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
Fix common typos in given URL like forgotten colon.
def url_fix_common_typos(url): if url.startswith("http//"): url = "http://" + url[6:] elif url.startswith("https//"): url = "https://" + url[7:] return url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fix_url(cls, url: str):\r\n ...", "def _fix_url(url):\n\n if not url.startswith('http'):\n url = 'http://' + url\n\n return url", "def correct_url(self, url: str) -> str:\n # check if url has \"http://\" prefix\n if \"http://\" not in url:\n if \"https://\" not ...
[ "0.770113", "0.73291516", "0.68543786", "0.6504218", "0.64858186", "0.6459376", "0.6437735", "0.63930553", "0.6289801", "0.6263048", "0.6251412", "0.62297577", "0.62242717", "0.613285", "0.61042875", "0.60988045", "0.60984194", "0.6093388", "0.606762", "0.60473937", "0.603849...
0.7982654
0
Split query part of mailto url if found.
def url_fix_mailto_urlsplit(urlparts): if "?" in urlparts[2]: urlparts[2], urlparts[3] = urlparts[2].split('?', 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _urlparse_splitquery(url):\r\n\r\n qpart = url.split(\"?\", 1)\r\n if len(qpart) == 2:\r\n query = qpart[1]\r\n else:\r\n query = \"\"\r\n\r\n return qpart[0], query", "def test_split_url_for_query_1(self):\n url = \"testurl.com\"\n\n output = split_url_for_query(url)\n\n self....
[ "0.67279136", "0.6404292", "0.6209104", "0.61731404", "0.6047626", "0.5870148", "0.5843502", "0.56338006", "0.55826217", "0.55750227", "0.5401481", "0.5397454", "0.5378606", "0.5351534", "0.53454334", "0.5219765", "0.5213521", "0.5209964", "0.5108182", "0.5093666", "0.5083529...
0.7407154
0
Same as urlparse.urlunsplit but with extra UNC path handling for Windows OS.
def urlunsplit(urlparts): res = urlparse.urlunsplit(urlparts) if os.name == 'nt' and urlparts[0] == 'file' and '|' not in urlparts[2]: # UNC paths must have 4 slashes: 'file:////server/path' # Depending on the path in urlparts[2], urlparse.urlunsplit() # left only two or three slashes. T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def urlparse(url):\n\tunquote_url=urllib.parse.unquote(url)\n\treturn unquote_url", "def _split_url(url):\n return url[1:].split('/')", "def split(path):\r\n if path.lower().startswith(\"smb://\"):\r\n if '/' not in path[6:]:\r\n path = path.replace(\"smb://\", \"smb:///\", 1)\r\n ...
[ "0.6627455", "0.65837115", "0.64844257", "0.64534926", "0.62631977", "0.6174686", "0.6172689", "0.6165752", "0.61646414", "0.61592484", "0.61030483", "0.610288", "0.60629", "0.6021757", "0.601455", "0.59292614", "0.5918131", "0.5909229", "0.58973026", "0.58960414", "0.5895975...
0.851646
0
Return True if host part of url matches an entry in given domain list.
def match_url(url, domainlist): if not url: return False return match_host(url_split(url)[1], domainlist)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_host(host, domainlist):\n if not host:\n return False\n for domain in domainlist:\n if domain.startswith('.'):\n if host.endswith(domain):\n return True\n elif host == domain:\n return True\n return False", "def matches(self, url):\n ...
[ "0.8105381", "0.7370516", "0.7126605", "0.6921519", "0.6796388", "0.6785669", "0.67464596", "0.6718634", "0.6564882", "0.654149", "0.6427154", "0.636126", "0.6316495", "0.6279034", "0.62371093", "0.62335455", "0.62335455", "0.6123072", "0.6119781", "0.60940176", "0.6078012", ...
0.83841044
0
Return True if host matches an entry in given domain list.
def match_host(host, domainlist): if not host: return False for domain in domainlist: if domain.startswith('.'): if host.endswith(domain): return True elif host == domain: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_url(url, domainlist):\n if not url:\n return False\n return match_host(url_split(url)[1], domainlist)", "def matches_hostname(self, hostname):\n return hostname in self.hostnames", "def domain_in_ip_whois_match(self, domain, ip):\n try:\n domain_ip_desc = self.ge...
[ "0.718514", "0.7060217", "0.69207466", "0.6798229", "0.6687461", "0.6494838", "0.6165921", "0.61154306", "0.6060035", "0.6051432", "0.6046193", "0.60253114", "0.5941196", "0.59102017", "0.5872509", "0.5855687", "0.5823825", "0.5729784", "0.5715016", "0.5689225", "0.5683604", ...
0.83065116
0
Check if url needs percent quoting. Note that the method does only check basic character sets, and not any other syntax. The URL might still be syntactically incorrect even when it is properly quoted.
def url_needs_quoting(url): if url.rstrip() != url: # handle trailing whitespace as a special case # since '$' matches immediately before a end-of-line return True return not _safe_url_chars_ro.match(url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unreserved_percentencoding():\n assert (normalize_url(\"http://www.example.com/%7Eusername/\") ==\n \"http://www.example.com/~username\")\n assert (normalize_url('http://example.com/foo%23bar') ==\n 'http://example.com/foo%23bar')\n assert (normalize_url('http://example.com/...
[ "0.7206755", "0.7197858", "0.70679295", "0.6783549", "0.66798353", "0.6624512", "0.65184194", "0.6379363", "0.6148199", "0.60375714", "0.59809166", "0.596141", "0.59491706", "0.59333074", "0.59282386", "0.5914704", "0.5908903", "0.5879197", "0.58755445", "0.58680904", "0.5833...
0.7765809
0
Split url in a tuple (scheme, hostname, port, document) where hostname is always lowercased.
def url_split(url): scheme, netloc = urllib.splittype(url) host, document = urllib.splithost(netloc) port = default_ports.get(scheme, 0) if host: host = host.lower() host, port = splitport(host, port=port) return scheme, host, port, document
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _urlparse_splitscheme(url):\r\n # The scheme is valid only if it contains these characters.\r\n scheme_chars = \\\r\n \"abcdefghijklmnopqrstuvwxyz0123456789+-.\"\r\n\r\n scheme = \"\"\r\n rest = url\r\n\r\n spart = url.split(\":\", 1)\r\n if len(spart) == 2:\r\n\r\n # Normalize the scheme.\r\n s...
[ "0.76368946", "0.7406988", "0.730206", "0.7067206", "0.6825835", "0.6800534", "0.6762756", "0.6522388", "0.65156657", "0.6501163", "0.64795834", "0.6466989", "0.64476293", "0.6421604", "0.64123183", "0.6403636", "0.63985515", "0.63941145", "0.6280987", "0.6277661", "0.6268658...
0.8727553
0
Split optional port number from host. If host has no port number, the given default port is returned.
def splitport(host, port=0): if ":" in host: shost, sport = host.split(":", 1) iport = is_numeric_port(sport) if iport: host, port = shost, iport elif not sport: # empty port, ie. the host was "hostname:" host = shost else: # Fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_host_port(hostport):\n if hostport is None:\n return (None, None)\n formatted_host = __host_per_rfc_2732(hostport)\n # The \"bogus\" is to make it look like a real, parseable URL.\n parsed = urlparse(\"bogus://%s\" % (formatted_host)) \n return (None if parsed.hostname == \"non...
[ "0.7247916", "0.6927607", "0.67452", "0.67267126", "0.65689474", "0.6426588", "0.621696", "0.6187966", "0.6167272", "0.61081445", "0.60974115", "0.6052857", "0.60080606", "0.5999279", "0.59521306", "0.59521306", "0.59521306", "0.59521306", "0.5936923", "0.5901868", "0.5845402...
0.806005
0
Remove anchor part and trailing index.html from URL.
def shorten_duplicate_content_url(url): if '#' in url: url = url.split('#', 1)[0] if url.endswith('index.html'): return url[:-10] if url.endswith('index.htm'): return url[:-9] return url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanUrl(url):\n\turl_clean = url.replace(' ','%20')\n\t\"\"\" add /index.html where necessary \"\"\"\n\tif (url[-1:]=='/'):\n\t\turl_clean += 'index.html'\n\telif (url[-5:].find('.') == -1):\n\t\t url_clean += '/index.html'\n\treturn url_clean", "def make_clean_url(url):\n return urlparse.urldefrag(url)[...
[ "0.7404366", "0.62768435", "0.61985534", "0.60928565", "0.6062319", "0.606141", "0.60366935", "0.60153073", "0.59648734", "0.5918957", "0.58407116", "0.58144933", "0.57838774", "0.5777596", "0.57617307", "0.57545966", "0.5725759", "0.5723972", "0.5707598", "0.5680764", "0.565...
0.6469476
1
Check if both URLs are allowed to point to the same content.
def is_duplicate_content_url(url1, url2): if url1 == url2: return True if url2 in url1: url1 = shorten_duplicate_content_url(url1) if not url2.endswith('/') and url1.endswith('/'): url2 += '/' return url1 == url2 if url1 in url2: url2 = shorten_duplicate_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def urlEqual(url_1, url_2):\n parse_result_1 = urlparse(url_1)\n parse_result_2 = urlparse(url_2)\n\n return (parse_result_1[:4] == parse_result_2[:4] and\n parse_qs(parse_result_1[5]) == parse_qs(parse_result_2[5]))", "def same_origin(url1, url2):\n p1, p2 = urlparse.urlparse(url1), urlpa...
[ "0.71224326", "0.6801178", "0.64278007", "0.637694", "0.63402057", "0.63119143", "0.6286929", "0.62371063", "0.61779445", "0.61676055", "0.6156955", "0.6119644", "0.6043208", "0.60181797", "0.6006415", "0.599031", "0.5972156", "0.59510684", "0.59472144", "0.5881061", "0.58000...
0.7777119
0
Test case for get_list
def test_get_list(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_listtem_using_get(self):\n pass", "def test_list(self):\n pass", "def test_list(self):\n pass", "def test_get_list8(self):\n pass", "def get_list(self, *args, **kwargs):\n pass", "def get_list(self, *args, **kwargs):\n pass", "def test_get_direct_acces...
[ "0.81973624", "0.8002237", "0.8002237", "0.7820368", "0.7754413", "0.7754413", "0.7502839", "0.7356105", "0.7302355", "0.7302355", "0.7302355", "0.72928464", "0.7265907", "0.7265907", "0.72070205", "0.7167211", "0.7133098", "0.7123853", "0.70505875", "0.70505875", "0.70437384...
0.90654755
0
Test case for get_machine_translate_settings_for_project_template
def test_get_machine_translate_settings_for_project_template(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_mt_settings(self):\n pass", "def test_get_translation_resources(self):\n pass", "def test_settings(self):\n \n self.assertTrue(settings.USE_I18N, msg=\"setting USE_I18N must be True to have languages working\")", "def test_supported_translations_retrieval(self):\n\t\t...
[ "0.6423906", "0.6117541", "0.60545284", "0.5706983", "0.56479394", "0.5599774", "0.5585604", "0.55680823", "0.5561398", "0.55571604", "0.5517412", "0.54765046", "0.54490405", "0.54315364", "0.5409706", "0.53768295", "0.5358784", "0.5356838", "0.53433293", "0.5304261", "0.5282...
0.957297
0
Test case for get_mt_settings
def test_get_mt_settings(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def settings():\n return SettingsMock.instance()", "def settings():\n return _get_settings()[1]", "def test_act_on_settings(self):\n pass # TODO(tlarsen)", "def test_act_on_settings(self):\n pass # TODO(tlarsen)", "def test_get_property_success(self):\r\n self.assertEqual(self.co...
[ "0.65869504", "0.6371646", "0.6219875", "0.6219875", "0.61787194", "0.61251485", "0.60651237", "0.6051131", "0.60047513", "0.5982245", "0.5963559", "0.59536403", "0.5907354", "0.59069467", "0.58953136", "0.5894668", "0.5894059", "0.5894059", "0.58797795", "0.5873697", "0.5863...
0.9280966
0
Test case for get_status
def test_get_status(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getStatus():", "def test_get_status(self):\n response = self.client.open(\n '/v1/status',\n method='GET')\n self.assert200(response,\n 'Response body is : ' + response.data.decode('utf-8'))", "def get_status() -> None:\n assert scraper.get_status...
[ "0.82322794", "0.80751175", "0.804237", "0.79979545", "0.79768527", "0.79583126", "0.7845333", "0.78452075", "0.7754469", "0.75887394", "0.7511992", "0.74121016", "0.73661184", "0.73120743", "0.73120743", "0.73000544", "0.73000544", "0.73000544", "0.7283349", "0.72744924", "0...
0.9054239
0
Test case for get_translation_resources
def test_get_translation_resources(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_simple_translation_using_get(self):\n pass", "def test_supported_translations_retrieval(self):\n\t\t\n\t\thelpers.find_supported_translations()\n\t\tself.assertTrue(helpers.get_supported_translations() != 0)", "def testCheckTranslationNeededWithTranslatableNotProvided(self):\n resourceAt...
[ "0.737819", "0.7090536", "0.668792", "0.6638322", "0.646433", "0.6331609", "0.62881887", "0.6273189", "0.62632895", "0.6226955", "0.61889964", "0.61564964", "0.61298376", "0.6118545", "0.61123955", "0.6091485", "0.6080488", "0.60626423", "0.60621613", "0.60341895", "0.6034189...
0.9478052
0
Calculates the surface potential generated by a dipole inside a homogeneous conducting sphere Calculates the surface potential generated by a dipole inside a homogeneous conducting sphere.
def potential_homogeneous_dipole(sphere_radius, conductivity, dipole_pos, dipole_moment, detector_positions): detector_positions = np.atleast_2d(detector_positions) assert detector_positions.shape[1] == 3 assert np.linalg.norm(dipole_pos) < sphere_radius sphere_radius =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sphere(indiv):\n return sum([ x ** 2 for x in indiv])", "def surfaceIntSphere(r: float) -> float:\n return 4.0 * np.pi * r * r", "def spherical_differential(self):\n r, theta, phi, v_r, v_t, v_p = self.convert_spherical()\n return SphericalDifferential(\n r * u.m,\n ...
[ "0.658713", "0.6568535", "0.648402", "0.648402", "0.63822716", "0.6308139", "0.62706184", "0.6254506", "0.62462366", "0.62357485", "0.62270266", "0.6215132", "0.61730653", "0.61590606", "0.6125751", "0.6122611", "0.61084485", "0.6102822", "0.6074824", "0.60695034", "0.6065470...
0.6933215
0
Calculates the B field outside a sphere, does not depend on conductivity
def B_outside_sphere(sphere_radius, dipole_pos, dipole_moment, detector_positions): pos = np.array(dipole_pos, dtype=float)*1e-3 moment = np.array(dipole_moment, dtype=float) detector = np.array(detector_positions, dtype=float)*1e-3 assert np.all(np.linalg.norm(detector_positions, axis=1) >sphere_rad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Spherical_aberrations_surface_addup(self):\n bf=beam_field()\n bf.U=np.array([[[0,0,1],[0,0,1],[0,0,1]]])\n pp=self.entrance_pupil\n bf.Q_p=np.array([[[0,0,0],[0,pp/10.,0],[0,pp,0]]]) \n bf.propagate(self.surfaces)\n i,x=bf.calculate_intersections(bf.U[:,[0]],bf.Q_p...
[ "0.6487187", "0.63440895", "0.6329006", "0.6257993", "0.6239358", "0.61747193", "0.6174182", "0.6174086", "0.6108033", "0.60255855", "0.5999336", "0.594849", "0.59456843", "0.5938181", "0.5888031", "0.58859", "0.5871444", "0.5869115", "0.58625394", "0.58577174", "0.5851395", ...
0.66003513
0
Overrides the httplib.HTTPS class with the local _SslAwareHttps class.
def MonkeyPatchHttplib(ca_cert): global _old_https global _ca_certs_file if ca_cert is None: if _old_https is not None: httplib.HTTPS = _old_https else: if _old_https is None: _old_https = httplib.HTTPS httplib.HTTPS = _SslAwareHttps _ca_certs_file = ca_cert
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_ssl(self):\n return self._is_ssl", "def setHTTPSMode(self, httpsMode):\n self.PDFreactorConfiguration.in1[\"httpsMode\"] = httpsMode", "def makeHttps(url, cert_file=None, key_file=None, ca_file=None, **options):\n \n scheme, netloc, path, parameters, query, fragment = urlparse(url)\n...
[ "0.6313102", "0.62866336", "0.6270552", "0.6250977", "0.6230167", "0.6229517", "0.62287635", "0.6179878", "0.6097633", "0.6059272", "0.59820807", "0.59361523", "0.5885651", "0.5870213", "0.5839354", "0.5774865", "0.57683086", "0.5706303", "0.57028407", "0.568737", "0.56655216...
0.65477884
0
Getter method for the current trusted certificates source file.
def GetCurrentCertsFile(): return _ca_certs_file
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cert_file(self):\n return self._get('cert_file')", "def get_source_file(self):\n return self.get_attribute(\"source_file\")", "def get_ssl_certificate():", "def get_ssl_certificate() :", "def cert(self):\n return self._cert", "def get_source(self):\n\t\treturn self.source.get_sou...
[ "0.69759476", "0.60624015", "0.6020163", "0.59594613", "0.5935936", "0.59314543", "0.59041905", "0.59041905", "0.590371", "0.58979017", "0.5822741", "0.5815077", "0.57949513", "0.5674972", "0.5671976", "0.5656625", "0.5656625", "0.5651814", "0.563617", "0.56335294", "0.563208...
0.7276953
0
Creates a socket and validates SSL certificates.
def connect(self): sock = socket.create_connection((self.host, self.port)) try: self.sock = ssl.wrap_socket(sock, keyfile=self.key_file, certfile=self.cert_file, cert_reqs=self.cert_reqs, ca_certs=self.ca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_socket(host, port):\n s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n s.settimeout(300)\n while True:\n try:\n s.connect( (host, int(port)) )\n except:\n s.shutdown(socket.SHUT_RDWR)\n s.close()\n time.sleep(1)\n else:\n ...
[ "0.71928084", "0.71864074", "0.70403665", "0.7029783", "0.7016247", "0.6988879", "0.69084984", "0.6848172", "0.6703928", "0.65433955", "0.652691", "0.6517353", "0.6509808", "0.63839084", "0.6326153", "0.62952316", "0.6259964", "0.62502015", "0.6201444", "0.6117971", "0.608719...
0.73476267
0
Checks the host name used against the host's SSL certificate.
def _VerifyHostName(self, hostname, certificate): if 'subjectAltName' in certificate: names = [name for (name_type, name) in certificate['subjectAltName'] if name_type.lower() == 'dns'] else: names = [value for ((key, value),) in certificate['subject'] if key.lower() ==...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_verify_hostname(self):\n verify_certificate_hostname(X509_DNS_ONLY, u\"twistedmatrix.com\")", "def test_verifyHostname_matching(self):\n hostname = 'www.google.com'\n url = 'https://' + hostname + '/recaptcha'\n contextFactory = crypto.SSLVerifyingContextFactory(url)\n ...
[ "0.7917988", "0.7195927", "0.7140244", "0.6946369", "0.6896055", "0.6609173", "0.65711814", "0.65366703", "0.64484096", "0.64244294", "0.6382294", "0.63806266", "0.632053", "0.6276054", "0.626954", "0.62648207", "0.6260005", "0.6253751", "0.6244663", "0.6207877", "0.61689734"...
0.7710241
1
Test when people bid the same thing on a single item This should theoretically not happen very frequently, but if it did we would expect the algo to cope with it
def test_single_identical_bid(self): bids = [Cost(ITEM1, ACTOR1, 1640), Cost(ITEM2, ACTOR1, 1540), Cost(ITEM3, ACTOR1, 1140), Cost(ITEM4, ACTOR1, 1640), Cost(ITEM5, ACTOR1, 1740), Cost(ITEM1, ACTOR2, 1540), Cost(ITEM...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_obvious_auction(self):\n bids = [Cost(ITEM1, ACTOR1, 1000),\n Cost(ITEM2, ACTOR1, 1000),\n Cost(ITEM3, ACTOR1, 1000),\n Cost(ITEM4, ACTOR1, 5000),\n\n Cost(ITEM1, ACTOR2, 1000),\n Cost(ITEM2, ACTOR2, 1000),\n ...
[ "0.6324635", "0.6153126", "0.6132199", "0.60983837", "0.60185254", "0.5900204", "0.5899364", "0.58920246", "0.58713007", "0.5843716", "0.5799943", "0.57909966", "0.5758705", "0.5689346", "0.56653607", "0.5661411", "0.56568706", "0.5651646", "0.56196105", "0.5615181", "0.56101...
0.7137202
0
Test a "real world" auction Each person has 5000 to use as they wish, on 5 items
def test_reasonable_auction(self): # I have no preferences bids = [Cost(ITEM1, ACTOR1, 1000), Cost(ITEM2, ACTOR1, 1000), Cost(ITEM3, ACTOR1, 1000), Cost(ITEM4, ACTOR1, 1000), Cost(ITEM5, ACTOR1, 1000), # I have line...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simulate_auction(self, item, start_price):\n print(f\"Auctioning {item} starting at {start_price}!\")\n\n self._auctioneer.accept_bid(start_price, \"Starting Bid\")\n\n summary = {bidder.name: bidder.highest_bid for bidder in self._bidders}\n\n print(f\"\\nThe winner of the auction ...
[ "0.64165014", "0.6326636", "0.6299852", "0.6259526", "0.6223078", "0.61645836", "0.610468", "0.6103745", "0.6006638", "0.5986016", "0.5960397", "0.5883546", "0.5842889", "0.5819596", "0.5804698", "0.5799672", "0.57981133", "0.57805246", "0.57743895", "0.5769677", "0.5767127",...
0.65049684
0
Plots a batch of positive examples as stars
def plot_positives(positives): plt.scatter(positives[:,0], positives[:,1], label='Goal examples', marker='*', color='g', s=200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_random_multi_image():\n\n shap.image_plot([np.random.randn(3, 20, 20) for i in range(3)], np.random.randn(3, 20, 20), show=False)", "def display_some_examples(examples, labels):\n\n plt.figure(figsize = (10, 10))\n\n for i in range(25):\n # select a random index in the dataset\n i...
[ "0.61978954", "0.61973125", "0.6167395", "0.6149284", "0.61034715", "0.6092634", "0.6089883", "0.60256594", "0.59677535", "0.591951", "0.5886561", "0.5876788", "0.58247906", "0.58138686", "0.58073723", "0.5785202", "0.57715905", "0.5770797", "0.57695746", "0.57691264", "0.575...
0.65197
0
Plots a batch of negative examples as 'x's
def plot_negatives(negatives, alpha=1): plt.scatter(negatives[:,0], negatives[:,1], label='Visited states', marker='x', color='r', s=100, alpha=alpha)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(self) :\r\n pos = np.nonzero(self.y > 0) # matlab: find(y > 0)\r\n neg = np.nonzero(self.y < 0) # matlab: find(y < 0)\r\n plt.plot(self.X[pos,0], self.X[pos,1], 'b+', markersize=5)\r\n plt.plot(self.X[neg,0], self.X[neg,1], 'ro', markersize=5)\r\n plt.show()", "def p...
[ "0.6373625", "0.618259", "0.607023", "0.59679776", "0.5947475", "0.5860285", "0.5839615", "0.5818892", "0.575471", "0.57314754", "0.57198006", "0.57119685", "0.5707297", "0.57065064", "0.56945616", "0.5686599", "0.5671367", "0.56566536", "0.565318", "0.5649096", "0.56386423",...
0.65921855
0
Returns a shape (bins, bins) grid of visitation counts for a batch of discrete states.
def discrete_to_counts(states, bins=16): counts = np.zeros((bins, bins)) indices, freqs = np.unique(states, return_counts=True, axis=0) indices = indices.astype(np.int32) counts[indices[:,0], indices[:,1]] = freqs return counts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_neighbourhood_states(self,state):\n\t\tassert len(state) > 0\n\t\tenergies = [float(\"inf\") for i in range (self._size)]\n\t\ttaxes = [float(\"inf\") for i in range (self._size)]\n\n\t\tfor i in range (0,self._size):\n\t\t\tnewState = copy(state)\n\t\t\tnewState[i] = 1 - newState[i]\n\t\t\tenergies[i] =...
[ "0.633325", "0.61648726", "0.6118334", "0.60178185", "0.59665114", "0.5965541", "0.5857674", "0.5814334", "0.57584375", "0.5751082", "0.57216156", "0.5713808", "0.571007", "0.5702278", "0.5695247", "0.56947154", "0.5680548", "0.5672545", "0.5666492", "0.5649434", "0.5644695",...
0.68741333
0
Plots a discrete grid of visitation counts given a batch of continuous x,y states.
def plot_visitations(states, ax=None, bins=16, low=-4, high=4): disc = discretized_states(states, bins, low, high) counts = discrete_to_counts(disc, bins) ax = ax or plt.gca() im = ax.imshow(counts.T) plt.colorbar(im, ax=ax, fraction=0.046, pad=0.04)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grid_frame(self, steps, figure_size=(12, 12)):\r\n\r\n x = self.seed\r\n counts = []\r\n for n in np.arange(0, steps):\r\n x, stats = self.update_grid(x)\r\n counts.append(stats)\r\n\r\n counts = np.array(counts)\r\n\r\n fig, ax = plt.subplots(figsize=fi...
[ "0.64633965", "0.58950794", "0.5872316", "0.5861202", "0.5653588", "0.5641931", "0.5597729", "0.5591232", "0.55878997", "0.55878997", "0.55627453", "0.5554182", "0.55359024", "0.54666686", "0.5459917", "0.5457301", "0.5454473", "0.5446862", "0.54402167", "0.54357356", "0.5425...
0.6375477
1
Plots the rewards assigned by the given model to points across the 2D environment.
def plot_rewards(model, bins=16, low=-4, high=4, contours=False, env=True, title=None): xs = np.linspace(low, high, bins) ys = np.linspace(low, high, bins) xys = np.meshgrid(xs, ys) grid_vals = np.array(xys).transpose(1, 2, 0).reshape(-1, 2) model.eval() with torch.no_grad(): logits = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_reward(self):\n if self.reward_im is None and self.reward_ax is None:\n fig, self.reward_ax = plt.subplots()\n self.reward_ax.set_title('Reward')\n self.reward_plot, = self.reward_ax.plot(self.reward_list)\n else:\n reward_array = np.array(self.rew...
[ "0.66137034", "0.653917", "0.6418352", "0.6349942", "0.6274397", "0.61198187", "0.57723767", "0.56787103", "0.5661478", "0.562923", "0.56053936", "0.5591847", "0.55391145", "0.55370414", "0.54808843", "0.54688555", "0.54400116", "0.54341495", "0.5419722", "0.54054636", "0.537...
0.66385525
0
Applies the deleagte's effect on a miss
def effectOnMiss(self, user, target): return self.stopCharge(user)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disarm(self):\n pass", "def _fire_missile(self):\n new_missile = Missile(self)\n self.missiles.add(new_missile)", "def check_miss(self):\n if self.ball.center.x > SCREEN_WIDTH:\n # We missed!\n self.score -= SCORE_MISS\n self.ball.restart()", "...
[ "0.5950533", "0.55224425", "0.5511924", "0.5438316", "0.54106605", "0.53790134", "0.5365977", "0.53500277", "0.52988017", "0.5294004", "0.52930677", "0.5263815", "0.5176615", "0.51750153", "0.5173968", "0.5170794", "0.5150109", "0.5144685", "0.5115379", "0.5112521", "0.511115...
0.6080611
1
Determines if the attack should not be completed because it is charging
def isCharging(self, user, environment): # Check if the user is charging # AKA no damage should be calculated charging = True if self.turnToAttack == self.turnOn: charging = False # Check if this is the first turn # If so lock the move for its dur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_attack(self):\n now = time.time() * 1000\n if self.prev_time is None:\n return True\n else:\n next_time = self.prev_time + self.get_recharge\n if now >= next_time:\n return True\n else:\n return False", "def ...
[ "0.68318135", "0.6688268", "0.6513832", "0.6513832", "0.6471805", "0.63523084", "0.631714", "0.6310281", "0.6284038", "0.62322634", "0.6200323", "0.61082196", "0.61060584", "0.60556287", "0.6007529", "0.60056907", "0.6004995", "0.6000257", "0.59966904", "0.5989895", "0.594365...
0.68634623
0
Locks the pkmn to use this move
def applyLock(self, pkmn): pkmn.actionLock = ActionLock(pkmn, \ pkmn.lastAction, self.turns-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lock(self):\n raise NotImplementedError", "def lock(self):\n self.mtx.acquire()", "def processLock(self):\r\n self.controller.executionLock()", "def action_lock(self):\n self.state = 'locked'", "def i_am_locking(self):\r\n pass", "def lock(self):\n\n self.wai...
[ "0.6984806", "0.6650139", "0.660776", "0.6559309", "0.6495143", "0.64541656", "0.6345493", "0.63062245", "0.629332", "0.62793416", "0.62486535", "0.62393093", "0.61543953", "0.6150631", "0.6045052", "0.601562", "0.6003374", "0.59475726", "0.5941618", "0.59194374", "0.5918584"...
0.674586
1
Flatten and concatenate nested array structure, keeping batch dims.
def batch_concat( values: types.NestedArray, num_batch_dims: int = 1, ) -> jnp.ndarray: flatten_fn = lambda x: _flatten.apply(None, x, num_batch_dims) flat_leaves = tree.map_structure(flatten_fn, values) return jnp.concatenate(tree.flatten(flat_leaves), axis=-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _flatten_and_concat(x, batch_shape, dtype):\n # For convenience.\n if x is None:\n return x\n\n def _reshape_part(part):\n part = tf.cast(part, dtype)\n new_shape = ps.concat(\n [batch_shape, [-1]],\n axis=-1,\n )\n return tf.reshape(part, ps.cast(new_shape, tf.int32))\n\n x = ...
[ "0.7510199", "0.67955357", "0.6694941", "0.6666932", "0.6666932", "0.6524717", "0.65078527", "0.65078527", "0.6445622", "0.6442294", "0.6393994", "0.63516563", "0.6349853", "0.632614", "0.6299196", "0.6281245", "0.62276775", "0.6225848", "0.616545", "0.61506224", "0.6131684",...
0.74157465
1
Performs prefetching of elements from an iterable in a separate thread.
def prefetch(iterable: Iterable[T], buffer_size: int = 5) -> Generator[T, None, None]: if buffer_size <= 1: raise ValueError('the buffer_size should be > 1') buffer = queue.Queue(maxsize=(buffer_size - 1)) producer_error = [] end = object() def producer(): """Enqueues items from `itera...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prefetch(self, oids):\n self.timeline.reset()\n self.timeline.start(\"prefetch\")\n fetch(oids)\n self.timeline.end(\"prefetch\")", "def producer():\n try:\n # Build a new iterable for each thread. This is crucial if working with\n # tensorflow datasets because tf.Gra...
[ "0.6562062", "0.6286496", "0.6193161", "0.6193161", "0.6081279", "0.60725296", "0.6033424", "0.5953297", "0.58598137", "0.5742586", "0.5732876", "0.57095844", "0.5668386", "0.56145066", "0.5533521", "0.548428", "0.54748315", "0.5473238", "0.546906", "0.54662156", "0.5465426",...
0.731909
0
Enqueues items from `iterable` on a given thread.
def producer(): try: # Build a new iterable for each thread. This is crucial if working with # tensorflow datasets because tf.Graph objects are thread local. for item in iterable: buffer.put(item) except Exception as e: # pylint: disable=broad-except logging.exception('Error in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _aiter_sync(iterable: Iterable[T]) -> AsyncIterator[T]:\n for item in iterable:\n yield item", "def queue_inputs(self, iterable):\n self.input_queue.extend(iterable)", "def imap(self, iterable):\n def get_results():\n \"\"\"Get a result from the worker output queue ...
[ "0.6482619", "0.6424396", "0.6024713", "0.5948052", "0.5816059", "0.57797146", "0.57494015", "0.5637934", "0.5492317", "0.54332095", "0.53467715", "0.5325421", "0.5254408", "0.52281237", "0.5205555", "0.5189476", "0.5170215", "0.5154162", "0.51500005", "0.51260334", "0.510404...
0.6857861
0
Prints JSON as a multiline, indented string rather than a jumbled mess. Truncates string that are more than 1,000 characters.
def printAsFormattedJSON(jsonObject): print(json.dumps(jsonObject, indent=2)[0:1000])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pretty_print(self, json_dict):\n if self.prettyprint:\n return \"\\n\" + json.dumps(json_dict, indent=self.indent)\n return json.dumps(json_dict)", "def pretty_print(js):\n try:\n return json.dumps(js, indent=4, sort_keys=True, separators=(\",\", \":\"))\n except Except...
[ "0.7124545", "0.7041214", "0.6993449", "0.69096905", "0.67075557", "0.6687837", "0.6609791", "0.6559124", "0.6541128", "0.6523184", "0.6511083", "0.6501031", "0.6481468", "0.6481468", "0.6446805", "0.63567704", "0.6342024", "0.63162607", "0.6302772", "0.6290895", "0.6284197",...
0.7289249
0
Sets the button_id of this ButtonChangeNotification.
def button_id(self, button_id): self._button_id = button_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetButton(self, button):\r\n if self._pButton:\r\n if not self.HasFlag(CP_USE_STATICBOX):\r\n self._sz.Replace(self._pButton, button)\r\n self.Unbind(wx.EVT_BUTTON, self._pButton)\r\n self._pButton.Destroy()\r\n\r\n self._pButton = button\r\n ...
[ "0.56377095", "0.5621892", "0.5578352", "0.5447032", "0.5347722", "0.53036946", "0.5280154", "0.51690286", "0.5168054", "0.51062906", "0.5094893", "0.50668573", "0.50315845", "0.5015618", "0.49925348", "0.49768975", "0.4969829", "0.49674788", "0.4931718", "0.49231914", "0.490...
0.79103726
0
Sets the activated of this ButtonChangeNotification.
def activated(self, activated): self._activated = activated
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active(self, activate):\n self.is_active = activate", "def activated_on(self, activated_on):\n\n self._activated_on = activated_on", "def activate(self):\n self._is_active = True", "def activated(self, value: bool) -> None:\n\n if not isinstance(value, bool):\n rais...
[ "0.7359399", "0.73333275", "0.7039976", "0.69603646", "0.693265", "0.6846935", "0.6846935", "0.6797959", "0.67049754", "0.67001826", "0.669241", "0.66285634", "0.6580712", "0.6532145", "0.65001523", "0.65001523", "0.65001523", "0.65001523", "0.6496056", "0.6455334", "0.644733...
0.755687
0
Sets the time_utc of this ButtonChangeNotification.
def time_utc(self, time_utc): self._time_utc = time_utc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def utc(self, utc):\n\n self._utc = utc", "def set_utc(date_time):\n utc = datetime.timezone(datetime.timedelta(0))\n date_time = date_time.replace(tzinfo=utc)\n return date_time", "def valkkafsmanager_set_time_cb(self, t):\n self.signals.set_time.emit(t)", "def set_umeastime(self, tim...
[ "0.6689335", "0.6163805", "0.6110037", "0.59258175", "0.57708126", "0.5765874", "0.5688948", "0.5647458", "0.5643259", "0.56422305", "0.55429167", "0.5526033", "0.54988146", "0.5471543", "0.5451009", "0.53738606", "0.5364426", "0.53632647", "0.53526765", "0.5303077", "0.52328...
0.7870826
0
this function selects the normal subjects data based on onesubjectout scenario for training the network select randomly 20% of training data to compute NPM
def normal_subjects_out(sub): baseDIR = 'the root directory' ## read data (contains training data (all subjects except one) and test data (the rest subject) and corresponding labels) matContent = sio.loadmat(baseDIR +'/Data/' +'normal_subject_out'+str(sub+1) +'.mat') normal_x_train = matContent['traini...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_classification_dataset(step, do_lower_case,data_type,data_subtype,use_syntetic_data):\n assert step in ['train', 'test']\n binary = False \n undersample_majority = False\n\n paths = ['~/Github/Data/Patient/NIRADS/PET_CT_NIRADS.xlsx', '~/Github/Data/Patient/NIRADS/MR_NIRADS_2018.xlsx','~/Github...
[ "0.6139809", "0.59973305", "0.5974813", "0.59313536", "0.58736205", "0.5803494", "0.57108134", "0.56487226", "0.5635513", "0.5626859", "0.56240916", "0.55998445", "0.55967647", "0.5579838", "0.5531847", "0.551621", "0.551081", "0.55050385", "0.55013925", "0.5456874", "0.54563...
0.63397366
0
ap = self._get_single("archiving_policy", default={})
def archiving_policy(self): raise RuntimeError("archiving_policy is not back compat")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def policy(self) -> typing.Optional[\"BucketPolicy\"]:\n ...", "def get_policy(self, *args, **kwargs):\r\n pass", "def default_archiver(random, population, archive, args):\r\n return archive", "def export_policy(self):\n return self._export_policy", "def policy_alias(self):", "def...
[ "0.57219464", "0.5555944", "0.55195606", "0.5382641", "0.5332072", "0.52623725", "0.52060854", "0.5165958", "0.51342744", "0.51342636", "0.511466", "0.5096775", "0.508957", "0.5032159", "0.50275964", "0.50229305", "0.5017152", "0.50114805", "0.50095695", "0.49476188", "0.4930...
0.7651909
0
Returns the asic_id list of physical ports for the given logical port
def get_asic_id_for_logical_port(self, logical_port): return self.logical_to_asic.get(logical_port)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serial_ports():\r\n return list(map(lambda listportinfo: listportinfo.device, list_ports.comports()))", "def _get_port_ids(self, name_or_id_list, filters=None):\n ids_list = []\n for name_or_id in name_or_id_list:\n port = self.get_port(name_or_id, filters)\n if not por...
[ "0.6558729", "0.63688004", "0.6289635", "0.62288165", "0.6097358", "0.6086849", "0.5983763", "0.59471965", "0.59184533", "0.58930415", "0.58889484", "0.58565056", "0.5831575", "0.5799337", "0.5790939", "0.5787681", "0.5764646", "0.57481205", "0.57246333", "0.56942", "0.568728...
0.65330184
1
Construct predicate indexed on class.
def class_predicate(name, get_key=None, fallback=None, default=None): return Predicate(name, ClassIndex, get_key, fallback, default)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args):\n _snap.TPredicate_swiginit(self, _snap.new_TPredicate(*args))", "def __init__(words, pred_index):", "def __init__(self, *args):\n _snap.TAtomicPredicate_swiginit(self, _snap.new_TAtomicPredicate(*args))", "def predicate (self, X, * args, ** kw) :\n XR = X.REF ...
[ "0.58803225", "0.5777751", "0.57333344", "0.5597821", "0.55714136", "0.5398927", "0.5377535", "0.53442955", "0.529104", "0.51837415", "0.5129952", "0.5105261", "0.5069897", "0.5034563", "0.49943793", "0.49558783", "0.4953553", "0.49508578", "0.49316508", "0.49039742", "0.4888...
0.6759346
0
Predicate that extracts class of instance returned by func.
def match_instance(name, func, fallback=None, default=None): return class_predicate(name, ClassKeyExtractor(func), fallback, default)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_class(name, func, fallback=None, default=None):\n return class_predicate(name, KeyExtractor(func), fallback, default)", "def func(self):\n return self.__class__", "def predicate(obj):\n return inspect.isclass(obj) and issubclass(obj, MafColumnRecord)", "def _class(self, *args):\r\n...
[ "0.64089006", "0.5961189", "0.58564186", "0.57954735", "0.57533145", "0.574053", "0.5640016", "0.55632114", "0.5518726", "0.54572797", "0.541122", "0.5371876", "0.53602564", "0.53536004", "0.5337575", "0.52637744", "0.5225031", "0.5190814", "0.5190236", "0.5186115", "0.518417...
0.6498851
0
Predicate that extracts class returned by func.
def match_class(name, func, fallback=None, default=None): return class_predicate(name, KeyExtractor(func), fallback, default)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_instance(name, func, fallback=None, default=None):\n return class_predicate(name, ClassKeyExtractor(func), fallback, default)", "def class_predicate(name, get_key=None, fallback=None, default=None):\n return Predicate(name, ClassIndex, get_key, fallback, default)", "def predicate(obj):\n ...
[ "0.63976914", "0.6068052", "0.5734643", "0.5571518", "0.55670816", "0.5550326", "0.5539132", "0.5485905", "0.5448552", "0.5396239", "0.5320248", "0.52606755", "0.51935756", "0.51731044", "0.5143752", "0.51361126", "0.5109493", "0.5107465", "0.5086158", "0.5069991", "0.5046674...
0.68398184
0
Permutations for a simple immutable key.
def permutations(self, key): yield key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permutations(iterable):\n pass", "def apply_permutation(hyper, pol, perm):\n pass", "def __init__(self, key):\n\n def keys(key, num_rounds):\n \"\"\"Yields the permuted key bitstring for i = 1..num_rounds\"\"\"\n C, D = key[:28], key[28:]\n # Rounds are 1-index...
[ "0.64504665", "0.61754125", "0.6070525", "0.5978016", "0.5950976", "0.59124404", "0.58832246", "0.5866005", "0.580853", "0.5802562", "0.57686883", "0.5767645", "0.5760818", "0.57604206", "0.5743716", "0.5714318", "0.5703989", "0.5690827", "0.5684919", "0.566638", "0.5635144",...
0.78250515
0
Return fallback if this index does not contain key. If index contains permutations of key, then ``NOT_FOUND`` is returned.
def fallback(self, key): for k in self.permutations(key): if k in self.d: return NOT_FOUND return self._fallback
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, key, fallback):\r\n try:\r\n return self[key]\r\n except (KeyError, IndexError):\r\n return fallback", "def _getitem_when_not_present(self, index):\n raise KeyError(index)", "def lookup(self, key, default=None):\n hash_key = hash(key) % self.lengt...
[ "0.6093498", "0.60327905", "0.58353156", "0.5821554", "0.5789667", "0.5775581", "0.57438695", "0.5720233", "0.5686101", "0.56820273", "0.56809384", "0.5618386", "0.5600701", "0.5567526", "0.55670565", "0.55642253", "0.5557101", "0.554965", "0.55332357", "0.55329597", "0.55007...
0.81885475
0
Permutations for class key. Returns class and its based in mro order. If a classic class in Python 2, smuggle in ``object`` as the base class anyway to make lookups consistent.
def permutations(self, key): for class_ in inspect.getmro(key): yield class_ if class_ is not object: yield object
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_keys(cls):\n reverse_map = {}\n for name, attr in cls.__dict__.items():\n try:\n reverse_map[attr.property.columns[0].name] = name\n except:\n pass\n mapper = class_mapper(cls)\n return tuple(reverse_map[key.name] for key in mapper.primary_key)", "def tes...
[ "0.6361297", "0.5989396", "0.5902447", "0.58039254", "0.57573944", "0.56973964", "0.5664984", "0.5612869", "0.5581151", "0.5531453", "0.54793286", "0.54461926", "0.54074645", "0.53986317", "0.53651357", "0.53641707", "0.5354307", "0.53516376", "0.53463846", "0.53335965", "0.5...
0.77278644
0
Compact all maps in a frame to their default sparse representation. Optionally remove NaN values as well. Removing NaN values will reduce memory use, but will remove the distinction in unweighted (or weightremoved) maps between unobserved regions and regions with zero temperature.
def CompactMaps(frame, zero_nans=False): for s in ["T", "Q", "U", "Wunpol", "Wpol"]: if s in frame: m = frame.pop(s) m.compact(zero_nans=zero_nans) frame[s] = m return frame
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_nans(dict_of_dfs):\n for key, df in dict_of_dfs.items():\n dict_of_dfs[key] = dict_of_dfs[key].fillna(-999)\n return dict_of_dfs", "def compact_dict(source_dict):\n return {k: v for k, v in source_dict.items() if v is not None}", "def compact(self):\n if self._memoized_compact...
[ "0.58548355", "0.5587488", "0.54499125", "0.5371619", "0.5353356", "0.5349373", "0.5292348", "0.52662545", "0.52164835", "0.52022105", "0.51015234", "0.508502", "0.5077335", "0.5072703", "0.5070282", "0.50612265", "0.50571525", "0.50527084", "0.504133", "0.5016694", "0.501108...
0.78470814
0
Remove weights from input maps. If zero_nans is `True`, empty pixels are skipped and pixels with zero weight are set to 0 instead of NaN. Operation is performed in place to minimize memory use.
def RemoveWeights(frame, zero_nans=False): if "Wpol" not in frame and "Wunpol" not in frame: return if not frame["T"].weighted: return frame ValidateMaps(frame) tmap = frame.pop("T") if "Wpol" in frame: wmap = frame["Wpol"] qmap = frame.pop("Q") umap = fram...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_zero_element(state, pruned_model, pinned_in, pinned_out):\n zeros = []\n non_zeros = []\n was_conv = False\n first = True\n\n # Iterate through all the elements of the state_dict\n for k in state:\n # print(k)\n if \"weight\" in k:\n\n # Find in the pruned mode...
[ "0.6257053", "0.60799694", "0.60619944", "0.5880996", "0.5862754", "0.5843285", "0.5785771", "0.569613", "0.5674805", "0.5662794", "0.5661323", "0.565733", "0.5654549", "0.56487364", "0.5648071", "0.5591358", "0.55448747", "0.55401003", "0.5534094", "0.5487322", "0.5486169", ...
0.72923356
0
Apply weights to the input maps. The operation is performed in place to minimize memory use.
def ApplyWeights(frame): if "Wpol" not in frame and "Wunpol" not in frame: return if frame["T"].weighted: return frame ValidateMaps(frame) tmap = frame.pop("T") if "Wpol" in frame: wmap = frame["Wpol"] qmap = frame.pop("Q") umap = frame.pop("U") map...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_layer_weights(self, layer, weights_map):\n\n weight_value_tuples = []\n for weight_tensor in layer.weights:\n weight_name = self._weight_name(weight_tensor.name)\n if weight_name in weights_map:\n weight_value_tuples.append((weight_tensor, weights_map[weight_name]))\n\n K.batch_s...
[ "0.6797688", "0.6464016", "0.6379102", "0.62901306", "0.628277", "0.6254613", "0.624456", "0.6217146", "0.62005913", "0.6191385", "0.6173399", "0.6170212", "0.6154586", "0.6132706", "0.6121013", "0.6119045", "0.61036", "0.6095827", "0.6087378", "0.60694605", "0.6050267", "0...
0.6871234
0
Converts individual unpolarized maps to polarized versions of the same map, with the given polarization convention This module is only a shim that creates null Q and U maps and populates a properly invertible Wpol array from the TT Wunpol weights.
def MakeMapsPolarized(frame, pol_conv=maps.MapPolConv.IAU): if "Wunpol" not in frame: return wgt = frame["Wunpol"].TT del frame["Wunpol"] qmap = frame["T"].clone(False) qmap.pol_type = maps.MapPolType.Q frame["Q"] = qmap umap = frame["T"].clone(False) umap.pol_type = maps.MapPo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MakeMapsUnpolarized(frame):\n if \"Wpol\" not in frame:\n return\n\n wgt = frame[\"Wpol\"].TT\n del frame[\"Wpol\"]\n del frame[\"Q\"]\n del frame[\"U\"]\n\n wgt_out = maps.G3SkyMapWeights(frame[\"T\"], polarized=False)\n wgt_out.TT = wgt\n\n frame[\"Wunpol\"] = wgt_out\n\n re...
[ "0.65701115", "0.5325264", "0.52232015", "0.5155431", "0.5036195", "0.5006237", "0.49359336", "0.48521832", "0.48036116", "0.47645384", "0.47283998", "0.47181678", "0.47051916", "0.4699772", "0.46956226", "0.46838817", "0.46722388", "0.4664422", "0.4661057", "0.4659371", "0.4...
0.7070434
0
Converts individual polarized maps to temperatureonly versions of the same map.
def MakeMapsUnpolarized(frame): if "Wpol" not in frame: return wgt = frame["Wpol"].TT del frame["Wpol"] del frame["Q"] del frame["U"] wgt_out = maps.G3SkyMapWeights(frame["T"], polarized=False) wgt_out.TT = wgt frame["Wunpol"] = wgt_out return frame
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_spin1_maps(data_map, mask_map, theta_map, phi_map, pole=\"diskCenter\"):\n if pole == \"diskCenter\":\n losr = np.cos(theta_map)\n lost = -np.sin(theta_map)\n losp = 0 * lost\n elif pole == \"solarNorth\":\n losr = np.sin(theta_map) * np.cos(phi_map)\n lost = - np.c...
[ "0.5645702", "0.5493307", "0.5407595", "0.52453315", "0.5203037", "0.5144644", "0.5130549", "0.509131", "0.5075411", "0.506501", "0.5052335", "0.5049111", "0.5041617", "0.5009767", "0.5009585", "0.5003646", "0.49696034", "0.4948524", "0.49349558", "0.49202847", "0.49173403", ...
0.55444247
1
Validate that the input map frame has all the necessary keys. If ignore_missing_weights is False (default), a warning is issued when the frame contains weighted Stokes maps without a weights map. Set this option to True when feeding single bolometer map frames with common weights through a pipeline.
def ValidateMaps(frame, ignore_missing_weights=False): if isinstance(frame, core.G3Frame) and frame.type != core.G3FrameType.Map: return map_id = frame.get("Id", None) if "T" not in frame: core.log_fatal("Map frame %s: Missing T map" % map_id, unit="ValidateMaps") if ("Q" in frame and...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_inputs(self, input_dict):\n required_keys = {\n 'start_delay_hours',\n 'mission_time_hours',\n 'critical_wind_speed_m_per_s',\n 'wind_height_of_interest_m',\n 'wind_shear_exponent',\n 'weather_window'\n }\n found_ke...
[ "0.56317323", "0.5444855", "0.52972746", "0.5291627", "0.5110546", "0.51086885", "0.5065675", "0.50211686", "0.48653755", "0.48407325", "0.48096317", "0.4758892", "0.4758466", "0.47113118", "0.4696083", "0.46748063", "0.4672037", "0.46528718", "0.46504936", "0.4639792", "0.46...
0.73839
0
Clone the input map frame with Id input_map_id into new stub frames, one for each Id listed in output_map_ids. Arguments
def ReplicateMaps(frame, input_map_id, output_map_ids, copy_weights=False): if frame.type != core.G3FrameType.Map: return if frame["Id"] != input_map_id: return ValidateMaps(frame) frames = [] first = True for oid in output_map_ids: fr = core.G3Frame(core.G3FrameType...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_new_input_output_maps(self, mapped_input_output_maps={}):\n inputs = self.get_input_contents()\n mapped_inputs = self.get_mapped_inputs(mapped_input_output_maps)\n mapped_inputs_scope_name = [ip['scope'] + \":\" + ip['name'] for ip in mapped_inputs]\n\n new_inputs = []\n ...
[ "0.59639275", "0.5207649", "0.51569706", "0.49734974", "0.49329174", "0.48268738", "0.48074257", "0.47410363", "0.4739389", "0.4705514", "0.46762255", "0.46571895", "0.4657134", "0.46487668", "0.46463147", "0.4637062", "0.4593172", "0.45910817", "0.45710745", "0.45451674", "0...
0.7654347
0
Validates an application description, making sure all required fields are present and of the correct type. If the description is not valid, an InvalidApplicationDescription exception is thrown. Uses a JSON schema definition.
def app_validate(data): schema = json.load(open('schemas/app_description_schema.json', 'r')) try: jsonschema.validate(data, schema) except jsonschema.ValidationError as e: raise InvalidApplicationDescription(str(e)) except jsonschema.SchemaError: log.exception('BUG: invalid sche...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_description(json_data: dict, manufacturer: dict):\n error_msg = ''\n if not json_data.get('description'):\n return ''\n desc = json_data.get('description')\n desc_man = manufacturer.get('description')\n if desc.get('manufacturer', '') != desc_man.get('manufacturer'):\n err...
[ "0.65155405", "0.591994", "0.58387893", "0.57241064", "0.56954294", "0.56712884", "0.55535734", "0.5547916", "0.5487829", "0.54671675", "0.5461422", "0.54116523", "0.5385446", "0.5357007", "0.5288694", "0.5253396", "0.5226772", "0.5218871", "0.5212015", "0.5206839", "0.519367...
0.7670873
0
Should return the ``Model`` class (not an instance) that the rest of the ``SearchIndex`` should use. This method is required & you must override it to return the correct class.
def get_model(self): raise NotImplementedError( "You must provide a 'get_model' method for the '%r' index." % self )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modelClass(self):\n raise NotImplementedError", "def model(self) -> Type[Model]:", "def get_model_type(self):\n pass", "def get_model(self):\n\t\treturn self.object.__class__", "def get_class(self):\n return self.meta_model.get_class()", "def get_model_obj(self):\n if hasattr(...
[ "0.748805", "0.72641265", "0.7245719", "0.7125324", "0.70965385", "0.7029405", "0.6985953", "0.69506085", "0.68859786", "0.6793991", "0.6757882", "0.6710611", "0.6710611", "0.6710611", "0.6710611", "0.6710611", "0.6710611", "0.6710611", "0.6710611", "0.6710611", "0.6710611", ...
0.7393815
1
Get the default QuerySet to index when doing a full update. Subclasses can override this method to avoid indexing certain objects.
def index_queryset(self, using=None): return self.get_model()._default_manager.all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n return NoneToEmptyQuerySet(self.model, using=self._db)", "def index_queryset(self, using=None):\n return self.get_model().objects.all()", "def index_queryset(self, using=None):\n return self.get_model().objects.all()", "def index_queryset(self, using=None):\n ...
[ "0.6522395", "0.633407", "0.633407", "0.633407", "0.633407", "0.633407", "0.633407", "0.633407", "0.633407", "0.633407", "0.633407", "0.633407", "0.62554216", "0.62295914", "0.6177124", "0.6110801", "0.6044992", "0.60033846", "0.59831893", "0.59670067", "0.5953851", "0.5935...
0.7085543
0
Returns the field that supplies the primary document to be indexed.
def get_content_field(self): for _, field in self.fields.items(): if field.document is True: return field.index_fieldname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field(self):\n return self.reference.field", "def field(self):\n return self._field", "def field(self):\n return self._field", "def field(self):\n return self._field", "def field(self):\n return self._field", "def field(self):\n return self.__field", "def g...
[ "0.6978274", "0.6826394", "0.6826394", "0.6826394", "0.6826394", "0.6755321", "0.67214185", "0.66773653", "0.66421586", "0.66308534", "0.6457187", "0.6457187", "0.6397838", "0.63089794", "0.6287127", "0.6266027", "0.620997", "0.6200891", "0.6195435", "0.6190782", "0.6185804",...
0.7484755
0
Returns a dict of fields with weight values
def get_field_weights(self): weights = {} for field_name, field in self.fields.items(): if field.boost: weights[field_name] = field.boost return weights
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight_statistics(self) -> Dict[str, Dict[str, List[float]]]:\n return self._weights_statistics", "def weights(self) -> Dict[str, DLTypes.WeightType]:\n return self._weights", "def get_weights(self):", "def get_data(self):\n return [self.weight]", "def get_weight(self):\n pa...
[ "0.7014792", "0.6837538", "0.6612904", "0.65788376", "0.645622", "0.645622", "0.6440888", "0.6376646", "0.63031673", "0.62926096", "0.6213669", "0.6213669", "0.6213669", "0.6213669", "0.6213669", "0.6213669", "0.6213669", "0.6213669", "0.62045527", "0.619776", "0.619776", "...
0.8258339
0
Updates the entire index. If ``using`` is provided, it specifies which connection should be used. Default relies on the routers to decide which backend should be used.
def update(self, using=None): backend = self.get_backend(using) if backend is not None: backend.update(self, self.index_queryset(using=using))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reindex(self, using=None):\n self.clear(using=using)\n self.update(using=using)", "def update_object(self, instance, using=None, **kwargs):\n # Check to make sure we want to index this first.\n if self.should_update(instance, **kwargs):\n backend = self.get_backend(usin...
[ "0.6816004", "0.61276066", "0.5614059", "0.5505023", "0.5388671", "0.53806204", "0.53760177", "0.5325005", "0.5309512", "0.5265058", "0.5232197", "0.52228856", "0.522203", "0.5213032", "0.5201989", "0.5186265", "0.51843154", "0.5163796", "0.51006454", "0.509396", "0.509396", ...
0.8148803
0
Update the index for a single object. Attached to the class's postsave hook. If ``using`` is provided, it specifies which connection should be used. Default relies on the routers to decide which backend should be used.
def update_object(self, instance, using=None, **kwargs): # Check to make sure we want to index this first. if self.should_update(instance, **kwargs): backend = self.get_backend(using) if backend is not None: backend.update(self, [instance])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, using=None):\n\n backend = self.get_backend(using)\n\n if backend is not None:\n backend.update(self, self.index_queryset(using=using))", "def save_object(self, obj):\n return AlgoliaUtils_request(self.client.headers, self.write_hosts, \"PUT\", \"/1/indexes/%s/%s\...
[ "0.7842042", "0.63706976", "0.61764526", "0.58874273", "0.58640665", "0.58074796", "0.57171005", "0.55909324", "0.5478878", "0.54757524", "0.5452157", "0.5448166", "0.5431463", "0.54157645", "0.5371473", "0.53543854", "0.5348702", "0.5341172", "0.5326563", "0.5285077", "0.528...
0.73679394
1
Remove an object from the index. Attached to the class's postdelete hook. If ``using`` is provided, it specifies which connection should be used. Default relies on the routers to decide which backend should be used.
def remove_object(self, instance, using=None, **kwargs): backend = self.get_backend(using) if backend is not None: backend.remove(instance, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, using=None):\n self.model.remove_field(self)", "def delete(self, obj=None):\n pass", "def delete(self, obj):\n raise NotImplementedError", "def delete(self, obj):\n self.session.delete(obj)", "def _delete(self, model_obj):\n conn = self._get_session()\n\n...
[ "0.66168565", "0.6474018", "0.6424098", "0.63203585", "0.62546647", "0.6206229", "0.6206229", "0.6206229", "0.6206229", "0.6166685", "0.6166052", "0.6166052", "0.6166052", "0.6120683", "0.61188376", "0.611746", "0.6102466", "0.60986376", "0.59959966", "0.59527385", "0.5952738...
0.7081268
0
Completely clear the index for this model and rebuild it. If ``using`` is provided, it specifies which connection should be used. Default relies on the routers to decide which backend should be used.
def reindex(self, using=None): self.clear(using=using) self.update(using=using)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear(self, using=None):\n backend = self.get_backend(using)\n\n if backend is not None:\n backend.clear(models=[self.get_model()])", "def update(self, using=None):\n\n backend = self.get_backend(using)\n\n if backend is not None:\n backend.update(self, self....
[ "0.6494065", "0.6284937", "0.61678827", "0.61412674", "0.6054825", "0.6042128", "0.5937427", "0.5905084", "0.5905084", "0.5901713", "0.58086914", "0.57105446", "0.5677104", "0.5653088", "0.5642981", "0.56256485", "0.56181693", "0.55739117", "0.5542029", "0.55401844", "0.54672...
0.79289484
0
Determine if an object should be updated in the index. It's useful to override this when an object may save frequently and cause excessive reindexing. You should check conditions on the instance and return False if it is not to be indexed. By default, returns True (always reindex).
def should_update(self, instance, **kwargs): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_update(self):\n return self.action in [\"update\", \"partial_update\"]", "def update_if_not_modified(self, obj, fields, upsert=False):\n spec = state(obj).original_document\n self.update(obj.__class__, spec, fields, upsert=upsert)\n err = self.impl.db.command(dict(getlasterror=...
[ "0.6705612", "0.6665094", "0.6450796", "0.63637704", "0.6324214", "0.6323257", "0.62669617", "0.6196118", "0.61161834", "0.6070323", "0.60081214", "0.59738415", "0.5952298", "0.5924202", "0.59203935", "0.59120035", "0.5911294", "0.58975846", "0.58743405", "0.58743405", "0.587...
0.72037023
0
Provides the ability to override how objects get loaded in conjunction with ``SearchQuerySet.load_all``. This is useful for postprocessing the results from the query, enabling things like adding ``select_related`` or filtering certain data. By default, returns ``all()`` on the model's default manager.
def load_all_queryset(self): return self.get_model()._default_manager.all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def queryset(cls):\n return cls.model._default_manager.all()", "def all(self):\n return self.__objects", "def all(self):\n return self.__objects", "def all(self):\n return self.__objects", "def all(self):\n return self.__objects", "def all(self):\n return self.__...
[ "0.66101956", "0.643561", "0.643561", "0.643561", "0.643561", "0.643561", "0.643561", "0.63397825", "0.6290898", "0.62837636", "0.6258117", "0.62498605", "0.6209671", "0.62085414", "0.6205274", "0.6167256", "0.6165007", "0.6142211", "0.61316377", "0.61313605", "0.61186314", ...
0.7823638
0
Given a Django field, return the appropriate index fieldname.
def get_index_fieldname(self, f): return f.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(self, field):\r\n\r\n try:\r\n index = self._field_names.index(unicode(field))\r\n except ValueError:\r\n raise KeyError(\"Field list has no field with name '%s'\" % unicode(field))\r\n\r\n return index", "def field_index(self, field):\r\n idx = self.fi...
[ "0.73228824", "0.72279114", "0.70474243", "0.6815128", "0.6683266", "0.6666094", "0.65193903", "0.64802706", "0.6409908", "0.64097255", "0.62970906", "0.6273589", "0.6263582", "0.623153", "0.6205761", "0.6205761", "0.61754113", "0.6119579", "0.6063708", "0.6039959", "0.597258...
0.76406515
0
Compute the linear kernel between X and Y
def linear_kernel_pure(X, Y=None): X, Y = _check_pairwise_arrays(X, Y) return dot_2d(X, Y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linear_kernel(x1, x2):\n return torch.dot(x1, x2)", "def Kernel(x, y):\n\n Result = (np.dot(x_train[x, :], x_train[y, :])+1)**5 # Polynomial\n #Result = (np.dot(x_train[x, :], x_train[y, :])+1) # Linear\n #Gaussian\n \"\"\"\n sigma = 1\n if np.ndim(x_train[x, :]) == 1 and np.ndim(x_train...
[ "0.807608", "0.7417713", "0.72510546", "0.7204725", "0.71933246", "0.7174573", "0.6915667", "0.68939793", "0.6871037", "0.66893286", "0.6653538", "0.66237164", "0.6498303", "0.6462767", "0.6451806", "0.64464706", "0.64464706", "0.6343468", "0.63377714", "0.62976146", "0.62626...
0.81951165
0
Adds localkey as an authorized key in remotehost over SSH
def appendLocalKeyInRemote(key, authorized_key_path, ip, user, passwd): key_append_cmd = 'echo "%s" >> %s' % (key, authorized_key_path) sshToOtherClient(ip, user, passwd, key_append_cmd) logging.debug("Local key has been added into authorized_keys in %s", ip)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def appendRemoteKeyInLocal(key, authorized_key_path, ip):\n\n key_append_cmd = 'echo \"%s\" >> %s' % (key, authorized_key_path)\n executeCmd(key_append_cmd)\n debug_text = \"\"\"Remote key for %s has been added into authorized_keys in\n LocalHost\"\"\"\n logging.debug(debug_text, ip)", "def add_lo...
[ "0.7934184", "0.7764943", "0.72371733", "0.6968261", "0.6682062", "0.6613494", "0.65473694", "0.6545366", "0.6516394", "0.64677846", "0.6441818", "0.6393933", "0.63609564", "0.62689716", "0.62654155", "0.61806643", "0.6176729", "0.6143143", "0.6099264", "0.60591483", "0.60303...
0.8304287
0
Adds remote key as an authorized key into localhost
def appendRemoteKeyInLocal(key, authorized_key_path, ip): key_append_cmd = 'echo "%s" >> %s' % (key, authorized_key_path) executeCmd(key_append_cmd) debug_text = """Remote key for %s has been added into authorized_keys in LocalHost""" logging.debug(debug_text, ip)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def appendLocalKeyInRemote(key, authorized_key_path, ip, user, passwd):\n\n key_append_cmd = 'echo \"%s\" >> %s' % (key, authorized_key_path)\n sshToOtherClient(ip, user, passwd, key_append_cmd)\n logging.debug(\"Local key has been added into authorized_keys in %s\", ip)", "def add_local_ssh_key(self):\...
[ "0.8085014", "0.7193947", "0.67654115", "0.6764166", "0.6547712", "0.6312446", "0.6267961", "0.6176798", "0.61716646", "0.6143982", "0.61162364", "0.60375917", "0.6016687", "0.5998061", "0.5995002", "0.59649825", "0.59607184", "0.59167445", "0.588574", "0.58612794", "0.582211...
0.8010356
1
Setups up passwordless SSH between the localhost and other target hosts
def setupSSH(key_rsa_path, key_append_path, key_gen_cmd, HostList): # Generate SSH key on localhost LocalKey = getLocalKey(key_gen_cmd, key_rsa_path) # Setup passwordless SSH with each of the specified machines for i in HostList: if i[0] != 'localhost': box_ip = i[1] us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ssh_tunnel(self):\n\n host = self.sshTunnelDict[\"ssh_ip\"]\n user = self.sshTunnelDict[\"ssh_user\"]\n password = self.sshTunnelDict[\"ssh_password\"]\n sfcs = self.sshTunnelDict[\"target_ip\"]\n\n tunnel_command = 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChec...
[ "0.713005", "0.694721", "0.6518343", "0.64695096", "0.6462488", "0.64535284", "0.64387923", "0.6435735", "0.6404588", "0.6290555", "0.6285333", "0.62561077", "0.623623", "0.620097", "0.61915046", "0.618156", "0.6169295", "0.6164128", "0.61532754", "0.61400604", "0.61214095", ...
0.75619024
0
wait for a heartbeat so we know the target system IDs
def wait_heartbeat(m): log.msg("Waiting for APM heartbeat") m.wait_heartbeat() log.msg("Heartbeat from APM (system %u component %u)" % (m.target_system, m.target_system))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inform_alive(self):\n\n response = requests.get(\n \"https://brokenprotocol.xyz/Device/Heartbeat\",\n headers={\"auth\": self.token}\n )\n response.raise_for_status()", "def test_heartbeat(self):\n pass", "def _wait(self):\n conn = None\n try:...
[ "0.64836156", "0.63089925", "0.6283224", "0.6196189", "0.6163644", "0.6135041", "0.6113974", "0.6078206", "0.6058798", "0.6036494", "0.598546", "0.5980778", "0.59757805", "0.59688926", "0.59371954", "0.5917507", "0.58905715", "0.5878669", "0.586995", "0.58660203", "0.58473164...
0.7345835
0
Returns the input Image with covered message inside of it.
def cover(img: Image, message: bitarray) -> Image: width, height = img.size check_image_width(width, RGB_PIXEL, message) pixels = img.load() row = random.randint(0, height) # Randomly chooses row. i = 0 # Tracks hidden bits # If Image consist of 8-bit pixels if img.mode == "P": o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_image(self, msg):\n self.cv_image = self.bridge.imgmsg_to_cv2(msg, desired_encoding=\"bgr8\")\n self.edge_detected = cv2.Canny(self.cv_image,self.minVal,self.maxVal)\n if cv2.__version__.startswith('3.'):\n _, self.contours,_ = cv2.findContours(self.edge_detected, cv2....
[ "0.6046034", "0.58501476", "0.5748362", "0.57211685", "0.57079965", "0.56804174", "0.5619478", "0.5615851", "0.55933034", "0.5558253", "0.5522358", "0.5461641", "0.5448951", "0.5443386", "0.5439719", "0.5439586", "0.5434058", "0.5430267", "0.53955525", "0.53926134", "0.537919...
0.6661549
0
Generates key for the uncovering process. R stands for row, so digits after R represent the row. L stands for length, so digits after L represent the length of the message in bits. O offset from the beggining of the row.
def generate_key(row: int, message: bitarray, offset: int): row = "R" + str(row) length = "L" + str(len(message)) offset = "O" + str(offset) key = [] key.extend([row, length, offset]) random.shuffle(key) print(f"Key: {''.join(key)}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def riKey(pre, ri):\n if hasattr(pre, \"encode\"):\n pre = pre.encode(\"utf-8\") # convert str to bytes\n return (b'%s.%032x' % (pre, ri))", "def gen_symkey(self, message):\n return int(hashlib.sha1(str(message)).hexdigest(), 16)", "def create_key(message, key):\n if len(key) > len(mess...
[ "0.5860431", "0.5673623", "0.5653033", "0.5652371", "0.5613599", "0.5579354", "0.55760914", "0.5540471", "0.5534099", "0.55258226", "0.5516928", "0.54834205", "0.5467719", "0.542944", "0.54007095", "0.5398282", "0.53946245", "0.5353867", "0.535323", "0.53315246", "0.53101057"...
0.72802985
0
Returns it's input binary representation. >>> binary("a") bitarray('01100001') >>> binary("1") bitarray('00110001')
def binary(message: str) -> bitarray: binary_message = bitarray() byte_message = bytes(message, encoding="ascii") binary_message.frombytes(byte_message) return binary_message
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_from_binary_bits_style(self):\n self.assertResult('[0001 0000]', b8('[0001 0000]'))", "def to_binary_string(x):\n return \"{0:b}\".format(x)", "def _get_binary(value, bits):\n\n # http://www.daniweb.com/code/snippet216539.html\n return ''.join([str((value >> y) & 1) for y in range(bits - 1...
[ "0.7142127", "0.68974", "0.6838889", "0.6827851", "0.6753569", "0.66621953", "0.660578", "0.6601633", "0.6597931", "0.6587949", "0.6545296", "0.6543103", "0.65247095", "0.6524125", "0.6460306", "0.6440843", "0.6440843", "0.6437607", "0.6423941", "0.64157", "0.64130956", "0....
0.74867177
0
Called when a message of the topic 'dmin' is received.
def callback_dmin(msg): global _stop, _dsafe1, _dsafe2 rospy.logdebug("received dmin: %f", msg.data) if msg.data < _dsafe_bot: if not _stop: rospy.logwarn("dmin falls below dsafe (%f)", _dsafe_bot) _stop = True elif msg.data > _dsafe_top: if _stop: rospy.l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_message(self, topic, message):\n if is_measurement_topic(topic):\n new_topic = \"measurement\".format(topic)\n self.produce(new_topic.encode(), message)", "def handleMessage_started(self, message):\n self.eventbus.publish(MarathonStartedEvent())", "def on_message(client, ...
[ "0.6048884", "0.59756136", "0.5864272", "0.576618", "0.57659084", "0.5742912", "0.574098", "0.57336664", "0.5713755", "0.567451", "0.5632536", "0.5625452", "0.55926865", "0.5568124", "0.55583704", "0.55482376", "0.5536619", "0.5502398", "0.54676557", "0.54349923", "0.5434687"...
0.7151055
0
Filters received messages of topic 'cmd_vel' w.r.t. minimum distance.
def callback_cmdvel(msg): global _stop rospy.logdebug("received cmd_vel: (%f,%f)", msg.linear.x, msg.angular.z) msgtosend = msg if _stop and msg.linear.x > 0: msgtosend.linear.x = 0 rospy.logdebug("reset cmd_vel(.linear.x)") _pub_cmdvel.publish(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cb_cmd_vel(self,msg):\r\n print \"Walker velocity command received: \",msg\r\n vx=msg.linear.x\r\n vy=msg.linear.y\r\n vt=msg.angular.z\r\n self.start()\r\n self.set_desired_velocity(vx,vy,vt)", "def filter_vert_vel(self, setting, threshold=None):\n\n # Set v...
[ "0.5862218", "0.53887534", "0.531218", "0.5268395", "0.52424544", "0.5058048", "0.5038371", "0.50024724", "0.49666083", "0.49221498", "0.49068543", "0.48927653", "0.48876974", "0.48398787", "0.48060846", "0.4750759", "0.46802518", "0.46758217", "0.46103874", "0.45868078", "0....
0.6164881
0
Query that updates a specific customer's credit limit.
def update_customer_credit(cust_id, credit_limit): update_query = Customer.update(credit_limit=credit_limit) \ .where(Customer.customer_id == cust_id) if not update_query.execute(): raise ValueError("Record does not exist") return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_customer_credit(customer_id, credit_limit):\n try:\n customer = cm.Customers.get(cm.Customers.customer_id == customer_id)\n customer.credit_limit = credit_limit\n customer.save()\n except cm.DoesNotExist:\n raise ValueError", "def update_customer_credit(customer_id, c...
[ "0.83389485", "0.8164742", "0.8063905", "0.8034536", "0.79610264", "0.79337305", "0.78912807", "0.787443", "0.77628773", "0.7599805", "0.7407861", "0.7212146", "0.6931266", "0.6154303", "0.6138558", "0.600885", "0.5814216", "0.5466966", "0.5418371", "0.5382199", "0.5372853", ...
0.8223842
1
Deletes all records. Used only for testing purposes.
def del_all_records(): delete_alles = Customer.delete().where(Customer.name >= '') delete_alles.execute()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_records(self):\n pass", "def deleteAllRecord(collection):\n collection_name = collection\n collection = db[collection_name]\n collection.delete_many({})\n\n print(\"Deleting all records from \" + collection_name)\n print(\"Finished operation. Collection cleared.\")\n prin...
[ "0.77266484", "0.7592773", "0.7592395", "0.7578309", "0.7505572", "0.7418404", "0.73961955", "0.7300665", "0.72803384", "0.7256621", "0.7199619", "0.71971315", "0.71440274", "0.7139897", "0.7097686", "0.7095089", "0.7006831", "0.6975799", "0.69379616", "0.6925585", "0.6919066...
0.80792344
0
Handle a username supplied in response to a prompt for one when creating a new character. This will create a user with the name given by C{line}, made available to the role indicated by C{self.role}, and entered into play.
def line_USERNAME(self, line): actor = self.world.create(line) self.role.shareItem(actor) return self.play(actor)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_and_create_user(self):\n print(\"Please input username!\")\n new_username = input()\n new_user = user.User(new_username)\n self.users.append(new_user)", "def enter_username(self):", "def __prompt_name(self):\n self.clear_screen()\n self.__print_logo()\n\n ...
[ "0.68609864", "0.67086864", "0.6640338", "0.64088964", "0.6257395", "0.62236816", "0.6137134", "0.6063155", "0.604502", "0.59853417", "0.59640485", "0.58856946", "0.5863836", "0.58404183", "0.5837947", "0.5834842", "0.5813032", "0.57883215", "0.5724009", "0.571349", "0.571246...
0.7260468
0
Find the characters the given role is allowed to play. This will load any L{Thing}s from C{store} which are shared to C{role}. It then unwraps them from their sharing wrapper and returns them (XXX there should really be a way for this to work without the unwrapping, no? See 2909. exarkun).
def _charactersForViewer(self, store, role): characters = [] things = store.query(Thing) actors = asAccessibleTo(role, things) characters.extend(map(itemFromProxy, actors)) return characters
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_role(self, s=None, things=None):\n\n self._plugin_used = None\n self._current_info = None\n self._current_key_addr = None\n self._current_role = Role.UNKNOWN\n plugins_used = []\n roles = [Role.UNKNOWN]\n\n if s is None and things is None:\n rai...
[ "0.5799731", "0.4985161", "0.49064004", "0.4824051", "0.47902247", "0.47299632", "0.4707985", "0.47036007", "0.46339935", "0.45469669", "0.45104447", "0.4487957", "0.44821674", "0.447853", "0.44701874", "0.44539917", "0.4440165", "0.44389462", "0.4346311", "0.43398398", "0.43...
0.6125925
0
Open binlog object based on SHOW SLAVE STATUS
def binlog_from_status(self, status): filepath = self.logpath + status["Relay_Log_File"] pos = int(status["Relay_Log_Pos"]) binlog = Binlog(filepath) binlog.seek(pos) return binlog
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slave_status():\n run_mysql_command(\"SHOW SLAVE STATUS\\G;\")", "def binlog(self):\n return self._binlog", "def reset_slave():\n\n # Confirm slave status in case we need to refer to the values later\n slave_status()\n run_mysql_command(\"STOP SLAVE;\")\n\n with hide('everything'):\n ...
[ "0.70276934", "0.5897734", "0.52344906", "0.5231146", "0.52080905", "0.51789796", "0.51353544", "0.51199913", "0.50744784", "0.5064627", "0.49741092", "0.49409539", "0.49357247", "0.49140686", "0.49118155", "0.48676923", "0.48610124", "0.48490477", "0.48451436", "0.48060232", ...
0.64037925
1
Load data based on the type/path (see param_lookup_function parameter of process_variables for more info).
def _load_var_data( var_type, var_location, fallback_var_type, fallback_var_location, file_cache, self_data_source, service_file_directory ): value = None if var_type is None: value = var_location elif var_type == "self": value = _determine_variable_value_from_dic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_file(path, data_type=None, *args, **kwargs):\n\n path = os.path.normpath(path)\n if os.path.isdir(path) and path[-1] != os.sep:\n path = path + os.sep\n\n if data_type == None:\n data_type = autodetect(path)\n\n if data_type == \"prospa\":\n return dnpIO.prospa.import_pros...
[ "0.70499456", "0.6265565", "0.60673225", "0.59263283", "0.592572", "0.58638227", "0.5859274", "0.5742688", "0.5730548", "0.5688844", "0.5676583", "0.56547517", "0.5649311", "0.5634073", "0.5621514", "0.56050754", "0.55491054", "0.55334675", "0.55253786", "0.55030596", "0.5500...
0.66488266
1
Returns a tuple of the var type, var loc, fallback type and fallback loc. See docs for the param_lookup_function parameter of process_variables_loop for more info.
def _parse_var(var_str): tokens = _tokenize_by_commas(var_str.strip()) if not tokens: return None var_type, var_loc = _token_to_type_and_loc(tokens[0]) if len(tokens) > 1: fallback_type, fallback_loc = _token_to_type_and_loc(tokens[1]) else: fallback_type = None fal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_var_data(\n var_type,\n var_location,\n fallback_var_type,\n fallback_var_location,\n file_cache,\n self_data_source,\n service_file_directory\n):\n value = None\n if var_type is None:\n value = var_location\n elif var_type == \"self\":\n value = _determine_var...
[ "0.63653916", "0.60714114", "0.58929414", "0.57418597", "0.5698518", "0.56817955", "0.56562454", "0.5605601", "0.55085975", "0.5507751", "0.543205", "0.5425623", "0.54057986", "0.5386769", "0.5373611", "0.5355534", "0.534988", "0.53336513", "0.5329332", "0.5279264", "0.525683...
0.6247951
1
Tokenize the given value by commas, respecting quoted blocks.
def _tokenize_by_commas(string: str) -> Optional[List[str]]: if not string: return None quoted_comma_ranges = [range(m.start(0), m.end(0)) for m in QUOTED_WORD_SYNTAX.finditer(string)] def clean(s: str) -> str: s = s.strip() # whitespace if len(s) > 0 and s[0] == '"' and s[len(s) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_values(self, value):\n if value:\n return [s.strip() for s in value.split(',')]\n else:\n return []", "def csv_line(value_parser):\n def convert(string):\n return list(map(value_parser, string.split(',')))\n return convert", "def parse_comma(option, _,...
[ "0.6333117", "0.6082156", "0.6080997", "0.59666353", "0.59242994", "0.5913831", "0.5884933", "0.5732863", "0.5702324", "0.56804144", "0.5666349", "0.5582747", "0.55694443", "0.5560034", "0.5536497", "0.5535833", "0.55190426", "0.5496546", "0.5496546", "0.5477811", "0.54364574...
0.631856
1
This function performs second order polynomial regression.
def poly_regression_second(X, Y, Xs_test, Ys_test): poly = PolynomialFeatures(degree = 2) X2 = poly.fit_transform(X)[:,1:] X2_test = [] for X_test in Xs_test: X2_test.append(poly.fit_transform(X_test)[:,1:]) mses = linear_regression(X2, Y, X2_test, Ys_test) return mses
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def poly_regression_second(X, Y, Xs_test, Ys_test):\n ## YOUR CODE HERE\n #################\n return 0", "def calc_poly_linear_regression(independent, dependent):\n # Reshape for sklearn\n independent = independent.values.reshape(-1,1)\n dependent = dependent.values.reshape(-1,1)\n # Make th...
[ "0.7883141", "0.74709266", "0.6893806", "0.68877536", "0.6833926", "0.68214965", "0.6789743", "0.67618144", "0.6721337", "0.66116184", "0.65810204", "0.64617866", "0.6451399", "0.64249736", "0.63940805", "0.6386852", "0.63448316", "0.633042", "0.6310642", "0.6293233", "0.6271...
0.8086931
0
This function performs third order polynomial regression.
def poly_regression_cubic(X, Y, Xs_test, Ys_test): poly = PolynomialFeatures(degree = 3) X3 = poly.fit_transform(X)[:,1:] X3_test = [] for X_test in Xs_test: X3_test.append(poly.fit_transform(X_test)[:,1:]) mses = linear_regression(X3, Y, X3_test, Ys_test) return mses
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_poly_linear_regression(independent, dependent):\n # Reshape for sklearn\n independent = independent.values.reshape(-1,1)\n dependent = dependent.values.reshape(-1,1)\n # Make the whole thing poly\n poly = PolynomialFeatures(degree=2)\n independent_ = poly.fit_transform(independent)\n ...
[ "0.67195016", "0.6661404", "0.6617306", "0.66101855", "0.66028696", "0.6421671", "0.6402211", "0.63470286", "0.62390393", "0.6206066", "0.6177354", "0.6174677", "0.61571705", "0.61389935", "0.6115052", "0.6112346", "0.60829884", "0.6060428", "0.60439694", "0.6021248", "0.5990...
0.70311046
0
Start backup job scheduler.
def backup(ctx): config_path = ctx.obj['config_path'] logger = ctx.obj['logger'] config = Config(config_path) scheduler = BlockingScheduler( executors={'default': ThreadPoolExecutor(max_workers=1)} ) for job in config.jobs.values(): logger.info(f'filesystem={job.filesystem} ' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_backup():\n\n from common.models import InvenTreeSetting\n\n if not InvenTreeSetting.get_setting('INVENTREE_BACKUP_ENABLE', False, cache=False):\n # Backups are not enabled - exit early\n return\n\n interval = int(InvenTreeSetting.get_setting('INVENTREE_BACKUP_DAYS', 1, cache=False))...
[ "0.66139066", "0.6526728", "0.63862264", "0.63553697", "0.62829685", "0.62829685", "0.6267056", "0.6254313", "0.6246434", "0.62357587", "0.60570836", "0.60366815", "0.6023009", "0.59244806", "0.5833096", "0.5822835", "0.57939494", "0.57696635", "0.5739092", "0.5655713", "0.56...
0.7391046
0
Gives the last output folder number
def get_output_number(dst): data = os.listdir(dst) print(data) if not data == []: last_record = sorted(data)[-1] print(last_record) hiphen_index = last_record.rfind("-") print(hiphen_index) print(int(last_record[hiphen_index + 1:])) return int(last_record[hiph...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logdir():\n listdir = [xx for xx in os.listdir(\"runs/\") if os.path.isdir(os.path.join(\"runs\", xx))]\n\n max_ = 0\n for i in range(len(listdir)):\n try:\n filename = int(listdir[i])\n if max_ < filename:\n max_ = filename\n except ValueError:\n ...
[ "0.71721", "0.69669425", "0.68577045", "0.67557305", "0.66702825", "0.66608906", "0.66509795", "0.65034556", "0.6356342", "0.6327851", "0.62281626", "0.61897796", "0.6175517", "0.6169303", "0.61690086", "0.6139297", "0.6118368", "0.6074031", "0.60167557", "0.6001597", "0.5999...
0.7492373
0
register signals for bottom bar buttons
def register_bottombar_button_signals(self): self.btn_btmbar_next.released.connect(self.btn_next_released) self.btn_btmbar_back.released.connect(self.btn_back_released) self.btn_btmbar_next.hide() self.btn_btmbar_back.hide()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_signals(self):\n\n # Hook the play/pause buttons\n self.ui.actionContinue_Live_Updates.triggered.connect(self.on_live)\n self.ui.actionPause_Live_Updates.triggered.connect(self.on_pause)\n self.ui.actionSave.triggered.connect(self.on_save)\n\n # Custom graph buttons\n ...
[ "0.6219547", "0.617013", "0.6153854", "0.60619146", "0.6047157", "0.60252464", "0.5995803", "0.59804523", "0.5965929", "0.5902234", "0.58630323", "0.58359635", "0.583215", "0.5806537", "0.57793224", "0.577855", "0.5774315", "0.5690318", "0.5678139", "0.5663293", "0.5634111", ...
0.75366396
0
for test loading screen
def test_loading_screen(self): self.timer = QtCore.QTimer() self.timer.timeout.connect(self.animation) self.timer.start(TIMER_INTERVAL_IN_MSEC)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_for_non_loading_screen():\n imagesearch_loop(image=SETTINGS['img_paths']['screens']['nav_box'])", "def test_window_loaded(self):", "def wait_for_load(browser):\n loader = browser.find_element_by_class_name('ui-loader')\n while loader.is_displayed():\n time.sleep(0.1)", "def wait_for_page...
[ "0.7117071", "0.6975048", "0.6940778", "0.6812799", "0.65741193", "0.6419496", "0.62859136", "0.6280401", "0.62695754", "0.62448704", "0.6236928", "0.62088716", "0.6175344", "0.616673", "0.61491895", "0.6095618", "0.6082893", "0.6043239", "0.59727013", "0.596325", "0.59458745...
0.77060163
0
set test button for QRcode screens
def init_qrcode_screens(self): self.btn_test.released.connect(self.btn_next_released) self.btn_test_2.released.connect(self.btn_next_released)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_custom_button(self):\n pass", "def test_create_custom_button(self):\n pass", "def test_update_custom_button(self):\n pass", "def test_generate_barcode_qr_code(self):\n pass", "def testButtonCB(self, testId):\n button = self.test_buttons[testId]\n if se...
[ "0.6779364", "0.6675017", "0.64194435", "0.63441676", "0.6107394", "0.6068985", "0.59872395", "0.59843564", "0.59031093", "0.587738", "0.58678955", "0.583615", "0.5808094", "0.5807509", "0.58018285", "0.57715946", "0.5768334", "0.57441574", "0.5725544", "0.57252336", "0.56993...
0.6796294
0
register button signals for patient information screen
def init_patient_information_screen(self): self.btn_female.clicked.connect(self.btn_female_clicked) self.btn_male.clicked.connect(self.btn_male_clicked) self.btn_yes.released.connect(self.btn_yes_clicked) self.btn_no.released.connect(self.btn_no_clicked)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signalSetup(self):\n self.ui.b_info.clicked.connect(self.showInfo)\n self.ui.b_save.clicked.connect(self.openSave)\n self.ui.b_vid.clicked.connect(self.openVideo)\n self.ui.b_run.clicked.connect(self.startRun)\n self.ui.b_colour.clicked.connect(self.pickColour)\n self....
[ "0.6066641", "0.59095556", "0.5850854", "0.5711178", "0.5703368", "0.56935436", "0.5633008", "0.5625073", "0.5617892", "0.56137687", "0.5608114", "0.5608114", "0.55970883", "0.5578985", "0.5536391", "0.5536292", "0.5530258", "0.54978263", "0.5482633", "0.54794204", "0.5457732...
0.753613
0
for Select Treatment Area screen
def init_select_treatment_area(self): self.txt_shoulder.hide() self.txt_arm.hide() self.txt_thigh.hide() self.line_shoulder.hide() self.line_arm.hide() self.line_thigh.hide()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(self):\n ...", "def area(self):", "def selectArms(self,**kwargs):\n self.use_arm[\"left\"] = False\n self.use_arm[\"right\"] = False\n entries = {}\n entries[\"Use Left\"] = self.useArm\n entries[\"Use Right\"] = self.useArm\n self.mm.addGenericMenu(\"s...
[ "0.61611223", "0.6134851", "0.56742734", "0.5530789", "0.5510776", "0.5504374", "0.54793143", "0.5430142", "0.5391901", "0.5381988", "0.53556526", "0.53172183", "0.5315018", "0.5310894", "0.5305996", "0.5296454", "0.5296247", "0.5291839", "0.52397794", "0.5225813", "0.519992"...
0.77699983
0
for Position Electrodes screen
def init_position_electrodes_screen(self): self.line_shoulder_pos_l.hide() self.line_shoulder_pos_r.hide() self.txt_shoulder_pos_r.hide() self.txt_shoulder_pos_r.hide()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pos(self):\n sw = self.parent.winfo_screenwidth()\n sh = self.parent.winfo_screenheight()\n w = sw * 0.8\n h = sh * 0.8\n x = (sw - w) / 2\n y = (sh - h) / 2\n self.parent.geometry('%dx%d+%d+%d' % (w, h, x, y))", "def position(self):\r\n pass", "def ...
[ "0.6741357", "0.67196053", "0.66584736", "0.657565", "0.6502367", "0.64421713", "0.634793", "0.63327247", "0.63034666", "0.62899214", "0.6282687", "0.6250943", "0.6243115", "0.6214212", "0.62034655", "0.6198015", "0.6197233", "0.6144322", "0.61430913", "0.61057115", "0.609580...
0.7270835
0
Compiles SCSS into CSS in the Static Assets folder
def process_scss(): paths = [ os.path.join(settings.BASE_DIR, 'themes/CMESH/assets/foundation-sites/scss/'), os.path.join(settings.BASE_DIR, 'themes/CMESH/assets/motion-ui/src/') ] # File dirs app_scss_file = os.path.join(settings.BASE_DIR, 'themes/CMESH/assets/scss/app.scss') app_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile_templated_sass(systems, settings):\r\n for sys in systems:\r\n sh(django_cmd(sys, settings, 'preprocess_assets'))", "def _get_custom_css(self) -> str:\n paths = []\n\n for scss_path in self.custom_scss:\n # Simplify the path to be only the relative path, if they've ...
[ "0.6583947", "0.6480078", "0.64177", "0.6210935", "0.60140026", "0.5951647", "0.58819324", "0.58802795", "0.5870103", "0.5856354", "0.585072", "0.58500034", "0.5784658", "0.5594828", "0.5545562", "0.55264574", "0.5501438", "0.54719764", "0.5468105", "0.54034907", "0.52233046"...
0.80126977
0
Copies JS from compile into static assets
def process_js(): source_paths = [ os.path.join(settings.BASE_DIR, 'themes/CMESH/assets/js/admin.js'), os.path.join(settings.BASE_DIR, 'themes/CMESH/assets/js/app.js'), os.path.join(settings.BASE_DIR, 'themes/CMESH/assets/js/footnotes.js'), os.path.join(settings.BASE_DIR, 'themes/CME...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_js(self):\n # Compiled JS files for copying\n js_dist_dir = os.path.join(node_root, 'dist', 'pydeck_embeddable')\n # Uncompiled JS files for copying\n # See https://github.com/jupyter-widgets/widget-ts-cookiecutter/blob/master/%7B%7Bcookiecutter.github_project_name%7D%7D/%7B%7B...
[ "0.74421734", "0.68463874", "0.6794442", "0.674165", "0.67405427", "0.655094", "0.65411323", "0.6485336", "0.6350563", "0.6244177", "0.62408805", "0.6164992", "0.6133196", "0.6076179", "0.6049514", "0.60399765", "0.5976893", "0.59738827", "0.59519637", "0.5939875", "0.5922697...
0.69159395
1
Processes fonts from the compile folder into Static Assets
def process_fonts(): fonts_path = os.path.join(settings.BASE_DIR, 'themes/CMESH/assets/fonts/') static_fonts = os.path.join(settings.BASE_DIR, 'static/CMESH/fonts/') copy_files(fonts_path, static_fonts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_fonts(self):\n for key, font in enumerate(self.fonts):\n self.fonts[key]['font'] = load_font(font['name'], font['size'])\n checkpoint('fonts')", "def assets():", "def load_all_fonts(directory, accept=(\".ttf\",)):\n return load_all_music(directory, accept)", "def load_all_fonts(directo...
[ "0.66174775", "0.65340555", "0.6488215", "0.6488215", "0.6127812", "0.6101365", "0.58951795", "0.5868204", "0.58654684", "0.583065", "0.57880837", "0.56540155", "0.5645038", "0.54724133", "0.54625595", "0.54617554", "0.54581666", "0.54510427", "0.54310507", "0.5426707", "0.54...
0.8365685
0
Processes images from the compile folder into Static Assets
def process_images(): image_path = os.path.join(settings.BASE_DIR, 'themes/CMESH/assets/img/') static_images = os.path.join(settings.BASE_DIR, 'static/CMESH/img/') copy_files(image_path, static_images)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assets():", "def images(name):\n return static_file(name, root=os.path.join(BASEDIR, \"images\"))", "def assets():\n pass", "def process_xmodule_assets():\r\n sh('xmodule_assets common/static/xmodule')", "def process_images(self):\n self.processed_content_image = tf.keras.applications.v...
[ "0.71756774", "0.6800249", "0.67028135", "0.6224927", "0.61053765", "0.61016846", "0.60867834", "0.60435706", "0.6006286", "0.5973556", "0.5964129", "0.5933479", "0.5926077", "0.58952844", "0.5889758", "0.5885172", "0.5807075", "0.5793583", "0.57587147", "0.57587147", "0.5758...
0.7876873
0
Method to create embeddings for documents by encoding their text.
def encode( self, docs: Optional[DocumentArray] = None, parameters: dict = {}, *args, **kwargs ) -> None: if not docs: return batch_generator = docs.batch( traversal_paths=parameters.get('traversal_paths', self.traversal_paths), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_embedding():\n\n HOST = app.config.get('EMBEDDING_HOST')\n PORT = app.config.get('EMBEDDING_PORT')\n query_params = {\n 'text' : request.args.get('text', \"\"),\n \"language\" : request.args.get('language', None)\n }\n r = requests.get(f\"http://{HOST}:{PORT}/api/v1/embeddings/...
[ "0.6767671", "0.6741734", "0.6494732", "0.64353657", "0.6419765", "0.64173263", "0.64032143", "0.6344852", "0.6342358", "0.61897606", "0.61114526", "0.608734", "0.60688555", "0.60533506", "0.604839", "0.6046317", "0.5983794", "0.5980191", "0.59599704", "0.5933091", "0.5920783...
0.6795354
0
The process_email command should process the correct email
def test_process_email(self, process_mock): with name_of_file_containing('contents') as filename: call_command('process_email', email_file=filename) self.assertEqual(process_mock.call_count, 1, 'process_response_email should be called once') self.assertEqual( process_mock...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_email(self, email_file, output_file):\n\t\t# Build the output file's name\n\t\tself._build_output_file(output_file)\n\t\t# Open the output file and email file and process it\n\t\twith open(self.output_file_name, \"w\") as output:\n\t\t\tself.parse_email(email_file, output)", "def process(self) -> Non...
[ "0.7364914", "0.66483474", "0.6643682", "0.6491361", "0.64206046", "0.63850975", "0.63699585", "0.63586307", "0.6318723", "0.62552786", "0.62274456", "0.6189089", "0.6186595", "0.61805063", "0.6177635", "0.6177522", "0.6159928", "0.6153826", "0.60729444", "0.6070825", "0.6000...
0.68821347
1