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
Install tomb to meta_path
def Install (self): if self in sys.meta_path: return sys.meta_path.insert (0, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install(self, egg, dir_path):", "def _install(self):\n\n pass", "def install():\n execute(generate)\n execute(upload)", "def install():\n deploy()\n configure()", "def _backup_meta_data(meta_path: Path) -> None:\n meta_path = meta_path.resolve()\n backup_meta_path = meta_path.p...
[ "0.6309034", "0.6034057", "0.59956175", "0.5940261", "0.5622195", "0.55528796", "0.5550637", "0.5504863", "0.55024195", "0.549349", "0.54680103", "0.54488826", "0.54459304", "0.54449683", "0.5384725", "0.537212", "0.53536737", "0.53350466", "0.5330916", "0.52948004", "0.52948...
0.66660225
0
Create bootstrap source for this tomb Initialization function (init) and its arguments (args, keys) must be pickleable objects and required modules must added to tomb.
def Bootstrap (self, init = None, *args, **keys): if init and inspect.getmodule (init).__name__ not in self.containments: raise ValueError ('Initialization function must reside in added modules') wrap = lambda source: '\\\n'.join (textwrap.wrap (source, 78)) return ''.join (( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bootstrap(self):\n None", "def __init__(self, *tocs, **kwargs):\n\n from PyInstaller.config import CONF\n Target.__init__(self)\n name = kwargs.get('name', None)\n cipher = kwargs.get('cipher', None)\n self.toc = TOC()\n # If available, use code objects direct...
[ "0.62991714", "0.62623227", "0.602408", "0.59905785", "0.5935988", "0.5934972", "0.58631", "0.5862863", "0.58562684", "0.58154756", "0.5763857", "0.5741304", "0.57349765", "0.57243377", "0.5701562", "0.5660837", "0.56362003", "0.56362003", "0.563267", "0.5621181", "0.56095505...
0.77433974
0
Is module identified by name a package
def is_package (self, name): containment = self.containments.get (name) if containment is None: raise ImportError ('No such module: \'{}\''.format (name)) return containment [2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isModule(self, name):\n return os.path.isfile(self.modulePath(name))", "def check_module(name):\n return importlib.util.find_spec(name) is not None", "def _package_available(package_name: str) -> bool:\n try:\n return find_spec(package_name) is not None\n except ModuleNotFoundError:\n ...
[ "0.7999587", "0.7882359", "0.7714379", "0.7495873", "0.74916536", "0.7435214", "0.7414131", "0.7410092", "0.73023874", "0.7286614", "0.7180876", "0.71728384", "0.7162383", "0.71403635", "0.7120476", "0.7091047", "0.70688754", "0.70669496", "0.70669496", "0.70162135", "0.69714...
0.8308181
0
Get code for module identified by name
def get_code (self, name): containment = self.containments.get (name) if containment is None: raise ImportError ('No such module: \'{}\''.format (name)) return compile (containment [0], containment [1], 'exec')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_code_by_name(self, name):\n raise NotImplementedError()", "def get_code(self, fullname):\n self.__get_module(fullname) # eventually raises ImportError\n return None", "def findModule(name):", "def get_code(self, fullmodname):\n submodname, is_package, fullpath, source = s...
[ "0.7718094", "0.7322896", "0.721494", "0.68895036", "0.6637174", "0.65590054", "0.6444357", "0.6417827", "0.63936955", "0.6375372", "0.6365534", "0.6357912", "0.6349478", "0.6308498", "0.62931067", "0.6271999", "0.62522984", "0.6226825", "0.6210812", "0.6190451", "0.61559325"...
0.8115714
0
Get source for module identified by name
def get_source (self, name): containment = self.containments.get (name) if containment is None: raise ImportError ('No such module: \'{}\''.format (name)) return (containment [0] if sys.version_info [0] > 2 else containment [0].encode ('utf-8'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_source(self, name):\n return self._sources[name]", "def get_source(self, fullmodname):\n submodname, is_package, fullpath, source = self._get_source(fullmodname)\n return source", "def get_source(source_name):\n if source_name == \"SCHOLAR_CENSUS\":\n from mec_data.source...
[ "0.8058301", "0.7259968", "0.6817746", "0.6757238", "0.66870004", "0.6669201", "0.64359176", "0.6426875", "0.640998", "0.6397263", "0.6384899", "0.6364288", "0.6340704", "0.6330962", "0.6294002", "0.62218827", "0.6195933", "0.61530846", "0.6099017", "0.607506", "0.60703486", ...
0.7352844
1
Bootstrap this module Returns python source, witch when executed allows to import this module by specified "name".
def BootstrapBootstrap (name): module = sys.modules [__name__] return BootstrapSource (name, inspect.getsource (module), inspect.getsourcefile (module))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_main(name):\n config.MAIN_MODULE_NAME = name\n return importlib.import_module(name)", "def exposed_getmodule(self, name):\n return __import__(name, None, None, \"*\")", "def load_python_startup_script(name):\n\n try:\n return sys.modules[name]\n except KeyError:...
[ "0.6754451", "0.6290696", "0.62285405", "0.6203903", "0.61654973", "0.61654973", "0.61654973", "0.6084278", "0.6084278", "0.6066942", "0.60323536", "0.5946593", "0.59372807", "0.58970433", "0.582528", "0.5805017", "0.5767606", "0.5748153", "0.5740259", "0.57063746", "0.570018...
0.84286284
0
Creates a normal distribution conditioned on the inputs.
def __call__(self, *args, **kwargs): mu, sigma = self.condition(args, **kwargs) return tf.contrib.distributions.Normal(loc=mu, scale=sigma)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_standard_normal_distribution():\n return np.random.normal(0, 1)", "def _gen_normal(self, count, **kwargs):\n normal = scipy.stats.norm(loc=kwargs['mean'], scale=kwargs['stdev'])\n rvs = normal.rvs(count)\n return rvs", "def normal(mean, std):\n\n return random.gauss(m...
[ "0.69619775", "0.69186944", "0.6791363", "0.66955763", "0.6693648", "0.6661753", "0.66542685", "0.66455", "0.6618548", "0.65891", "0.6470705", "0.6468497", "0.6468497", "0.6468497", "0.6468497", "0.6468497", "0.63889205", "0.63577276", "0.6346451", "0.6307618", "0.62905085", ...
0.74019897
0
Encodes a timeseries of inputs with a time independent encoder.
def encode_all(self, inputs, encoder): input_shape = tf.shape(inputs) num_timesteps, batch_size = input_shape[0], input_shape[1] reshaped_inputs = tf.reshape(inputs, [-1, inputs.shape[-1]]) inputs_encoded = encoder(reshaped_inputs) inputs_encoded = tf.reshape(inputs_encoded, [num...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _encode(timestamps: List[int], encoder: Encoder, encoding: Encoding) -> Encoding:\n enc = encoder(timestamps[0])\n tss = [enc.encode(ts) for ts in timestamps[1:]]\n return encoding(timestamps[0], tss)", "def encoder(self, inputs):\n pass", "def encodeTimeSeries(timeSeries):\n\titems = timeS...
[ "0.70300907", "0.6236814", "0.61934924", "0.58577347", "0.58365756", "0.5745245", "0.5740449", "0.5733982", "0.5703914", "0.5673216", "0.5585604", "0.5475224", "0.54581016", "0.54575217", "0.54162216", "0.54142183", "0.54081607", "0.5352172", "0.53393203", "0.53198457", "0.53...
0.6395792
1
Evalute the cosine similarity between provided 'text_vectors' and trained X (articles trained and stored as a vecotr of topics). Return dataframe with index as trained articles and columns as text_vector indices with values as similarity scores
def get_similarity_score(text_vectors, X, factor=None): similarity_scores = cosine_similarity(X, text_vectors, dense_output=True) return similarity_scores * factor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vectorize_text(df: pd.DataFrame):\n # Creating a stop_words list set that are common to many questions.\n common_phrases = [\n 'read the sentence from the passage',\n 'which of the following best describes',\n 'which is the best one sentence * for the section',\n 'which senten...
[ "0.69177234", "0.6732489", "0.6714994", "0.6684291", "0.65570474", "0.6443633", "0.6429141", "0.6408822", "0.63878083", "0.63609", "0.6340021", "0.63081306", "0.62867033", "0.62659913", "0.6264336", "0.6203579", "0.61966485", "0.6157965", "0.6134012", "0.6105529", "0.60587335...
0.67971575
1
Get an Identifiers.org namespace
def get_identifiers_org_namespace(prefix): try: return get_identifiers_org_namespaces()[prefix] except KeyError: raise InvalidIdentifiersOrgUri('`{}` is not a valid prefix of a Identifiers.org namespace.'.format(prefix))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def namespace_id(self) -> str:\n return pulumi.get(self, \"namespace_id\")", "def namespace_id(self) -> Optional[str]:\n return pulumi.get(self, \"namespace_id\")", "def namespace(self) -> Optional[str]:\n return pulumi.get(self, \"namespace\")", "def namespace(self) -> Optional[str]:\n ...
[ "0.6649516", "0.6578286", "0.6528642", "0.6528642", "0.6528642", "0.6521246", "0.6519585", "0.6375492", "0.6375492", "0.6375492", "0.6375492", "0.6375492", "0.63449657", "0.63442254", "0.6335008", "0.62707514", "0.6257633", "0.62433416", "0.6228933", "0.6221595", "0.62207586"...
0.73772436
0
Determine whether a URI is a validate for one of the namespaces registered with Identifiers.org
def validate_identifiers_org_uri(uri): match = re.match(r'^https?://identifiers\.org/((([^/:]+)/([^/:]+)|[^/:]+)([/:])(.+))$', uri) try: namespace = get_identifiers_org_namespace(match.group(2).lower()) except InvalidIdentifiersOrgUri: if match.group(3): namespace = get_identifie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hasURI(self, *args):\n return _libsbml.XMLNamespaces_hasURI(self, *args)", "def is_valid(BaseURL):\n parsed = urlparse(BaseURL)\n return bool(parsed.netloc) and bool(parsed.scheme)", "def containsUri(self, *args):\n return _libsbml.XMLNamespaces_containsUri(self, *args)", "def is_urn(...
[ "0.670965", "0.667822", "0.66165257", "0.6595207", "0.6498957", "0.6455187", "0.6331057", "0.62750375", "0.60879886", "0.6053262", "0.6042288", "0.60388076", "0.59925216", "0.59925216", "0.5972868", "0.5916745", "0.5874985", "0.58692425", "0.5814867", "0.5754969", "0.5753672"...
0.6832338
0
>>> rotate_one_left([1, 2, 3, 4, 5]) [2, 3, 4, 5, 1]
def rotate_one_left(a): first = a[0] for i in range(1, len(a)): a[i-1] = a[i] a[len(a)-1] = first return a
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def left_rotate(arr):\n return arr[1:] + [arr[0]]", "def rotate_left_list(liste):\n \n rotate_cube_right_list(liste)\n rotate_front_list(liste)\n rotate_cube_left_list(liste)\n \n return liste", "def rotate_left3(nums):\n rotated_list = nums[1:len(nums)]\n rotated_list.append(nums[0]...
[ "0.8034248", "0.7550502", "0.7537523", "0.75177014", "0.73116136", "0.7274165", "0.7257144", "0.7220701", "0.7183137", "0.7152496", "0.71431047", "0.709721", "0.706897", "0.70462745", "0.70367545", "0.6921499", "0.69125503", "0.68779516", "0.68440044", "0.68309736", "0.679946...
0.85942495
0
Always O(n), but uses dynamic list creating (not pure array) >>> rot_left_pythonic([1, 2, 3, 4, 5], 4) [5, 1, 2, 3, 4] >>> rot_left_pythonic([1, 2, 3, 4, 5], 5) [1, 2, 3, 4, 5] >>> rot_left_pythonic([1, 2, 3, 4, 5], 3) [4, 5, 1, 2, 3] >>> rot_left_pythonic([41, 73, 89, 7, 10, 1, 59, 58, 84, 77, 77, 97, 58, 1, 86, 58, 2...
def rot_left_pythonic(a, d): n = len(a) if (n == d): return a result = [] i = d%n for _ in range(n): result.append(a[i]) i = (i+1)%n return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotLeft(a, d):\n i = d%len(a)\n return a[i:] + a[:i]\n\n \"\"\"\n Complicated solution with queue demonstration\n Slow\n \"\"\"\n # queue = SimpleQueue(a)\n # len_a = len(a)\n # if d > len_a//2:\n # for _ in range(len_a - d):\n # queue.add_left(queue.remove_right())...
[ "0.7498209", "0.7409165", "0.73556876", "0.71801704", "0.7114243", "0.7010652", "0.698409", "0.6964118", "0.68441784", "0.67712826", "0.6733429", "0.67049336", "0.67049336", "0.6700275", "0.6690243", "0.66901714", "0.6669708", "0.66455376", "0.6615404", "0.6612364", "0.660180...
0.76064754
0
Test consistency for names to bits to masks
def test_names(self): for m in self.masks: for name in m.names(): self.assertEqual(m.mask(name), 2**m.bitnum(name), 'Failed matching mask to bitnum for '+name) self.assertEqual(m.mask(name), m.mask(m.bitnum(name)), 'Failed matching mask to name for '+name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testBits(self):\n\n fullPlaneNameList = list(MaskPlaneNameIDDict.keys())\n totNumBits = countBits(MaxBitMask)\n for i in range(len(fullPlaneNameList)):\n numPlanes = i + 1\n setPlaneNameList = fullPlaneNameList[0:numPlanes]\n\n bitMask = coaddUtils.makeBitM...
[ "0.6870052", "0.6143947", "0.596622", "0.5952104", "0.5850913", "0.5827628", "0.58101416", "0.5795685", "0.57949096", "0.57943", "0.5785929", "0.5767551", "0.5750421", "0.57156134", "0.5703716", "0.55912125", "0.55739623", "0.5547855", "0.5543956", "0.551072", "0.5506012", ...
0.78700304
0
Get a list of groups for the user ``user_name``.
def _get_user_groups(user_name): groups = [g.gr_name for g in grp.getgrall() if user_name in g.gr_mem] gid = pwd.getpwnam(user_name).pw_gid groups.append(grp.getgrgid(gid).gr_name) return groups
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_groups_for_user_id(user):\n if not user or not user.id:\n return []\n\n return user.groups", "def getUserGroups(self, user):\n return [gu[0] for gu in grp.getgrall() if user in gu[3]]", "def get_groups(self, username):\n groups = []\n for group in grp.getgr...
[ "0.8079474", "0.79564226", "0.77837527", "0.7774739", "0.77455986", "0.7568154", "0.7557482", "0.7478388", "0.7466999", "0.74615055", "0.7403565", "0.73850274", "0.7314811", "0.73146063", "0.72100085", "0.7160438", "0.71271354", "0.70748776", "0.6984971", "0.6964909", "0.6897...
0.806905
1
Check that the current user belongs to the required groups to both run S2E and build S2E images.
def _check_groups_docker(): if not _user_belongs_to('docker'): _raise_group_error('docker')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_groups_kvm():\n if not _user_belongs_to('libvirtd') and not _user_belongs_to('kvm'):\n _raise_group_error('kvm')", "def verify_user(self):\n if self.username == \"root\":\n print \"Error: Please do not run this script as root.\"\n sys.exit(1)\n\n members =...
[ "0.6761393", "0.6219493", "0.6138404", "0.60930175", "0.58358294", "0.5806046", "0.5799099", "0.57859266", "0.5676942", "0.5629145", "0.56182015", "0.5600617", "0.5597782", "0.5591784", "0.5586531", "0.55625254", "0.5554537", "0.555286", "0.5540388", "0.55343", "0.5507383", ...
0.7104854
0
Check if VirtualBox is running. VirtualBox conflicts with S2E's requirement for KVM, so VirtualBox must not be running together with S2E.
def _check_virtualbox(): # Adapted from https://github.com/giampaolo/psutil/issues/132#issuecomment-44017679 # to avoid race conditions for proc in psutil.process_iter(): try: if proc.name() == 'VBoxHeadless': raise CommandError('S2E uses KVM to build images. VirtualBox '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CheckKVM():\n return os.path.exists('/dev/kvm')", "def _check_vmware():\n for proc in psutil.process_iter():\n try:\n if proc.name() == 'vmware-vmx':\n raise CommandError('S2E uses KVM to build images. VMware '\n 'is currently running, wh...
[ "0.7140965", "0.7064138", "0.6658352", "0.6583048", "0.65674144", "0.65674144", "0.65674144", "0.65674144", "0.65674144", "0.65674144", "0.65674144", "0.65674144", "0.65674144", "0.65674144", "0.65674144", "0.65674144", "0.65674144", "0.65674144", "0.65674144", "0.65674144", ...
0.7859381
0
Check if VMWare is running. VMware conflicts with S2E's requirement for KVM, so VMWare must not be running together with S2E.
def _check_vmware(): for proc in psutil.process_iter(): try: if proc.name() == 'vmware-vmx': raise CommandError('S2E uses KVM to build images. VMware ' 'is currently running, which is not ' 'compatible with KVM...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_virtualbox():\n # Adapted from https://github.com/giampaolo/psutil/issues/132#issuecomment-44017679\n # to avoid race conditions\n for proc in psutil.process_iter():\n try:\n if proc.name() == 'VBoxHeadless':\n raise CommandError('S2E uses KVM to build images. V...
[ "0.6846121", "0.6752233", "0.6330952", "0.62163776", "0.6192615", "0.6188115", "0.61833626", "0.61802113", "0.61712277", "0.6010563", "0.5997352", "0.5996313", "0.5963246", "0.59471756", "0.59471756", "0.59471756", "0.59471756", "0.59471756", "0.59471756", "0.59471756", "0.59...
0.742611
0
Check that the KVM interface exists. This is required by libs2e to communicate with QEMU.
def _check_kvm(): if not os.path.exists(os.path.join(os.sep, 'dev', 'kvm')): raise CommandError('KVM interface not found - check that /dev/kvm ' 'exists. Alternatively, you can disable KVM (-n ' 'option) or download pre-built images (-d option)')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CheckKVM():\n return os.path.exists('/dev/kvm')", "def _check_virtualbox():\n # Adapted from https://github.com/giampaolo/psutil/issues/132#issuecomment-44017679\n # to avoid race conditions\n for proc in psutil.process_iter():\n try:\n if proc.name() == 'VBoxHeadless':\n ...
[ "0.77850586", "0.6774782", "0.658015", "0.63146055", "0.62488544", "0.6238064", "0.6204543", "0.6204543", "0.6204543", "0.6204543", "0.6204543", "0.6204543", "0.6204543", "0.6204543", "0.6204543", "0.6204543", "0.6204543", "0.6204543", "0.6204543", "0.6204543", "0.6204543", ...
0.8349383
0
Check that /boot/vmlinux files are readable. This is important for guestfish.
def _check_vmlinux(): try: for f in glob.glob(os.path.join(os.sep, 'boot', 'vmlinu*')): with open(f, 'rb'): pass except IOError: raise CommandError('Make sure that the kernels in /boot are readable. ' 'This is required for guestfish. Please ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_mounted_system(self):\n res = self.su_cmd('touch /system/.dwarf_check')\n if res == '':\n res = self._do_adb_command('shell ls -la /system')\n if '.dwarf_check' in res:\n res = self.su_cmd('rm /system/.dwarf_check')\n if res == '':\n ...
[ "0.61423403", "0.5907705", "0.5901718", "0.58705515", "0.58680797", "0.5811451", "0.5714445", "0.5697339", "0.5585091", "0.55605185", "0.55590147", "0.55236685", "0.545419", "0.5446189", "0.54104424", "0.53353703", "0.5324679", "0.53190213", "0.52923214", "0.5290725", "0.5272...
0.82916737
0
Check that the file system that stores guest images supports copyonwrite.
def _check_cow(image_dir): try: src = f'{image_dir}/.cowcheck' dst = f'{image_dir}/.cowcheck1' sh.touch(src) sh.cp('--reflink=always', src, dst) return True except Exception: warn_msg = f""" Copy-on-write check failed. The file system where images ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_file_check(self):\n pass", "def _check_mounted_system(self):\n res = self.su_cmd('touch /system/.dwarf_check')\n if res == '':\n res = self._do_adb_command('shell ls -la /system')\n if '.dwarf_check' in res:\n res = self.su_cmd('rm /system/.dwarf...
[ "0.67018986", "0.57573164", "0.5720924", "0.5654952", "0.5631426", "0.5631426", "0.5631426", "0.5631426", "0.5631426", "0.5631426", "0.5631426", "0.5631426", "0.5631426", "0.5631426", "0.5631426", "0.5631426", "0.5631426", "0.5631426", "0.5631426", "0.5631426", "0.5628063", ...
0.6575526
1
create a new partner
def partner_create(self): try: mongo_module.mongo_insert(self.partner) output = 'sucesfully created' code = 201 except Exception as err: output = str(err) code = 409 return output, code
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_partner(name):\n\n return Partner.objects.create(name=name)", "def make_partner(self, cr, uid, ids, context=None):\n partner_id = self._create_partner(cr, uid, ids, context=context)\n return self.pool.get('res.partner').redirect_partner_form(cr, uid, partner_id, context=context)", "...
[ "0.83082443", "0.72475225", "0.71739584", "0.6884321", "0.6884321", "0.6411903", "0.63647455", "0.62175417", "0.6191565", "0.61628664", "0.6119368", "0.6119368", "0.6081012", "0.60752696", "0.6068162", "0.6033867", "0.5989054", "0.5939511", "0.5919422", "0.5899731", "0.586151...
0.81342596
1
set point from lnt, lat. iter over documents from partners_data and get distancec fron point. finally get min distance fron partners_data and return lower value
def partner_find_closest(self, partners_data): distance = {} point = Point(self.lng, self.lat) for partner in partners_data: if 'coverageArea' in partner and 'coordinates' in partner['coverageArea']: for coordinates_array in partner['coverageArea']['coordinates']: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nearest_point(pt):\n nearest_point = None\n min_dist = float(\"inf\")\n for p in cur_points:\n dist = euclidean_dist(pt, p.to_tuple())\n if dist < min_dist:\n min_dist, nearest_point = dist, p\n\n return nearest_point.to_tuple()", "def pointfind2(plat, plon, lat, lon, pdi...
[ "0.61284465", "0.6083157", "0.60698116", "0.6008139", "0.59368527", "0.5832634", "0.58061904", "0.57954025", "0.57779676", "0.57671785", "0.5764438", "0.5754937", "0.570971", "0.56861585", "0.5682471", "0.56823736", "0.5669694", "0.56391066", "0.56301135", "0.5629487", "0.561...
0.6851903
0
Adds a pyyaml serializer to handle xmlrpclib.Binary objects
def represent_xml_binary(loader, data): data = base64.b64encode(data.data) return loader.represent_scalar(u'tag:yaml.org,2002:binary', data, style='|')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(cls):\n yaml.add_constructor(cls.label(), cls.parse_yaml)\n yaml.add_representer(cls, cls.dump_yaml)", "def _register_serializers(self):\n import ray.util.serialization_addons\n from ray.util.serialization import StandaloneSerializationContext\n\n ctx = StandaloneS...
[ "0.5455851", "0.49699178", "0.49428704", "0.49335387", "0.49218032", "0.49139836", "0.4901603", "0.48941225", "0.4865953", "0.48530665", "0.48265773", "0.48242733", "0.48216864", "0.48000243", "0.47956255", "0.47930902", "0.47924063", "0.47714603", "0.47273362", "0.46886325", ...
0.5404318
1
Download a parameter tree from the Parameter Server and store in a yaml file
def dump_params(filename, param, verbose=False): tree = get_param(param) if verbose: print_params(tree, param) if not filename: f = sys.stdout yaml.dump(tree, f) else: f = open(filename, 'w') try: yaml.dump(tree, f) finally: f.close...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saveToFile(self,filename):\n path = os.path.dirname(__file__)+\"/\"+filename\n stream = open(path,\"w\")\n yaml.dump(self.parameters(),stream)", "def load_parameters(self):\n with open(INTERNAL_DATA_DIR / self.name_default_params, 'r') as f:\n return yaml.load(f, Loader=yaml.FullLo...
[ "0.58530194", "0.57653797", "0.5596736", "0.54784024", "0.5465318", "0.5443125", "0.54174405", "0.5363865", "0.5332185", "0.5291081", "0.52762717", "0.5274237", "0.5264998", "0.52144647", "0.51575625", "0.5131191", "0.51117283", "0.510922", "0.5073731", "0.50543517", "0.50491...
0.59290874
0
Set param on the ROS parameter server using a YAML value.
def set_param(param, value, verbose=False): set_param_raw(param, yaml.load(value), verbose=verbose)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_param(command):\n namespace = app.main(command)\n assert namespace.command == 'sp' or namespace.command == \"setparam\"\n assert namespace.name == \"test\"\n assert namespace.value == \"test\"", "def setParameter(self, name, value):", "def set_config(param, value):\n _config = loadConfig...
[ "0.7221956", "0.72209096", "0.7034302", "0.70336217", "0.6917591", "0.6901871", "0.68208706", "0.6753843", "0.67494917", "0.6713383", "0.6624609", "0.6557055", "0.652967", "0.6519365", "0.6483028", "0.64794254", "0.6477284", "0.64770836", "0.6467058", "0.6461186", "0.6449114"...
0.8135313
0
Upload params to the Parameter Server
def upload_params(ns, values, verbose=False): if ns == '/' and not type(values) == dict: raise RosParamException("global / can only be set to a dictionary") if verbose: print_params(values, ns) set_param_raw(ns, values)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_params(self, params):", "def updateParameters(self, parameters):", "def update_params(self):\n pass", "def set_params(self):\r\n pass", "def upload(self, parameters: Optional[Dict[str, Any]]) -> None:\n from pymol import cmd\n \n # Job Information (local)\n ...
[ "0.6657093", "0.64279455", "0.6279205", "0.62250215", "0.62047106", "0.6151507", "0.61054605", "0.6076275", "0.6053294", "0.6053294", "0.6053294", "0.6053294", "0.6053294", "0.6053294", "0.6053294", "0.6053294", "0.6035985", "0.6018161", "0.6013579", "0.60065377", "0.59918904...
0.6880061
0
Get list of parameters in ns
def list_params(ns): try: ns = make_global_ns(ns) names = get_param_server().getParamNames() names.sort() return [n for n in names if n.startswith(ns)] except socket.error: raise RosParamIOException("Unable to communicate with master!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameter_names(self) -> List[str]:", "def parameters(self):\n return []", "def _get_parameters(self) -> list:\n return self.parameters", "def get_params(self):\n return []", "def param(self):\r\n\r\n return []", "def param(self):\n return []", "def param(self):\n...
[ "0.7495876", "0.737233", "0.7363517", "0.7290466", "0.7197204", "0.71933335", "0.71933335", "0.71309847", "0.7080846", "0.70459414", "0.70335615", "0.6925345", "0.6914732", "0.689824", "0.6887471", "0.68772036", "0.6869809", "0.6863892", "0.68600464", "0.68534815", "0.6788355...
0.7964706
0
Return all line endings in the file.
def line_endings(fname): _endings = {line[-2:] for line in open(fname, 'rb').readlines()} res = set() for e in _endings: if e.endswith(b'\r'): res.add(b'\r') elif e.endswith(b'\r\n'): res.add(b'\r\n') elif e.endswith(b'\n'): res.add(b'\n') retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fix_line_endings(fname, eol=b'\\n'):\n lines = [chomp(line) for line in open(fname, 'rb').readlines()]\n with open(fname, 'wb') as fp:\n for line in lines:\n fp.write(line + eol)", "def convert_line_endings():\n files = []\n for ext in [\n \".py\",\n \".sh\",\n ...
[ "0.6668037", "0.6303632", "0.6167485", "0.60262275", "0.6011908", "0.59590435", "0.5912973", "0.5883655", "0.5844091", "0.57774127", "0.5764803", "0.5762743", "0.5740417", "0.5738503", "0.5735223", "0.5710538", "0.5666547", "0.5665389", "0.5661651", "0.56309247", "0.56309086"...
0.78253335
0
returns the log likelihood of 'points' arising from the distribution described by density()
def log_likelihood(self, points): point_set = list(points) log_probabilities = [np.log(self.density(point)) for point in point_set] return sum(log_probabilities)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def likelihood(mean, logs, x):\n return -0.5 * (logs * 2. + ((x - mean) ** 2) / np.exp(logs * 2.) + GaussianDiag.Log2PI)", "def log_gaussian_density(x, mu, L):\n\n D = x.shape[-1]\n # print(\"x shape:\", x.shape)\n # print(\"mu shape:\", mu.shape)\n # print(\"L shape:\", L.shape)\n\n a = np...
[ "0.73263603", "0.7232011", "0.711528", "0.70010966", "0.6942255", "0.6924976", "0.69075525", "0.68811285", "0.6780632", "0.6764393", "0.67464423", "0.67406917", "0.67390895", "0.6711482", "0.66367406", "0.6626012", "0.6624606", "0.66170055", "0.66134965", "0.66075754", "0.660...
0.8538363
0
For use during building only. Indicate "__annotations__" need.
def markAsNeedsAnnotationsDictionary(self): self.needs_annotations_dict = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def needsAnnotationsDictionary(self):\n return self.needs_annotations_dict", "def check_annotation(config):\n # Check whether to set annotation downstream of assembly\n tools = [config[\"annotation\"][key] for key in config[\"annotation\"].keys()]\n assems = [config[\"assembly\"][\"metaspades\"],...
[ "0.633983", "0.5952905", "0.5915228", "0.57676977", "0.57187563", "0.57006633", "0.5661887", "0.56577903", "0.5597215", "0.55303264", "0.5511181", "0.5501958", "0.54693633", "0.5421355", "0.54158384", "0.53971505", "0.538159", "0.53017735", "0.5290851", "0.52834445", "0.52624...
0.6278793
1
For use during building only. Indicate "__annotations__" need.
def needsAnnotationsDictionary(self): return self.needs_annotations_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def markAsNeedsAnnotationsDictionary(self):\n self.needs_annotations_dict = True", "def check_annotation(config):\n # Check whether to set annotation downstream of assembly\n tools = [config[\"annotation\"][key] for key in config[\"annotation\"].keys()]\n assems = [config[\"assembly\"][\"metaspad...
[ "0.6278259", "0.59539115", "0.59161144", "0.57681817", "0.57199687", "0.5699877", "0.5661112", "0.5656948", "0.5597326", "0.55304015", "0.55109686", "0.5501742", "0.54690087", "0.54226744", "0.5416614", "0.5398194", "0.5382289", "0.53015226", "0.5291588", "0.52835596", "0.526...
0.63396627
0
Runs a hadoop streaming job using mrjob.
def RunMRJobStreamingJob(self, input_path, hdfs_output_path, mrjob_file, archive_file, job_name, python_path, num_reduce_tasks_override=None, jar_paths=None, partitioner_class=None, output_protocol_override=None,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_and_run_job(self):\n step = StreamingStep(name='Titanic Machine Learning',\n mapper='s3n://' + EmrProcessing.bucket_name + '/mapper/mapper.py',\n reducer='org.apache.hadoop.mapred.lib.IdentityReducer',\n input='s3n://' + EmrProcessing.bucket_name + '/input/',\n ...
[ "0.6492897", "0.583598", "0.57820356", "0.57495487", "0.5681385", "0.5561174", "0.5540327", "0.5482609", "0.54688275", "0.5424329", "0.53944844", "0.5372803", "0.5280541", "0.5261444", "0.52043927", "0.52007544", "0.5164762", "0.5141039", "0.51122034", "0.50945824", "0.503104...
0.688896
0
test encoding and decoding JWT tokens
def test_encode_decode_token(create_user): user = create_user user_data = { "email": user.email, "username": user.username } jwt = JWTAuthentication() # encode token encoded_token = jwt.generate_token(user_data) assert type(encoded_token) is str # test encoding is 'utf-8' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_jwt_example(self):\n data = r'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'\n expected = json.loads(r'''{\"header\":{\"alg\":\"HS256\",\"typ\":\"JWT\"},\"payload\":{\"sub\":\"123456...
[ "0.75912654", "0.7119186", "0.6949815", "0.6939086", "0.69363946", "0.6871404", "0.6838341", "0.6731247", "0.67183", "0.66957253", "0.6652292", "0.66368425", "0.6583013", "0.65726095", "0.6565835", "0.656275", "0.6528573", "0.6491267", "0.64611095", "0.6450976", "0.64225596",...
0.80075985
0
test authenticating JWT token against user data
def test_authenticate_credentials(generate_token, django_user_model): access_token, user_data = generate_token jwt = JWTAuthentication() user, payload = jwt.authenticate_credentials(access_token) user_instance = django_user_model.objects.get( username=user_data['username'] ) assert user ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_jwt_login_json(self):\n response = self.client.post(\n '/auth-token/',\n json.dumps(self.data),\n content_type='application/json'\n )\n\n response_content = json.loads(smart_text(response.content))\n\n decoded_payload = utils.jwt_decode_handler(...
[ "0.7919438", "0.77818495", "0.76022685", "0.7581445", "0.75289357", "0.75116587", "0.7423047", "0.7419434", "0.7388643", "0.73214716", "0.7309594", "0.71848863", "0.71587276", "0.7156607", "0.71432143", "0.71328217", "0.71305174", "0.71264976", "0.71137875", "0.7087691", "0.7...
0.80766
0
Calibrates the flux of an output image. Can either be a broadband image or a spectral cube depending on if the spectral flag is set. Assumes the broadband flux calibration is just multiplication by a single scalar number whereas spectral datacubes may have a separate calibration value for each wavelength
def calibrate_output(self, img, spectral=False, units="contrast"): if units == "contrast": if spectral: # spectral cube, each slice needs it's own calibration numwvs = img.shape[0] img /= self.dn_per_contrast[:numwvs, None, None] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fluxcalib(self):\n from ..fluxcalibration import FluxCalib\n from ..io.fluxcalibration import read_flux_calibration, write_flux_calibration\n nspec = 5\n nwave = 10\n wave = np.arange(nwave)\n calib = np.random.uniform(size=(nspec, nwave))\n ivar = np.rando...
[ "0.5834028", "0.5552536", "0.55324066", "0.54045963", "0.54028136", "0.5400234", "0.53946316", "0.5390341", "0.53620356", "0.5355227", "0.5344635", "0.5343923", "0.5299322", "0.5283469", "0.52814853", "0.5227191", "0.5184095", "0.5158678", "0.5157897", "0.5150893", "0.5147377...
0.6734471
0
Create a new empty TypedDict with key_type and value_type as the types for the keys and values of the dictionary respectively.
def empty(cls, key_type, value_type): return cls(dcttype=DictType(key_type, value_type))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_dict(typingctx, keyty, valty, ptr):\n dict_ty = types.DictType(keyty.instance_type, valty.instance_type)\n\n def codegen(context, builder, signature, args):\n [_, _, ptr] = args\n ctor = cgutils.create_struct_proxy(dict_ty)\n dstruct = ctor(context, builder)\n dstruct.da...
[ "0.65021694", "0.64598584", "0.6137077", "0.57969946", "0.5718489", "0.57113713", "0.5672381", "0.5653581", "0.5650383", "0.56327116", "0.56033117", "0.55712324", "0.5465431", "0.5454871", "0.5421098", "0.54094374", "0.5404606", "0.539811", "0.5365514", "0.5332857", "0.532901...
0.7523846
0
Returns the index of the correlation between an individual on the given index and the previous individual in the chain of individuals.
def _get_prev_correlation_index(self, index: int) -> int: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_next_correlation_index(self, index: int) -> int:\n pass", "def correlations(self, index: int) -> Tuple[int, int]:\n prev_index = self._get_prev_correlation_index(index)\n next_index = self._get_next_correlation_index(index)\n return self._correlation[prev_index], self._correl...
[ "0.72343004", "0.67907906", "0.5708425", "0.5613088", "0.56076455", "0.5580767", "0.55760086", "0.5514937", "0.5512073", "0.5502395", "0.54905945", "0.5446895", "0.53913903", "0.53371644", "0.5299722", "0.5287811", "0.5280381", "0.5261069", "0.52596474", "0.5218803", "0.52167...
0.7917535
0
Returns the index of the correlation between an individual on the given index and the next individual in the chain of individuals.
def _get_next_correlation_index(self, index: int) -> int: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_prev_correlation_index(self, index: int) -> int:\n pass", "def correlations(self, index: int) -> Tuple[int, int]:\n prev_index = self._get_prev_correlation_index(index)\n next_index = self._get_next_correlation_index(index)\n return self._correlation[prev_index], self._correl...
[ "0.6851933", "0.6687", "0.57197076", "0.56677306", "0.5648532", "0.55912286", "0.5531533", "0.54950756", "0.5439448", "0.5425506", "0.5398766", "0.53954893", "0.53313005", "0.53112453", "0.5290973", "0.52899504", "0.5286244", "0.52834064", "0.5278654", "0.52781624", "0.527405...
0.78618824
0
Sets the individual on the specified index to the given individual and updates appropriate correlations and metrics.
def set_individual( self, index: int, individual: Individual, diff_nodes: List[int] ) -> None: old_individual = self._individuals[index] self._individuals[index] = individual self._update_correlation(index, old_individual, diff_nodes) self._update_metrics(index, old_individua...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setIndex(self,index):\n if isinstance(index,str):\n index = MaterialIndex(index)\n self[0].refractiveindex = index", "def set_at_index(self, index: int, value: object) -> None:\n self.data[index] = value", "def index(self, index):\n\n self._index = index", "def indi...
[ "0.6202715", "0.5987197", "0.5871625", "0.57234645", "0.57192165", "0.54824066", "0.5409382", "0.5390501", "0.53760797", "0.53586614", "0.5352395", "0.5298161", "0.5233869", "0.5156648", "0.5122112", "0.51215243", "0.5109298", "0.51052713", "0.51029605", "0.50929207", "0.5081...
0.8079112
0
Returns the cumulative correlation of the population.
def cumulative_correlation(self) -> int: return self._cumulative_correlation
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_corr(self):\n self.corr_ = cov_to_corr(self.cov_)\n return self", "def corrcoef(self):\r\n return np.corrcoef(self.input.data)", "def get_corr(self):\r\n cov = self.data.values\r\n with np.errstate(divide='ignore', invalid='ignore'):\r\n coeff = np.true...
[ "0.7016668", "0.6502757", "0.65012944", "0.64405566", "0.644024", "0.6418526", "0.63447756", "0.6251889", "0.6168676", "0.6160586", "0.61442614", "0.6122795", "0.6106338", "0.61051506", "0.609214", "0.6085698", "0.60772574", "0.60770917", "0.6072486", "0.60597587", "0.6037513...
0.7797955
0
Returns correlations between a given individual and the previous and next individual.
def correlations(self, index: int) -> Tuple[int, int]: prev_index = self._get_prev_correlation_index(index) next_index = self._get_next_correlation_index(index) return self._correlation[prev_index], self._correlation[next_index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def corr_with(self, other):\n return self.data.corrwith(other)", "def correlation(self, other):\n dates=self.get_dates(other.get_dates())\n #print(len(self.get_values(dates)))\n #print(len(other.get_values(dates)))\n #print(self.get_values(dates))\n r,p=stats.pearsonr(se...
[ "0.5938814", "0.576604", "0.57292587", "0.5648692", "0.55700374", "0.5566395", "0.5494628", "0.54905933", "0.5471765", "0.542473", "0.5408501", "0.53388625", "0.53180337", "0.5300238", "0.52660584", "0.52468604", "0.5222255", "0.52093506", "0.52039266", "0.518541", "0.5158771...
0.5930782
1
Compute dictionary of letter probabilities of text for alphabet X
def compute_probabilities(text, X=alph): # Convert to lowercase (just to be sure) text = text.lower() # Make empty dictionary with letters as keys counts = {k: 0 for k in X} # Keep track of total length of legitimate characters total = 0 # Loop through text and update counts only for alp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def letter_freq( text ):\n\tchars = string.ascii_uppercase\n\ttext = text.upper()\n\tresult = get_letter_dict()\n\ttotal = 0\n\tfor char in chars:\n\t\tcount = text.count(char)\n\t\tresult[char] = count\n\t\ttotal += count\n\tif total != 0:\n\t\tfor char in chars:\n\t\t\tresult[char] = (result[char]*10000 / total)...
[ "0.77493757", "0.74624574", "0.711768", "0.7114489", "0.71143943", "0.6943491", "0.69102657", "0.68116164", "0.6790654", "0.66877985", "0.66534346", "0.6546373", "0.6481512", "0.6476291", "0.6456903", "0.6436106", "0.6417798", "0.6404603", "0.6402022", "0.63857055", "0.638537...
0.8658968
0
Compute variational distance between P and Q for alphabet X
def var_dist(P, Q, X=alph): dist = 0.5 * sum([abs(P[x] - Q[x]) for x in X]) return dist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dist(p, q):\n return ((p[0] - q[0])**2 + (p[1] - q[1])**2 + (p[2] - q[2])**2)**0.5", "def distance(p, q):\n return norm(np.asarray(p) - np.asarray(q))", "def sym_distance(p, q):\n p = np.asarray(p)\n q = np.asarray(q)\n return np.minimum(norm(p - q), norm(p + q))", "def dist(p,q):\n ret...
[ "0.6733357", "0.65792984", "0.6576871", "0.65002286", "0.64435476", "0.63417184", "0.6334989", "0.6245435", "0.6008847", "0.58618486", "0.5852988", "0.58302516", "0.5786825", "0.57637227", "0.57637227", "0.5725057", "0.5721549", "0.5714084", "0.570911", "0.57072145", "0.57006...
0.77834207
0
Compute the collision probability of a distribution P for alphabet X
def col_prob(P, X=alph): return sum([P[x] ** 2 for x in X])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_probabilities(text, X=alph):\n\n # Convert to lowercase (just to be sure)\n text = text.lower()\n\n # Make empty dictionary with letters as keys\n counts = {k: 0 for k in X}\n\n # Keep track of total length of legitimate characters\n total = 0\n\n # Loop through text and update cou...
[ "0.72211987", "0.6587097", "0.6364776", "0.63594013", "0.6254955", "0.6214626", "0.62061554", "0.6164972", "0.6162452", "0.61589164", "0.6115254", "0.6105521", "0.61036974", "0.6036795", "0.6034593", "0.60244673", "0.5941429", "0.5939522", "0.5934541", "0.59312725", "0.591186...
0.6776177
1
Finds all the available actions for the given board
def available_actions(board): actions = [] # Loop through the board for i in range(3): for j in range(3): if board[i][j] == None: actions.append((i, j)) return actions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getAvailableActions(self, board):\r\n myPits = board.mySide(self.id)\r\n return [i for i in myPits if i > 0]", "def _getAvailableActions(self, board):\r\n myPits = board.mySide(self.id)\r\n return [i for i in myPits if i > 0]", "def actions(self, board):\n possibleAction...
[ "0.77615434", "0.77615434", "0.757036", "0.7538123", "0.7477568", "0.7385613", "0.73539054", "0.73460543", "0.73457944", "0.7329273", "0.7313652", "0.7295286", "0.72750723", "0.72237986", "0.721898", "0.71366435", "0.7125981", "0.7120061", "0.7054596", "0.7052828", "0.6995880...
0.8077701
0
Checks if the action is valid
def is_valid_action(self, action): if self.board[action[0]][action[1]] == None: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_action_sanity(self):\n for action in crest.get_all_actions(self.model):\n assert action._name is not None, f\"There is an Action in {action._parent._name} ({action._parent.__class__.__name__}) whose name is 'None'\"\n assert action._name != \"\", f\"There is an Action in {act...
[ "0.7743943", "0.7365764", "0.7078166", "0.69660896", "0.6865892", "0.6734294", "0.6729491", "0.6637088", "0.65203273", "0.65017533", "0.64176524", "0.6407973", "0.6362987", "0.6339927", "0.6332401", "0.6332401", "0.6332401", "0.6332401", "0.6332401", "0.6332401", "0.6332401",...
0.75959307
1
Creates heatmap by stitching patch_right on to patch_left Overlap region heatmap is the weighted sum of two patches
def stitch_to_right(self, patch_left, patch_right): overlap_cols = int( (self.patch_w - self.strides_cols) / self.out_stride) left, left_overlap = tf.split( patch_left, [-1, overlap_cols], axis=1) right_overlap, right = tf.split( patch_right, [overlap_cols, -1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def triangle_warping(img1, img2, t1, t2, method):\n # Find bounding rectangle for each triangle\n x1, y1, w1, h1 = cv2.boundingRect(np.float32([t1]))\n x2, y2, w2, h2 = cv2.boundingRect(np.float32([t2]))\n\n # Offset points by left top corner of the respective rectangles\n t1Rect = []\n t2Rect = ...
[ "0.5839399", "0.56645966", "0.5576645", "0.55055076", "0.54985756", "0.5352495", "0.5347219", "0.5321907", "0.53168464", "0.52837247", "0.5255244", "0.52419865", "0.5184701", "0.51840943", "0.5146829", "0.5138015", "0.51220703", "0.5109756", "0.51003075", "0.50811404", "0.507...
0.7099316
0
Creates heatmap by stitching patch_bottom on to patch_top Overlap region heatmap is the weighted sum of two patches
def stitch_to_bottom(self, patch_top, patch_bottom): overlap_rows = int( (self.patch_h - self.strides_rows) / self.out_stride) top, top_overlap = tf.split( patch_top, [-1, overlap_rows], axis=0) bottom_overlap, bottom = tf.split( patch_bottom, [overlap_rows, -...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recreate_from_patches(data):\n overlap_height = (PATCHES * PATCH_HEIGHT - IMG_HEIGHT) // (PATCHES - 1) # Overlap of patches along y axis\n step_size_height = PATCH_HEIGHT - overlap_height # Step size along y axis\n\n overlap_width = (PATCHES * PATCH_WIDTH - IMG_WIDTH) // (PATCHES - 1) # Overlap of ...
[ "0.5809524", "0.57277507", "0.5619775", "0.56066614", "0.54870486", "0.5482732", "0.54014504", "0.5392424", "0.53896445", "0.53565514", "0.5320733", "0.5294499", "0.5271605", "0.5263038", "0.5246973", "0.5244774", "0.5201949", "0.5169914", "0.5155974", "0.5150579", "0.5138908...
0.7197721
0
Create a new output panel with the given `name` in the given `window`. If `kwargs` are given, they will be interpreted as for
def create( cls, window, name, *, force_writes=False, follow_cursor=False, unlisted=False, **kwargs ): validate_view_options(kwargs) window.destroy_output_panel(name) view = window.create_output_panel(name, unlisted) set_view_options(v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showWindow(*args, **kwargs)->None:\n pass", "def panel(*args, control: bool=True, copy: AnyStr=\"\", createString: bool=True, defineTemplate:\n AnyStr=\"\", docTag: Union[AnyStr, bool]=\"\", editString: bool=True, exists: bool=True,\n init: bool=True, isUnique: bool=True, label: Union[An...
[ "0.6023577", "0.574418", "0.57032573", "0.5688821", "0.5558354", "0.5548492", "0.5432385", "0.53196037", "0.5319581", "0.53195083", "0.528546", "0.52377486", "0.5223845", "0.516348", "0.5149003", "0.5128388", "0.5107456", "0.5104095", "0.50907516", "0.5078983", "0.5077354", ...
0.74360627
0
The output panel name, beginning with ``output.``. Generally, API methods specific to output panels will use `name`, while methods that work with any panels will use `full_name`.
def full_name(self): return "output.%s" % self.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._output_name", "def _get_name(self):\n return '%s (%d)' % (\n self.panel_template.panel_name,\n self.implementation)", "def output_name(self) -> str:\n return jsii.get(self, \"outputName\")", "def outputname(self, identifier):\n ...
[ "0.75580347", "0.75517553", "0.74340254", "0.6840934", "0.67454123", "0.6626438", "0.65341705", "0.65341705", "0.65341705", "0.65341705", "0.65341705", "0.65341705", "0.65341705", "0.65341705", "0.65341705", "0.65341705", "0.65341705", "0.65341705", "0.65341705", "0.65341705", ...
0.7944014
0
Returns ``True`` if the output panel is currently visible.
def is_visible(self): return self.window.active_panel() == self.full_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_visible(self):\n return self.container['is_visible']", "def is_visible(self):\n return self._visible", "def is_visible(self):\n return self._currently_shown", "def is_visible(self):\n return self.proto.display_type == DISPLAY_TYPE.Visible.value", "def visible(self):\n ...
[ "0.7668139", "0.75853205", "0.7568856", "0.75384575", "0.7455235", "0.72954285", "0.72954285", "0.7165468", "0.7163588", "0.71611303", "0.71467394", "0.70842755", "0.70828", "0.7077463", "0.7073292", "0.7073292", "0.7069485", "0.7052102", "0.7029817", "0.69596475", "0.6819367...
0.826542
0
Shows the output panel, hiding any other visible panel.
def show(self): self.window.run_command("show_panel", {"panel": self.full_name})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_output_panel():\n window = sublime.active_window()\n if window.active_panel() == 'output.YouTubeEditor Log':\n return\n\n # True for always, False for Never, number for Always (but autoclose);\n # thus if this is a boolean and it's False, we should leave. Otherwise,\n # we're good...
[ "0.7665788", "0.67305297", "0.6658151", "0.66208225", "0.66164005", "0.6547054", "0.6539251", "0.6522784", "0.6500433", "0.648715", "0.64670134", "0.6397465", "0.6392343", "0.63859797", "0.63290906", "0.62949455", "0.6274372", "0.6246176", "0.62236685", "0.6212975", "0.621284...
0.7242572
1
Hides the output panel.
def hide(self): self.window.run_command("hide_panel", {"panel": self.full_name})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide(self):\n self.visible = False", "def hide(self):\n self.set_visible(False)", "def hideDisplay(self):\n if self._displayPjt:\n self._displayPjt.hide()\n if self._displayUsr:\n self._displayUsr.hide()\n if self._displayVtk:\n self._disp...
[ "0.77253985", "0.7568135", "0.75639385", "0.7437855", "0.7415186", "0.73480654", "0.7337557", "0.730565", "0.72141254", "0.7149685", "0.7100635", "0.7100635", "0.70720184", "0.7071647", "0.7006422", "0.7006422", "0.69301534", "0.68798286", "0.6822775", "0.6804328", "0.6803036...
0.8176615
0
Destroys the output panel.
def destroy(self): self.window.destroy_output_panel(self.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy(self):\n\n sceneOpts = self.sceneOpts\n contentPanel = self.contentPanel\n\n sceneOpts .removeListener('showXCanvas', self.name)\n sceneOpts .removeListener('showYCanvas', self.name)\n sceneOpts .removeListener('showZCanvas', self.n...
[ "0.7193226", "0.68968743", "0.6834006", "0.6807891", "0.6798294", "0.67648476", "0.66658133", "0.6663485", "0.66035354", "0.6602881", "0.65584713", "0.6545481", "0.6520772", "0.64931065", "0.64461774", "0.64023775", "0.63974214", "0.6392973", "0.6371955", "0.6344312", "0.6334...
0.9011572
0
Export recipe to KRecipes XML string
def toKrecipesXml(self, author=None): sauthor = u'' if not empty(self.author): sauthor += '%s@' % self.author if author is None: sauthor += 'Cookboob' else: sauthor += author header = u'<?xml version="1.0" encoding="UTF-8" ?>\n' initi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_xml(self):\n description = ''\n if self.description is not None:\n description = '<Description>%s</Description>' % self.description\n\n timestamp = ''\n if self.timestamp:\n timestamp = '<Timestamp>%s</Timestamp>' % self.timestamp\n\n user_name = ''\n...
[ "0.6010239", "0.5701536", "0.53696835", "0.53363144", "0.5310411", "0.53031147", "0.5295261", "0.5271995", "0.5259991", "0.5216882", "0.52063394", "0.5203734", "0.5138142", "0.513038", "0.5118125", "0.5097201", "0.5057735", "0.5055886", "0.5050824", "0.50440603", "0.5042698",...
0.744579
0
Get a recipe object from an ID.
def get_recipe(self, _id): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_recipe(cls, recipeid):\n\n recipe = Recipe.query.filter_by(recipe_id=recipeid).one()\n\n return recipe", "def find_recipe(self, recipe_id):\n return self.find_doc('recipe', 'name', self.get_unique_recipe_name(recipe_id))", "def get_recipe_by_id(self, recipe_id):\n\n url = f\...
[ "0.8377665", "0.7713799", "0.7524016", "0.74002683", "0.7218536", "0.7000964", "0.6827044", "0.67245144", "0.66867", "0.6664977", "0.6651893", "0.66343296", "0.654762", "0.6544687", "0.65396255", "0.6453572", "0.6349183", "0.6304003", "0.6304003", "0.6303423", "0.6245677", ...
0.8048214
1
Retrieves diff encoder fn for image and 3D
def get_encoder_fn_separate(model_type, # e.g., model_type = 'resnet_fc3_dropout' encoder_fn_type = "Encoder_resnet_v2" ): encoder_fn = None threed_fn = None if 'resnet' in model_type: #encoder_fn = Encoder_resnet # added by CCJ encoder_fn = Encoder_resnet_v2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_encoder_name(self):\n return \"P\" + str(self.parameters_common_index) + \".\" + str(self.parameters_fs_index) + \"_E\" \\\n + str(self.get_encoder_number())", "def encode(self, img):\n with tf.variable_scope('encoder'):\n #conv1 = self.conv_layer(\n # ...
[ "0.5806261", "0.57589775", "0.563855", "0.5582836", "0.54606414", "0.5400806", "0.53650427", "0.5363339", "0.53145856", "0.53103936", "0.5172266", "0.5160215", "0.51586235", "0.5102503", "0.50997406", "0.5081622", "0.5074102", "0.5022137", "0.5020066", "0.5014903", "0.5012079...
0.6380668
0
23 Discriminators on each joint + 1 for all joints + 1 for shape. To share the params on rotations, this treats the 23 rotation matrices
def Discriminator_separable_rotations( poses, shapes, weight_decay, ): data_format = "NHWC" with tf.name_scope("Discriminator_sep_rotations", [poses, shapes]): with tf.variable_scope("D") as scope: with slim.arg_scope( [slim.conv2d, slim.fully_connecte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_inter_muscles_sensorimotor_connections(self):\n\n\t\tfor pathway in self._infoInterMuscSensorimotorConnections:\n\t\t\tconnections = self._infoInterMuscSensorimotorConnections[pathway][\"connections\"]\n\t\t\tmatrix = self._infoInterMuscSensorimotorConnections[pathway][\"matrix\"]\n\t\t\tif not len(mat...
[ "0.5311791", "0.52636063", "0.5223962", "0.51666474", "0.51513153", "0.5147555", "0.5147096", "0.5076116", "0.504603", "0.5043449", "0.5020913", "0.5009611", "0.5006697", "0.5001964", "0.49943382", "0.49916703", "0.49279815", "0.49181437", "0.49138898", "0.49081388", "0.49061...
0.6719711
0
Read mesh file and set mesh info
def read(self, mesh_path: str) -> None: reader = VtuReader(mesh_path) self.set_mesh_data(mesh=reader.mesh, bc=reader.bc, mpc=reader.mpc)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, file_path):\n\n # Comments\n # mtllib mtl_name\n # o object_name\n # v x y z\n # vt u v\n # vn x y z\n # f v0/t0/n0 v1/t1/n1 v2/t2/n2\n\n print('loading mesh \"%s\"' % file_path)\n mesh_file = open(file_path, 'r')\n\n verts = ...
[ "0.72477895", "0.7231545", "0.6861958", "0.65328884", "0.6502265", "0.64358604", "0.6418677", "0.6410978", "0.63954353", "0.63278455", "0.6290899", "0.62744457", "0.6266086", "0.6242484", "0.6171982", "0.6151769", "0.6147169", "0.6136301", "0.6073607", "0.6051929", "0.6042278...
0.74444646
0
Set mesh shape from coordinates and connectivity
def set_shape(self, *, coords: np.ndarray, connectivity) -> None: self._coords = coords self._n_dof, self._n_point = coords.shape if self._n_dof == 3: if np.max(np.abs(coords[2])) < 1.0e-30: self._n_dof = 2 self._n_dfdof = 3 if self._n_dof == 2 else 6 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_mesh_set(self, all_meshes):\n if isinstance(all_meshes, Mesh):\n mesh_tp = []\n mesh_tp.append(all_meshes)\n all_meshes = mesh_tp\n\n if not isinstance(all_meshes, list):\n raise TypeError(\"Please send a list of mesh to update_mesh\")\n self...
[ "0.63095385", "0.6133455", "0.60748947", "0.5996647", "0.5935439", "0.5797967", "0.5770493", "0.5763034", "0.575348", "0.5732035", "0.56429887", "0.5611152", "0.56005925", "0.55983496", "0.55866754", "0.5570907", "0.5565921", "0.55617815", "0.5530908", "0.5512073", "0.5491944...
0.7190176
0
Test that getting a CallError will suppress Exception by default
async def test_suppress_call_error(base_central_system): call_error = CallError( unique_id="1337", error_code="GenericError", error_description="test_raise_call_error", ) await base_central_system.route_message(call_error.to_json()) payload = call.ClearCachePayload() await b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_raise_call_error(base_central_system):\n call_error = CallError(\n unique_id=\"1337\",\n error_code=\"GenericError\",\n error_description=\"test_raise_call_error\",\n )\n await base_central_system.route_message(call_error.to_json())\n\n payload = call.ClearCachePaylo...
[ "0.74404263", "0.6764512", "0.67392343", "0.67175555", "0.6665568", "0.66465676", "0.65869296", "0.65313244", "0.6518903", "0.6515121", "0.6457542", "0.64349633", "0.6402038", "0.6391041", "0.63766503", "0.6353119", "0.63412386", "0.63406044", "0.63274175", "0.6326284", "0.63...
0.7601008
0
check if a given text consists of more nonswiss chars than allowed by the threshold
def check_sentences(text, threshold=80, print_only=False): non_white_text = re.sub(masks, "", re.sub(emojis, "", re.sub(punctuation, "", re.sub("\s", "", text)))) num_chars = len(non_white_text) num_non_swiss_chars = 0 for char in non_white_text: if char not in swiss_chars: num_non_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bad_chars_from_threshold(self):\r\n exp1 = [\r\n '\\t',\r\n '\\n',\r\n '\\r',\r\n ' ',\r\n '!',\r\n '\"',\r\n '#',\r\n '$',\r\n '%',\r\n '&',\r\n \"'\",\r\n '(',\r\n ...
[ "0.67343956", "0.6438954", "0.6417638", "0.6345464", "0.6294759", "0.6108843", "0.606833", "0.6064365", "0.6040222", "0.60336137", "0.60284996", "0.6009242", "0.60005784", "0.5995445", "0.5990827", "0.5984578", "0.5954107", "0.59496266", "0.59294087", "0.58975804", "0.5873103...
0.7474896
0
Process infile line by line. If text is below threshold it is written to outfile.
def process_file(path_in, path_out, threshold): infile = open(path_in, "r", encoding="utf-8") outfile = open(path_out, "w", encoding="utf-8") csv_reader = csv.reader(infile) csv_writer = csv.writer(outfile) for i, line in enumerate(csv_reader): try: text_id, text, masked, label_b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess_raw_text(source_file, output_file, min_length=5):\n STOP_WORDS = set(stopwords.words('english'))\n TOKENIZER = RegexpTokenizer(r'[a-zA-Z]{2,}')\n WORDS = set(nltk.corpus.words.words())\n\n total_sent = 0\n sent_count = 0\n write_file = open(output_file, 'a+')\n\n with open(sourc...
[ "0.5342204", "0.51974237", "0.4992547", "0.4979002", "0.48810345", "0.48231542", "0.4748882", "0.47401735", "0.4739367", "0.47332078", "0.47123075", "0.46686062", "0.46666098", "0.46398395", "0.46289426", "0.46094322", "0.46052054", "0.4605075", "0.4599252", "0.45792446", "0....
0.73162127
0
Initialize the view with the specified model and screen.
def __init__(self, model, screen): self.model = model self.screen = screen
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, screen, model):\n self.screen = screen\n self.model = model", "def __init__(self, view, model):\n self.view = view\n self.view.set_controller(self)\n self.model = model", "def __init__(self, model, **kwargs):\n self.model = model\n\n super(Rec...
[ "0.77187085", "0.7525358", "0.7046307", "0.69160295", "0.6824942", "0.6709154", "0.6602792", "0.6543344", "0.6423815", "0.63758487", "0.63739794", "0.6364629", "0.62607765", "0.6213999", "0.6192608", "0.61906385", "0.6189571", "0.6184618", "0.61534446", "0.6120863", "0.607998...
0.7898838
0
Queue a mail for delivery at the end of the transaction. We don't immediately call mailhost.send() here, but instead place mails to be sent in a queue that gets processed at the end of the transaction. We need to do this because mailhost.send() registers an IDataManager without savepoint support (zope.sendmail.delivery...
def send_mail(self, msg): mail_queue.put(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def queueMail(self, mail):\n if mail is not None:\n assert isinstance(mail, Message)\n self.mailQueue.put(mail)", "def flush_email_queue():\n from indico.core.emails import store_failed_email, update_email_log_state\n queue = g.get('email_queue', [])\n if not queue:\n ...
[ "0.6712524", "0.6405596", "0.6173024", "0.59460574", "0.5930177", "0.5916785", "0.59139335", "0.5896478", "0.58417267", "0.577474", "0.56759465", "0.5586475", "0.5561998", "0.55504334", "0.5542502", "0.5535428", "0.5517532", "0.5509053", "0.5501889", "0.5501889", "0.546916", ...
0.6468783
1
Instanciation de la grille remplie de 0
def __init__(self): self.grille = [] for i in range(3): self.grille.append([0, 0, 0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,):\r\n self.g = 9.81\r\n self.l = 0.5\r\n self.m1 = 1.0\r\n self.m2 = 1.0\r\n self.m3 = 1.0\r\n self.r1 = 1.0\r\n self.r2 = 1.0\r\n self.tau = 0.001\r\n self.theta1 = 1.0\r\n self.theta2 = 1.0\r\n self.theta3 = 1.0", "...
[ "0.635757", "0.6268537", "0.61629856", "0.61330193", "0.61299413", "0.61132044", "0.607511", "0.6060138", "0.6054695", "0.6049013", "0.6022527", "0.599101", "0.59559685", "0.591105", "0.5896893", "0.5876133", "0.58687896", "0.58581257", "0.58531964", "0.5844048", "0.58418787"...
0.693859
0
Retourne le nombre de tours
def nbr_tours(self): nbr_tours = 0 for i in range(3): for j in range(3): if self.grille[i][j] != 0: nbr_tours += 1 return nbr_tours
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_lengte(self):", "def nombre_monomes(self):\n\t\tif self.__tete:\n\t\t\treturn self.__tete.nombre_monomes()\n\t\telse:\n\t\t\treturn 0", "def tour_length(tour):\n return sum(distance(tour[i], tour[i-1]) for i in range(len(tour)))", "def top(self):\r\n return self.topele", "def getNrTargets...
[ "0.6097599", "0.5841696", "0.582113", "0.58156747", "0.5763662", "0.56664723", "0.56400603", "0.56183165", "0.55874324", "0.5582562", "0.5537225", "0.5532089", "0.55275244", "0.549702", "0.54936695", "0.5467893", "0.5454346", "0.5452843", "0.5451162", "0.5444562", "0.54296", ...
0.6989913
0
Ajoute un nouveau tour dans la partie seulement si la case est libre donc contient 0.
def nouveau_tour(self, tour): # Teste si la case est libre if self.grille.case(tour.x, tour.y) == 0: nbr_tour = len(self.tours)+1 # Calcul du nombre de tour tour.numero = nbr_tour if nbr_tour%2 == 1: # Décide du joueur du tour tour.joueur = 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finTour(self):\n print(\"fin du tour\")\n self.etat = \"Fin\"\n if self.joueurActif.nbRessource + self.joueurActif.getNbRessourceTour() <= self.joueurActif.nbMaxRessource :\n self.joueurActif.nbRessource += self.joueurActif.getNbRessourceTour()\n else:\n self.joueurActif.nbR...
[ "0.58160925", "0.5603885", "0.55803025", "0.5388907", "0.5387003", "0.53643996", "0.5285554", "0.5259573", "0.5190299", "0.5171138", "0.5153983", "0.5113155", "0.50980085", "0.50890636", "0.5079389", "0.50791484", "0.5064852", "0.5048941", "0.5030087", "0.5016047", "0.5010231...
0.81000745
0
Copie la partie dans un autre objet
def copier(partie): # Instanciation d'une nouvelle partie partie_copiee = Partie() for tour in partie.tours: tour_tmp = Tour(tour.x, tour.y) # Instanciation d'un tour partie_copiee.nouveau_tour(tour_tmp) # Ajout du tour return partie_copiee
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, partie):\n self.ID = 0\n self.nbr_noeuds = 1\n self.nbr_feuilles = 1\n self.partie = partie\n self.nbr_fils = 0\n self.fils = []", "def object(self):", "def mezclar_bolsa(self):", "def objects(self):", "def sketch_und_part(self):\n if (sel...
[ "0.60373586", "0.59689224", "0.58841515", "0.58621794", "0.57410973", "0.5679388", "0.54564327", "0.54407513", "0.54303795", "0.5392611", "0.53861403", "0.5371106", "0.5363698", "0.53603745", "0.53571296", "0.5352821", "0.5342778", "0.53372157", "0.53038996", "0.526282", "0.5...
0.62015474
0
Compose ad types, intended for dense a and sparse b
def compose(a,b,shape_factor=None): if isinstance(a,Dense.denseAD) and (isinstance(b,Sparse.spAD) or all(isinstance(e,Sparse.spAD) for e in b)): elem = None size_factor = np.prod(shape_factor) if shape_factor is None: if not isinstance(b,Sparse.spAD): raise ValueError("Compose error : unspecified shape_fa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_ad(state):\n return [adnumber(val) for val in state]", "def _buildAB(lap_sparse, labels):\n labels = labels[labels >= 0]\n indices = np.arange(labels.size)\n unlabeled_indices = indices[labels == 0]\n seeds_indices = indices[labels > 0]\n \n # The following two lines take most of th...
[ "0.58313257", "0.5263013", "0.5105327", "0.5056426", "0.50276285", "0.49711472", "0.4903355", "0.4894205", "0.48496133", "0.48405477", "0.47760114", "0.47468212", "0.4667488", "0.4657196", "0.46571103", "0.46204466", "0.46033058", "0.45807293", "0.4567043", "0.45574138", "0.4...
0.6339438
0
given a list of field texts, convert to a list of lists of fields, where each list of fields is no more than 10 fields, and each field
def make_fields(self, ftext): fields = [{'type': 'mrkdwn', 'text': x} for x in ftext] return utils.chunks(fields, 10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_field_list(entities: List[Entity], features: List[Feature]) -> List[Field]:\n fields: List[Field] = []\n\n for entity in entities:\n if isinstance(entity, Field):\n fields.append(entity)\n\n for feature in features:\n if isinstance(feature, Field):\n fields....
[ "0.63049895", "0.60494995", "0.6042377", "0.58889556", "0.57323325", "0.5654697", "0.5636447", "0.55993885", "0.55857927", "0.5525666", "0.5512379", "0.55079097", "0.5505211", "0.5482248", "0.5481543", "0.5478429", "0.5433399", "0.54266167", "0.5423206", "0.54226106", "0.5401...
0.6797203
0
Return middleware wrangler for display module type.
def get_wrangler(cls): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_wrangler(cls):\n return MethylWrangler", "def mainTypeName(type_name):\n return mainRender(type_name)", "def module(filter_):\n def decorator(module_fn):\n \"\"\"Decorates a module function.\"\"\"\n _FILTERS_AND_SAMPLERS.append((filter_, module_fn))\n return module_fn\n return deco...
[ "0.62054604", "0.5231313", "0.5116533", "0.5095605", "0.50789547", "0.5018407", "0.4871412", "0.4863365", "0.4855846", "0.48507357", "0.48388818", "0.4815539", "0.48002517", "0.47662795", "0.47573403", "0.47569326", "0.47199535", "0.4684725", "0.4676501", "0.46528643", "0.465...
0.6005479
1
Enumerate which ToolResult modules a sample must have for this task to run.
def required_tool_results(): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def required_tool_results():\n return [MethylResultModule]", "def get_required_module_descriptors(self):\r\n return []", "def _list_all(root_pkg, prog):\n res = \"\\n\".join(\n sorted(\n pkinspect.package_module_names(_import(root_pkg)),\n key=str.lower,\n )...
[ "0.75875896", "0.591068", "0.5730903", "0.5685862", "0.56812304", "0.56406015", "0.5628199", "0.5566931", "0.5555047", "0.5519543", "0.5502232", "0.5455325", "0.5450195", "0.5445556", "0.54447776", "0.5437996", "0.5421188", "0.5403129", "0.53945416", "0.5386692", "0.5381068",...
0.6590472
1
Return a list of hooks to run before transmission to the client.
def transmission_hooks(cls): return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hooks(self):\n return tuple(self.__hooks.keys())", "def getHooks(self):\n return self.__hooks", "def extension_hooks(self, global_step):\n return []", "def extension_hooks(self, global_step):\n return []", "def get_hooks(self, type_: str) -> typing.Iterable:\n hooks =...
[ "0.73655885", "0.71785975", "0.7086775", "0.7086775", "0.70380497", "0.70158744", "0.7012391", "0.6932244", "0.69204557", "0.68895966", "0.6851708", "0.6847747", "0.6832454", "0.68089086", "0.6785452", "0.6731263", "0.6722889", "0.6581353", "0.6504369", "0.6457942", "0.643557...
0.79330647
0
Return True if this display module is dependent on a given Tool Result type.
def is_dependent_on_tool(cls, tool_result_cls): required_tools = cls.required_tool_results() return tool_result_cls in required_tools
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def should_display(self, source: TestGroupReport) -> bool:\n style = self.get_style(source)\n if source.category == ReportCategories.TESTSUITE:\n return style.display_testsuite\n elif source.category == ReportCategories.PARAMETRIZATION:\n return style.display_testcase\n ...
[ "0.5816579", "0.5628707", "0.55777824", "0.54889745", "0.5420486", "0.54008335", "0.53764594", "0.5367646", "0.53598297", "0.5335004", "0.53226", "0.5321031", "0.53186536", "0.5311553", "0.5311553", "0.5284604", "0.5276594", "0.5252781", "0.5241503", "0.5229118", "0.5227202",...
0.77842027
0
Transform my_query_result to data.
def get_data(cls, my_query_result): return my_query_result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unpack_query_response(self, query_result_array):\n result = []\n\n for row in query_result_array:\n result.append({\n 'case_id': row['f'][0]['v'],\n 'sample_id': row['f'][1]['v'],\n 'aliquot_id': row['f'][2]['v'],\n 'value': f...
[ "0.6981122", "0.6577858", "0.63920665", "0.6376893", "0.6324235", "0.63039035", "0.6156872", "0.6126251", "0.6125512", "0.6103589", "0.6100486", "0.6096133", "0.6015602", "0.6013755", "0.60091", "0.60091", "0.6008982", "0.5964533", "0.595245", "0.5940423", "0.59343916", "0....
0.8270387
0
Given a list of hourly forecasts, returns a boolean specifying whether there is rain in tomorrow's forecast.
def is_raining_tomorrow(data): pendulum.now("utc").add(days=1).strftime("%Y-%m-%d") rain = [ w for forecast in data["list"] for w in forecast["weather"] if w["main"] == "Rain" and forecast["dt_txt"].startswith(tomorrow) ] if not bool(rain): raise SKIP("There is no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_winter(et_cell, foo_day):\n if et_cell.latitude > 0 and (foo_day.month < 4 or foo_day.month > 10):\n # if et_cell.cell_lat > 0 and (foo_day.month < 4 or foo_day.month > 10):\n # Northern hemisphere\n return True\n else:\n # Southern hemisphere\n return False", "def hol...
[ "0.5610351", "0.55637497", "0.5548337", "0.55290747", "0.5506278", "0.54174626", "0.5280249", "0.52736783", "0.5273325", "0.5273297", "0.5233735", "0.52072436", "0.5202358", "0.51705116", "0.51691294", "0.51608115", "0.5127911", "0.50878334", "0.50420797", "0.5039532", "0.503...
0.7621358
0
Validate if the given admin_secret is the correct one
def validate_admin (admin_secret): try: admin_secret = admin_secret.encode() hashed = app.config['ADMIN_SECRET'].encode() return bcrypt.checkpw(admin_secret, hashed) except Exception as e: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_db_admin (db_secret):\n\n try:\n db_secret = db_secret.encode()\n hashed = app.config['DB_SECRET'].encode()\n return bcrypt.checkpw(db_secret, hashed)\n except Exception as e:\n return False", "def verify_admin_password(password: str) -> bool:\n # Ensure password...
[ "0.8299549", "0.75497776", "0.684883", "0.66909057", "0.6597921", "0.6502495", "0.6463577", "0.6390254", "0.6340422", "0.6257478", "0.62562394", "0.6225879", "0.62185997", "0.6175717", "0.6170695", "0.61422396", "0.60965115", "0.6092784", "0.60026026", "0.59991443", "0.595441...
0.8931452
0
Validate if the given db_secret is the correct one
def validate_db_admin (db_secret): try: db_secret = db_secret.encode() hashed = app.config['DB_SECRET'].encode() return bcrypt.checkpw(db_secret, hashed) except Exception as e: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_admin (admin_secret):\n\n try:\n admin_secret = admin_secret.encode()\n hashed = app.config['ADMIN_SECRET'].encode()\n return bcrypt.checkpw(admin_secret, hashed)\n\n except Exception as e:\n return False", "def check_secret_key(cls):\n logger.info(\"attempti...
[ "0.74829483", "0.69464415", "0.6771598", "0.66690654", "0.651468", "0.64202344", "0.63476896", "0.63411343", "0.63125145", "0.6286078", "0.6226795", "0.6211228", "0.6193013", "0.6172618", "0.608836", "0.605262", "0.6019824", "0.6018786", "0.5989689", "0.5940818", "0.5940511",...
0.86207783
0
Sign the payload with jwt using secret key Return as API key Expiry = 100 days
def encode_payload(payload): jwt_secret = app.config['SECRET_KEY'] # expiry = 60 * 60 * 24 * 100 # 100 days # payload['exp'] = datetime.datetime.utcnow() + datetime.timedelta(seconds=expiry) encoded_jwt = jwt.encode(payload, jwt_secret, algorithm='HS256') return (encoded_jwt).decode()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateAuthToken(self):\n try:\n payload = {\n 'exp': datetime.utcnow() + timedelta(days=0, minutes=30),\n 'iat': datetime.utcnow(),\n 'sub': self.id\n }\n return jwt.encode(payload, current_app.config['SECRET_KEY'], algorith...
[ "0.70266306", "0.69973254", "0.6879286", "0.6736447", "0.6704087", "0.6656463", "0.6656185", "0.6612251", "0.6610009", "0.6558215", "0.65495676", "0.65458244", "0.64826906", "0.6411417", "0.63910115", "0.63853747", "0.63654083", "0.633271", "0.63082", "0.6296346", "0.6290792"...
0.70484716
0
Decode the payload with jwt using secret key Return the payload if valid
def decode_payload(encoded_payload): jwt_secret = app.config['SECRET_KEY'] payload = jwt.decode(encoded_payload, jwt_secret, algorithms='HS256') return payload
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode(encoded_token):\n return jwt.decode(encoded_token, key=settings.JWT_AUTH['JWT_SECRET_KEY'])", "def decode(token):\n return jwt.decode(token, app.config[\"JWT_SECRET\"], algorithms=[\"HS256\"])", "def decode_auth_token(auth_token): \n try: \n payload = jwt.d...
[ "0.74451417", "0.7372809", "0.72904104", "0.7230739", "0.7175137", "0.71648806", "0.7119963", "0.7084711", "0.70346344", "0.70256925", "0.6955904", "0.6925407", "0.6915475", "0.6855873", "0.6854993", "0.68441266", "0.6811485", "0.67334646", "0.6714272", "0.67123103", "0.67040...
0.7783653
0
Updates the API access of the given app
def update_api_access(info): try: file = open(PATH + "/../DB/access.json", 'r') accessData = json.load(file) except: raise try: accessData[info['application_name']] = { 'api_list': info['api_list'], 'timestamp': info['timestamp'] } except ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AppUpdateApp(self, request, context):\n context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)", "async def update_app_oauth(self, app_id: str, data: dict) -> dict:\r\n return await self.put(API_APP_OAUTH.format(app_id=app_id), data)", "async def update_app(self, app_id: str, data: dict) -> dic...
[ "0.699919", "0.6788806", "0.6618002", "0.6534463", "0.63898516", "0.628866", "0.6253333", "0.6113381", "0.60424316", "0.5963111", "0.5945156", "0.5923656", "0.59072936", "0.58681726", "0.58025724", "0.5760841", "0.57577914", "0.5727997", "0.5690599", "0.5675276", "0.5669731",...
0.6935682
1
Revoke the API access of this application
def revoke_api_access(application): try: file = open(PATH + '/../DB/access.json', 'r') accessData = json.load(file) if (application in accessData): accessData.pop(application, None) with open(PATH + '/../DB/access.json', 'w') as f: f.write(json.dumps(accessDa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def revoke(self):\r\n return http.Request('DELETE', self.get_url()), parsers.parse_empty", "def delete_api_key(api_key):\n api.delete(api_key)", "def fusion_api_revoke_certificate(self, name=None, api=None, headers=None):\n return self.ca.revoke(name=name, api=api, headers=headers)", "de...
[ "0.6730182", "0.6729978", "0.6615203", "0.6509093", "0.6454731", "0.62866485", "0.6253291", "0.6251638", "0.6239345", "0.62288606", "0.617178", "0.615104", "0.6108182", "0.61016226", "0.6098169", "0.60865456", "0.6082932", "0.6066611", "0.605869", "0.60306275", "0.5992551", ...
0.77157366
0
to print out error of LSE
def show_error(self): print('LSE Error : {}'.format(self._error))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_error(e):\n\tprint(e)", "def log_error(e):\n\tprint(e)", "def printGLError(err_msg):\n print('[GL-ERROR] {0}'.format(err_msg))", "def log_error(e):\r\n print(e)", "def log_error(e):\r\n print(e)", "def print_error_analysis(self, to_stdout = True):\n message = ''\n message +...
[ "0.6471635", "0.6471635", "0.64265156", "0.6361193", "0.6361193", "0.6294889", "0.62870204", "0.6262249", "0.62443817", "0.62093896", "0.62093896", "0.62093896", "0.62093896", "0.62093896", "0.62093896", "0.62093896", "0.62093896", "0.62093896", "0.61480564", "0.61259896", "0...
0.76531595
0
Load requests' cookies from a file
def __loadCookies(self): with open(self.cookies_file, 'rb') as cookie_file: LOGGER.debug("Unpickling HTTP cookies from file: {0}".format(self.cookies_file)) session.cookies = requests.utils.cookiejar_from_dict(pickle.load(cookie_file))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_cookies(filename):\n with open(filename, 'rb') as f:\n requests_cookiejar = pickle.load(f)\n return requests_cookiejar", "def load_cookies(self, filename):\n\t\tif self._session is None:\n\t\t\tself.start_new_session()\n\n\t\twith open(filename, 'rb') as f:\n\t\t\tcookies = pickle.load(f)\n...
[ "0.8190505", "0.7919491", "0.781587", "0.7532788", "0.74161005", "0.703919", "0.68430036", "0.6701831", "0.64587516", "0.64421403", "0.64019436", "0.6380138", "0.63643", "0.6304223", "0.62641627", "0.62601537", "0.6257137", "0.6251569", "0.62127733", "0.61244", "0.6059112", ...
0.7956011
1
Given int, print digits in reverse order, starting with the ones place >>> print_digits(1) 1 >>> print_digits(314) 4 1 3 >>> print_digits(12) 2 1
def print_digits(num): # Given an integer, print each digit in reverse order, starting with the ones place. # # For example, if you were given 1 you should simply print 1, if given 314 you should print 4, 1, 3, and if given 12 you should print 2, 1: # Implement print_digits. Do not do this by just turnin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_digits(number: int):\n acc = 0\n\n while number != 0:\n acc *= 10\n acc += number % 10\n\n number //= 10 # 정수 나눗셈\n\n return acc", "def print_last_digit(number):\n\n ld = abs(number) % 10\n print(ld, end=\"\")\n return ld", "def reverseInt(self, x):\n ...
[ "0.71114177", "0.69571304", "0.6555556", "0.64400125", "0.64276296", "0.63207483", "0.6307353", "0.62142164", "0.62111366", "0.61732656", "0.6168225", "0.61178094", "0.61169153", "0.61041933", "0.61001784", "0.59447086", "0.59351593", "0.59322053", "0.5894241", "0.58274496", ...
0.8082196
0
Calculate flooding destinations based on this DP's position. If a standalone switch, then flood to local VLAN ports. If a distributed switch, see the following example. Hosts |||| |||| ++ ++ ++ +1 | |1234| | 1+ Hosts +2 | | | | 2+ Hosts +3 | | | | 3+ +4 5++5 6++5 4+ ++ ++ ++ Root DP The basic strategy is floodtowardsro...
def _build_flood_rule_actions(self, vlan, exclude_unicast, in_port): local_flood_actions = self._build_flood_local_rule_actions( vlan, exclude_unicast, in_port) # If we're a standalone switch, then flood local VLAN if self.stack is None: return local_flood_actions ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flood(self, msg):\r\n datapath = msg.datapath\r\n ofproto = datapath.ofproto\r\n\r\n for dpid in self.awareness.access_ports:\r\n for port in self.awareness.access_ports[dpid]:\r\n if (dpid, port) not in self.awareness.access_table.keys():\r\n d...
[ "0.58870244", "0.5848398", "0.56891984", "0.56619173", "0.56313396", "0.5572743", "0.54262346", "0.5406666", "0.53992283", "0.53992283", "0.5390001", "0.5388538", "0.5388474", "0.5382279", "0.5367141", "0.5362024", "0.533819", "0.5327275", "0.5295861", "0.5293269", "0.5276602...
0.65360856
0
Add ``django_hipchat`` to ``INSTALLED_APPS`` Ensure ``django.template.loaders.app_directories.Loader`` is in your ``TEMPLATE_LOADERS``. >>> from django_hipchat.api import message >>> message("path/to/my_message.hipchat", {
def hipchat_message(template, context=None, fail_silently=app_settings.FAIL_SILENTLY): if not app_settings.ENABLED: return context = Context(context or {}) context['settings'] = settings def render(component): component_template = 'django_hipchat/%s' % component return rende...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_message(self, request, level, message_template,\n message_context=None, extra_tags=''):\n if 'django.contrib.messages' in settings.INSTALLED_APPS:\n try:\n if message_context is None:\n message_context = {}\n message = re...
[ "0.59793943", "0.5208079", "0.488642", "0.48840332", "0.48807856", "0.4874102", "0.48248", "0.4807923", "0.48006102", "0.4769188", "0.47678974", "0.47485507", "0.47124565", "0.471015", "0.4682964", "0.4665155", "0.4654864", "0.465368", "0.46388587", "0.46298146", "0.45924622"...
0.5785857
1
r""" Checks that cotraining parameters are valid. Throws AttributeError if estimators are invalid. Throws ValueError if any other parameters
def _check_params(self): # verify that estimator1 and estimator2 have predict_proba if (not hasattr(self.estimator1_, 'predict_proba') or not hasattr(self.estimator2_, 'predict_proba')): raise AttributeError("Co-training classifier must be initialized " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_params(self):\n if self.n_estimators <= 0:\n raise ValueError(\"n_estimators must be greater than 0 but \"\n \"was %r\" % self.n_estimators)\n\n if self.learning_rate <= 0.0:\n raise ValueError(\"learning_rate must be greater than 0 but \"\...
[ "0.70868254", "0.6892", "0.68422365", "0.66688854", "0.66282433", "0.6605668", "0.6591788", "0.657282", "0.6469603", "0.64408475", "0.64206666", "0.6413409", "0.6403609", "0.6399887", "0.639419", "0.6374055", "0.6362308", "0.6350616", "0.6337345", "0.6332795", "0.6307364", ...
0.7846526
0
r""" Predict the classes of the examples in the two input views.
def predict(self, Xs): Xs = check_Xs(Xs, multiview=True, enforce_views=self.n_views) X1 = Xs[0] X2 = Xs[1] # predict each view independently y1 = self.estimator1_.predict(X1) y2 = self.estimator2_.predict(X2) # initi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_multifield_classify(self):\n self.model.fit(self.text_data_train, self.train_targets)\n self.assertTrue(self.model.is_classification)\n predictions = self.model.predict(self.text_data_valid)\n self.model.save(self.save_file)\n model = LanguageModelGeneralAPI.load(self.sa...
[ "0.64654356", "0.64648676", "0.61843085", "0.6026428", "0.5975408", "0.5915534", "0.5899724", "0.58217555", "0.5786423", "0.5782284", "0.57059187", "0.56996584", "0.5693123", "0.5662868", "0.56304616", "0.562411", "0.5621905", "0.55986106", "0.559817", "0.5594976", "0.558372"...
0.66578734
0
Increase linearly from initial to final over T then remain at final.
def linear(initial, final, T): def f(t): if t < T: r = t / float(T) p = (1 - r) * initial + r * final else: p = final return p return f
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cool(self):\n self.t = self.t - 1", "def lerp(self, t):\n pass", "def inc_tau_trans(self):\r\n self.num_tau_trans += 1", "def temp_update(self):\n a_w = self.k / self.dx\n a_e = self.k / self.dx\n a_n = self.k / self.dy\n a_s = self.k / self.dy\n a_...
[ "0.6219811", "0.59867257", "0.5921388", "0.59171176", "0.5822338", "0.5770929", "0.56293476", "0.55778104", "0.5562849", "0.5508735", "0.548904", "0.54454124", "0.5387143", "0.5338235", "0.53249556", "0.528532", "0.5277742", "0.52760696", "0.5265971", "0.5239519", "0.52102506...
0.6405913
0
Test that get_category_data has access to Category model data
def test_category_has_access_to_model_data(): category = Category() category_data = category.get_category_data() assert type(category_data) is list assert len(category_data) > 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get(self, init_db, category):\n assert Category.get(category.id) == category", "def test_get_categories(self):\n pass", "def test_get_category_details(self):\n category = sample_category()\n url = category_details_url(category.id)\n res = self.client.get(url)\n ...
[ "0.781616", "0.77358955", "0.7667147", "0.7495113", "0.7485289", "0.74218965", "0.74166435", "0.7398926", "0.73573416", "0.72917026", "0.72917026", "0.72799927", "0.7272853", "0.7272054", "0.724342", "0.7187817", "0.71614367", "0.71460027", "0.70949364", "0.70434767", "0.7039...
0.8451159
0
Detects labels in the file.
def detect_labels(path): client = vision.ImageAnnotatorClient() with io.open(path, 'rb') as image_file: content = image_file.read() image = vision.types.Image(content=content) response = client.label_detection(image=image) labels = response.label_annotations #print('Labels:') #fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect_labels(path):\n client = vision.ImageAnnotatorClient()\n with io.open(path, 'rb') as image_file:\n content = image_file.read()\n image = vision.types.Image(content=content)\n response = client.label_detection(image=image)\n labels = response.label_annotations\n print('Labels:')\...
[ "0.69569653", "0.6777468", "0.6708667", "0.6603811", "0.6387664", "0.6329701", "0.63295937", "0.62779915", "0.6274977", "0.6223336", "0.62140894", "0.6181219", "0.61630213", "0.615036", "0.6096672", "0.60832655", "0.6073533", "0.6073533", "0.6042281", "0.60382044", "0.6033432...
0.69775647
0
Detects image properties in the file.
def detect_properties(path): client = vision.ImageAnnotatorClient() with io.open(path, 'rb') as image_file: content = image_file.read() image = vision.types.Image(content=content) response = client.image_properties(image=image) props = response.image_properties_annotation return prop...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_properties(self):\n return self._image_properties", "def _get_image_properties(image):\n immin, immax = np.min(image), np.max(image)\n imtype = image.dtype.type\n try:\n lo, hi = dtype_range[imtype]\n except KeyError:\n lo, hi = immin, immax\n\n signed = immin < 0\n ...
[ "0.62220645", "0.6211554", "0.6181497", "0.5858606", "0.5756054", "0.5746566", "0.5724156", "0.57044584", "0.57040876", "0.5676858", "0.5673514", "0.566228", "0.5635225", "0.5597849", "0.5594146", "0.55667824", "0.5515112", "0.5507947", "0.5502039", "0.5501348", "0.54628426",...
0.77241194
0
The minimum possible roll given the dice on this roller.
def minimum_roll(self): return self.number
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maximum_roll(self):\n if self.dice_array is None:\n return self.number * self.sides\n else:\n return np.sum(self.dice_array)", "def roll(self):\n self.current_roll = random.randint(self.min, self.max)\n return self.current_roll", "def roll(self) -> int:\n ...
[ "0.7500324", "0.7313964", "0.71546924", "0.7101064", "0.7095978", "0.7067354", "0.70590055", "0.70525527", "0.70232743", "0.69578344", "0.69485414", "0.6944818", "0.6944818", "0.6921419", "0.6921419", "0.6921419", "0.6921419", "0.6862697", "0.6847367", "0.6817786", "0.6814134...
0.79371685
0
The maximum possible roll given the dice on this roller.
def maximum_roll(self): if self.dice_array is None: return self.number * self.sides else: return np.sum(self.dice_array)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roll_die(sides = 6, maxi = 6):\n d = 1000\n # discard highest roll(s)\n while d > maxi:\n d = random.randint(1,sides)\n return d", "def get_damage_roll(self):\n\t\tif self.difficulty == 1:\n\t\t\treturn 4\n\t\tif self.difficulty == 2:\n\t\t\treturn 6\n\t\tif self.difficulty == 3:\n\t\t\tre...
[ "0.7150562", "0.70769626", "0.7032661", "0.6994607", "0.6948948", "0.6923557", "0.684725", "0.684371", "0.6820993", "0.67397636", "0.6712397", "0.6682507", "0.6666534", "0.6660419", "0.66307664", "0.6622229", "0.6622229", "0.6614107", "0.6607899", "0.66002166", "0.66002166", ...
0.88046837
0
Roll all the dice present on this object. Rolls either each dice of sides self.sides for each self.number of dice, or a dice of each integer in the self.dice_array list.
def roll(self): rolls = [] if self.dice_array is not None: for dice in self.dice_array: rolls.append(np.random.randint(1, dice+1)) else: for _ in range(0,self.number): rolls.append(np.random.randint(1, self.sides+1)) #Fast way from ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roll_the_dice(self, dice):\n if type(dice) == list:\n for die in dice:\n die.roll()", "def roll(self, *diceNums):\n if not diceNums:\n diceNums = list(range(0,5))\n for i in diceNums:\n self._dice[i - 1] = random.randint(1,6);\n self._dice = ...
[ "0.7716717", "0.72996944", "0.72135663", "0.71790856", "0.6979288", "0.69642735", "0.69427365", "0.6937187", "0.69342464", "0.6881656", "0.67474645", "0.66544914", "0.6601555", "0.65924305", "0.65496266", "0.6440301", "0.6430562", "0.6397451", "0.6395144", "0.6387934", "0.637...
0.7756239
0
Compute heat index given the temperature and humidity
def compute_heatindex(t,hum): a = -42.379 b = 2.04901523 c = 10.14333127 d = 0.22475541 e = 0.00683783 f = 0.05481717 g = 0.00122874 h = 0.00085282 i = 0.00000199 rh = hum/100 hi = (a+(b*t)+(c*rh)+(d*t*rh)+(e*t**2)+(f*rh**2)+(g*rh*t**2)+(h*t*rh**2)+(i*t**2*rh**2)) retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_heatindex(temperature, humidity):\n\n a = -42.379\n b = 2.04901523\n c = 10.14333127\n d = 0.22475541\n e = 0.00683783\n f = 0.05481717\n g = 0.00122874\n h = 0.00085282\n i = 0.00000199\n\n rh = humidity / 100\n\n heat_index = (a + (b * temperature) + (c * rh) + (d * t...
[ "0.897947", "0.67431843", "0.64822775", "0.64744574", "0.64579034", "0.64157116", "0.6251905", "0.6171769", "0.60084456", "0.6007168", "0.6004676", "0.5898105", "0.58670235", "0.5797731", "0.5757073", "0.5720581", "0.56876683", "0.568378", "0.5669631", "0.56557775", "0.564843...
0.84342057
1
Parse chess.Board() to a List[List[chr]]
def board_to_list_of_list(self): str_board = str(self.__board).replace(" ", "") list_board = str_board.split("\n") list_of_list_board1 =[line.split(",") for line in list_board] list_of_list_board =[utils.split_string_to_chars(l) for [l] in list_of_list_board1] return list_of_lis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile_board(self, moves=None) -> List[List[str]]:\n if not moves:\n moves = self.moves\n board = []\n current_line = []\n for itr in range(1, 10):\n current_line.append(\n self.tokens[moves.get(itr, ' ')]\n )\n if itr % 3 ...
[ "0.67866457", "0.676974", "0.6457209", "0.63862574", "0.62929875", "0.62672055", "0.6151076", "0.6136664", "0.6128998", "0.6121222", "0.60622287", "0.6061095", "0.60582787", "0.6021341", "0.5974653", "0.5954322", "0.59503984", "0.5946321", "0.5942086", "0.5934736", "0.5854889...
0.78297865
0