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
Insert a user header with the supplied text into the .frd file.
def add_user_header(self, text): new_header = FRDHeader() new_header.key = 1 new_header.code = 'U' new_header.string = text last_user_idx = -1 last_user_header = self.frd.headers[last_user_idx] while last_user_header.code != 'U': last_user_idx -= 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_header(self, text):\n with self.doc:\n h3(text)", "def insert_header(path: Path, header: str, docx_name: str) -> None:\n content = path.read_text()\n context = {\"docx\": docx_name}\n content = \"\\n\\n\".join((header.format(**context), content))\n path.write_text(content)",...
[ "0.70682687", "0.6929386", "0.66683954", "0.6630516", "0.629352", "0.6228307", "0.6223019", "0.62177575", "0.6174613", "0.61320055", "0.6083003", "0.60484314", "0.6041748", "0.6036281", "0.6013078", "0.60023844", "0.5999925", "0.5946964", "0.593472", "0.5887463", "0.58262044"...
0.8074849
0
Get the first user header that matches the given prefix.
def get_user_header(self, prefix): for header in self.frd.headers: if header.string.startswith(prefix): return header.string.replace(prefix, '').strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_uri_matching_prefix(xia, prefix):\n\n if xia is not None:\n for uri in xia:\n if uri.startswith(prefix):\n return uri\n return None", "def GetHeader(header, sample_prefixes):\n if len(sample_prefixes) == 0: return [header]\n else:\n header_items = []\...
[ "0.6507488", "0.6271171", "0.5968171", "0.59664214", "0.58222866", "0.57355654", "0.5670779", "0.5636987", "0.55947244", "0.5565466", "0.5565466", "0.5565466", "0.5559555", "0.55540806", "0.55477965", "0.5546304", "0.5541036", "0.5533869", "0.55178684", "0.5500421", "0.549736...
0.8432813
0
Gets package.json info for package_name on npm
def get_package_info(package_name): r = requests.get(f'https://api.npms.io/v2/search?q={package_name}&size=1') response_json = r.json() if 'results' in response_json: result = response_json['results'][0] return result['package']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getpackinfo(package_name: str) -> Dict[str, str]:\n\t# execute command\n\tproc = subprocess.Popen(['pip', 'show', package_name], stdout=subprocess.PIPE)\n\tproc.wait()\n\n\t# get and treate return\n\tlines = proc.stdout.read().decode('utf8')\n\tinfo = {}\n\tlines = list(map(lambda inf: inf.split(': '), lines.s...
[ "0.7172648", "0.6824519", "0.67997897", "0.67524683", "0.6733202", "0.67256707", "0.6668096", "0.6578985", "0.6556825", "0.64765173", "0.6442397", "0.6345317", "0.6151867", "0.6151222", "0.6085146", "0.60696775", "0.60617155", "0.60091126", "0.60039485", "0.5971188", "0.59132...
0.73230517
0
Finds repo url from package.json on npm
def get_repo_url(package_name): package_info = get_package_info(package_name) if package_info and package_info.get('links'): links = package_info['links'] if links.get('repository'): return links['repository']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_npm_install_url_referenced_package(modules, npm, npm_version, states):\n ret = npm.installed(\n name=\"request/request#v2.88.2\",\n registry=\"https://registry.npmjs.org/\",\n )\n assert ret.result is True\n ret = npm.removed(\n name=\"git://github.com/request/request\",\n...
[ "0.6731666", "0.67079645", "0.66061264", "0.6503107", "0.64749205", "0.64322865", "0.64107394", "0.6360064", "0.62021106", "0.6196629", "0.61961335", "0.61955965", "0.6158084", "0.60941887", "0.6052495", "0.6032884", "0.5994147", "0.5987307", "0.59768474", "0.5894701", "0.583...
0.7634042
0
Collects the last price from the output fields and checks whether it is a float larger than zero.
def check_iterate(out_fields): last_price = out_fields[LAST_PRICE_FLD] check_float_value(last_price, LAST_PRICE_FLD)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_last_price(market_data):\n print(\"Consultando el último precio\")\n if market_data[\"marketData\"][\"LA\"]:\n last_price = market_data[\"marketData\"][\"LA\"][\"price\"]\n print(\n f\"Último precio operado: ${last_price:,.2f}\".replace('.', ','))\n ...
[ "0.6271355", "0.5933679", "0.5800997", "0.5691686", "0.5648853", "0.5623907", "0.55060756", "0.5500531", "0.548454", "0.54823565", "0.5472537", "0.54640615", "0.5459817", "0.5458082", "0.5448156", "0.54064983", "0.5397893", "0.53619856", "0.5348598", "0.5334264", "0.5305329",...
0.7075779
0
Test the importer FMI PGM.
def test_io_import_fmi_pgm_shape(): root_path = pysteps.rcparams.data_sources["fmi"]["root_path"] filename = os.path.join(root_path, "20160928", "201609281600_fmi.radar.composite.lowest_FIN_SUOMI1.pgm.gz") R, _, _ = pysteps.io.import_fmi_pgm(filename, gzipped=True) assert R.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_io_import_fmi_pmg_metadata(variable, expected):\n root_path = pysteps.rcparams.data_sources[\"fmi\"][\"root_path\"]\n filename = os.path.join(root_path, \"20160928\",\n \"201609281600_fmi.radar.composite.lowest_FIN_SUOMI1.pgm.gz\")\n metadata = pysteps.io.importers._imp...
[ "0.65615994", "0.63812834", "0.6067058", "0.60490984", "0.60159093", "0.57693243", "0.5769277", "0.57227415", "0.5713535", "0.5707837", "0.56939757", "0.5692267", "0.5684236", "0.5674629", "0.56721985", "0.56546754", "0.5646513", "0.5639076", "0.56190664", "0.56031495", "0.55...
0.64258885
1
Test the importer FMI PMG.
def test_io_import_fmi_pmg_metadata(variable, expected): root_path = pysteps.rcparams.data_sources["fmi"]["root_path"] filename = os.path.join(root_path, "20160928", "201609281600_fmi.radar.composite.lowest_FIN_SUOMI1.pgm.gz") metadata = pysteps.io.importers._import_fmi_pgm_metad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_import(self):\n self.assertTrue(NagiosPerfdataCollector)", "def test_import_process(self):\r\n good_file = self._get_file()\r\n imp = Importer(good_file, username=u\"admin\")\r\n imp.process()\r\n\r\n # now let's do some db sanity checks\r\n self._firefox_data_t...
[ "0.63707936", "0.6202567", "0.6187144", "0.61517066", "0.61136675", "0.6110886", "0.60565263", "0.6052924", "0.5962812", "0.59466326", "0.5938897", "0.59176284", "0.59089255", "0.590013", "0.5880031", "0.58798236", "0.5871", "0.58304685", "0.5811639", "0.578455", "0.57495576"...
0.7019252
0
Test the importer FMI pgm.
def test_io_import_fmi_pgm_geodata(variable, expected, tolerance): root_path = pysteps.rcparams.data_sources["fmi"]["root_path"] filename = os.path.join(root_path, "20160928", "201609281600_fmi.radar.composite.lowest_FIN_SUOMI1.pgm.gz") metadata = pysteps.io.importers._import_fmi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_io_import_fmi_pmg_metadata(variable, expected):\n root_path = pysteps.rcparams.data_sources[\"fmi\"][\"root_path\"]\n filename = os.path.join(root_path, \"20160928\",\n \"201609281600_fmi.radar.composite.lowest_FIN_SUOMI1.pgm.gz\")\n metadata = pysteps.io.importers._imp...
[ "0.64308214", "0.626447", "0.6252141", "0.6251795", "0.5986383", "0.59576815", "0.5957314", "0.5956047", "0.5923523", "0.59181523", "0.59042", "0.5871521", "0.5871462", "0.5862609", "0.58358747", "0.58072317", "0.57841766", "0.5770826", "0.5759225", "0.5742479", "0.57398075",...
0.6326262
1
Blocking version of authenticated_request_async.
def authenticated_request(**kwargs): return authenticated_request_async(**kwargs).get_result()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def handle_async(req):\n return await logic_async(req)", "async def request(self) -> Any:\n raise NotImplementedError()", "async def authenticate(self, request: Request):\n\n pass", "async def handle_async_stream(req):\n yield await logic_async(req)", "def async_manager(self):\n ...
[ "0.6490102", "0.6224778", "0.59480387", "0.5882289", "0.5873201", "0.5862244", "0.5771545", "0.57415986", "0.57082003", "0.5701335", "0.5701335", "0.5582584", "0.55588734", "0.5542261", "0.55265737", "0.55025536", "0.5498806", "0.5494406", "0.54799086", "0.54715574", "0.54529...
0.67969024
0
Blocking version of get_project_access_token_async.
def get_project_access_token(*args, **kwargs): return get_project_access_token_async(*args, **kwargs).get_result()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_access_token(self):\n async with self._access_token_lock:\n if (not self._access_token\n or (not self._access_token_checked\n and not await self.check_access_token(\n self._access_token))):\n await self.receive_...
[ "0.6708782", "0.66425025", "0.6524741", "0.64879", "0.5722882", "0.57143843", "0.56376773", "0.56213325", "0.5568078", "0.5556944", "0.5492626", "0.5470154", "0.54658055", "0.5420351", "0.54152876", "0.54079497", "0.5372457", "0.5348835", "0.5337721", "0.53323567", "0.5315764...
0.72551453
0
Returns an OAuth2 access token for a service account. If 'service_account_key' is specified, will use it to generate access token for corresponding .gserviceaccount.com account. Otherwise will invoke app_identity.get_access_token(...) to use app's .gserviceaccount.com account. If 'act_as' is specified, will return an a...
def get_access_token_async( scopes, service_account_key=None, act_as=None, min_lifetime_sec=5*60): # Limit min_lifetime_sec, since requesting very long-lived tokens reduces # efficiency of the cache (we need to constantly update it to keep tokens # fresh). if min_lifetime_sec <= 0 or min_lifetime_sec > 30 *...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_access_token():\n\n scopes = [\n 'https://www.googleapis.com/auth/cloud-platform', 'email', 'profile'\n ]\n\n credentials, _ = default()\n credentials = auth.delegated_credentials(credentials, scopes=scopes)\n\n request = req.Request()\n credentials.refresh(request)\n access_tok...
[ "0.64293814", "0.62425953", "0.6241079", "0.61866224", "0.6051025", "0.59656537", "0.5822332", "0.57262146", "0.5588098", "0.54756904", "0.5468066", "0.5420145", "0.5405318", "0.53775233", "0.5359169", "0.5345706", "0.5345099", "0.53398085", "0.5339717", "0.53306997", "0.5277...
0.717205
0
Gets an access token from the cache or triggers mint flow.
def _get_or_mint_token_async( cache_key, min_lifetime_sec, minter, namespace=_MEMCACHE_NS): # Randomize refresh time to avoid the thundering herd effect when token # expires. Also add 5 seconds extra to make sure callers will get the token # that lives for at least min_lifetime_sec even taking int...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_token(self):\n if self._access_token is None or self._is_expired():\n self._refresh_token()\n return self._access_token", "async def get_access_token(self):\n async with self._access_token_lock:\n if (not self._access_token\n or (not self._access...
[ "0.6953966", "0.6796372", "0.6750112", "0.6744755", "0.6728913", "0.67156637", "0.66578275", "0.66414905", "0.6602784", "0.6552081", "0.6517683", "0.65129894", "0.6460685", "0.64088696", "0.637971", "0.6334511", "0.63166916", "0.63145065", "0.6217851", "0.62160724", "0.621607...
0.68933284
1
Makes URL fetch call aggressively retrying on errors a bunch of times. On success returns deserialized JSON response body. On failure raises AccessTokenError.
def _call_async(url, payload, method, headers): attempt = 0 while attempt < 4: if attempt: logging.info('Retrying...') attempt += 1 logging.info('%s %s', method, url) try: response = yield _urlfetch( url=url, payload=payload, method=method, headers...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retry_get(session, url):\n # Retry if server is down.\n retry_count = 0\n\n while True:\n try:\n r = session.get(url=url)\n r.raise_for_status()\n break\n except Exception:\n if 401 <= r.status_code <= 403:\n raise ConnectionErro...
[ "0.6749661", "0.6710005", "0.6665843", "0.6526654", "0.6425632", "0.6414464", "0.6372785", "0.63026524", "0.6280911", "0.6253435", "0.62278116", "0.62191457", "0.6175396", "0.6170738", "0.6166532", "0.60976726", "0.60386944", "0.60223556", "0.60204417", "0.6009287", "0.598406...
0.7479202
0
True if blob is valid JSON object, i.e '{...}'.
def _is_json_object(blob): try: return isinstance(json.loads(blob), dict) except ValueError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_json(j):\n try:\n json.dumps(j)\n return True\n except json.JSONDecodeError:\n print(\"not valid json\")\n return False", "def isJson(data):\r\n try:\r\n json.loads(data)\r\n return True\r\n except ValueError:\r\n return False", "def is_...
[ "0.7596079", "0.75786364", "0.75764304", "0.73399323", "0.72567904", "0.72371614", "0.7138173", "0.71264887", "0.7004462", "0.6934071", "0.6931526", "0.691715", "0.6903763", "0.6833324", "0.6785462", "0.67171603", "0.66924685", "0.66866654", "0.65450346", "0.6232402", "0.6216...
0.8642789
0
Logs information about the signed JWT. Does some minimal validation which fails only if Google backends misbehave, which should not happen. Logs broken JWTs, assuming they are unusable.
def _log_jwt(email, method, jwt): parts = jwt.split('.') if len(parts) != 3: logging.error( 'Got broken JWT (not <hdr>.<claims>.<sig>): by=%s method=%s jwt=%r', email, method, jwt) raise AccessTokenError('Got broken JWT, see logs') try: hdr = _b64_decode(parts[0]) # includes key I...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(validator: JwtValidator, raw_jwt: _raw_jwt.RawJwt) -> None:\n if validator.has_fixed_now():\n now = validator.fixed_now()\n else:\n now = datetime.datetime.now(tz=datetime.timezone.utc)\n if (raw_jwt.has_expiration() and\n raw_jwt.expiration() <= now - validator.clock_skew()):\n raise...
[ "0.5991539", "0.5385521", "0.5292693", "0.52926177", "0.5226193", "0.5159561", "0.5149951", "0.51400304", "0.509602", "0.5072338", "0.4976363", "0.4959751", "0.49494818", "0.49341166", "0.49315652", "0.4914022", "0.49095118", "0.49027622", "0.48431605", "0.4817264", "0.480277...
0.7501162
0
Byte blob + PEM key => RSASHA256 signature byte blob.
def _rsa_sign(blob, private_key_pem): # Lazy import crypto. It is not available in unit tests outside of sandbox. from Crypto.Hash import SHA256 from Crypto.PublicKey import RSA from Crypto.Signature import PKCS1_v1_5 pkey = RSA.importKey(private_key_pem) return PKCS1_v1_5.new(pkey).sign(SHA256....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign(private_key: RsaKey, content: dict) -> None:\n\n signer = PKCS1_v1_5.new(private_key)\n encoded_content = json.dumps(content, sort_keys=True).encode()\n h = SHA256.new(encoded_content)\n signature = signer.sign(h)\n\n return binascii.hexlify(signature).decode('ascii')", "def sign_message(...
[ "0.64362293", "0.6238569", "0.61767673", "0.6174088", "0.6161144", "0.6160187", "0.6150808", "0.6143679", "0.609354", "0.6092535", "0.60885334", "0.60536665", "0.603091", "0.6020221", "0.59562266", "0.59505326", "0.5930926", "0.59296405", "0.5915348", "0.5913839", "0.5911018"...
0.70118093
0
Map a full csv file to windows of sequence_length elements
def _map_csv_file_to_sequences(self, csv_columns_dict, file_path: str) -> tf.data.Dataset: # We NEED drop_remainder=False, but it's tricky. If the entire csv is smaller than sequence_length, if # drop_remainder=True, the entire csv sequence will be dropped, and we don't what that. But, if drop_remainder...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_readlength_csv(fasta_fn, csv_fn):\n log.info(\"Making read length csv file %s from %s\", csv_fn, fasta_fn)\n rmpath(csv_fn)\n with open(csv_fn, 'w') as writer:\n writer.write(\"'name'\\t'readlength'\\n\")\n cls = FastaReader if (fasta_fn.endswith('.gz') or fasta_fn.endswith('.fasta'...
[ "0.58589494", "0.581646", "0.5814919", "0.56885266", "0.56824255", "0.5431386", "0.536619", "0.53388745", "0.53009677", "0.5299694", "0.52815264", "0.52602404", "0.5215833", "0.5160331", "0.51574504", "0.51453596", "0.5139037", "0.51356304", "0.511603", "0.50869083", "0.50829...
0.68235934
0
r""" Return the minimal rncmodel of a divisor on the projective line, with respect to a discrete valuation.
def minimal_rnc_model(f, v_K): A = f.parent() # K = v_K.domain() # assert A.base_ring() is K, "the base field of f has to be the domain of v_K" X = ModelOfProjectiveLine(v_K, A.variable_name()) F = X.function_field() f = F(f) X.add_horizontal_divisor(f) X.make_minimal_rnc_model() ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getModelPosterior(self, min):\n Sigma = self._getLaplaceCovar(min)\n n_params = self.vd.getNumberScales()\n ModCompl = 0.5 * n_params * \\\n sp.log(2 * sp.pi) + 0.5 * sp.log(sp.linalg.det(Sigma))\n RV = min['LML'] + ModCompl\n return RV", "def minimum_spanning_a...
[ "0.55649084", "0.55603105", "0.54553443", "0.5448555", "0.5384115", "0.53717566", "0.53670186", "0.53358895", "0.53336227", "0.5287796", "0.5271147", "0.5256753", "0.525221", "0.523513", "0.5219274", "0.5123081", "0.5113563", "0.50986373", "0.50964826", "0.5095615", "0.509266...
0.7319308
0
r""" Return whether xi is the generic point of a component.
def is_component(self, xi): T = self.tree() vertex = T.find_point(xi) if not vertex: return False if xi.type() == "II": return not all([not comp.vertex().root().is_equal(xi) for comp in self.vertical_components()]) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ispoint(x):\n if isvect(x) and x[3] > 0.0:\n return True\n return False", "def __contains__(self, point):\n for component, dim in zip(point, self.dimensions):\n if component not in dim:\n return False\n return True", "def has_x(self):\n return any...
[ "0.7179681", "0.6419474", "0.6361386", "0.6335879", "0.6335879", "0.60219115", "0.5992161", "0.59561974", "0.58851105", "0.5865181", "0.58534056", "0.5838632", "0.58334", "0.581279", "0.58020705", "0.57736343", "0.5767795", "0.5750486", "0.57363164", "0.5696354", "0.56921244"...
0.72959125
0
r""" Remove this component from the model.
def remove_component(self, component): component.remove() self._changed = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, component) -> None:\n pass", "def delX(self):\n del self.components[0]", "def delX(self):\n del self.components[0]", "def remove(self, name: str) -> None:\n del self.components[name]", "def RemoveComponent(self, *args):\n return _XCAFDoc.XCAFDoc_ShapeTool...
[ "0.81303656", "0.74919754", "0.74919754", "0.72545755", "0.72391194", "0.71744215", "0.71744215", "0.7164391", "0.7153434", "0.7153434", "0.7153434", "0.71313494", "0.706517", "0.70514894", "0.69843733", "0.69843733", "0.69843733", "0.69843733", "0.69843733", "0.69843733", "0...
0.77671033
1
r""" Add the zeroes and poles of `f` to the horizontal divisor.
def add_horizontal_divisor(self, f): X = self f = X.function_field()(f) D = X.berkovich_line().divisor(f) for xi, m in D: X.add_component(xi)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def div(f):\n num_dims = len(f)\n return np.ufunc.reduce(np.add, [np.gradient(f[i], axis=i) for i in range(num_dims)])", "def fd_center(f, h, x0):\n return (f(x0 + h) - 2*f(x0) + f(x0 - h))/(h**2)", "def pdiv(f, g):\n lev, dom, per, F, G = f.unify(g)\n q, r = dmp_pdiv(F, G, lev, dom)\n ...
[ "0.6062962", "0.55019045", "0.54648024", "0.54593325", "0.539274", "0.5288662", "0.5286539", "0.52818286", "0.52775514", "0.5268813", "0.52523154", "0.5247142", "0.52444327", "0.52248466", "0.5220601", "0.52201", "0.5219418", "0.514708", "0.5131621", "0.5100331", "0.50962824"...
0.77513456
0
r""" Add vertical components to make the tree infclosed. We add vertical components to the set of components such that it becomes infclosed. As a result, any point on the special fiber will lie on at most two components.
def make_inf_closed(self): X = self T = X.tree() for vertex in T.vertices(): X.add_component(vertex)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand_component(img, components, edges, rlso_h=10, rlso_w=10, expand_h=20, expand_w=20,\n max_allowed_long_side=defaults.EXPAND_MAX_LONGER_SIDE,\n max_allowed_short_side=defaults.EXPAND_MAX_SHORTER_SIDE):\n\n mask = np.zeros(img.shape)\n for edge in edges:\n ...
[ "0.5083876", "0.5060827", "0.4919606", "0.49084914", "0.48566923", "0.48544213", "0.4818928", "0.4812157", "0.47973043", "0.4795336", "0.47562703", "0.4745102", "0.4743797", "0.47103652", "0.4683191", "0.46674886", "0.46562856", "0.46215916", "0.46092665", "0.46043175", "0.45...
0.65058166
0
r""" Refine the model to a regular rnc model. We refine the model `X` such that it becomes a regular model and such that the divisor `D` is a normal crossing divisor.
def make_rnc_model(self): X = self # Step 1 for E in X.components(): xi = E.vertex().root() for xi1 in predecessors(xi): X.add_component(xi1) # Step 2 X.make_inf_closed() # Step 3 new_components = [] T = X.tree() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_r_tensor():\n A_op = linear_operator_r(num_w*num_o, D*num_rep, tensors_A, model.x_r, model.xs_l, model.x_orb)\n model.x_r[:,:] = __ridge_complex_lsqr(num_w*num_o, D * num_rep, A_op, y, model.alpha, atol=atol_lsqr, comm=comm).reshape((D, num_rep))", "def nondimensionalize(self):\n ...
[ "0.5587637", "0.52104324", "0.51524675", "0.51033616", "0.5093275", "0.5076428", "0.50753224", "0.5068751", "0.5064509", "0.5032216", "0.50066465", "0.49676096", "0.49610755", "0.49345347", "0.49316055", "0.4928218", "0.49199712", "0.4912838", "0.48500997", "0.48280662", "0.4...
0.59659505
0
r""" Refine the model to a minimal rnc model.
def make_minimal_rnc_model(self, components_to_keep=[]): X = self if not X._is_rnc: X.make_rnc_model() if not X._is_minimal_rnc: while True: E = X.removable_component() if E: X.remove_component(E) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_rnc_model(self):\n X = self\n\n # Step 1\n for E in X.components():\n xi = E.vertex().root()\n for xi1 in predecessors(xi):\n X.add_component(xi1)\n\n # Step 2\n X.make_inf_closed()\n\n # Step 3\n new_components = []\n ...
[ "0.630508", "0.576929", "0.57136357", "0.5666132", "0.54536104", "0.54204005", "0.5381197", "0.53657186", "0.5359335", "0.5354347", "0.5344462", "0.5328338", "0.53138715", "0.53072363", "0.52673566", "0.5253312", "0.52367944", "0.5227551", "0.5226529", "0.51773566", "0.517621...
0.6752392
0
r""" Return a removable component (if one exists).
def removable_component(self): if not self._is_rnc: return None for E in self.vertical_components(): if (E.valency() <= 2 and E.self_intersection() == -1 and all([E1.is_vertical() for E1 in E.neighbors()])): return E
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removable(self) -> bool:\n return self.properties[DBUS_ATTR_REMOVABLE]", "def remove(self, component) -> None:\n pass", "def test_component_remove_ok(self):\n test_name = sys._getframe().f_code.co_name\n self._execute('component remove component1')\n rv, output = self._ex...
[ "0.6271685", "0.599292", "0.5802229", "0.56798565", "0.55830866", "0.556119", "0.5483645", "0.54737496", "0.54557717", "0.5334885", "0.5314873", "0.5298304", "0.5269523", "0.5170945", "0.5148775", "0.51352286", "0.513314", "0.50695044", "0.5062623", "0.5047981", "0.49947262",...
0.6907581
0
r""" Show a graphic representation of the component tree.
def show_tree(self): G, vertex_dict = self.tree().graph() root = self.tree().root() vertical_list = [] horizontal_list = [] no_component_list = [] for i, xi in vertex_dict.items(): if xi.is_equal(root): root_index = i if self.is_com...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotTree(self):\n t = self.make(self.tree)\n t.draw()", "def tree():\n nobv.visual_tree()", "def __repr__(self):\n return self.displayTree(0)", "def drawtree(self):\r\n\r\n Phylo.draw(self.tree)", "def draw_tree(self):\n nx.draw(self.diffusion_tree, with_labels=Tru...
[ "0.7116329", "0.6880963", "0.687941", "0.67947596", "0.67601305", "0.66022277", "0.65472037", "0.6482506", "0.6429593", "0.64010847", "0.63885397", "0.6343218", "0.6339885", "0.6274807", "0.62443036", "0.62443036", "0.62356377", "0.62280554", "0.6218737", "0.6201329", "0.6198...
0.7716309
0
r""" Return the valency of this component. The valency of a component is the number of its neighbors, i.e. the other components which intersect it.
def valency(self): return len(self.neighbors())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vertex_valence(self, idx=-1):\n if idx >= len(self.vertices):\n raise IndexError\n if idx >= 0:\n return np.sum(self.adj[:, idx]) + np.sum(self.adj[idx, :]) - self.adj[idx, idx]\n else:\n return self.adj.sum(axis=1)", "def len(self):\n return m...
[ "0.62729096", "0.6243316", "0.623081", "0.6148876", "0.60621613", "0.60530674", "0.60283023", "0.60259414", "0.6007848", "0.6007041", "0.59651446", "0.59489393", "0.59165126", "0.5877464", "0.5871133", "0.5861997", "0.58568466", "0.58439356", "0.58051497", "0.5788457", "0.577...
0.8152268
0
r""" Return the list of the neighbors of this component. A neighbor of a component is another component which intersects it.
def neighbors(self): vertex = self.vertex() neighbors = vertex.children() if vertex.has_parent(): neighbors.append(vertex.parent()) return [v._attr["component"] for v in neighbors if "component" in v._attr]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighbors(self):\n return self.mesh.neighbors()", "def neighbors(self):\n return self._neighbors", "def neighbors(self):\n return self.graph.neighbors(self.id)", "def get_neighbors(self):\n \n return [neighbor for neighbor,_ in self.neighbors.items()]", "def get_neigh...
[ "0.81812406", "0.80785656", "0.7881611", "0.785588", "0.7847207", "0.7847207", "0.7847207", "0.7847207", "0.77727705", "0.7752649", "0.7677221", "0.76742136", "0.7659327", "0.7634686", "0.76329654", "0.75171083", "0.74922645", "0.7481735", "0.73576885", "0.73568803", "0.73472...
0.8313218
0
r""" Return the selfintersection number of this component.
def self_intersection(self): from sage.rings.integer_ring import ZZ assert self.is_vertical(), "self-intersection number of horizontal component not defined." ret = sum(E.multiplicity() for E in self.neighbors() if E.is_vertical()) ret = -ret/self.multiplicity() assert ret.is_int...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_intra_plate_cluster_distance(self) -> int:\n return self.intra_plate_cluster_distance", "def isect_index(self):\n return self._lazy_isect_index()", "def interior(self):\n return self - self.boundary", "def num_considered(self):\n return self._current", "def nt(self):\n ...
[ "0.5963451", "0.59518653", "0.5900555", "0.5846094", "0.58194846", "0.5807942", "0.57639706", "0.57353735", "0.5726307", "0.5666855", "0.56547546", "0.56463605", "0.56442046", "0.56117374", "0.55960166", "0.55960166", "0.55792016", "0.5574965", "0.55494833", "0.5547442", "0.5...
0.7746958
0
r""" Return the predecessors of this Berkovich point.
def predecessors(xi): X_K = xi.berkovich_line() if xi.is_limit_point(): xi = xi.approximation() y = xi.parameter() v = xi.pseudovaluation_on_polynomial_ring() v_list = v.augmentation_chain()[1:-1] return [X_K.point_from_pseudovaluation_on_polynomial_ring(w, y) for w in v_list...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_predecessors(self, pos: tuple):\n return self.get_successors(pos)", "def get_predecessors(self, node): \n preds = []\n child_state = self.node_to_state(node)\n for it in self.predecessors:\n parent_node = (node[0] + it[0], node[1] + it[1])\n parent_state = self.node_to_state(...
[ "0.77336574", "0.74647355", "0.7312377", "0.70575607", "0.6882676", "0.6880616", "0.6732077", "0.6554532", "0.653753", "0.65045804", "0.6453065", "0.6411364", "0.63785994", "0.6357544", "0.63340384", "0.63139695", "0.6280114", "0.62689817", "0.6225963", "0.6188394", "0.615328...
0.7547226
1
r""" Return the critical residue class of this point.
def critical_residue_class(xi): from sage.rings.infinity import Infinity from mclf.berkovich.type_V_points import TypeVPointOnBerkovichLine if not xi.type() == "II" or xi.is_gauss_point(): return None v = xi.pseudovaluation_on_polynomial_ring() v0 = v.augmentation_chain()[1] if v.E() == ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def piece_coor(self):\n return self.piece_type[self.rotation]", "def cole_coeff(self):\n return self.diseq_coeff(standardize=True)", "def CAMC_class_level(self, class_entity: und.Ent):\n if \"Interface\" in class_entity.kindname():\n return 2.\n\n percentage = class_entit...
[ "0.60656065", "0.5724504", "0.57177883", "0.57002723", "0.5605799", "0.55595136", "0.55285037", "0.5497443", "0.5497443", "0.54714996", "0.54711515", "0.54708683", "0.5463815", "0.5455728", "0.54204273", "0.5417683", "0.53726715", "0.53391033", "0.5333919", "0.5327187", "0.53...
0.69958276
0
r""" Return the resolution chain of a point of type II.
def resolution_chain(xi0, xi1=None): X_K = xi0.berkovich_line() y = xi0.parameter() v0 = xi0.pseudovaluation_on_polynomial_ring() if xi1 is None or xi1.type() == "I": if v0.is_gauss_valuation(): N = 1 else: N = v0.augmentation_chain()[1].E() phi = v0.phi(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getIR2() -> int:\n pass", "def resolution(self, step):\n res_pts = [self.proof[num] for num in step.assms]\n pt_0 = self.proof[step.assms[0]]\n arity1 = self.steps[step.assms[0]-1].arity\n for i in step.assms[1:]:\n arity2 = self.steps[i-1].arity\n assert ...
[ "0.5622787", "0.5543199", "0.54089123", "0.53968316", "0.53968316", "0.51457584", "0.50723773", "0.49955902", "0.49825704", "0.49736786", "0.49306187", "0.4925446", "0.49228638", "0.4920846", "0.48919636", "0.48818153", "0.4871097", "0.48614314", "0.48420197", "0.4833187", "0...
0.6654868
0
r""" Return the shortest Npath from a to aa.
def shortest_path(N, a_0, a_1=None): path = HJ_path(a_1*N, a_0*N) path = [c/d/N for c, d in path] return path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shortest(graph, a, b):\n try:\n s = nx.shortest_path(graph, a, b)\n return s\n except BaseException:\n # try traversing the DiGraph backwards\n s = nx.shortest_path(graph, b, a)\n return s[::-1]", "def find_shortest_path(g, n, s, e):\n dist, prev = lazy_dijkstra(g,...
[ "0.6980032", "0.6464261", "0.6211308", "0.6194923", "0.61639917", "0.6154371", "0.6109509", "0.6107774", "0.60785586", "0.6026781", "0.60193324", "0.60155696", "0.6005275", "0.5991564", "0.5986907", "0.5963779", "0.5957011", "0.5942074", "0.5941289", "0.5923962", "0.59154797"...
0.7492281
0
r""" Return the HirzebruchJung path from s1 to s2.
def HJ_path(s1, s2): from sage.all import xgcd, ceil, floor assert s1 > s2, "s1 must be larger than s2" m1 = s1.numerator() d1 = s1.denominator() m2 = s2.numerator() d2 = s2.denominator() path = [(m1, d1)] while m1 / d1 > s2: _, x, y = xgcd(m1, d1) if d1 * m2 - m1 * d2 > ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_path(self, v0, v2):\n start = self.get_node(v0)\n target = self.get_node(v2)\n return self.astar(start,target)", "def path_to(start, end):\n sol = djikstra(start, end)\n if sol is None:\n return None\n (distances, cost) = sol\n return compute_path(distances, cost, ...
[ "0.6275406", "0.61264414", "0.6126285", "0.60763437", "0.60116184", "0.59512436", "0.5936589", "0.5930217", "0.58587784", "0.5802111", "0.5794838", "0.5789707", "0.5771555", "0.5735118", "0.57074803", "0.570417", "0.56736124", "0.566998", "0.56515783", "0.5645272", "0.5642204...
0.7441027
0
Contract constructor _owner Contract owner address _coins Addresses of ERC20 conracts of coins _pool_token Address of the token representing LP share _A Amplification coefficient multiplied by n (n 1) _fee Fee to charge for exchanges _admin_fee Admin fee
def __init__( _owner: address, _coins: address[N_COINS], _pool_token: address, _A: uint256, _fee: uint256, _admin_fee: uint256 , self=None): for i in range(N_COINS): assert _coins[i] != ZERO_ADDRESS self.coins = _coins self.initial_A = _A * A_PRECISION...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, owner, amount=0):\n self.owner = owner\n self.amount = amount\n self._transaction = []", "def __init__(self, owner, initial_balance=0.0):\n Account.count += 1\n self.owner = owner\n self.account_number = '%sXY-%s-%08d' % (Account.division,\n ...
[ "0.62484443", "0.6060191", "0.59690756", "0.5943244", "0.57800096", "0.5733312", "0.5733312", "0.57311237", "0.5495393", "0.5475052", "0.54444677", "0.5423125", "0.5422002", "0.54150367", "0.5383167", "0.53794825", "0.5347383", "0.5334396", "0.5292339", "0.5269935", "0.524084...
0.7874769
0
The current virtual price of the pool LP token Useful for calculating profits LP token virtual price normalized to 1e18
def get_virtual_price() -> uint256: D: uint256 = self._get_D(self._xp(), self._A()) # D is in the units similar to DAI (e.g. converted to precision 1e18) # When balanced, D = n * x_u - total virtual value of the portfolio token_supply: uint256 = ERC20(self.lp_token).totalSupply() return D * PRECISIO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def price(self):\n return self._safe_value(VAR_PRICE, float)", "def desired_price(self):\n return self._desired_price", "def base_price(self):\n return self._base_price", "def current_price(self) -> Dict[str, int]:\n return self._current_price", "def __get_deal_price(self):\n ...
[ "0.65932363", "0.65562904", "0.6510884", "0.64934933", "0.64291865", "0.63204134", "0.63109577", "0.629016", "0.62893933", "0.62772155", "0.62541765", "0.62437177", "0.62437177", "0.62437177", "0.6230178", "0.6203097", "0.6173806", "0.6173806", "0.6171493", "0.61435056", "0.6...
0.8022648
0
Calculate addition or reduction in token supply from a deposit or withdrawal This calculation accounts for slippage, but not fees. Needed to prevent frontrunning, not for precise calculations! _amounts Amount of each coin being deposited _is_deposit set True for deposits, False for withdrawals Expected amount of LP tok...
def calc_token_amount(_amounts: uint256[N_COINS], _is_deposit: bool) -> uint256: amp: uint256 = self._A() balances: uint256[N_COINS] = self.balances D0: uint256 = self._get_D_mem(balances, amp) for i in range(N_COINS): if _is_deposit: balances[i] += _amounts[i] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deposit(amt) :\r\n\tglobal bal\r\n\tbal_in = bal\r\n\t#PREMISES FOR NEXT LINE: \r\n\t# (amt >= 0)\r\n\t# (bal >= 0)\r\n\t# (bal == bal_in)\r\n\tbal = bal + amt\r\n\t#PREMISES FOR ATTACHED PROOF, IF ANY: \r\n\t# (bal == (bal_old + amt))\r\n\t# (amt >= 0)\r\n\t# (bal_old >= 0)\r\n\t# (bal_old == bal_in)\r\n\t#PR...
[ "0.6339114", "0.6000741", "0.5945407", "0.5938768", "0.5934405", "0.59006387", "0.58866584", "0.58855265", "0.5838834", "0.5772823", "0.5750273", "0.5748759", "0.57377076", "0.5728117", "0.5705449", "0.5701286", "0.57009065", "0.57006747", "0.57006747", "0.57006747", "0.56891...
0.7686162
0
Deposit coins into the pool _amounts List of amounts of coins to deposit _min_mint_amount Minimum amount of LP tokens to mint from the deposit Amount of LP tokens received by depositing
def add_liquidity(_amounts: uint256[N_COINS], _min_mint_amount: uint256) -> uint256: assert not self.is_killed # dev: is killed amp: uint256 = self._A() old_balances: uint256[N_COINS] = self.balances # Initial invariant D0: uint256 = self._get_D_mem(old_balances, amp) lp_token: address = sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_liquidity(_amount: uint256, _min_amounts: uint256[N_COINS]) -> uint256[N_COINS]:\n lp_token: address = self.lp_token\n total_supply: uint256 = CurveToken(lp_token).totalSupply()\n amounts: uint256[N_COINS] = empty(uint256[N_COINS])\n\n for i in range(N_COINS):\n old_balance: uint256 =...
[ "0.6274335", "0.6252441", "0.5881713", "0.5812754", "0.55528057", "0.5470746", "0.54087645", "0.5373065", "0.5361972", "0.5321267", "0.5270432", "0.52693886", "0.5266969", "0.525445", "0.5238999", "0.52280354", "0.51924026", "0.51885754", "0.51885754", "0.51541466", "0.514559...
0.73789334
0
Perform an exchange between two coins Index values can be found via the `coins` public getter method i Index value for the coin to send j Index valie of the coin to recieve _dx Amount of `i` being exchanged _min_dy Minimum amount of `j` to receive Actual amount of `j` received
def exchange(i: int128, j: int128, _dx: uint256, _min_dy: uint256) -> uint256: assert not self.is_killed # dev: is killed old_balances: uint256[N_COINS] = self.balances xp: uint256[N_COINS] = self._xp_mem(old_balances) rates: uint256[N_COINS] = RATES x: uint256 = xp[i] + _dx * rates[i] / PRECISIO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _transfer_coin(self,\n context: 'IconScoreContext',\n params: dict) -> None:\n from_: 'Address' = params['from']\n to: 'Address' = params['to']\n value: int = params.get('value', 0)\n\n self._icx_engine.transfer(context, from_, to, value)"...
[ "0.578856", "0.562697", "0.5464757", "0.53476435", "0.53119123", "0.5298778", "0.5172292", "0.5158998", "0.5053959", "0.50050277", "0.49357444", "0.49233374", "0.49223718", "0.48969835", "0.48451948", "0.48182943", "0.4794722", "0.47769246", "0.4746526", "0.4743713", "0.47354...
0.7525362
0
Withdraw coins from the pool in an imbalanced amount _amounts List of amounts of underlying coins to withdraw _max_burn_amount Maximum amount of LP token to burn in the withdrawal Actual amount of the LP token burned in the withdrawal
def remove_liquidity_imbalance(_amounts: uint256[N_COINS], _max_burn_amount: uint256) -> uint256: assert not self.is_killed # dev: is killed amp: uint256 = self._A() old_balances: uint256[N_COINS] = self.balances D0: uint256 = self._get_D_mem(old_balances, amp) new_balances: uint256[N_COINS] = old...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def burn(amount: int) -> int:\n global total_supply\n\n _assert_is_bank(context.sender)\n total_supply = base.burn(balance_of, total_supply, context.sender, amount)\n return total_supply", "def withdraw(self, amount):\r\n self.balance = self.balance - amount\r\n self.transactions.append...
[ "0.6379062", "0.6300986", "0.6217589", "0.61984175", "0.61920696", "0.6173052", "0.61348873", "0.6098571", "0.60939944", "0.6079627", "0.60102195", "0.59990555", "0.59830105", "0.5953238", "0.5952403", "0.5952403", "0.5942359", "0.5895939", "0.5890844", "0.5881536", "0.587091...
0.6760306
0
Calculate the amount received when withdrawing a single coin _token_amount Amount of LP tokens to burn in the withdrawal i Index value of the coin to withdraw Amount of coin received
def calc_withdraw_one_coin(_token_amount: uint256, i: int128) -> uint256: return self._calc_withdraw_one_coin(_token_amount, i)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_token_amount(_amounts: uint256[N_COINS], _is_deposit: bool) -> uint256:\n amp: uint256 = self._A()\n balances: uint256[N_COINS] = self.balances\n D0: uint256 = self._get_D_mem(balances, amp)\n for i in range(N_COINS):\n if _is_deposit:\n balances[i] += _amounts[i]\n el...
[ "0.6464173", "0.61991566", "0.6083616", "0.60692155", "0.5864373", "0.58533823", "0.58486927", "0.57908744", "0.5750773", "0.57107246", "0.5701739", "0.5695577", "0.56713486", "0.5622521", "0.56049675", "0.55316526", "0.5523169", "0.5504765", "0.5498867", "0.54961497", "0.549...
0.68738365
0
Check if data_out_dfe and data_out_cpu match.
def check(data_out_dfe, data_out_cpu, size): status = 0 for i in range(size): if data_out_dfe[i] != data_out_cpu[i]: print str(data_out_dfe[i]) + " != " + str(data_out_cpu[i]) status = status + 1 return status
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check(correlations_dfe, correlations_cpu, num_timeseries, indices_step):\n failed = 0\n for i in range(num_timeseries * (num_timeseries - 1) / 2):\n j = calc_index(indices_step[2 * i], indices_step[2 * i + 1])\n if correlations_dfe[j] != correlations_cpu[i]:\n failed += 1\n ...
[ "0.63061994", "0.59476465", "0.5612675", "0.5590824", "0.5539899", "0.544543", "0.53825104", "0.5336676", "0.53145164", "0.5309927", "0.52917117", "0.5267094", "0.5265385", "0.5261109", "0.52473336", "0.52463585", "0.5216025", "0.5212736", "0.5184594", "0.5181657", "0.5155266...
0.75012976
0
Calls LMemLoopbackDFE and LMemLoopbackCPU and checks if they return the same result.
def test(): # Input start_time = time.time() size = 384 in_a = [i for i in range(size)] in_b = [size - i for i in range(size)] print ('Generating input data:\t\t\t\t%.5lfs' % (time.time() - start_time)) # DFE Output start_time = time.time() data_out_dfe = lmem_loopback_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MulticastLoopback(self) -> bool:", "def MulticastLoopback(self) -> bool:", "def isLoopbackEnabled(self):\n if DPxIsDoutDinLoopback() == 0:\n enable = False\n else:\n enable = True\n return enable", "def test_live_migration_common_check_checking_cpuinfo_fail(self...
[ "0.5619541", "0.5619541", "0.5568379", "0.50732976", "0.5025254", "0.49277762", "0.49167788", "0.48925838", "0.4823095", "0.48116893", "0.47692746", "0.4755242", "0.46969733", "0.46850154", "0.46679962", "0.4654978", "0.46494955", "0.4648862", "0.46483955", "0.46371126", "0.4...
0.7113063
0
Compute average per cluster (key='_scvi_labels') or per batch (key='_scvi_batch'). Returns pd.DataFrame with variables in rows and labels in columns
def _compute_cluster_averages(self, key="_scvi_labels"): # find cell label column label_col = self.adata.uns["_scvi"]["categorical_mappings"][key]["original_key"] # find data slot x_dict = self.adata.uns["_scvi"]["data_registry"]["X"] if x_dict["attr_name"] == "X": u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_vectors_of_classes(hidden_reps, labels):\n vector_dict = collections.defaultdict(list)\n for label, vector in zip(labels, hidden_reps):\n vector_dict[label].append(vector)\n return pd.DataFrame.from_dict(dict([(label, np.mean(vectors, axis=0)) for label, vectors in vector_dict.items()]),\n ...
[ "0.64381444", "0.5885049", "0.58073866", "0.5786522", "0.5605885", "0.5578359", "0.5573467", "0.555843", "0.5540165", "0.54304475", "0.5426012", "0.5404483", "0.5376678", "0.53703195", "0.5320622", "0.5301181", "0.52953035", "0.52901757", "0.5282877", "0.5275878", "0.5267767"...
0.7366102
0
print all the item needed to craft the items selected a file name "listressource.txt"
def printresultfile(self): itemvoulu = self.resultlist.curselection() list_ressource = {} for i in itemvoulu: print(i) print(self.list_name_item) for item, value in self.list_name_item[self.resultlist.get(i)].items(): if item in list_res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Infor_file():\n \n import os\n import sys\n pdbfile_list()\n\n file_list = pdbfile_list()\n\n items = os.listdir('/home/njesh/python-mini-project-JaneNjeri/PDB_files/')\n \n file_list = [name for name in items if name.endswith('.pdb')]\n\n for count, fileName in enumerate(file_list, ...
[ "0.6027266", "0.6002033", "0.5996043", "0.59859335", "0.58575606", "0.5830068", "0.57213795", "0.567736", "0.56676644", "0.5630337", "0.55845", "0.55770993", "0.5557775", "0.5544399", "0.55402267", "0.5534874", "0.55024856", "0.54266334", "0.5418315", "0.54125047", "0.5407413...
0.7528923
0
Create an index page listing and linking to all languoids of a specified level. glottolog index (family|language|dialect|all)
def index(args): for level in ['family', 'language', 'dialect']: if args.args[0] in [level, 'all']: make_index(level)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n\n INTERFACE.add_dir(u'RÚV', 'view_category', '1')\n INTERFACE.add_dir(u'RÚV Íþróttir', 'view_category', '10')\n INTERFACE.add_dir(u'RÁS 1', 'view_category', '2')\n INTERFACE.add_dir(u'RÁS 2', 'view_category', '3')\n INTERFACE.add_dir(u'Rondó', 'view_category', 'rondo')\n INTERFACE....
[ "0.64846", "0.6077362", "0.5858819", "0.58508366", "0.580936", "0.57031673", "0.5633744", "0.55372274", "0.5495862", "0.5483289", "0.5480132", "0.54753035", "0.5456942", "0.54479104", "0.54166204", "0.54137313", "0.5390623", "0.53867394", "0.5334664", "0.53331167", "0.5308871...
0.7048579
0
Create lff.txt and dff.txt from the current languoid tree. glottolog tree2lff
def tree2lff(args): lff.tree2lff()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lff2tree(args):\n lff.lff2tree(test=args.args and args.args[0] == 'test')\n if args.args and args.args[0] == 'test':\n print(\"\"\"\nYou can run\n\n diff -rbB build/tree/ languoids/tree/\n\nto inspect the changes in the directory tree.\n\"\"\")\n else:\n print(\"\"\"\nRun\n\n git s...
[ "0.6573921", "0.5670163", "0.5447951", "0.5440086", "0.5416621", "0.53938264", "0.53930473", "0.52710426", "0.5208374", "0.5167403", "0.5109023", "0.51080745", "0.50674635", "0.5029002", "0.50170106", "0.5001466", "0.4994771", "0.49875414", "0.49785522", "0.49782285", "0.4956...
0.7967199
0
Recreate tree from lff.txt and dff.txt glottolog lff2tree [test]
def lff2tree(args): lff.lff2tree(test=args.args and args.args[0] == 'test') if args.args and args.args[0] == 'test': print(""" You can run diff -rbB build/tree/ languoids/tree/ to inspect the changes in the directory tree. """) else: print(""" Run git status to inspect changes in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tree2lff(args):\n lff.tree2lff()", "def __init__(self, path2tree, treeformat='newick'):\r\n self.path2tree = path2tree\r\n self.treeformat = treeformat\r\n self.tree = Phylo.read(self.path2tree, self.treeformat)", "def make_tree(fname: str):\n\n tree = PDDL_Tree.create(fname)\n ...
[ "0.74021006", "0.6280137", "0.6276202", "0.6243892", "0.59444016", "0.5926031", "0.58964807", "0.58414763", "0.5801433", "0.5766105", "0.5727481", "0.5680155", "0.5652643", "0.55455536", "0.5503651", "0.548953", "0.5465199", "0.5461262", "0.54085505", "0.5400471", "0.5399969"...
0.7235913
1
Unwrap scenario validators created by validation.validator().
def _get_scenario_validators(self, func_, scenario_, reset=True): if reset: if hasattr(func_, "permission"): del func_.permission if hasattr(scenario_, "validators"): del scenario_.validators scenario = validation.validator(func_)()(scenario_) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_validators(self, value):\r\n for validator in self.validators:\r\n if isinstance(validator, validators.UniqueTogetherValidator):\r\n self.validators.remove(validator)\r\n super(ProfileSerializer, self).run_validators(value)", "def test_validators():", "def test_w...
[ "0.55443984", "0.5517838", "0.5431734", "0.52895904", "0.5289338", "0.5278242", "0.5273942", "0.51683736", "0.5150987", "0.51081014", "0.51077646", "0.51030356", "0.50828314", "0.50501597", "0.503692", "0.50332755", "0.49949232", "0.49933535", "0.49782398", "0.49665526", "0.4...
0.69094545
0
e.g., ellipse((left + margin, margin, right margin, min(device.height, 64) margin), outline="yellow")
def ellipse(self, arg, fill='', outline=''): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_ellipse_outline(center_x, center_y, width, height, color,\n border_width=1, tilt_angle=0):\n\n num_segments = 128\n\n GL.glEnable(GL.GL_BLEND)\n GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA)\n GL.glEnable(GL.GL_LINE_SMOOTH)\n GL.glHint(GL.GL_LINE_SMOOTH_...
[ "0.6479759", "0.64531225", "0.63160884", "0.6295187", "0.62888676", "0.62884647", "0.6262616", "0.6217451", "0.62116826", "0.6174981", "0.61481845", "0.61444783", "0.6116246", "0.61056674", "0.6104291", "0.6087061", "0.60507715", "0.60290843", "0.59710765", "0.596631", "0.595...
0.74815977
0
Returns a set of all unique ngrams observed in file `filename`
def unique_ngrams(filenames, target_speaker, gram_size=1): vocab = list(read_files(filenames, gram_size=gram_size)) child_vocab = set() for _, _, speaker, ngram in vocab: if speaker == target_speaker: child_vocab.add(ngram) return child_vocab
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_ngrams_scored(path):\r\n # This func exists because and only because I forgot to count logDice ranking\r\n ngrams = set()\r\n with open(path, 'r', encoding='utf-8') as f:\r\n for line in f:\r\n if line.startswith('coll'):\r\n pass\r\n else:\r\n ...
[ "0.7147303", "0.6962482", "0.6875011", "0.66457075", "0.6635692", "0.6517794", "0.6492837", "0.64761484", "0.64285", "0.63182515", "0.63167924", "0.62272364", "0.62003857", "0.61796683", "0.6140623", "0.6107387", "0.6083583", "0.60835236", "0.607825", "0.60754144", "0.604951"...
0.7362125
0
Returns a set of all unique ngrams that are shared with the child
def parent_shared_ngrams(filenames, gram_size): all_ngrams = list(read_files(filenames, gram_size=gram_size)) parent_vocab = set() child_vocab = speaker_vocab(filenames, 'CHI') for _, _, speaker, ngram in all_ngrams: if speaker == "MOT": for word in ngram.split(): if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_ngrams(filenames, target_speaker, gram_size=1):\n vocab = list(read_files(filenames, gram_size=gram_size))\n child_vocab = set()\n for _, _, speaker, ngram in vocab:\n if speaker == target_speaker:\n child_vocab.add(ngram)\n return child_vocab", "def ngrams(self):\n ...
[ "0.69190955", "0.6463612", "0.63773775", "0.6284468", "0.6198447", "0.6129034", "0.61043644", "0.60970956", "0.5951845", "0.5901693", "0.58536327", "0.58242565", "0.5794538", "0.5790096", "0.5777482", "0.5775421", "0.5762091", "0.57604164", "0.57534397", "0.5740606", "0.57220...
0.6893962
1
Returns a frequency count of the ngrams in the parent's speech, excluding those that contained any words that did not appear in the child's speech.
def filtered_parent_freq_count(filenames, gram_size): counts = Counter() vocab = list(read_files(filenames, gram_size=gram_size)) parent_list = parent_shared_ngrams(filenames, gram_size=gram_size) for _, _, speaker, ngram in vocab: if speaker == "MOT" and ngram in parent_list: counts...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_family_frequencies(self, parent, family):\n if not family:\n return None\n counts = {}\n n_tokens = 0\n for description_array in family:\n seen = set([])\n for token in description_array:\n counts[token] = counts.get(token, 0) ...
[ "0.6396736", "0.61375445", "0.5856961", "0.5813341", "0.5797779", "0.57622725", "0.57549316", "0.5657696", "0.56156975", "0.5611035", "0.5610772", "0.5604656", "0.560463", "0.5596895", "0.55839807", "0.5567101", "0.5561803", "0.5538538", "0.5505939", "0.54889596", "0.54866064...
0.7373855
0
Create a socket of the given type, bind it to a random port and register it to the poller
def _create_socket(self, socket_type, linger_value): socket = zmq.Context.instance().socket(socket_type) socket.setsockopt(zmq.LINGER, linger_value) socket.set_hwm(0) port_number = socket.bind_to_random_port(LOCAL_ADDR) self.poller.register(socket, zmq.POLLIN) self.logger...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, type, host, port):\n self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n if type == \"server\":\n self._socket.bind((host, port))\n self._socket.listen(1)\n s...
[ "0.73855746", "0.7200254", "0.6737604", "0.6591743", "0.64480716", "0.63431853", "0.63282406", "0.6326136", "0.63057494", "0.6292665", "0.62656385", "0.6257695", "0.62198454", "0.62020344", "0.6151324", "0.61505044", "0.61192185", "0.6116588", "0.6098671", "0.6061921", "0.604...
0.76695836
0
Close all socket handle by this interface
def close(self): if self.push_socket is not None: self.push_socket.close() if self.pull_socket is not None: self.pull_socket.close() if self.control_socket is not None: self.control_socket.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n self.s.close()\n print(\"Socket closed\")", "def close(self):\n self.socket.close()", "def close(self):\n self.socket.close()", "def close(self):\n self.socket.close()", "def close(self):\n self.socket.close()", "def close(self):\n self....
[ "0.76626974", "0.7644357", "0.7644357", "0.7644357", "0.7644357", "0.7644357", "0.7644357", "0.7624725", "0.761387", "0.7603529", "0.7575563", "0.75539756", "0.75144637", "0.75144637", "0.74719465", "0.7465825", "0.7438879", "0.74367285", "0.74130136", "0.7408932", "0.7406897...
0.77275413
0
Send a serialized msg with pickle to the given socket
def _send_serialized(self, socket, msg): socket.send(pickle.dumps(msg))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_pickle(self, obj, flags=0, protocol=-1):\n pobj = pickle.dumps(obj, protocol)\n return self.send(pobj, flags=flags)", "def send_msg_to_server(self, msg_obj=None):\n serialized_msg = pickle.dumps(msg_obj)\n msg_header = general_message_header(len(serialized_msg),BUFFER_LENGTH)...
[ "0.72078466", "0.70128226", "0.6996855", "0.6855018", "0.64961123", "0.6414732", "0.6390094", "0.63375235", "0.6294461", "0.6173786", "0.6165371", "0.61284125", "0.61056006", "0.60595256", "0.6047854", "0.6045518", "0.5955152", "0.5901384", "0.5893523", "0.5892298", "0.587366...
0.87408495
0
Wait for a message from the given socket and return its deserialized value (using pickle)
def _recv_serialized(self, socket): msg = pickle.loads(socket.recv()) return msg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receive_pickle(self,message,address):\n\t\tcomplete=False\n\t\tdata=message\n\t\tprint(\"Address of sender:\",address)\n\t\tpnum=self.pladdr.index(address)+1\n\t\twhile not complete:\n\t\t\ttry:\n\t\t\t\tprint(\"Server trying to 'loads' data\")\n\t\t\t\tpickle.loads(data)\n\t\t\t\tcomplete=True\n\t\t\t\tself.s...
[ "0.72760147", "0.72533613", "0.70670635", "0.6624535", "0.6535923", "0.6528861", "0.6496934", "0.63871974", "0.6376781", "0.6348171", "0.63241905", "0.6316035", "0.63143426", "0.630045", "0.62896127", "0.626314", "0.6235015", "0.6230768", "0.6200144", "0.6199975", "0.6193816"...
0.75483274
0
Connect to the pull socket of this actor Open a push socket on the process that want to communicate with this actor this method shouldn't be called if socket interface was not initialized with the setup method
def connect_data(self): if self.pull_socket_address is None: self._values_available.wait() self.pull_socket_address = LOCAL_ADDR + ':' + str(self._pull_port.value) self.control_socket_address = LOCAL_ADDR + ':' + str(self._ctrl_port.value) self.push_socket = zmq.Con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(self):\n # create the pull socket (to communicate with this actor, others\n # process have to connect a push socket to this socket)\n self.pull_socket, pull_port = self._create_socket(zmq.PULL, -1)\n\n # create the control socket (to control this actor, a process have to\n ...
[ "0.7364541", "0.6505103", "0.64707476", "0.6462317", "0.62658733", "0.6249051", "0.61987215", "0.61749476", "0.6153968", "0.61479247", "0.6135382", "0.61341166", "0.612983", "0.6123467", "0.6033702", "0.6026794", "0.6026725", "0.60167545", "0.5966361", "0.5942245", "0.5925320...
0.6809458
1
Connect to the control socket of this actor Open a pair socket on the process that want to control this actor this method shouldn't be called if socket interface was not initialized with the setup method
def connect_control(self): if self.pull_socket_address is None: self._values_available.wait() self.pull_socket_address = LOCAL_ADDR + ':' + str(self._pull_port.value) self.control_socket_address = LOCAL_ADDR + ':' + str(self._ctrl_port.value) self.control_socket = zm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(self):\n # create the pull socket (to communicate with this actor, others\n # process have to connect a push socket to this socket)\n self.pull_socket, pull_port = self._create_socket(zmq.PULL, -1)\n\n # create the control socket (to control this actor, a process have to\n ...
[ "0.7182905", "0.6746533", "0.67012936", "0.6536102", "0.6491266", "0.6488393", "0.6458929", "0.64453685", "0.64046717", "0.640355", "0.6388376", "0.6379678", "0.63650376", "0.6339296", "0.63259536", "0.6316033", "0.6313516", "0.6311204", "0.6310962", "0.6300292", "0.62841994"...
0.7390313
0
go through each card and mark eligiblity for current actions
def check_cards_eligibility(self): for c in self.hand: c.check_actions(self) for c in self.phand: c.check_actions(self) for c in self.discard: c.check_actions(self) for c in self.active_player.phand: c.check_actions(self) for c in s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_card_action(self, card):\n if card.value == \"7\":\n self.seven_punishment()\n elif card.value == \"8\":\n self.eight_punishment()\n elif card.value == \"9\":\n self.nine_punishment()\n elif card.value == \"B\":\n self.jack_wish()", ...
[ "0.6032979", "0.56922853", "0.54334784", "0.54240274", "0.54082894", "0.5395675", "0.53406924", "0.53203946", "0.5287635", "0.5263892", "0.526179", "0.5260624", "0.5260624", "0.52200913", "0.5212627", "0.51810384", "0.5161486", "0.51375645", "0.5109088", "0.5107522", "0.51006...
0.6539559
0
General all possible fillinsin of letters in formula with digits.
def fill_in(formula): letters = ''.join(set(re.findall(r'[A-Z]', formula))) for digits in itertools.permutations('1234567890', len(letters)): table = string.maketrans(letters, ''.join(digits)) yield formula.translate(table)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_in(formula):\n letters = \"\".join(set(\"\".join(re.findall(\"[A-Z]+\", formula))))\n # print(letters)\n for digits in itertools.permutations('1234567890', len(letters)):\n table = str.maketrans(letters, ''.join(digits))\n yield formula.translate(table)", "def fill_in(rawFormula):...
[ "0.7287875", "0.70078695", "0.6593577", "0.59157944", "0.58476937", "0.5841208", "0.5718677", "0.56900305", "0.5671199", "0.566255", "0.5660028", "0.5657038", "0.56420714", "0.5623358", "0.5582655", "0.5580716", "0.5580194", "0.5572481", "0.55406976", "0.5528573", "0.5525315"...
0.703686
1
Parse all the receipts in a page $($('receiptList')[0], '.receipt')
def get_all_receipts(driver): for rs in driver.find_elements_by_css_selector('#receiptList > .receipt'): m = rs.find_element_by_class_name('merchant').text a = rs.find_element_by_class_name('amount').text tags = get_tags(rs) # created = rs.find_element_by_class_name('created').text ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_page(html):\n\n soup = BeautifulSoup(html, \"html.parser\")\n review_soups = soup.find_all(\"script\", type=\"application/ld+json\")\n\n description_list = []\n for soup in review_soups:\n text = soup.string\n # decode the json into python dict\n js_dict = json.loads(text...
[ "0.5918104", "0.58435255", "0.58188194", "0.57904243", "0.5556428", "0.5508593", "0.5491882", "0.5340022", "0.5337224", "0.5319644", "0.53191775", "0.52593327", "0.5188675", "0.51741016", "0.5160254", "0.5149924", "0.51434594", "0.51386225", "0.5125705", "0.5125278", "0.51094...
0.7097282
0
Adds a random tag to te element e
def add_tag(e, driver): tag = random_tag(8) e.find_element_by_class_name('add-tag').click() driver.find_element_by_class_name('tag_input')\ .send_keys(tag) driver.find_element_by_class_name('tag_input')\ .send_keys(Keys.ENTER) # driver.find_elements_by_class_name('save-tag')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_tag():\n le = string.ascii_lowercase\n t = ''.join(random.choices(le, k=20))\n while t in all_sync_tags:\n t = ''.join(random.choices(le, k=20))\n all_sync_tags.add(t)\n return t", "async def random(self, ctx: \"IceTeaContext\"):\n random_tag = await ctx.guild_data.get_random...
[ "0.65818673", "0.6172663", "0.5825145", "0.5720927", "0.5680862", "0.5654317", "0.56073415", "0.55814886", "0.54953814", "0.5490698", "0.5482699", "0.544681", "0.5446589", "0.54433995", "0.5442182", "0.5436922", "0.54314387", "0.54289097", "0.5411935", "0.5398727", "0.5386961...
0.6847355
0
Adds a receipt and checks if the receipt is available in the page or not.
def test_add_receipts(driver): print("-"*80) print("Test: Adding a receipt") print("-"*80) driver = driver time.sleep(1) old_receipts = list(get_all_receipts(driver)) m, a = add_receipts(driver) if DEBUG>=2: driver.refresh() time.sleep(1) new_receipts = list(get_all_re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_receipt(self, expense_id, receipt):\n url = base_url + expense_id + '/receipt'\n attachments = [{\n 'receipt': {\n 'filename': basename(receipt),\n 'content': open(receipt).read()\n }\n }]\n data = {...
[ "0.6474564", "0.60533386", "0.60503274", "0.59340584", "0.59150124", "0.5709651", "0.5687415", "0.5664679", "0.55857974", "0.5524835", "0.54288006", "0.5311793", "0.53011096", "0.5201266", "0.5190392", "0.51798517", "0.51535845", "0.5153071", "0.51528484", "0.5149826", "0.514...
0.6201582
1
Adds tag to a randomly chosen receipts, and test if the tag appears in the page.
def test_add_tag(driver): print("-"*80) print("Test: Adding a tag") print("-"*80) time.sleep(1) # Get all receipts receipts = driver.find_elements_by_class_name('receipt') # Choose a receipt randomly to add tag i = random.randint(0, len(receipts)-1) e = receipts[i] # Click on...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_tag_available(self, tag):\n if not self.is_tag_available(tag):\n self.available_tags.append(tag)\n return True\n return False", "def add_tag(e, driver):\n tag = random_tag(8)\n e.find_element_by_class_name('add-tag').click()\n \n driver.find_element_by_cla...
[ "0.61787117", "0.58436096", "0.56740206", "0.5673675", "0.56630784", "0.560776", "0.5599565", "0.5599389", "0.55671066", "0.5524673", "0.55101967", "0.5503966", "0.540269", "0.53944606", "0.5385403", "0.5377311", "0.5365164", "0.53577447", "0.53268236", "0.53238463", "0.53207...
0.6953735
0
Selects a random receipt and delets its one of the tag.
def test_del_tag(driver): print("-"*80) print("Test: Deleting a tag") print("-"*80) # Select a random receipt receipts = driver.find_elements_by_class_name('receipt') index_of_random_receipt = random.randint(0, len(receipts)-1) e = receipts[index_of_random_receipt] # Click on the add-ta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_card_to_discard(self):\n random.choice(self.hand.card_list).use()", "def popitem(self):\n all_items = self.items()\n removed_item = random.choice(all_items)\n self[removed_item[0]] = None\n return removed_item", "def randomchooseanddelete():\n\t\tvar = random.choic...
[ "0.56589305", "0.56030184", "0.5574104", "0.5553268", "0.5550799", "0.5537981", "0.5410938", "0.5271329", "0.52251256", "0.5189678", "0.518462", "0.518013", "0.51355296", "0.5100171", "0.50719386", "0.50703305", "0.5046442", "0.5043233", "0.50326264", "0.50287735", "0.5027231...
0.5921851
0
Tests that no duplicate tags are present in any of the receipt rows.
def test_no_duplicate_tag(driver): for i,rs in enumerate(driver.find_elements_by_class_name('receipt')): l = list(get_tags(rs)) if len(l) != len(set(l)): print("There are duplicate tags in the {}-th receipt line"\ .format(i)) print("Found tag: {!r}".format(l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_identify_duplicates_2(self):\n\n ticket1 = ticket.ImportTicket()\n ticket1.id = \"none\"\n ticket1.type = \"replace\"\n ticket1.phage_id = \"none\"\n\n ticket2 = ticket.ImportTicket()\n ticket2.id = \"none\"\n ticket2.type = \"replace\"\n ticket2.pha...
[ "0.64517295", "0.63557196", "0.63374513", "0.63146347", "0.62994874", "0.6062375", "0.5988476", "0.5920074", "0.5837031", "0.5792533", "0.5742825", "0.5715697", "0.56995887", "0.5624811", "0.5606689", "0.5596342", "0.5590627", "0.5542353", "0.5532762", "0.54885316", "0.546058...
0.7634636
0
Use only the primary patch names.
def normalize_patch_names(self): # possibly busted -- don't use unless you know what you're doing self.set_all_levels(self.levels.copy())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_base_patch_attribute(self, name):\n return getattr(self.patches[0],name)", "def select_patch(self, pset, name):\n new_pset = {}\n local = []\n for p in pset.pop(name, []):\n if p.path:\n new_pset[p.pop()] = [p]\n else:\n loc...
[ "0.58377707", "0.56666094", "0.5597444", "0.5579668", "0.5453649", "0.5399043", "0.5339904", "0.53296804", "0.5318845", "0.53062016", "0.5186838", "0.5186247", "0.51232326", "0.5088145", "0.5077108", "0.5073389", "0.50535864", "0.5053332", "0.50263005", "0.50233734", "0.50104...
0.6785791
0
Get a copy of this sumbaster that only uses the primary patch names. The levels will be the same.
def get_normalized_copy(self): newsub = Submaster("%s (normalized)" % self.name, temporary=1) newsub.set_all_levels(self.levels) return newsub
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_patch_names(self):\n # possibly busted -- don't use unless you know what you're doing\n self.set_all_levels(self.levels.copy())", "def select_patch(self, pset, name):\n new_pset = {}\n local = []\n for p in pset.pop(name, []):\n if p.path:\n ...
[ "0.6610615", "0.55338424", "0.5316381", "0.50903565", "0.4965529", "0.49571154", "0.48675856", "0.48469475", "0.4844921", "0.4835232", "0.48207238", "0.47844133", "0.4756528", "0.4659601", "0.46503493", "0.46458557", "0.4645491", "0.46413666", "0.46378627", "0.46317893", "0.4...
0.57336044
1
Returns a new sub that is a crossfade between this sub and another submaster.
def crossfade(self, othersub, amount): otherlevels = othersub.get_levels() keys_set = {} for k in self.levels.keys() + otherlevels.keys(): keys_set[k] = 1 all_keys = keys_set.keys() xfaded_sub = Submaster("xfade", temporary=1) for k in all_keys: x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def single_crossover(self, original1, original2):\n point=self.r.uniform(0.1,0.6)\n cut1=int(point*len(original1))\n cut2=int(point*len(original2))\n child1=original1[:cut1]+original2[cut2:]\n child2=original2[:cut2]+original1[cut1:]\n return child1, child2", "def cross_...
[ "0.5533875", "0.53190196", "0.51839143", "0.51807356", "0.516271", "0.51314044", "0.50931656", "0.5081098", "0.50494057", "0.4948672", "0.48324168", "0.48280615", "0.4818816", "0.48025087", "0.47644114", "0.4739545", "0.47050485", "0.4703831", "0.4700212", "0.468024", "0.4679...
0.6667901
0
Fades between two floats by an amount. amount is a float between 0 and 1. If amount is 0, it will return the start value. If it is 1, the end value will be returned.
def linear_fade(start, end, amount): level = start + (amount * (end - start)) return level
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_fade(f):\n\n return 6 * f**5 - 15 * f**4 + 10 * f**3", "def note(f, start, end, fade=.01):\n\n def sampler(t):\n seconds = t / frame_rate\n if seconds < start:\n return 0\n elif seconds > end:\n return 0\n elif seconds < start + fade:\n ...
[ "0.63774043", "0.58785605", "0.57970434", "0.57820743", "0.5732445", "0.55991083", "0.55940306", "0.54289734", "0.5340329", "0.52971613", "0.52749896", "0.5232748", "0.52009887", "0.52002275", "0.51993597", "0.5190919", "0.5162115", "0.5096275", "0.50267357", "0.501857", "0.5...
0.71994865
0
Make a submaster with chans at full.
def fullsub(*chans): return Submaster('%r' % chans, leveldict=dict([(c, 1.0) for c in chans]), temporary=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slave_to_master():\n print(\"Shifting from slave to master\")\n stop_slave_worker()\n setup_slave_web()\n pull_from_slave()\n commit_pull_to_db()\n stop_slave_web()\n start_master_worker()\n print(\"DONE!\")", "def _createMaster(self, *args, **kwds):\n raise NotImplementedError...
[ "0.58434314", "0.5790138", "0.577078", "0.5688928", "0.5688928", "0.56830597", "0.5652936", "0.56389004", "0.5592588", "0.5241908", "0.51976085", "0.51319396", "0.5120436", "0.5092865", "0.506428", "0.5058892", "0.50532806", "0.505305", "0.5025217", "0.5023051", "0.5001885", ...
0.72206587
0
Get (and make on demand) the global instance of Submasters
def get_global_submasters(): global _submasters if _submasters is None: _submasters = Submasters() return _submasters
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_as_global(self):\n return setup(env=self)", "def getCore(cls):\n if RegistryCore in SingletonMetaClass._instances:\n return SingletonMetaClass._instances[RegistryCore]\n else:\n dummyCore = RegistryCore() # Which will persist because it is a singleton\n ...
[ "0.61441386", "0.5998967", "0.5872403", "0.5779558", "0.5716639", "0.5647827", "0.5647827", "0.55729216", "0.5532796", "0.5526975", "0.5435401", "0.5431643", "0.53985244", "0.53905225", "0.53872716", "0.53734785", "0.5368312", "0.5367188", "0.5337147", "0.531928", "0.52608085...
0.844328
0
name is a channel or sub nama, submasters is a Submasters object. If you leave submasters empty, it will use the global instance of Submasters.
def get_sub_by_name(name, submasters=None): if not submasters: submasters = get_global_submasters() if name in submasters.get_all_sub_names(): return submasters.get_sub_by_name(name) try: val = int(name) s = Submaster("#%d" % val, leveldict={val : 1.0}, temporary=True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_global_submasters():\n global _submasters\n if _submasters is None:\n _submasters = Submasters()\n return _submasters", "def getSlave(name):", "def __init__(self,name):\n self.name=name", "def choose_master(searchname):\n masters = get_masters()\n masternames = []\n master_l...
[ "0.60327685", "0.5456186", "0.52233124", "0.52174276", "0.5192696", "0.5189498", "0.515374", "0.515374", "0.515374", "0.515374", "0.515374", "0.515374", "0.515374", "0.515374", "0.515374", "0.515374", "0.515374", "0.515374", "0.51509494", "0.51326793", "0.511801", "0.511137...
0.6861665
0
Get block links that needs to be scraped
def get_block_links(driver, flat_link): success = False while not success: try: driver.get(flat_link) links = [ a.find_element_by_tag_name("div").get_attribute("onclick") for a in driver.find_element_by_tag_name( "table" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrape_links(links):\n chrome_options = set_chrome_options()\n driver = webdriver.Chrome(ChromeDriverManager().install(), options=chrome_options)\n # driver = webdriver.Chrome(ChromeDriverManager().install())\n data = []\n click.secho(\"Processing Blocks\", fg=\"green\")\n for link in links:\...
[ "0.64953417", "0.63744885", "0.63381374", "0.6304446", "0.6284163", "0.6245196", "0.6236293", "0.62197006", "0.62188816", "0.62003785", "0.6200064", "0.61960524", "0.61911696", "0.6149259", "0.6149259", "0.6077804", "0.60738134", "0.6063514", "0.60611784", "0.6055509", "0.605...
0.69733745
0
Get unit details such as price, unit number and size of the flat
def get_unit_details(driver): unit_details = [ a for a in driver.find_elements_by_xpath("//span[contains(@class, 'tooltip')]") if "$" in a.get_attribute("title") ] data = [] for unit in unit_details: unit_dict = {} unit_dict["Unit"] = unit.get_attribute("data-sele...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_units(self, unit_tag):\n\n # a list that contains apartment unit's information\n unit = []\n # use a loop to list all the cells in a row \n for cell in unit_tag.find_all('td'):\n if cell.attrs: # omit the cell with nothing in it \n # look for the apart...
[ "0.65363365", "0.6247561", "0.62094957", "0.6176072", "0.60823435", "0.60677147", "0.60247993", "0.59882915", "0.5932856", "0.5925027", "0.59137136", "0.59080875", "0.5906841", "0.59064364", "0.58812594", "0.581311", "0.5801488", "0.5773368", "0.57587975", "0.57579017", "0.56...
0.62567747
1
Sets chrome options for Selenium. Chrome options for headless browser is enabled.
def set_chrome_options(): chrome_options = Options() chrome_options.add_argument("--headless") chrome_options.add_argument("--no-sandbox") chrome_options.add_argument("--disable-dev-shm-usage") chrome_prefs = {} chrome_options.experimental_options["prefs"] = chrome_prefs chrome_prefs["profil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chrome_options(chrome_options):\n # https://pytest-selenium.readthedocs.io/en/latest/user_guide.html#id2\n chrome_options.add_argument(\"--headless\")\n return chrome_options", "def get_driver_options():\n # Define Browser Options\n chrome_options = Options()\n chrome_options.add_argument(\...
[ "0.8496415", "0.7502271", "0.7380162", "0.732335", "0.7207787", "0.72045255", "0.7193336", "0.71788657", "0.71749604", "0.7159074", "0.69817954", "0.6930866", "0.69131696", "0.68333215", "0.67308944", "0.66156524", "0.65814704", "0.6520646", "0.64218086", "0.6401822", "0.6392...
0.8364757
1
inspect files for terms and package in report
def process(self, terms): for entry in self.files: try: logger.info('file - {0}'.format(entry.path)) # notional output file path path_sentences = self.path.joinpath('{0}.csv'.format(entry.path.stem)) path_summary = self.path.joinpath('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inspect_doc(self, file, terms):\n # populate with studies in loop\n reports = []\n\n # extract text and do the search\n for i, chunk in enumerate(file.content_chunks()):\n\n study = self.inspect_text(chunk, terms)\n\n for entry in study:\n # only...
[ "0.58868176", "0.5764706", "0.554264", "0.54554343", "0.5339803", "0.53092337", "0.5306702", "0.5306702", "0.5279815", "0.5256303", "0.5224792", "0.52182484", "0.52127594", "0.5207112", "0.51852155", "0.51701903", "0.5164076", "0.5128097", "0.5112102", "0.51082677", "0.509898...
0.6321172
0
This will assign each uniqueSynIDBabelNetDict item to its belonging doc's index's synsetID in docIndexBabelSynsetID. It will return a new dict contains docIndexLangTrans which only contains each translation's simple lemma.
def queryBabelNetSimpleLemma(docIndexBabelSynsetID, keyset = ['0b8bb0c1-7e51-41f6-8d32-31d15a9ca7ad',\ '29738119-195a-42c8-ace1-8a78de74b891'], limit = 1000): uniqueSynIDBabelNetDict = getUniqueSynsetIDInfo(docIndexBabelSynsetID,\ keyset, limit) return uniqueSynIDDict2docIndexLangSimpleLemma\ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_rel_doctitle_dict():\n claim_rel_docno_dict = {} #key is claim text, value is a set of doc_title that are relevant\n clm_sen_doc_title_dict = read_pickle(\"sen_doc_title_dict\")\n claim_sen_true_relevance_dict = read_pickle(\"claim_sen_relevance_dict_\"+curr_source)\n exclude = set(string.pu...
[ "0.5330593", "0.503289", "0.49542165", "0.4926849", "0.48962122", "0.48810023", "0.48669112", "0.4849703", "0.4818311", "0.4808446", "0.47217777", "0.47156107", "0.47085276", "0.46934414", "0.468521", "0.4650607", "0.4636594", "0.4608131", "0.45931166", "0.45893452", "0.45717...
0.54201746
0
Return the renderable's type (or class)
def getType(self, renderable): if hasattr(renderable, 'type'): return renderable.type return renderable.__class__.__name__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_type(self):\n return self.type", "def get_type(self):\n return self.type", "def get_type ( self, object ):\n return self.type", "def get_type ( self, object ):\n return self.type", "def _get_type(self):\n return self.__type", "def _get_type(self):\n return self._...
[ "0.738765", "0.738765", "0.7356796", "0.7356796", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0...
0.87245935
0
Puts a stream to a URI as a steam
def put(self, stream, uri): osaka.utils.LOGGER.debug("Putting stream to URI: {0}".format(uri)) path = osaka.utils.get_uri_path(uri) # Attempt to create the directories needed try: self.webdav.mkdirs(os.path.dirname(path)) self.webdav.delete(path) except Ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _put_stream(\n session: \"Session\",\n url_tail: str,\n stream: Any,\n params: Optional[Dict[str, Any]] = None,\n) -> None:\n _put(session, url_tail, params=params, stream=stream)", "def push(self, stream, url, chunk_size=BaseStorageConnector.CHUNK_SIZE, hashes={}):\n data_remaining = T...
[ "0.7054951", "0.64119333", "0.6110452", "0.6086386", "0.604635", "0.59401935", "0.59182334", "0.5894305", "0.58401287", "0.58284074", "0.58060104", "0.57905805", "0.5720501", "0.5701586", "0.5699771", "0.568601", "0.5669447", "0.5650895", "0.56434804", "0.56145215", "0.557887...
0.68627423
1
Detect if this uri is a composite uri (uri to collection of objects i.e. directory)
def isComposite(self, uri): return self.httpHandler.isComposite(re.compile("^dav").sub("http", uri))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def equals(self, uri):\r\n return self.uri == uri.uri", "def __contains__(self, uri):\n\t\treturn uri in self._uris", "def exists(self, uri):\n nodes = self.nodes\n parts = uri.strip(\"/\").split(\"/\")\n while parts:\n item = parts.pop(0)\n if item in nodes:\n...
[ "0.6044663", "0.59846824", "0.56538606", "0.547975", "0.5412995", "0.53839725", "0.53809494", "0.53663313", "0.5299749", "0.5286439", "0.52351284", "0.52337736", "0.5166748", "0.5152837", "0.51354367", "0.5079929", "0.5077022", "0.5007033", "0.50047165", "0.49976695", "0.4975...
0.7831748
0
Try to identify if this ID is a Diaspora ID.
def identify_id(id: str) -> bool: return validate_handle(id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_is_sys_id(value):\n return re.match(r'^[A-Za-z0-9]{32}$', value) is not None", "def is_id(string):\n regex = re.compile('[0-9a-f]{32}\\Z', re.I)\n if bool(regex.match(string)):\n return True\n\n return False", "def is_id(self):\n found = False\n for p in self.ant:...
[ "0.59963197", "0.59421945", "0.593698", "0.58225274", "0.58214414", "0.57790256", "0.5756167", "0.57188654", "0.5654986", "0.56482553", "0.56460714", "0.56319267", "0.56233346", "0.5620309", "0.5589509", "0.55803376", "0.55722827", "0.55430007", "0.5532444", "0.54714316", "0....
0.6429384
0
Try to identify whether this is a Diaspora request. Try first public message. Then private message. The check if this is a legacy payload.
def identify_request(request: RequestType): # Private encrypted JSON payload try: data = json.loads(decode_if_bytes(request.body)) if "encrypted_magic_envelope" in data: return True except Exception: pass # Public XML payload try: xml = etree.fromstring(en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_request_id(\n self,\n message: W24TechreadMessage\n ) -> None:\n self.assertEqual(type(message.request_id), UUID)", "def test_parse_request_type_1b(self):\n req_type, errors = self._exec_parse(test_source=MessageEventType.MAAS_REQUEST, session_secret=self.session_secret,...
[ "0.5976573", "0.5566071", "0.5507683", "0.5502372", "0.54410976", "0.53419185", "0.52768904", "0.52765584", "0.5259478", "0.52162665", "0.51526713", "0.50846195", "0.5070117", "0.50653064", "0.5056263", "0.5053988", "0.50189286", "0.50047797", "0.49829745", "0.4969264", "0.49...
0.6161511
0
Get the Magic Envelope, trying JSON first.
def store_magic_envelope_doc(self, payload): try: json_payload = json.loads(decode_if_bytes(payload)) except ValueError: # XML payload xml = unquote(decode_if_bytes(payload)) xml = xml.lstrip().encode("utf-8") logger.debug("diaspora.protocol.st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def envelope(self) -> ty.Optional[reapy.Envelope]:\r\n ...", "def _get(self, endpoint):\n res = self._request(\"get\", endpoint)\n if not res.content:\n return {}\n try:\n res = res.json()\n except ValueError:\n raise ValueError(\"Cannot parse {...
[ "0.58300304", "0.52251226", "0.517581", "0.51550686", "0.51502216", "0.5089819", "0.5088869", "0.49445137", "0.4938673", "0.49159572", "0.49054477", "0.48548508", "0.48404655", "0.48331526", "0.48033655", "0.47506374", "0.47504154", "0.47300792", "0.4723121", "0.47184947", "0...
0.5803346
1
Receive a payload. For testing purposes, `skip_author_verification` can be passed. Authorship will not be verified.
def receive( self, request: RequestType, user: UserType = None, sender_key_fetcher: Callable[[str], str] = None, skip_author_verification: bool = False) -> Tuple[str, str]: self.user = user self.get_contact_key = sender_key_fetcher self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def consume(self, payload):\n raise NotImplementedError()", "def parse_payload(self, reader, *args):\n self.public_key = VerifyingKey(base58.b58encode(reader.read_octet_string(Ed25519Fulfillment.PUBKEY_LENGTH)))\n self.signature = reader.read_octet_string(Ed25519Fulfillment.SIGNATURE_LENGTH)...
[ "0.61539936", "0.5716426", "0.5672425", "0.55479646", "0.55434424", "0.5535404", "0.5526889", "0.5324167", "0.5275576", "0.52546746", "0.5214359", "0.5210298", "0.51711327", "0.5140142", "0.51385045", "0.5129198", "0.5123276", "0.5112027", "0.5058972", "0.5022598", "0.5013941...
0.58068484
1
Verify the signed XML elements to have confidence that the claimed author did actually generate this message.
def verify_signature(self): if self.get_contact_key: sender_key = self.get_contact_key(self.sender_handle) else: sender_key = fetch_public_key(self.sender_handle) if not sender_key: raise NoSenderKeyFoundError("Could not find a sender contact to retrieve key")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify(self):\n if not self.public_key:\n self.fetch_public_key()\n data = self.doc.find(\".//{http://salmon-protocol.org/ns/magic-env}data\").text\n sig = self.doc.find(\".//{http://salmon-protocol.org/ns/magic-env}sig\").text\n sig_contents = '.'.join([\n dat...
[ "0.6460989", "0.6012024", "0.5928324", "0.58900124", "0.58766717", "0.58533514", "0.5705952", "0.57010704", "0.57010704", "0.57008016", "0.5696933", "0.56610656", "0.5656039", "0.5643142", "0.5613317", "0.5607168", "0.5607168", "0.55957574", "0.55839974", "0.55581915", "0.554...
0.635598
1
Test whether template messages are filled in correctly
def test_template(): # Keywords and values to be filled into the template items = {'item_1': 'First', 'long_keyword_item_2': 'Second', 'space_3': 'Third Third Third ', 'item_4': 'Fourth', 'item_5': None} sender = 'dummy@moc.org' receiver = 'dummy@moc.org' result = 'F...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_template_feedback(self):\r\n pass", "def test_no_template(self):\n template = ''\n value_count = 2\n msg = 'No template has been provided for formatting multiple fields.'\n with six.assertRaisesRegex(self, ValidationError, msg):\n validate_str_substitution(t...
[ "0.70445824", "0.69512606", "0.6756586", "0.6515136", "0.6505775", "0.63853836", "0.63569164", "0.63475287", "0.6342673", "0.6311789", "0.6182489", "0.6177041", "0.6113845", "0.6097171", "0.6028403", "0.6024074", "0.60189646", "0.60169435", "0.60158145", "0.5994536", "0.59719...
0.72762394
0
Restore unit name from operator storage.
def restore(self, snapshot): self.unit_name = snapshot["unit_name"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unset_current_units(self, utype):\n try:\n cunits = self._saved_units[utype]\n except KeyError:\n raise Exception(\"Units to restore not found\")\n \n if utype in self.allowed_utypes:\n if cunits in self.units[utype]:\n self.curren...
[ "0.5882164", "0.5470842", "0.53259164", "0.5200672", "0.5197964", "0.5142684", "0.51369697", "0.51304567", "0.51059127", "0.508888", "0.5024236", "0.5002708", "0.5002232", "0.4978874", "0.49773827", "0.49704474", "0.49696362", "0.4954233", "0.4941948", "0.49404556", "0.493762...
0.69181377
0
Determine the indices for labels that are not corrupted in the dataset.
def get_valid_indices(labels): idxs = (labels != invalid_labels[0]) for l in invalid_labels[1:]: idxs = idxs & (labels != l) return idxs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_unlabeled_idx(X_train, labeled_idx):\n return np.arange(X_train.shape[0])[np.logical_not(np.in1d(np.arange(X_train.shape[0]), labeled_idx))]", "def test_label_indices_unknown():\n with pytest.raises(ValueError):\n util.get_label_indices(3, \"random_str\")", "def labeled_indices(self):\n ...
[ "0.71164936", "0.6890843", "0.66725874", "0.6499322", "0.6470832", "0.6461701", "0.6385171", "0.63188404", "0.6288615", "0.62110835", "0.6081898", "0.60789007", "0.6048194", "0.60084397", "0.60058415", "0.5992234", "0.5959932", "0.59489834", "0.59395844", "0.5922739", "0.5922...
0.767029
0
How large is the memory footprint of conf, based on its name. Will be fooled by a character sequence of 'g' followed by a ''.
def parse_memsize(conf): def is_int(x): try: int(x) return True except ValueError: return False return int([x[:-1] for x in conf.split('-') if x.endswith('g') and is_int(x[:-1])][0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stats_conf(cls, name, parsed_conf):\n return [('%s.byte_count' % name, 'sum')]", "def const_size():\r\n return 1000.0", "def parse_conf(cls, name, conf):\n return {'chunk_read': conf.get_int(name, 'chunk_read', 65536)}", "def __repr__(self):\n return \"This {} has {} GB of memory\...
[ "0.5902921", "0.583913", "0.58113116", "0.5456372", "0.5391151", "0.5356007", "0.53244126", "0.5324148", "0.5314864", "0.5306662", "0.52871865", "0.52870625", "0.52672195", "0.52419114", "0.52418697", "0.5218706", "0.52169126", "0.52168775", "0.5185539", "0.51632905", "0.5160...
0.6888114
0
Write centrality values to disk in a sorted order
def writeCentrality(filename, data): filePath = os.path.join(CONFIG['CENTRALITIES_PATH'], filename) f = open(filePath, "w") data = {k: v for k, v in sorted( data.items(), key=lambda x: x[1], reverse=True)} for k, v in data.items(): text = f"{k:<4}\t{v:.6f}\n" f.write(text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_concordance(self, filename):\n out = ''\n values = [x for x in self.concordance_table.hash_table if x is not None]\n values.sort(key=lambda x: x[0])\n for v in values:\n out += f'{v[0]}: {\" \".join(str(x) for x in sorted(set(v[1])))}\\n' \n with open(filenam...
[ "0.60706383", "0.6037458", "0.5878708", "0.5682553", "0.56810784", "0.56637853", "0.5599887", "0.5573662", "0.55650854", "0.5537689", "0.55024195", "0.5464176", "0.54634184", "0.54443085", "0.5426661", "0.542125", "0.54044104", "0.53835964", "0.53779113", "0.5361577", "0.5359...
0.66767085
0
Returns an icon and color for the current battery status.
def _get_icon_and_color(status, percent): # ACPI incorrectly reports Unknown status when battery is full. if status == _STATUS_CHARGING or status == _STATUS_UNKNOWN: return (_ICON_CHARGE, _get_xres('i3blocks.Battery.charging')) elif percent < 13: return (_ICON_BATTERY0, _get_xres('i3blocks.Battery.wa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def icon(self) -> str:\n return icon_for_battery_level(\n battery_level=self._device.battery_level,\n charging=self._device.battery_status == \"Charging\",\n )", "def icon(self):\n if self._sensor_type == \"battery_level\" and self._state is not None:\n retur...
[ "0.7368904", "0.7080904", "0.6770462", "0.6676303", "0.666014", "0.6639815", "0.6630334", "0.65848225", "0.6547445", "0.65156764", "0.65122", "0.6509895", "0.64397836", "0.64348817", "0.6421024", "0.6402484", "0.6393751", "0.6383948", "0.6379605", "0.6368297", "0.6336585", ...
0.74303985
0
Send the unlock command to the ISY device.
async def async_unlock(self, **kwargs: Any) -> None: if not await self._node.secure_unlock(): raise HomeAssistantError(f"Unable to unlock device {self._node.address}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def unlock_socket(self, **kwargs) -> None: # pylint: disable=unused-argument\r\n await self._send(\"unlock\")", "def unlock(self, volume, _cfg=None) :\n name_or_id = self.get_name_or_id(volume)\n CmdList=[_cfg.binaries[\"vos\"], \"unlock\",\"-id\" ,\"%s\" % name_or_id, \"-cell\", \"%...
[ "0.6933005", "0.6880047", "0.6764243", "0.6674355", "0.65612656", "0.6523741", "0.65057546", "0.6444326", "0.63621765", "0.6292668", "0.62738365", "0.6243749", "0.6237608", "0.61635226", "0.6132243", "0.61316955", "0.61226827", "0.61185473", "0.6117652", "0.60763335", "0.6063...
0.7108106
0
Set a user lock code for a ZWave Lock.
async def async_set_zwave_lock_user_code(self, user_num: int, code: int) -> None: if not await self._node.set_zwave_lock_code(user_num, code): raise HomeAssistantError( f"Could not set user code {user_num} for {self._node.address}" )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_lock(self, value):\n act = LockAction(self, value)\n return act.invoke()", "def bdev_opal_set_lock_state(client, bdev_name, user_id, password, lock_state):\n params = {\n 'bdev_name': bdev_name,\n 'user_id': user_id,\n 'password': password,\n 'lock_state': loc...
[ "0.63590306", "0.6249155", "0.62183875", "0.59769493", "0.59599304", "0.5901474", "0.5836311", "0.57592857", "0.5626843", "0.5608006", "0.5600001", "0.5518261", "0.54043525", "0.5400554", "0.53396076", "0.52960056", "0.5278731", "0.52023333", "0.5202007", "0.5099273", "0.5099...
0.8170936
0
Delete a user lock code for a ZWave Lock.
async def async_delete_zwave_lock_user_code(self, user_num: int) -> None: if not await self._node.delete_zwave_lock_code(user_num): raise HomeAssistantError( f"Could not delete user code {user_num} for {self._node.address}" )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_lock(self, lock_name):\n path = '/locks/delete/%s' % lock_name\n response = self.rest.request(content_type='text/plain',\n method='delete', path=path)\n return response.ok", "def remove_lock(lockfilename):\n if os.path.isfile(lockfilename...
[ "0.6468142", "0.60991776", "0.60766983", "0.60018265", "0.59561795", "0.5938285", "0.59352523", "0.5836511", "0.58137447", "0.58059436", "0.57329696", "0.5720484", "0.5700564", "0.5658155", "0.56113094", "0.55580187", "0.55230284", "0.54913527", "0.5483612", "0.54719645", "0....
0.7895677
0
Make figure 1 with sample sizes, AUCs, number of significant genera, and direction of shift. Note that 'edd_singh' should be converted to 'cdi_singh' in all of these inputs.
def plot_fig1(dysbiosis, dataset_order, samplesizes, edd_color=False): disease_colors = fmt.get_disease_colors() # Make color palette dictionary that has all of the datasets # Note: need trailing underscore so that cd studies are not considered cdi diseases = set([i.split('_')[0] + '_' for i in dataset_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fig1a():\n # fmt: off\n tpm = np.array([\n [0, 0, 0, 0, 0, 0],\n [0, 0, 1, 0, 0, 0],\n [1, 0, 1, 0, 1, 0],\n [1, 0, 0, 0, 1, 0],\n [1, 0, 0, 0, 0, 0],\n [1, 1, 1, 0, 0, 0],\n [1, 0, 1, 0, 1, 0],\n [1, 1, 0, 0, 1, 0],\n [1, 0, 0, 0, 0, 0],\n ...
[ "0.58824545", "0.5732328", "0.5641182", "0.5567753", "0.5508082", "0.550383", "0.5480538", "0.5412664", "0.54065424", "0.5347281", "0.53468496", "0.53282726", "0.5326497", "0.53225636", "0.5300855", "0.5290681", "0.5252", "0.5245081", "0.5244896", "0.5240326", "0.52390766", ...
0.5809068
1
Returns the number of marked points in this space
def n(self): return len(self.marks)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nr_points(self):\n return len(self.x)", "def Points_Counting(self):\n return len(self.__traectory_list)", "def get_position_count(self):\n return self.positions.count()", "def remaining(self):\n\t\tmines = sum(1 for _ in self.get_mines())\n\t\tmarked = sum(1 for x in range(self.width...
[ "0.696392", "0.67317307", "0.67282224", "0.67231625", "0.66830474", "0.663576", "0.66085297", "0.6584659", "0.65598637", "0.65361863", "0.64434", "0.64434", "0.6428971", "0.64273876", "0.6387803", "0.6330457", "0.6312989", "0.629933", "0.6259385", "0.624347", "0.6226892", "...
0.7444573
0
Assuming that this Mgn represents a reducible componet, then find its complement in the big_space.
def complementary_component(self, big_space): if not self.marks.issubset(big_space.marks): print(self, big_space) raise Exception("Bad marked points") if not self.genus <= big_space.genus: raise Exception("Bad genus") return Mgn(big_space.genus - self.genus, b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_complement(num):\n pass", "def findComplement(self, num: int) -> int:\n n = num\n xor = 1\n while n > 0:\n num = num ^ xor\n xor = xor << 1\n n = n >> 1\n return num", "def __neg__(self):\n return self[::-1].complement", "def com...
[ "0.63396746", "0.61063755", "0.59051156", "0.5849143", "0.57684183", "0.55742115", "0.5551845", "0.5545718", "0.54682595", "0.5424471", "0.54141927", "0.5409631", "0.5397393", "0.5304626", "0.5295751", "0.52824384", "0.5260014", "0.5250732", "0.5249668", "0.524294", "0.524003...
0.66515833
0
Determines whether self and space represent the same reducible boundary in in_space. Returns true or false.
def same_as(self, space, in_space): if self.marks == space.marks and self.genus == space.genus: return True space = space.complementary_component(in_space) if self.marks == space.marks and self.genus == space.genus: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identical_to(self, elem):\n \n return (self.n == elem.n) and (math.fabs(self.dx - elem.dx) < 0.001) and (math.fabs(self.dy - elem.dy) < 0.001) and (math.fabs(self.dz - elem.dz) < 0.001)", "def is_crossed(self):\n left_boundary_clusters = np.extract(self.cluster[0] > 0,\n ...
[ "0.6337293", "0.6325333", "0.63244414", "0.61551076", "0.6122222", "0.60953236", "0.60872793", "0.6034836", "0.60208577", "0.6013389", "0.6013389", "0.59886944", "0.59886944", "0.59886944", "0.59716356", "0.595167", "0.5944169", "0.59415483", "0.59169555", "0.5908367", "0.589...
0.7264176
0