query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
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
Sends an authenticated JSON API request, returns deserialized response.
def authenticated_request_async(url, method='GET', payload=None, params=None): scope = 'https://www.googleapis.com/auth/userinfo.email' access_token = get_access_token(scope)[0] headers = { 'Accept': 'application/json; charset=utf-8', 'Authorization': 'Bearer %s' % access_token, } if payload is not N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_request(self):\n response = urllib2.urlopen(\n url=self.api_url,\n data=self._get_request_data()\n )\n content = response.read()\n return json.loads(content.decode('utf8'))", "def http_request(endpoint, data, method='POST'):\n url = BASE_API + endpoi...
[ "0.6648755", "0.6521595", "0.65022767", "0.64924556", "0.6434019", "0.6431409", "0.64148045", "0.6407515", "0.63818115", "0.63640153", "0.6353898", "0.63488287", "0.63487077", "0.6325085", "0.62980586", "0.62364864", "0.61875117", "0.61702245", "0.61326087", "0.6132602", "0.6...
0.0
-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
Returns an OAuth2 access token for a project.
def get_project_access_token_async( project_id, scopes, 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 * 60: raise Valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_project_access_token(*args, **kwargs):\n return get_project_access_token_async(*args, **kwargs).get_result()", "def create_oauth2_access_token(self):\n if not isinstance(self.session, DropboxSession):\n raise ValueError(\"This call requires a DropboxClient that is configured with an \"...
[ "0.8017812", "0.7187884", "0.7130936", "0.70251614", "0.68929297", "0.68698007", "0.6821241", "0.68183976", "0.6758947", "0.6757545", "0.6709553", "0.6690153", "0.66442037", "0.6629509", "0.6626342", "0.6589034", "0.6566614", "0.6479927", "0.64461756", "0.644031", "0.64387137...
0.64870083
17
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
Blocking version of get_access_token_async.
def get_access_token(*args, **kwargs): return get_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.732077", "0.7175416", "0.6271311", "0.6183839", "0.58947515", "0.5837832", "0.58251184", "0.58061486", "0.58035564", "0.57488537", "0.5704995", "0.5684398", "0.5677287", "0.5663078", "0.5620533", "0.5616272", "0.55817324", "0.55632967", "0.55527204", "0.55462855", "0.55278...
0.6913767
2
Returns a string to use as a memcache key for a token.
def _memcache_key(method, email, scopes, key_id=None): blob = utils.encode_to_json({ 'method': method, 'email': email, 'scopes': scopes, 'key_id': key_id, }) return hashlib.sha256(blob).hexdigest()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_access_token_cache_key(token):\n\n return 'wopi_access_token_' + str(token)", "def generate_key():\n return get_token_generator().generate_token()", "def make_key(k, with_locale=True):\r\n key = encoding.smart_str('%s:%s' % (CACHE_PREFIX, k))\r\n if with_locale:\r\n key += e...
[ "0.7769432", "0.683662", "0.6612868", "0.66047055", "0.6449082", "0.6362821", "0.63589", "0.63581705", "0.63489914", "0.633265", "0.63314164", "0.6311724", "0.6311724", "0.6274112", "0.62566805", "0.62432283", "0.62302977", "0.6229341", "0.6229341", "0.6229341", "0.62094814",...
0.6399665
5
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
Creates new access token given a JWT signer.
def _mint_jwt_based_token_async(scopes, signer): # For more info see: # * https://developers.google.com/accounts/docs/OAuth2ServiceAccount. # Prepare a claim set to be signed by the service account key. Note that # Google backends seem to ignore 'exp' field and always give one-hour long # tokens, so we just ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_access_token(identity: Union[str,int], type_token: str, fresh: Optional[bool] = False) -> bytes:\n return AuthJWT.create_token(\n identity=identity,\n type_token=type_token,\n fresh=fresh,\n exp_time=timedelta(minutes=AuthJWT._ACCESS_TOKEN_EXPIRES)\n ...
[ "0.6837397", "0.6539045", "0.6358975", "0.62315047", "0.6020235", "0.60154456", "0.5925729", "0.57910836", "0.57859755", "0.57820815", "0.57474554", "0.5742067", "0.5716312", "0.56843626", "0.565226", "0.5651935", "0.56311494", "0.56239426", "0.5621711", "0.56003505", "0.5573...
0.59406877
6
Creates a new access token using IAM credentials API.
def _mint_oauth_token_async( token_factory, email, scopes, lifetime_sec=0, delegates=None): # Query IAM credentials generateAccessToken API to obtain an OAuth token for # a given service account. Maximum lifetime is 1 hour. And can be obtained # through a chain of delegates. logging.info( 'Refreshing ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_access_token(self):\n\t\t# Wraper for also caching invalid results\n #def getMetadataRofs(path):\n #\ttry:\n # \treturn self.client.metadata(path)\n # except Exception, e:\n # log.write('Exception at ...
[ "0.6487817", "0.6432206", "0.62757486", "0.61826295", "0.6030486", "0.59795105", "0.59623957", "0.5947448", "0.59069836", "0.58605164", "0.5856217", "0.5831523", "0.5819485", "0.5816893", "0.5798942", "0.57818", "0.57782966", "0.57676464", "0.5752714", "0.57351905", "0.572483...
0.0
-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
To be mocked in tests.
def _randint(*args, **kwargs): return random.randint(*args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mockup(cls):\n pass", "def use(self):", "def __call__(self) -> None:", "def _test(self):\n pass", "def _test(self):\n pass", "def _test(self):\n pass", "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def __ca...
[ "0.7107109", "0.7005468", "0.69746715", "0.6910201", "0.6910201", "0.6910201", "0.6891712", "0.6891712", "0.6891712", "0.6891712", "0.6891712", "0.6751386", "0.6751386", "0.6731014", "0.6720849", "0.66718245", "0.66615623", "0.66608894", "0.65758026", "0.65251637", "0.6525163...
0.0
-1
To be mocked in tests.
def _urlfetch(**kwargs): return ndb.get_context().urlfetch(**kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mockup(cls):\n pass", "def use(self):", "def __call__(self) -> None:", "def _test(self):\n pass", "def _test(self):\n pass", "def _test(self):\n pass", "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def __ca...
[ "0.7107109", "0.7005468", "0.69746715", "0.6910201", "0.6910201", "0.6910201", "0.6891712", "0.6891712", "0.6891712", "0.6891712", "0.6891712", "0.6751386", "0.6751386", "0.6731014", "0.6720849", "0.66718245", "0.66615623", "0.66608894", "0.65758026", "0.65251637", "0.6525163...
0.0
-1
To be mocked in tests.
def _memcache_get(*args, **kwargs): return ndb.get_context().memcache_get(*args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mockup(cls):\n pass", "def use(self):", "def __call__(self) -> None:", "def _test(self):\n pass", "def _test(self):\n pass", "def _test(self):\n pass", "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def __ca...
[ "0.7107104", "0.7004893", "0.6974841", "0.6910021", "0.6910021", "0.6910021", "0.6891274", "0.6891274", "0.6891274", "0.6891274", "0.6891274", "0.67514586", "0.67514586", "0.6730707", "0.67209905", "0.6671556", "0.6661969", "0.66608524", "0.6575258", "0.6525262", "0.6525262",...
0.0
-1
To be mocked in tests.
def _memcache_set(*args, **kwargs): return ndb.get_context().memcache_set(*args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mockup(cls):\n pass", "def use(self):", "def __call__(self) -> None:", "def _test(self):\n pass", "def _test(self):\n pass", "def _test(self):\n pass", "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def __ca...
[ "0.7107109", "0.7005468", "0.69746715", "0.6910201", "0.6910201", "0.6910201", "0.6891712", "0.6891712", "0.6891712", "0.6891712", "0.6891712", "0.6751386", "0.6751386", "0.6731014", "0.6720849", "0.66718245", "0.66615623", "0.66608894", "0.65758026", "0.65251637", "0.6525163...
0.0
-1
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
To be mocked in tests.
def _urlfetch_async(**kwargs): return ndb.get_context().urlfetch(**kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mockup(cls):\n pass", "def use(self):", "def __call__(self) -> None:", "def _test(self):\n pass", "def _test(self):\n pass", "def _test(self):\n pass", "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def __ca...
[ "0.7107109", "0.7005468", "0.69746715", "0.6910201", "0.6910201", "0.6910201", "0.6891712", "0.6891712", "0.6891712", "0.6891712", "0.6891712", "0.6751386", "0.6751386", "0.6731014", "0.6720849", "0.66718245", "0.66615623", "0.66608894", "0.65758026", "0.65251637", "0.6525163...
0.0
-1
This function is run at the beginning of every web request (every time you enter an address in the web browser). We use it to setup a database connection that can be used throughout the request The variable g is globally accessible for one request.
def before_request(): engine = cache['engine'] try: g.conn = engine.connect() except: print "error creating temporary connection to the db" import traceback; traceback.print_exc() g.conn = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_request():\n g.db = connect_db()", "def before_request():\n g.db = connect_db()", "def before_request():\n g.db = connect_db()", "def before_request():\n g.db = connect_db()", "def before_request():\r\n try:\r\n g.conn = engine.connect()\r\n except:\r\n print(\"uh oh, problem...
[ "0.7684903", "0.7684903", "0.7684903", "0.7684903", "0.71573937", "0.71573937", "0.71573937", "0.7151152", "0.7136317", "0.71352726", "0.71352726", "0.71352726", "0.71352726", "0.7011289", "0.70085263", "0.69808674", "0.69010925", "0.69010925", "0.69010925", "0.69010925", "0....
0.69947064
15
At the end of the web request, this makes sure to close the database connection. If you don't the database could run out of memory!
def teardown_request(exception): try: g.conn.close() except Exception as e: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_request():\n db.close()", "def close(self):\r\n self.conn.close()\r\n gc.collect()", "def cleanup(_):\n self.db.close()", "def close(self): \n self.connection.close()", "def close(self):\n\t\tself.db.close()", "def after_request(response):\n g.db.close(...
[ "0.79804355", "0.7822464", "0.76400095", "0.753811", "0.7476291", "0.74484444", "0.74484444", "0.74484444", "0.74484444", "0.74484444", "0.74484444", "0.74484444", "0.74484444", "0.74484444", "0.74484444", "0.74484444", "0.7436082", "0.7436082", "0.74210554", "0.74196386", "0...
0.0
-1
Load full CSV file content and return it to the pipeline as dict with keys=column names, values=column values
def _load_csv(self, file_path): csv_ds = tf.data.experimental.CsvDataset( file_path, self._default_csv_values, header=True, field_delim=CsvFilesDataset.CSV_SEPARATOR, use_quote_delim=False, select_cols=self._feature_column_indices ) # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csv_to_dict(self):\n log = logger.configure(\"default\")\n try: \n df = pd.read_csv(self.__csv_path)\n except IOError as e:\n # file not found\n log.error('Could not import {}. Got error {}'.format(self.__csv_path, e))\n raise \n else:\n ...
[ "0.6913934", "0.68703586", "0.680714", "0.6743349", "0.66757226", "0.6560351", "0.6528568", "0.652429", "0.6517438", "0.65026367", "0.63893986", "0.6389231", "0.6330696", "0.63234466", "0.63234466", "0.62898016", "0.62553954", "0.6244603", "0.62438715", "0.62025636", "0.62001...
0.58686143
61
Get real window values. I don't really understand this step, but it's required
def _flat_map_window(self, window_elements_dict): result = {} for key in window_elements_dict: # See https://github.com/tensorflow/tensorflow/issues/23581#issuecomment-529702702 result[key] = tf.data.experimental.get_single_element( window_elements_dict[key].batch(self.sequence_l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_window_info (self):\n \n # g.trace(self.w,self.h,self.x,self.y)\n \n return self.w,self.h,self.x,self.y", "def _window(self, get_lims=False):\n\t\timg_h, img_w = self.od_model.img_shape\n\t\th_llim = 0\n\t\tw_llim = img_w // 3\n\t\th_ulim = img_h - (img_h // 4)\n\t\tw_ulim = 1- wl...
[ "0.72178924", "0.67988247", "0.6687536", "0.6479215", "0.6396723", "0.635609", "0.6305295", "0.6304923", "0.62763554", "0.6254243", "0.62073654", "0.61862344", "0.60994506", "0.60726887", "0.60464156", "0.59868", "0.59639907", "0.5958834", "0.5922218", "0.5922218", "0.5919629...
0.0
-1
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
Options are described by the help() function
def parse_options(): options ={ "vcf":None, "out":None, "ref":None, "haplotypes":False, "sample":None, "chrom":None, "refcheck" :True } try: opts, args = getopt.getopt(sys.argv[1:], "v:o:r:s:c:h", ["vcf", "out", "ref", "sample", "chrom", "haplotypes"]) print opts, args except Exception as ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def help_opt(self):\n print(OPTIONS)", "def options():\n print \"\"\"Options summary:\n -h, --help\n -u, --usage\n -v, --verbose <verb_level>\n -e, --endpoint <endpoint>\n -i, --interface-type <iface_type>\n -r, --recursive\n --dbs-conf <conf_file>\n --show-prod\n --show-ca...
[ "0.81592023", "0.801142", "0.7904479", "0.7880539", "0.77130747", "0.76430625", "0.7548139", "0.7461283", "0.7378869", "0.7378869", "0.73517257", "0.7334882", "0.7334882", "0.7332353", "0.7325584", "0.73053473", "0.72521454", "0.721984", "0.7111992", "0.710655", "0.710278", ...
0.0
-1
Iterate over the vcf and output one fasta file for each chromosome.
def main(options): ref_fa=Fasta(options["ref"]) out0=gzip.open(options["out"]+".0.fa.gz", "w") out1=gzip.open(options["out"]+".1.fa.gz", "w") out0.write(">"+options["chrom"]+"\n") out1.write(">"+options["chrom"]+"\n") vcf=gdc.open2(options["vcf"]) sample_idx=None last_pos=0 for li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_to_vcf(self):\n\n # 1. Generate header info\n date_for_vcf = datetime.now().strftime('%Y%m%d')\n header_info = [\n '##fileformat=VCFv4.2',\n '##fileDate=%s' % date_for_vcf,\n '##source=%s' % self.get_analyser_name(),\n '##reference=https://...
[ "0.6719253", "0.63316023", "0.6220914", "0.6031175", "0.59802383", "0.58626944", "0.5832174", "0.5830148", "0.57844657", "0.56443703", "0.5616658", "0.5613928", "0.5610172", "0.559484", "0.5581773", "0.55812275", "0.5567715", "0.55646116", "0.55256677", "0.54888254", "0.54688...
0.5937182
5
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""" Add a component to the model.
def add_component(self, xi): assert xi.berkovich_line() is self.berkovich_line(), "xi must be a point\ on the Berkovich line underlying this model" X = self if not X.is_component(xi): ComponentOfModel(X, xi) X._changed = True """ T = X.tree() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, component) -> None:\n pass", "def add_component(self, componentInstance):\n\n #print \"Componet being added to %s entity.\"%(self._sName)\n #print componentInstance\n \n self._dComponents[componentInstance.get_name()] = componentInstance\n\n #These if state...
[ "0.83950996", "0.74265784", "0.7415577", "0.72388774", "0.7177965", "0.71720827", "0.70141417", "0.68446773", "0.6680025", "0.6669043", "0.65709126", "0.6365235", "0.63241243", "0.6317126", "0.6303362", "0.6198381", "0.6189713", "0.6135661", "0.61099833", "0.6064516", "0.6061...
0.66953707
8
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
Handle ramping A up or down
def _A() -> uint256: t1: uint256 = self.future_A_time A1: uint256 = self.future_A if block.timestamp < t1: A0: uint256 = self.initial_A t0: uint256 = self.initial_A_time # Expressions in uint256 cannot have negative numbers, thus "if" if A1 > A0: return A0 + (A1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ramp_up(self):\n value = self.current_event[\"ramp_up\"][\"value\"]\n self.current_value.append(self.current_value[-1] + value)", "def ramp_down(self):\n value = self.current_event[\"ramp_down\"][\"value\"]\n self.current_value.append(self.current_value[-1] - value)", "def get_r...
[ "0.73426914", "0.7157217", "0.6162812", "0.6123802", "0.59510285", "0.5885761", "0.5824209", "0.5754216", "0.57265013", "0.5725592", "0.56341946", "0.562714", "0.5616443", "0.558141", "0.5544472", "0.5513667", "0.5511653", "0.5494207", "0.5482946", "0.54648584", "0.54636997",...
0.0
-1
D invariant calculation in nonoverflowing integer operations iteratively A sum(x_i) nn + D = A D nn + D(n+1) / (nn prod(x_i))
def _get_D(_xp: uint256[N_COINS], _amp: uint256) -> uint256: S: uint256 = 0 Dprev: uint256 = 0 for _x in _xp: S += _x if S == 0: return 0 D: uint256 = S Ann: uint256 = _amp * N_COINS for _i in range(255): D_P: uint256 = D for _x in _xp: D_P = D_P...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_dE(self, i):\n \n dE = self.h[i]\n dE += sum((1 if self.spins[j] else -1)*self.J[i,j] for j in self.adjacency[i])\n if not self.spins[i]:\n dE *= -1\n\n return -2*dE", "def d(i):\n if i==0:\n return 0\n elif (i%2)==0:\n return g(i-1)...
[ "0.61177194", "0.6097798", "0.60182554", "0.600007", "0.59787387", "0.59683335", "0.5864873", "0.5841586", "0.58114976", "0.5791155", "0.5777063", "0.57704115", "0.57272655", "0.57204205", "0.5710994", "0.5709194", "0.57073164", "0.5705618", "0.5705097", "0.5701948", "0.56974...
0.6028057
2
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
Calculate x[j] if one makes x[i] = x Done by solving quadratic equation iteratively. x_12 + x_1 (sum' (Ann 1) D / (A nn)) = D (n + 1) / (n (2 n) prod' A) x_12 + bx_1 = c x_1 = (x_12 + c) / (2x_1 + b)
def _get_y(i: int128, j: int128, x: uint256, _xp: uint256[N_COINS]) -> uint256: # x in the input is converted to the same price/precision assert i != j # dev: same coin assert j >= 0 # dev: j below zero assert j < N_COINS # dev: j above N_COINS # should be unreachable, but good for sa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def TestFunc1(x):\r\n return 12*x[0]*x[0] + 4*x[1]*x[1] - 12*x[0]*x[1] + 2*x[1]", "def f(self, x: np.array) -> np.array:\n return self.a * x**2 + self.b * x + self.c", "def easy_eval(self, x):\n answer = 0\n for i in range(len(self.coefficients)):\n coef = self.coefficien...
[ "0.6470488", "0.640307", "0.6319861", "0.6293105", "0.6290612", "0.62211764", "0.6158483", "0.6153188", "0.6140652", "0.606372", "0.6058459", "0.6033761", "0.6029725", "0.5977051", "0.59664106", "0.5915992", "0.5915286", "0.58887416", "0.58839697", "0.5867666", "0.5833529", ...
0.0
-1
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 Withdrawal amounts are based on current deposit ratios _amount Quantity of LP tokens to burn in the withdrawal _min_amounts Minimum amounts of underlying coins to receive List of amounts of coins that were withdrawn
def remove_liquidity(_amount: uint256, _min_amounts: uint256[N_COINS]) -> uint256[N_COINS]: lp_token: address = self.lp_token total_supply: uint256 = CurveToken(lp_token).totalSupply() amounts: uint256[N_COINS] = empty(uint256[N_COINS]) for i in range(N_COINS): old_balance: uint256 = self.balan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def withdrawal(self, amount):\n if self.balance - amount < self.minimum_balance:\n print \"This would take you below your minimum balance.\"\n return\n else:\n self.balance -= amount\n print \"Please take your cash.\"\n print \"Your balance is no...
[ "0.6469376", "0.62122893", "0.62045175", "0.6112238", "0.6110461", "0.60382724", "0.6016786", "0.5993147", "0.5944028", "0.5923513", "0.5859739", "0.5844326", "0.58355784", "0.58152175", "0.58017844", "0.5788988", "0.57880694", "0.57880694", "0.57716924", "0.57553405", "0.575...
0.60831106
5
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 x[i] if one reduces D from being calculated for xp to D Done by solving quadratic equation iteratively. x_12 + x_1 (sum' (Ann 1) D / (A nn)) = D (n + 1) / (n (2 n) prod' A) x_12 + bx_1 = c x_1 = (x_12 + c) / (2x_1 + b)
def _get_y_D(A: uint256, i: int128, _xp: uint256[N_COINS], D: uint256) -> uint256: # x in the input is converted to the same price/precision assert i >= 0 # dev: i below zero assert i < N_COINS # dev: i above N_COINS Ann: uint256 = A * N_COINS c: uint256 = D S: uint256 = 0 _x: uint256 = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _der(self, x):\n if _isscalar(x):\n pos = np.searchsorted(self.x_list, x)\n if pos == 0:\n dydx = self.coeffs[0, 1]\n elif pos < self.n:\n alpha = (x - self.x_list[pos - 1]) / (\n self.x_list[pos] - self.x_list[pos - 1]\n ...
[ "0.66612667", "0.662512", "0.631674", "0.631674", "0.6002912", "0.5995372", "0.594409", "0.59385264", "0.5927466", "0.5901317", "0.5895147", "0.5851004", "0.58178675", "0.58048576", "0.5804381", "0.5788224", "0.5782979", "0.57826895", "0.57640123", "0.5731823", "0.5730691", ...
0.0
-1
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
Withdraw a single coin from the pool _token_amount Amount of LP tokens to burn in the withdrawal i Index value of the coin to withdraw _min_amount Minimum amount of coin to receive Amount of coin received
def remove_liquidity_one_coin(_token_amount: uint256, i: int128, _min_amount: uint256) -> uint256: assert not self.is_killed # dev: is killed dy: uint256 = 0 dy_fee: uint256 = 0 total_supply: uint256 = 0 dy, dy_fee, total_supply = self._calc_withdraw_one_coin(_token_amount, i) assert dy >= _mi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_withdraw_one_coin(_token_amount: uint256, i: int128) -> uint256:\n return self._calc_withdraw_one_coin(_token_amount, i)[0]", "def withdraw(self, amount):\r\n self.balance = self.balance - amount\r\n self.transactions.append(-amount)\r\n return amount", "def withdrawal(self, am...
[ "0.69817805", "0.64169514", "0.64133614", "0.62907416", "0.6079728", "0.59863305", "0.59495467", "0.59417325", "0.59106344", "0.58914495", "0.588961", "0.5883216", "0.5844729", "0.5834748", "0.58260083", "0.58260083", "0.58144283", "0.5802669", "0.57916087", "0.5717578", "0.5...
0.5965433
6
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
Train the model with useful defaults
def train(self, max_epochs: int, batch_size: int = 2500, train_size: float = 1, lr: float = 0.002, **kwargs): kwargs["max_epochs"] = max_epochs kwargs["batch_size"] = batch_size kwargs["train_size"] = train_size kwargs["lr"] = lr super().train(**kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trainModel( self, featureTrain, classTrain):", "def train(self):\n\t\tself.model.fit(self.training_data, self.training_labels)", "def train():\n pass", "def train_model(self, *args, **kwargs):\n raise NotImplementedError", "def set_train(self):\n self.model.train()", "def train()...
[ "0.7890871", "0.765682", "0.7532871", "0.75181335", "0.751392", "0.746906", "0.74328655", "0.7405101", "0.73843354", "0.734385", "0.72983235", "0.72983235", "0.72983235", "0.72983235", "0.72983235", "0.7290068", "0.72349745", "0.722089", "0.7209363", "0.7208839", "0.71953136"...
0.0
-1
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
this function show you the page in argument
def show_frame(self, framekey): frame = self.frames[framekey] frame.tkraise() def get_page(self, classname): """ Take the name f the page and return the objet page """ return self.frames[classname]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_page(self):", "def get_page(self):\n self.browser.get(self.url)", "def show(*args):", "def show(*args):", "def show(*args):", "def show(*args):", "def main_page():\n pages=get_accounts()\n return render_template('disp.html',pages=pages)", "def message_page(request,page_name):\...
[ "0.68443584", "0.66505826", "0.65792525", "0.65792525", "0.65792525", "0.65792525", "0.651151", "0.64239323", "0.64037454", "0.64033633", "0.63223875", "0.63087535", "0.6307309", "0.63036835", "0.6283334", "0.626913", "0.6228287", "0.62052864", "0.6189684", "0.61708146", "0.6...
0.6247364
16
Update will do the request and return you the list of item in a list in the GUI in witch you can choose witch items you need
def update(self): start_page = self.controller.get_page(StartPage) value_list_item = start_page.listitem.curselection() value_list_arme = start_page.listarme.curselection() value_list_bonus = start_page.listbonus.curselection() value_list_bonus_sec = start_page.listbonussec....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_list_view(self):\n self.model.dataChanged.emit(self.model.index(0, 1),\n self.model.index(len(self.model.data_list), 1))\n #self.pBar.setValue(localization.localizationProgress() * 100)", "def update_command():\n # global selected_tuple\n backend....
[ "0.6946119", "0.68738914", "0.6614876", "0.65846336", "0.6582207", "0.6566711", "0.65500295", "0.6504534", "0.6498249", "0.64884466", "0.64144784", "0.64144784", "0.64144784", "0.63497645", "0.6313554", "0.6304673", "0.6299775", "0.6299775", "0.62697625", "0.6203685", "0.6124...
0.649484
9
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
Cette route est la route par defaut, elle permet de renvoyer un micropage d'acceuil de l'API.
def get_index(): return render_template('index.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def route(self):\n pass", "def routes(self, body):\n pass", "def route( request, c ):", "def test_custom_route(self):\n\n # Create a human object\n Human.create(id=1, name='John')\n Dog.create(id=5, name='Johnny', owner='John')\n\n # Get the custom route\n ...
[ "0.6895544", "0.6295286", "0.62651926", "0.6163111", "0.61529243", "0.612729", "0.6103026", "0.6051701", "0.6005775", "0.59833395", "0.5978684", "0.5964395", "0.5963377", "0.5948314", "0.594727", "0.5934674", "0.59088904", "0.5854282", "0.58405477", "0.5837811", "0.5831105", ...
0.0
-1
Cette route permet de recuperer la photo d'un cristal envoye par l'utilisateur et de renvoyer la classe du cristal.
def get_classe_cristal(type_of_image): if request.method != 'POST': return 'Bad request, POST expected', 405 if type_of_image == 'SEC' or type_of_image == 'SUR': classifier.set_type_of_image(type_of_image) image_path = get_image_from_post(request, app.config['UPLOAD_FOLDER']) if image_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_profile_photo():\n pass", "def perfil(request):\n\n\n usuario=Usuario.objects.get(user_id=request.user.id)\n user = request.user\n auth0user = user.social_auth.filter(provider='auth0')[0]\n userdata = {\n 'user_id': auth0user.uid,\n 'name': user.first_name,\n 'estado':...
[ "0.5687878", "0.55563337", "0.5540755", "0.5537463", "0.5388874", "0.5352883", "0.53388333", "0.5311625", "0.5294564", "0.52646464", "0.520669", "0.516897", "0.5162606", "0.51578134", "0.5155594", "0.5141877", "0.513507", "0.513507", "0.5116856", "0.5115484", "0.5097478", "...
0.0
-1
Cette route a pour but de recuperer le cristal ainsi que la classification verifiee par l'utilisateur dans le but d'agrandir le dataset.
def upload_cristal(): if request.method != 'POST': return 'Bad request, POST expected', 405 # Authentification if not auth(): return 'Bad authentification, go back !', 401 classe = request.form['classe'] type = request.form['type'] image_name = str(classe) + "_" + str(type) + "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self):\n pass", "def train(self):\n pass", "def train(self):\n pass", "def train(self):\n pass", "def train(self):\n pass", "def train(self)->None:", "def train(self):\n return", "def pre_train(self, dataset):\n pd_dataset = pandas.read_csv('...
[ "0.59330356", "0.59330356", "0.59330356", "0.59330356", "0.59330356", "0.58475584", "0.5794313", "0.57475996", "0.5697087", "0.5658891", "0.5638293", "0.56148386", "0.5606201", "0.558169", "0.5557881", "0.55540067", "0.5511967", "0.551173", "0.5505205", "0.5493328", "0.547784...
0.0
-1
Cette fonction permet de recuperer la requete POST et d'en extraire une image.
def get_image_from_post(http_request, directory, filename=None): # check if the post request has the file part if 'image' not in http_request.files: return -1 file = http_request.files['image'] # if user does not select file, browser also # submit a empty part without filename if file.fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self, bot_id):\n response = request.get_json(force=True)\n base64_image = response['base64Image']\n\n return handler.handle_post(bot_id, base64_image)", "def post(self):\n data = request.form.to_dict() # data is a dict with multipart/form-data\n if(not data):\n ...
[ "0.65681034", "0.65292525", "0.64366525", "0.637192", "0.635045", "0.6304546", "0.61229664", "0.61013836", "0.6100319", "0.606673", "0.603078", "0.6024477", "0.5968679", "0.59649444", "0.59495944", "0.5931771", "0.5926783", "0.59051406", "0.5854317", "0.5846818", "0.5835903",...
0.6388221
3
Get current platform name by short string.
def current_platform() -> str: if sys.platform.startswith('linux'): return 'linux' elif sys.platform.startswith('darwin'): return 'mac' elif (sys.platform.startswith('win') or sys.platform.startswith('msys') or sys.platform.startswith('cyg')): if sys.maxsize > 2 *...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def platform():\n return \"micaz\"", "def name(cls):\n\n system = platform.system()\n\n # Apply system map\n if system in NAME_MAP:\n system = NAME_MAP[system]\n\n return system", "def platform(self, return_str=True):\n architecture = self.arch(\"docker\")\n ...
[ "0.6710005", "0.6574502", "0.64428717", "0.6284099", "0.628025", "0.62626773", "0.62544644", "0.6251064", "0.6250662", "0.6228545", "0.62177414", "0.62042147", "0.61738294", "0.61738294", "0.6168861", "0.6117028", "0.6114609", "0.60991156", "0.6084149", "0.60605234", "0.60219...
0.5545148
79
Compile the monster bibfile from the BibTeX files listed in references/BIBFILES.ini glottolog monster
def monster(args): compile_monster()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_bbl(filepath):\n working_directory, texfile = os.path.split(filepath)\n \n try:\n # Precompile the main file to get the .aux file\n run_command([\"pdflatex\", \"-draftmode\", \"-interaction=batchmode\", texfile + \".tex\"], working_directory)\n # Load the bibtex reference...
[ "0.63835466", "0.5946757", "0.59321046", "0.59064066", "0.58879906", "0.5778026", "0.56210834", "0.55705094", "0.5317624", "0.5202531", "0.5191357", "0.5190204", "0.51808256", "0.51694864", "0.5153924", "0.51112354", "0.5106365", "0.5080857", "0.5072778", "0.5062555", "0.4964...
0.4563562
52
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
e.g., line((cx, cy, cx + hrs[0], cy + hrs[1]), fill="white")
def line(self, arg, fill): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hline(self, x, y, width, color):\n self.rect(x, y, width, 1, color, fill=True)", "def _defLine(self):\n self._dline=GPath(points = [0,100,GAME_WIDTH,100], linewidth = 1.5,\n linecolor = 'cyan')", "def hline(self, x, y, length, color):\n self.fill_rect(x, y, length, 1, color)...
[ "0.67122275", "0.6642873", "0.65832245", "0.65689427", "0.6562991", "0.6520265", "0.6444102", "0.64151275", "0.6301036", "0.62642324", "0.62618446", "0.62564754", "0.625628", "0.6209412", "0.6188319", "0.61703825", "0.61610156", "0.6134427", "0.61096084", "0.6106784", "0.6104...
0.63239
8
Returns a list of ngrams, each ngram represented as a 4tuple of filename, utterance id, speaker name, and list of words in the ngram
def read_files(filenames, gram_size=1): assert isinstance(filenames, list), "filenames argument must be a list" parser = MorParser() for fn in filenames: for uid, speaker, ngram in generate_chunks(parser.parse(fn), gram_size): yield fn, uid, speaker, ngram
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_ngrams():\n grams = ()\n for i in range(0, 40):\n text_i = read_file(str(i))\n curr_grams = ngramize(text_i, n)\n grams = chain(grams, curr_grams)\n return grams", "def get_ngrams(self, n = None):\n if not n:\n n = self.N\n\n temp = []\n f...
[ "0.7511536", "0.70480585", "0.69828093", "0.6834482", "0.6822036", "0.6762867", "0.6735106", "0.6734953", "0.66730297", "0.662533", "0.6593495", "0.65693355", "0.6565634", "0.65468997", "0.65367264", "0.65129817", "0.6505234", "0.65043163", "0.649223", "0.64910996", "0.646233...
0.5657222
94
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 the unique words that were uttered by speaker in the files.
def speaker_vocab(filenames, target_speaker): return unique_ngrams(filenames, target_speaker, gram_size=1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_unique_words():\n # Unique words\n words_set = set()\n for i in range(1, 114+1):\n sura = quran.get_sura(i)\n for aya in sura:\n wordsList = aya.split(' ')\n for word in wordsList:\n words_set.add(word)\n\n return words_set", "def uniqueword...
[ "0.731386", "0.7288845", "0.69393903", "0.69386834", "0.6929483", "0.6844437", "0.6759081", "0.6726135", "0.6683796", "0.66650957", "0.65901154", "0.6566055", "0.65532964", "0.6546015", "0.65326506", "0.6531036", "0.6512286", "0.64746076", "0.6456683", "0.64484406", "0.644333...
0.72172284
2
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
Output the parent's most frequent ngrams, excluding those ngrams that contain words not present in the child's speech during that same session.
def main(): glob_pattern = "{root}/{child}/*.xml".format(root=MANCHESTER_ROOT, child=TARGET_CHILD) corpus_files = glob(glob_pattern) for filename in corpus_files: print(filename) to_csv(filtered_parent_freq_count([filename], 2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filtered_parent_freq_count(filenames, gram_size):\n counts = Counter()\n vocab = list(read_files(filenames, gram_size=gram_size))\n parent_list = parent_shared_ngrams(filenames, gram_size=gram_size)\n for _, _, speaker, ngram in vocab:\n if speaker == \"MOT\" and ngram in parent_list:\n ...
[ "0.7113082", "0.6464794", "0.6458967", "0.6458967", "0.64498836", "0.62634724", "0.5948875", "0.593783", "0.59295964", "0.58267695", "0.57853293", "0.57033664", "0.5624959", "0.559297", "0.55286145", "0.5477127", "0.54151744", "0.5411046", "0.53399557", "0.53293586", "0.53239...
0.0
-1
Initialize sockets and send the selected port number to the father process with a Pipe
def setup(self): # create the pull socket (to communicate with this actor, others # process have to connect a push socket to this socket) self.pull_socket, pull_port = self._create_socket(zmq.PULL, -1) # create the control socket (to control this actor, a process have to # conne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def port_connection(self, sock):\n sock.bind(('', 0)) # Bind to OS-assigned available & random port.\n sock.listen(1)", "def make_data_port(self):\n err = None\n sock = None\n for res in socket.getaddrinfo(None, 0, socket.AF_INET, socket.SOCK_STREAM, 0, socket.AI_PASSIVE):\n ...
[ "0.6636719", "0.63062865", "0.6298155", "0.6284251", "0.6206001", "0.61183155", "0.609472", "0.6051839", "0.59785825", "0.59763026", "0.5972886", "0.5956362", "0.5908604", "0.590535", "0.5881754", "0.5880274", "0.5860489", "0.58205014", "0.581869", "0.58069015", "0.58038396",...
0.0
-1
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
Block until a message was received (or until timeout) an return the received messages
def receive(self): events = self.poller.poll(self.timeout) # If there is control socket, he has the priority if len(events) == 2: return self._recv_serialized(self.control_socket) elif len(events) == 1: return self._recv_serialized(events[0][0]) return No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_for_messages(self):\n msg = self.inbox.get()\n return msg", "def wait_for_message(self, tag, timeout=None):\n def done_check():\n if self._message_queue.setdefault(tag,[]):\n value=heapq.heappop(self._message_queue[tag])[-1]\n return True,val...
[ "0.7281814", "0.68462986", "0.68338895", "0.6778009", "0.66986734", "0.6684152", "0.6675568", "0.6622844", "0.6622844", "0.66180176", "0.6567688", "0.6563809", "0.65341675", "0.6533108", "0.65196824", "0.6517018", "0.64326113", "0.6428787", "0.6411501", "0.64016074", "0.64001...
0.0
-1
Block until a message was received on the control canal (client side) (or until timeout) an return the received messages
def receive_control(self, timeout): if self.control_socket is None: raise NotConnectedException event = self.control_socket.poll(timeout) if event == 0: return None return self._recv_serialized(self.control_socket)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_for_messages(self):\n msg = self.inbox.get()\n return msg", "def wait_till_read_out():\n\n\trespond = send_command('waitreadout')", "def _read_data(self):\n while True:\n try:\n data = yield from asyncio.wait_for(self._socket.recv(), 1)\n excep...
[ "0.72291696", "0.6882757", "0.6865332", "0.67682534", "0.6693178", "0.6663294", "0.6660271", "0.66446036", "0.66203576", "0.6615487", "0.6607324", "0.6605967", "0.6577566", "0.65745187", "0.65711117", "0.6541973", "0.65418196", "0.6541073", "0.6534656", "0.652897", "0.6512350...
0.6064793
81
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
Send a message on the control canal
def send_control(self, msg): if self.control_socket is None: raise NotConnectedException() self._send_serialized(self.control_socket, msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sendMessage(self,message):\n if message is not None: self.controlProtocol.sendMessage(message)", "def send(self, msg):\n self.message('Me', msg)", "def sendmessage(self):\n \n self.message.parentItem = self.rxtxcontroller.transmittable.rootItem\n self.message.can_id = self.id...
[ "0.7485353", "0.7143323", "0.7072263", "0.697397", "0.68778914", "0.6840593", "0.6824069", "0.6824069", "0.6824069", "0.67144084", "0.66631067", "0.66455984", "0.6620691", "0.6619944", "0.65999293", "0.6588872", "0.6586184", "0.6585441", "0.6584765", "0.6570165", "0.65609246"...
0.64405453
32
Send a message on data canal
def send_data(self, msg): if self.push_socket is None: raise NotConnectedException() self._send_serialized(self.push_socket, msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(self, data):", "def send_message(self, data):\n self.transport.write(data)", "def send(self, message):\n pass", "def send(self, data):\n pass", "def sendmessage(self):\n \n self.message.parentItem = self.rxtxcontroller.transmittable.rootItem\n self.message...
[ "0.7394769", "0.73389196", "0.71864665", "0.716673", "0.71419513", "0.70261306", "0.70219094", "0.70090795", "0.70090795", "0.70090795", "0.697715", "0.6946398", "0.6908111", "0.6850792", "0.68437576", "0.6816303", "0.6794249", "0.6789949", "0.67790186", "0.6745188", "0.67377...
0.0
-1
change player, get new hand, and start turn
def next_player_turn(self): if self.extra_turn: self.played_user_cards = [] self.active_player.start_turn() self.extra_turn = False return self.turn += 1 self.num_turns += 1 if self.turn >= len(self.players): self.turn = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_player(self):\n self.player = Nim.other_player(self.player)", "def switchPlayer(self):\n\t\tif (self.current is Piece.EX):\n\t\t\tself.current = Piece.OH \n\t\telse:\n\t\t\tself.current = Piece.EX", "def switchPlayer(self):\n self.player = Nim.otherPlayer(self.player)", "def _switch_...
[ "0.72461736", "0.71983904", "0.7140665", "0.70096004", "0.67927957", "0.6765252", "0.67346096", "0.6669071", "0.66102207", "0.66102207", "0.66037244", "0.66016144", "0.6565904", "0.6548574", "0.65401673", "0.6516399", "0.6503728", "0.6487636", "0.64814067", "0.64654315", "0.6...
0.6249293
37
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
Given a formula like 'ODD + EVEN === EVEN', fill in digits to solve it. Input formula is a string; output is a digitfilledin string or None.
def solve(formula): for f in fill_in(formula): if valid(f): return f return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def faster_solve(formula):\n f, letters = compile_formula(formula)\n for digits in itertools.permutations((1,2,3,4,5,6,7,8,9,0), len(letters)):\n try:\n if f(*digits) is True:\n table = string.maketrans(letters, ''.join(map(str, digits)))\n return formula.trans...
[ "0.59557945", "0.5789731", "0.5602373", "0.5586244", "0.5410668", "0.53613466", "0.52791667", "0.52669346", "0.5265934", "0.52649766", "0.5257081", "0.52345973", "0.51853544", "0.5181937", "0.5180268", "0.5178729", "0.51624167", "0.51335216", "0.5117556", "0.5117432", "0.5117...
0.5046468
29
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
Formula f is valid iff it has no numbers with leading zero, and evals true.
def valid(f): try: return not re.search(r'\b0[0-9]', f) and eval(f) is True # "\b" is a word boundary """We need to exclude numbers starting with zero, as these are interpretted as base8 (octal). This in turn could cause interpretation errors, and exceptions (for exam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid(f):\r\n try:\r\n return not re.search(r'\\b0[0-9]', f) and eval(f) is True\r\n except ArithmeticError:\r\n return False", "def valid(f):\n try:\n return not re.search(r'\\b0[0-9]', f) and eval(f) is True\n except ArithmeticError:\n return False", "def valid(f):...
[ "0.81120336", "0.81116873", "0.80529046", "0.80529046", "0.7122886", "0.6713914", "0.6531089", "0.63207614", "0.6203561", "0.61812127", "0.61800635", "0.61374056", "0.613668", "0.60927373", "0.6084526", "0.60836285", "0.6070814", "0.6062427", "0.6013782", "0.6001119", "0.5996...
0.74138737
4