query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Preprocess requests by attempting to extract face image, and transforming to fit the model's input Returns list of NDArray Processed images in the model's expected input shape
def preprocess(self, request): img_list = [] input_shape = self.signature['inputs'][0]['data_shape'] [height, width] = input_shape[2:] param_name = self.signature['inputs'][0]['data_name'] # Iterate over all input images provided with the request, transform and append for infere...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(self, request):\n img_list = []\n param_name = self.signature['inputs'][0]['data_name']\n input_shape = self.signature['inputs'][0]['data_shape']\n\n for idx, data in enumerate(request):\n img = data.get(param_name)\n if img is None:\n ...
[ "0.73400545", "0.6653662", "0.65381366", "0.65293646", "0.6363785", "0.6331957", "0.6321112", "0.6304423", "0.62506974", "0.6235382", "0.6233115", "0.6188294", "0.61358917", "0.61200666", "0.6102832", "0.60749215", "0.6074793", "0.6067623", "0.6028816", "0.6026498", "0.602559...
0.81999916
0
Postprocess inference result to normalize probabilities and render with labels
def postprocess(self, data): if self.error is not None: return [self.error] # Iterating over inference results to render the normalized probabilities response = [] for inference_result in data: softmax_result = inference_result.softmax().asnumpy() for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inference_preprocess(self):\n return", "def post(self):\n result = {'status': 'error'}\n\n args = input_parser.parse_args()\n input_data = args['image'].read()\n image = self.model_wrapper._read_image(input_data)\n preds = self.model_wrapper._predict(image)\n\n ...
[ "0.6822541", "0.6789945", "0.6525151", "0.6503865", "0.635317", "0.63490814", "0.63463706", "0.6325388", "0.6312468", "0.6298555", "0.627382", "0.62542534", "0.6231594", "0.62100625", "0.6208489", "0.61715907", "0.6155044", "0.61538804", "0.6099723", "0.6094014", "0.60685134"...
0.7199529
0
Get Mapbox access token from arg or environment
def _get_token(token=None): if token is not None: return token else: return os.environ.get("MAPBOX_ACCESS_TOKEN") or os.environ.get( "MapboxAccessToken" )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def access_token(*args, **kwargs):\n return None", "def _get_api():\n return os.environ.get(\"MAPBOX_API\", \"https://api.mapbox.com\")", "def get_access_token() -> str:\n\n gcloud_access_token = (\n subprocess.check_output(\n \"gcloud auth print-access-token\".split(\" \")).decode().rstri...
[ "0.6571186", "0.641618", "0.6319432", "0.6312531", "0.62517345", "0.62223494", "0.61801493", "0.61801493", "0.61801493", "0.61801493", "0.61801493", "0.61801493", "0.61801493", "0.61801493", "0.61801493", "0.61801493", "0.61801493", "0.61220384", "0.61139506", "0.60954535", "...
0.7944125
0
Create a new tileset with a recipe. $ tilesets create is in the form of username.handle for example "mapbox.neattileset". The handle may only include "" or "_" special characters.
def create( tileset, recipe, name=None, description=None, privacy=None, token=None, indent=None ): mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/{1}?access_token={2}".format( mapbox_api, tileset, mapbox_token ) body = {} body["name"] = name or "" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tile(self, name):\n return self.subgrids[name[0:2]].tilesys.create_tile(name)", "def create_mapset(self, mapset, dbase=None, location=None):\n module = 'g.c.mapset'\n gs.run_command(module, mapset=mapset, dbase=dbase, location=location)", "def create_mapset(self, mapset, dbase=N...
[ "0.5746558", "0.56829774", "0.56782365", "0.5534749", "0.54125917", "0.53344876", "0.52849835", "0.52363425", "0.52307814", "0.52018946", "0.5193289", "0.5177163", "0.51419634", "0.5093439", "0.5085827", "0.50712436", "0.5016903", "0.4999963", "0.49877235", "0.49808466", "0.4...
0.7657994
0
Publish your tileset. tilesets publish
def publish(tileset, token=None, indent=None): mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/{1}/publish?access_token={2}".format( mapbox_api, tileset, mapbox_token ) r = requests.post(url) if r.status_code == 200: click.echo(json.dumps(r.json(),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def publish():\n pass", "def publish(self):\n return", "def publish(self, settings, item):\n\n publisher = self.parent\n engine = publisher.engine\n document = item.properties[\"document\"]\n\n path = _document_path(document)\n item.properties[\"upload_path\"] = pat...
[ "0.6580128", "0.5952823", "0.5932906", "0.58998835", "0.5859718", "0.56866664", "0.5659581", "0.5582952", "0.55645955", "0.5559791", "0.5526525", "0.5434319", "0.5407289", "0.54018307", "0.53910875", "0.5360681", "0.5359375", "0.5341747", "0.53361744", "0.5277855", "0.5274251...
0.7308318
0
View the current queue/processing/complete status of your tileset. tilesets status
def status(tileset, token=None, indent=None): mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/{1}/status?access_token={2}".format( mapbox_api, tileset, mapbox_token ) r = requests.get(url) click.echo(json.dumps(r.json(), indent=indent))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status(self):", "def thread_status():\n global dataSession\n return jsonify(dict(status=('finished' if len(dataSession) > 1 else 'running')))", "def report_queue_status(self):\n raise NotImplementedError", "def update_status(cls):\n for job in cls.query.filter(cls.finished == False):\...
[ "0.6251672", "0.6249044", "0.6178998", "0.61220944", "0.6083708", "0.60823643", "0.601419", "0.5995323", "0.5989828", "0.5984694", "0.5970482", "0.5943197", "0.5943197", "0.5942803", "0.5938031", "0.5891603", "0.5884071", "0.58760405", "0.5856712", "0.58364433", "0.58343846",...
0.6567368
0
View all jobs for a particular tileset. tilesets jobs
def jobs(tileset, stage, token=None, indent=None): mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/{1}/jobs?access_token={2}".format( mapbox_api, tileset, mapbox_token ) if stage: url = "{0}/tilesets/v1/{1}/jobs?stage={2}&access_token={3}".format( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_jobs():\n\n jobs = Job.get_all()\n\n oneoffs = OneOff.get_all()\n\n job = JobView(None, jobs, oneoffs, False, Job.count() > 0)\n\n add_trello_task_links_to_g()\n\n return render_template(\"jobs.template.html\", page_title=\"Jobs\", job_info=job)", "def job(tileset, job_id, token=None, inde...
[ "0.7152179", "0.71383125", "0.6330445", "0.6263424", "0.6214478", "0.6188785", "0.61780936", "0.61448723", "0.60901165", "0.6074674", "0.6017765", "0.6007803", "0.59747595", "0.59221345", "0.589214", "0.5855021", "0.5803626", "0.57746786", "0.57746786", "0.5773371", "0.575212...
0.75485474
0
View a single job for a particular tileset. tilesets job
def job(tileset, job_id, token=None, indent=None): mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/{1}/jobs/{2}?access_token={3}".format( mapbox_api, tileset, job_id, mapbox_token ) r = requests.get(url) click.echo(json.dumps(r.json(), indent=indent))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_job(options, job_name, client):\n if options.show_events:\n return display_events(client.job_events(job_name))\n\n job_content = client.job(job_name)\n return display.DisplayJobs(options).format_job(job_content)", "async def job_detail(request, job_id=None):\n current_jobs = dagobah._...
[ "0.69182616", "0.6617653", "0.63476014", "0.62747604", "0.62315136", "0.60969406", "0.6079476", "0.5952673", "0.58088917", "0.5790628", "0.5686428", "0.5582579", "0.5581716", "0.55650765", "0.5540786", "0.55388176", "0.5536627", "0.55236", "0.55182064", "0.5472965", "0.544627...
0.7312882
0
List all tilesets for an account. By default the response is a simple list of tileset IDs. If you would like an array of all tileset's information, use the versbose flag. tilests list
def list(username, verbose, token=None, indent=None): mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/{1}?access_token={2}".format( mapbox_api, username, mapbox_token ) r = requests.get(url) if r.status_code == 200: if verbose: for tile...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixture_tile_list():\n return {\n \"version\": 1,\n \"revision\": 1,\n \"timestamp\": \"2018-06-19T23:04:32.442Z\",\n \"timestamp_ms\": 1529449472442,\n \"result_code\": 0,\n \"result\": [\n {\n \"tileType\": \"TILE\",\n \"us...
[ "0.6313657", "0.5784542", "0.5680937", "0.56709623", "0.5668289", "0.56286174", "0.56016797", "0.55826", "0.5550821", "0.5427271", "0.535748", "0.5275198", "0.52157974", "0.5204004", "0.5186647", "0.51531774", "0.5109934", "0.51063216", "0.5066046", "0.5051925", "0.50334436",...
0.7860446
0
Validate a Recipe JSON document tilesets validaterecipe
def validate_recipe(recipe, token=None, indent=None): mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/validateRecipe?access_token={1}".format( mapbox_api, mapbox_token ) with open(recipe) as json_recipe: recipe_json = json.load(json_recipe) r ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_recipe(environ, recipe):\n try:\n validate_recipe(recipe, environ)\n except InvalidBagError as exc:\n raise HTTP409('Recipe content is invalid: %s' % exc)", "def check_recipe(recipe, data_directory=None):\n # check recipe is a dictionary\n if not isinstance(recipe, dict):\...
[ "0.63595736", "0.60863644", "0.5877467", "0.5658971", "0.544159", "0.5438701", "0.54253197", "0.5409057", "0.53850645", "0.5367168", "0.53094155", "0.5285954", "0.5279377", "0.5246911", "0.5224074", "0.5209505", "0.52058226", "0.50977165", "0.5095339", "0.50936866", "0.509328...
0.72382593
0
View a tileset's recipe JSON tilesets viewrecipe
def view_recipe(tileset, token=None, indent=None): mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/{1}/recipe?access_token={2}".format( mapbox_api, tileset, mapbox_token ) r = requests.get(url) if r.status_code == 200: click.echo(json.dumps(r.json(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_recipe(request, recipe, **_kwargs):\n return render(request, \"deployments/disp_recipe.html\", {\"recipe\": recipe})", "def recipe(id):\n\n selected_recipe = mongo.db.recipes.find_one({'_id': ObjectId(id)})\n\n # Using create list function to display these sections easier\n display_method = ...
[ "0.6430486", "0.6278637", "0.60368425", "0.60243356", "0.60141695", "0.5860817", "0.585936", "0.58377564", "0.58284754", "0.57778907", "0.5770112", "0.5763494", "0.5761875", "0.5735329", "0.57243955", "0.5721431", "0.5719946", "0.5699056", "0.5689098", "0.5674704", "0.5661595...
0.8028861
0
Update a Recipe JSON document for a particular tileset tilesets updaterecipe
def update_recipe(tileset, recipe, token=None, indent=None): mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/{1}/recipe?access_token={2}".format( mapbox_api, tileset, mapbox_token ) with open(recipe) as json_recipe: recipe_json = json.load(json_recipe)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_full_update_recipe(self):\n recipe = sample_recipe()\n recipe.ingredients.create(name='Eggs')\n original_description = recipe.description\n\n payload = {\n 'name': 'Vegan gnocchi',\n 'ingredients': [{'name': 'Vegegg'}]\n }\n url = recipe_deta...
[ "0.6287885", "0.62047666", "0.61583877", "0.6145476", "0.61356527", "0.612758", "0.6121439", "0.6084628", "0.5905411", "0.5889674", "0.5887126", "0.58802575", "0.5874741", "0.58549875", "0.5836796", "0.5829042", "0.5811349", "0.58038753", "0.57788795", "0.56087655", "0.559031...
0.7319158
0
Create/add a tileset source tilesets addsource
def add_source(ctx, username, id, features, no_validation, token=None, indent=None): mapbox_api = _get_api() mapbox_token = _get_token(token) url = ( f"{mapbox_api}/tilesets/v1/sources/{username}/{id}?access_token={mapbox_token}" ) with tempfile.TemporaryFile() as file: for feature ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _addSourceToTile(self, tile, sourceEntry, corners, scale):\n source = self._sources[sourceEntry['sourcenum']]\n ts = self._openSource(source, sourceEntry['kwargs'])\n # If tile is outside of bounding box, skip it\n bbox = source['bbox']\n if (corners[2][0] <= bbox['left'] or ...
[ "0.63106346", "0.6242407", "0.6181852", "0.5995432", "0.5959899", "0.59026515", "0.5895848", "0.5837343", "0.5822718", "0.5802456", "0.5723033", "0.5697263", "0.56536853", "0.5642326", "0.5624862", "0.5598968", "0.5473412", "0.54200363", "0.54169947", "0.5408778", "0.5397525"...
0.70931864
0
View a Tileset Source's information tilesets viewsource
def view_source(username, id, token=None, indent=None): mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/sources/{1}/{2}?access_token={3}".format( mapbox_api, username, id, mapbox_token ) r = requests.get(url) if r.status_code == 200: click.echo(jso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_sources(username, token=None):\n mapbox_api = _get_api()\n mapbox_token = _get_token(token)\n url = \"{0}/tilesets/v1/sources/{1}?access_token={2}\".format(\n mapbox_api, username, mapbox_token\n )\n r = requests.get(url)\n if r.status_code == 200:\n for source in r.json():...
[ "0.57861507", "0.5623747", "0.54790926", "0.5461085", "0.544482", "0.53834367", "0.5382121", "0.5329366", "0.53023386", "0.5296684", "0.5284189", "0.5280753", "0.5255383", "0.52418125", "0.52131957", "0.5167571", "0.51532954", "0.51469177", "0.51326746", "0.5106873", "0.51036...
0.7161197
0
Delete a Tileset Source + all of its files. tilesets deletesource
def delete_source(username, id, force, token=None): if not force: click.confirm( "Are you sure you want to delete {0} {1}?".format(username, id), abort=True ) mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/sources/{1}/{2}?access_token={3}".for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, source):\n _source = self._source_prefix+source\n assert _source in self.cache.keys()\n del self.cache[_source]", "def __del__(self):\r\n train_data_sources = list(self._train_data.values())\r\n test_data_sources = list(self._test_data.values())\r\n all_...
[ "0.636035", "0.6173071", "0.60790503", "0.5987599", "0.5917638", "0.5863623", "0.58427405", "0.58380115", "0.5836744", "0.58044493", "0.5800107", "0.5758255", "0.5698515", "0.56531304", "0.56498647", "0.56251085", "0.55927056", "0.5576707", "0.55732995", "0.55669975", "0.5549...
0.6908297
0
List all Tileset Sources for an account. Response is an unordered array of sources. tilesets listsources
def list_sources(username, token=None): mapbox_api = _get_api() mapbox_token = _get_token(token) url = "{0}/tilesets/v1/sources/{1}?access_token={2}".format( mapbox_api, username, mapbox_token ) r = requests.get(url) if r.status_code == 200: for source in r.json(): cl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sources():\n url = base_url + \"sources\"\n params = {\"language\": \"en\"}\n resp = requests.get(url, params=params)\n data = resp.json()\n sources = [src['id'].strip() for src in data['sources']]\n print(\"all the sources:\")\n print(sources)\n return sources", "def get_sources(...
[ "0.7102343", "0.70275754", "0.6670911", "0.66414875", "0.6598273", "0.6418739", "0.63086843", "0.624363", "0.61829776", "0.61549807", "0.6057943", "0.60390824", "0.60325825", "0.6032255", "0.6019853", "0.600825", "0.59725916", "0.5939919", "0.5932034", "0.5928629", "0.5920800...
0.7821861
0
Mutes everyone that you are following
def auto_mute_following(): following = set(t.friends.ids(screen_name=TWITTER_HANDLE)["ids"]) muted = set(t.mutes.users.ids(screen_name=TWITTER_HANDLE)["ids"]) not_muted = following - muted # put user IDs of people you do not want to mute here users_keep_unmuted = set([]) # mute al...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def follow_reciprocated(self, target):\n if random.randint(1, 1000) == 1: # 1 in 20 are public @replies\n self.tweet_user(target)\n else:\n try:\n self.dm_user(target)\n except:\n pass", "def author_following(self):\n\t\tpass", "def f...
[ "0.6377603", "0.6330849", "0.6264719", "0.6097981", "0.60914946", "0.60311484", "0.57444423", "0.5744262", "0.57255733", "0.5723841", "0.56434613", "0.5592666", "0.554689", "0.55407053", "0.552391", "0.55216295", "0.55041254", "0.54987043", "0.5481601", "0.54815555", "0.54575...
0.68102974
0
Unmutes everyone that you have muted
def auto_unmute(): muted = set(t.mutes.users.ids(screen_name=TWITTER_HANDLE)["ids"]) # put user IDs of people you want to remain muted here users_keep_muted = set([]) # mute all for user_id in muted: if user_id not in users_keep_muted: t.mutes.users.destroy(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def unmute(self, ctx, user: Redeemed):\n if member == None or member == ctx.message.author:\n await ctx.send(\"You cannot unmute yourself!\")\n return \n await user.remove_roles(discord.utils.get(ctx.guild.roles, name=\"Muted\"))\n await ctx.send(f\"{user.mention}...
[ "0.7793159", "0.7562203", "0.7182035", "0.71422404", "0.71150947", "0.70955354", "0.7093954", "0.709301", "0.7084421", "0.7016341", "0.7013622", "0.68202204", "0.68122566", "0.67613274", "0.6734327", "0.6710592", "0.665197", "0.6545975", "0.6484686", "0.6455824", "0.64350253"...
0.8222266
0
Extend `unichr` for all possible Unicode values (n).
def unicode_char(n): try: return unichr(n) except ValueError: # Generate bytes object packed as int. bytes_object = struct.pack('i', n) # Return decoded w/ utf-32 codec. return bytes_object.decode('utf-32')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def int_to_unichr(codepoint):\n if PY2:\n return unichr(codepoint)\n return chr(codepoint)", "def make_unicode():\r\n for num in range(300, 320):\r\n yield unichr(num)", "def safe_unichr(intval):\n try:\n return unichr(intval)\n except ValueError:\n # ValueError: unic...
[ "0.68852764", "0.6683728", "0.6391506", "0.59930366", "0.586188", "0.58399165", "0.58334017", "0.5817205", "0.56382495", "0.5589591", "0.55534005", "0.54915816", "0.5490308", "0.5472899", "0.5450932", "0.5440723", "0.54287136", "0.5352844", "0.53169405", "0.5304779", "0.52560...
0.7051785
0
Test ``create_engine`` with invalid adapter.
def test_create_engine_no_adapters(): engine = create_engine("shillelagh://") with pytest.raises(ProgrammingError) as excinfo: Table("dummy://", MetaData(bind=engine), autoload=True) assert str(excinfo.value) == "Unsupported table: dummy://"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_engine_exists():\n # Check if engine is present\n if not is_engine_binded():\n print(\"Binding new engine\")\n bind_engine(create_engine(\"sqlite:///:memory:\", echo=True))", "def test_engine(self):\n config = {\n \"url\": 'sqlite://',\n \"connect_args\...
[ "0.68235004", "0.66725576", "0.6549929", "0.6455361", "0.62477577", "0.6210242", "0.61840785", "0.61660314", "0.6095915", "0.60754657", "0.60633755", "0.6048799", "0.59452164", "0.5927696", "0.58780146", "0.5844836", "0.5800548", "0.57547444", "0.5749329", "0.57365346", "0.57...
0.83949554
0
init the class object and simply pass either twitter object or tweets plain text to this method. The analysis will return a list indicating the polarity and subjectivity of the tweets.
def analyse(self, tweet): if (type(tweet) == dict): text = self.clean_tweet(self.to_text(tweet)) else: text = self.clean_tweet(tweet) analysis = TextBlob(text) polarity = analysis.polarity subjectivity = analysis.subjectivity res = [] #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, tweet_json):\r\n self.tweet = tweet_json\r\n self.date = datetime.datetime.strptime(self.tweet[\"date\"], \"%Y-%m-%dT%H:%M:%S.000Z\")\r\n self.processed = False\r\n self.max_importance = 0\r\n try:\r\n text = re.sub(self.tweet[\"keywords\"][0], '', s...
[ "0.6772969", "0.66310155", "0.6570511", "0.6479291", "0.64774686", "0.6471122", "0.63829994", "0.63479525", "0.6342602", "0.6246067", "0.6185657", "0.6146315", "0.61160105", "0.6048045", "0.6047929", "0.6042262", "0.6041226", "0.6035858", "0.60260266", "0.60242325", "0.600587...
0.74163216
0
Discrete Variable to Feature Convertor. var value of variable varname name of variable. lims = range of numbers lims = range of discretization. collapse = list with two binary vals. collapse all below lim[0] to lim[0] & collapse all above lim[1] to lim[1] e.g., fdict = discVar2Feature(8, 'positive adjective', lims = [1...
def discVar2Feature( var, varname, lims = [1,3], collapse = [False, False], ctxt = 'Has'): vals = xrange(lims[0], lims[1]+1) keystr = ctxt + ' %s ' + varname fdict = {keystr % val:False for val in vals} if collapse[0] == True: if lims[0] > var: var = lims[0] #va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discVar2FeatureOld( var, varname, lims = [1,5], collapse = [False, False], ctxt = 'contains'):\n nums = ['zero','one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten']\n \n vals = range(lims[0], lims[1]+1) \n \n #init fdict\n fdict = dict() \n for k, val in en...
[ "0.7855145", "0.5295992", "0.5193816", "0.51229674", "0.5071455", "0.50275296", "0.4994465", "0.49909624", "0.48956412", "0.4888899", "0.48470324", "0.47712082", "0.4754599", "0.4749255", "0.47370207", "0.47250566", "0.46894085", "0.46833327", "0.46548498", "0.4644874", "0.46...
0.8257702
0
Discrete Variable to Feature Convertor. var value of variable varname name of variable. lims = range of numbers lims = range of discretization. collapse = list with two binary vals. collapse all below lim[0] to lim[0] & collapse all above lim[1] to lim[1] e.g., fdict = discVar2Feature(8, 'positive adjective', lims = [1...
def discVar2FeatureOld( var, varname, lims = [1,5], collapse = [False, False], ctxt = 'contains'): nums = ['zero','one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'] vals = range(lims[0], lims[1]+1) #init fdict fdict = dict() for k, val in enumerate(vals...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discVar2Feature( var, varname, lims = [1,3], collapse = [False, False], ctxt = 'Has'):\n \n vals = xrange(lims[0], lims[1]+1) \n \n keystr = ctxt + ' %s ' + varname\n fdict = {keystr % val:False for val in vals} \n\n if collapse[0] == True:\n if lims[0] > var:\n var = lims[...
[ "0.8234406", "0.52805275", "0.5167155", "0.5081879", "0.50444704", "0.50157154", "0.49738747", "0.49235922", "0.4897217", "0.48730886", "0.48664978", "0.47522265", "0.47458404", "0.47244322", "0.47193447", "0.47139582", "0.47023058", "0.4691292", "0.46388435", "0.46278065", "...
0.784609
1
Check if featureVals contains FKEY This is a check to see if a core feature function has been previously computed.
def haskey(featureVals, fkey): try: featureVals[fkey] except KeyError: return False #warn(HASKEYMSG % (fkey)) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_feature_by_keys(service_data=None, service_keys=None, ns_data=None, ns_keys=None):\n\n if service_data and not isinstance(service_data, Exception) and service_keys:\n if _is_keyval_greater_than_value(service_data, service_keys):\n return True\n\n if ns_data and ns_keys:\n ...
[ "0.6286112", "0.60849124", "0.5997217", "0.58951616", "0.5878267", "0.5877975", "0.58187664", "0.57946813", "0.5696939", "0.5696939", "0.564731", "0.56072927", "0.55438966", "0.5499882", "0.5431996", "0.5373477", "0.53706175", "0.53663695", "0.536493", "0.53626704", "0.531663...
0.7618906
0
End detection. described in Eq. (50) of S. Watanabe et al "Hybrid CTC/Attention Architecture for EndtoEnd Speech Recognition"
def end_detect(ended_hyps, i, M=3, d_end=np.log(1 * np.exp(-10))): if len(ended_hyps) == 0: return False count = 0 best_hyp = sorted(ended_hyps, key=lambda x: x["score"], reverse=True)[0] for m in six.moves.range(M): # get ended_hyps with their length is i - m hyp_length = i - m ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_detect(ended_hyps, i, M=3, D_end=np.log(1 * np.exp(-10))):\n if len(ended_hyps) == 0:\n return False\n count = 0\n best_hyp = sorted(ended_hyps, key=lambda x: x[\"score\"], reverse=True)[0]\n for m in range(M):\n # get ended_hyps with their length is i - m\n hyp_length = i ...
[ "0.59446865", "0.5918407", "0.5820141", "0.5536501", "0.54732686", "0.5456574", "0.5447737", "0.541912", "0.53824407", "0.53753823", "0.53732294", "0.53102255", "0.5226697", "0.52063173", "0.51992583", "0.5165421", "0.51476526", "0.5133361", "0.5113841", "0.50879014", "0.5086...
0.5958459
0
Geocode the addresses and build an address table
def build_addresses(self): from ambry.geo.geocoders import DstkGeocoder facilities = self.partitions.find(table='facilities') def address_gen(): for row in facilities.query("SELECT * FROM facilities"): address = "{}, {}, {} {}".format(row['dba_address1'], r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geolocate_address(self):\n self.geolocator = Nominatim(user_agent=\"fundaft\")\n\n # If latitude / longitude are missing, try to geocode them on the basis\n # of the address \n self.coords = [self.get_coords(address) if np.isnan(lat)\n else (lat, lon) for address...
[ "0.69380814", "0.63339984", "0.61368567", "0.60685796", "0.6055097", "0.6045649", "0.60010093", "0.5977058", "0.5975706", "0.59695", "0.59433144", "0.5934059", "0.5919156", "0.5903649", "0.5892241", "0.5878959", "0.5866598", "0.5815604", "0.5803367", "0.57603157", "0.5752638"...
0.74458176
0
Build the facilities_blockgroups crosswalk file to assign facilities to blockgroups.
def build_block_cross(self): from ambry.geo.util import find_geo_containment, find_containment from geoid import civick lr = self.init_log_rate(3000) def gen_bound(): boundaries = self.library.dep('blockgroups').partition # Note, ogc_fid is the pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_output_block_groups():\n for dept in Department.list():\n yield {\n 'name': dept.name,\n 'file_dep': [dept.block_groups_path],\n 'targets': [dept.block_groups_output],\n 'actions': ['cp %(dependencies)s %(targets)s'],\n 'clean': True,\n ...
[ "0.56382924", "0.520446", "0.51788396", "0.51779836", "0.5162532", "0.5090228", "0.50537544", "0.5002893", "0.49870488", "0.4973123", "0.49609685", "0.49350616", "0.49249336", "0.49217957", "0.49188414", "0.49178317", "0.49041072", "0.4886093", "0.4883396", "0.48815715", "0.4...
0.64450157
0
This will run through all of the web interface using selenium. The input should be a pdb_file full path. It will download the wrappers/bonds as PDB_NAME_wrappers.txt and PDB_NAME_bonds.txt.
def run_wrappa(browser, pdb_file): # Wrappa has 3 MB limit if os.path.getsize(pdb_file) > 3000000: logging.warn("%s is too large (size is %d), skipping", pdb_file, os.path.getsize(pdb_file)) return False if os.path.isfile(pdb_file[:-4] + "_bonds.txt"): logging.warn("%s has already b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dl_pdb(url_dom, pdb_id, dom_sid):\n good_url = re.sub(r'(output=html)', 'output=txt', url_dom)\n\n print(\"Dowloading the good domain of \" + pdb_id + \".pdb from the SCOP \" +\n \"website...\")\n urlreq.urlretrieve(good_url, \"data/\" + dom_sid + '.pdb')\n print(\"Download finished !\\n\"...
[ "0.59274244", "0.56355226", "0.536841", "0.53651416", "0.53063196", "0.5264013", "0.51971424", "0.5158493", "0.515513", "0.5132952", "0.50971687", "0.50108147", "0.49585226", "0.49400154", "0.49312222", "0.49199107", "0.4919623", "0.48803052", "0.48767388", "0.48723873", "0.4...
0.67259806
0
Generic function to take write .rst files and convert to pdf/html. Accepts a report template and dictionary. Writes rst once with full paths for image files and generates a pdf, then strips leading path components and writes again, generating an html file that exepects to live in the same directory as report images.
def write_workflow_report(workflow_name, report_template, report_dict): from os.path import exists, basename from subprocess import check_output # Plug the values into the template for the pdf file report_rst_text = report_template % report_dict # Write the rst file and convert to pdf report_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_report(template_filename, report_title, report_dir):\n\n def inner(output_dir: Optional[str] = None):\n output_dir = output_dir or report_dir\n with open(template_filename) as fd:\n template = jinja2.Template(fd.read())\n\n template.globals.update(\n {\"da...
[ "0.61397487", "0.5963483", "0.5911825", "0.58263385", "0.57665575", "0.5704803", "0.56863654", "0.56828785", "0.5679785", "0.5642886", "0.55997115", "0.5599295", "0.55712205", "0.5511724", "0.5507876", "0.5451432", "0.54270923", "0.534096", "0.53085405", "0.53046376", "0.5291...
0.7019554
0
S.feed(handle, consumer) Feed in a BLAST report for scanning. handle is a filelike object that contains the BLAST report. consumer is a Consumer object that will receive events as the report is scanned.
def feed(self, handle, consumer): if isinstance(handle, File.UndoHandle): uhandle = handle else: uhandle = File.UndoHandle(handle) # Try to fast-forward to the beginning of the blast report. read_and_call_until(uhandle, consumer.noevent, contains='BLAST') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feed(self, handle, consumer, do_features=...): # -> bool:\n ...", "def handle_feed(\n actapi: act.api.Act,\n user_agent: Text,\n proxies: Optional[Dict[Text, Text]] = None,\n verify_ssl: bool = True,\n output_format: Text = \"json\",\n) -> None:\n\n feed = download_feed(user_agent, p...
[ "0.63534445", "0.5767998", "0.5734903", "0.5599733", "0.54569304", "0.5154365", "0.5127441", "0.50028217", "0.49828988", "0.4976283", "0.49430162", "0.4887362", "0.4875427", "0.4865234", "0.4799642", "0.47539532", "0.4745771", "0.47228912", "0.4705688", "0.46607345", "0.46272...
0.79035497
0
next(self) > object Return the next Blast record from the file. If no more records, return None.
def next(self): lines = [] query = False while 1: line = self._uhandle.readline() if not line: break # If I've reached the next one, then put the line back and stop. if lines and (line.startswith('BLAST') o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _next(self, filename):\n try:\n return self.tmp_read[filename]['reader'].__next__()\n except StopIteration:\n return None", "def __next__(self):\n try:\n next_record = next(self.records)\n self.all_records.append(next_record)\n retur...
[ "0.69588554", "0.6904435", "0.6851931", "0.66342896", "0.652028", "0.64878345", "0.6429976", "0.6358846", "0.62886494", "0.62753236", "0.62223315", "0.62091005", "0.62091005", "0.6207237", "0.61904114", "0.6156381", "0.6149515", "0.6137225", "0.6125767", "0.61171055", "0.6112...
0.73920125
0
Execute and retrieve data from standalone BLASTPALL as handles (OBSOLETE). NOTE This function is obsolete, you are encouraged to the command line wrapper Bio.Blast.Applications.BlastallCommandline instead. Execute and retrieve data from blastall. blastcmd is the command used to launch the 'blastall' executable. program...
def blastall(blastcmd, program, database, infile, align_view='7', **keywds): _security_check_parameters(keywds) att2param = { 'matrix' : '-M', 'gap_open' : '-G', 'gap_extend' : '-E', 'nuc_match' : '-r', 'nuc_mismatch' : '-q', 'query_genetic_code' : '-Q', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rpsblast(blastcmd, database, infile, align_view=\"7\", **keywds):\n\n import warnings\n warnings.warn(\"This function is obsolete, you are encouraged to the command line wrapper Bio.Blast.Applications.BlastrpsCommandline instead.\", PendingDeprecationWarning)\n _security_check_parameters(keywds)\n ...
[ "0.6584838", "0.6572283", "0.650212", "0.6392259", "0.61772364", "0.6139482", "0.6132713", "0.6076423", "0.59617484", "0.58901364", "0.5859545", "0.5780147", "0.5600362", "0.5597818", "0.5547912", "0.54921067", "0.54734504", "0.54669", "0.5431532", "0.5394897", "0.5355753", ...
0.7728994
0
Execute and retrieve data from standalone BLASTPGP as handles (OBSOLETE). NOTE This function is obsolete, you are encouraged to the command line wrapper Bio.Blast.Applications.BlastpgpCommandline instead. Execute and retrieve data from blastpgp. blastcmd is the command used to launch the 'blastpgp' executable. database...
def blastpgp(blastcmd, database, infile, align_view='7', **keywds): import warnings warnings.warn("This function is obsolete, you are encouraged to the command line wrapper Bio.Blast.Applications.BlastpgpCommandline instead.", PendingDeprecationWarning) _security_check_parameters(keywds) att2param = {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rpsblast(blastcmd, database, infile, align_view=\"7\", **keywds):\n\n import warnings\n warnings.warn(\"This function is obsolete, you are encouraged to the command line wrapper Bio.Blast.Applications.BlastrpsCommandline instead.\", PendingDeprecationWarning)\n _security_check_parameters(keywds)\n ...
[ "0.69132483", "0.63498545", "0.6059055", "0.5686107", "0.5529276", "0.5422737", "0.54194593", "0.54177874", "0.54152125", "0.5406426", "0.53167474", "0.5235951", "0.52318496", "0.52102786", "0.5169427", "0.5141408", "0.5137818", "0.5122259", "0.5119625", "0.50635177", "0.4977...
0.821216
0
Execute and retrieve data from standalone RPSBLAST as handles (OBSOLETE). NOTE This function is obsolete, you are encouraged to the command line wrapper Bio.Blast.Applications.RpsBlastCommandline instead. Execute and retrieve data from standalone RPSBLAST. blastcmd is the command used to launch the 'rpsblast' executabl...
def rpsblast(blastcmd, database, infile, align_view="7", **keywds): import warnings warnings.warn("This function is obsolete, you are encouraged to the command line wrapper Bio.Blast.Applications.BlastrpsCommandline instead.", PendingDeprecationWarning) _security_check_parameters(keywds) att2param...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blastall(blastcmd, program, database, infile, align_view='7', **keywds):\n\n _security_check_parameters(keywds)\n\n att2param = {\n 'matrix' : '-M',\n 'gap_open' : '-G',\n 'gap_extend' : '-E',\n 'nuc_match' : '-r',\n 'nuc_mismatch' : '-q',\n 'query_genetic_code' ...
[ "0.6567743", "0.6469183", "0.62038195", "0.6169676", "0.5998038", "0.5889682", "0.57250804", "0.5698743", "0.55632794", "0.55214614", "0.5490336", "0.53914905", "0.52392304", "0.5195957", "0.51946354", "0.51559067", "0.5152533", "0.5110173", "0.5094674", "0.50776154", "0.5056...
0.74148107
0
Start BLAST and returns handles for stdout and stderr (PRIVATE). Expects a command line wrapper object from Bio.Blast.Applications
def _invoke_blast(cline): import subprocess, sys blast_cmd = cline.program_name if not os.path.exists(blast_cmd): raise ValueError("BLAST executable does not exist at %s" % blast_cmd) #We don't need to supply any piped input, but we setup the #standard input pipe anyway as a work around for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\targs = sys.argv[1:]\n\t# If stdin is not empty (being piped to)\n\tif not sys.stdin.isatty():\n\t\targs += sys.stdin.readlines()\n\tcommand = Main()\n\tcatch = lnk.errors.Catch(1)\n\tcatch.catch(command.main, args, standalone_mode=False)", "def blastn_commandline(cls):\n command = generate_...
[ "0.60168827", "0.5796402", "0.56809795", "0.56387544", "0.55868495", "0.55859977", "0.5585382", "0.55839694", "0.556747", "0.55591005", "0.5537728", "0.5533495", "0.5521777", "0.54482013", "0.5421747", "0.54031545", "0.5402231", "0.5383822", "0.53771955", "0.5370251", "0.5368...
0.66386735
0
Initialize a parser that tries to catch BlastErrors.
def __init__(self, bad_report_handle = None): self._bad_report_handle = bad_report_handle #self._b_parser = BlastParser() self._scanner = _Scanner() self._consumer = _BlastErrorConsumer()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, parser=None):", "def __init__(self, parser: Any = None):", "def __init__(self, *args, **kw):\n self.parser = Parser(*args, **kw)", "def test_create_new_gerber_parser(self):\n parser = Gerber()\n assert parser != None", "def _parse(self):\n try:\n # ...
[ "0.6177303", "0.6087029", "0.6007341", "0.5901439", "0.58615685", "0.5810311", "0.57898545", "0.5760166", "0.5715188", "0.5695503", "0.56734216", "0.55885917", "0.55627733", "0.5551707", "0.552452", "0.5515549", "0.55094403", "0.5507326", "0.5501497", "0.54901755", "0.5484418...
0.685799
0
Parse a handle, attempting to diagnose errors.
def parse(self, handle): results = handle.read() try: self._scanner.feed(File.StringHandle(results), self._consumer) except ValueError, msg: # if we have a bad_report_file, save the info to it first if self._bad_report_handle: # send the info ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _diagnose_error(self, handle, data_record):\n line = handle.readline()\n\n while line:\n # 'Searchingdone' instead of 'Searching......done' seems\n # to indicate a failure to perform the BLAST due to\n # low quality sequence\n if line.startswith('Search...
[ "0.5839811", "0.57687813", "0.5528219", "0.550164", "0.5492486", "0.54591936", "0.53429043", "0.5302302", "0.5275931", "0.5261604", "0.5244928", "0.5179438", "0.5175663", "0.51575375", "0.5084481", "0.50780374", "0.5070664", "0.5024885", "0.5024073", "0.5020243", "0.5017326",...
0.6661924
0
Attempt to diagnose an error in the passed handle.
def _diagnose_error(self, handle, data_record): line = handle.readline() while line: # 'Searchingdone' instead of 'Searching......done' seems # to indicate a failure to perform the BLAST due to # low quality sequence if line.startswith('Searchingdone'): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def myHandleError(self, record):\n if raiseExceptions:\n ei = sys.exc_info()\n try:\n traceback.print_exception(ei[0], ei[1], ei[2], None, sys.stderr)\n except IOError:\n pass # see issue 5971\n finally:\n del ei\n raise", "def myHandleErr...
[ "0.5868295", "0.5868295", "0.5857427", "0.5809658", "0.57716674", "0.57299936", "0.56281805", "0.5510797", "0.5452078", "0.5449711", "0.5429637", "0.5401915", "0.53741544", "0.537217", "0.5346068", "0.53016144", "0.52907413", "0.5285683", "0.5241748", "0.52281684", "0.521598"...
0.625596
0
Decrease dataset size by cutting requested classes smaller
def cut_classes(self, dataset, classes, max_size, label): # Cherry picked classes class_dfs = [] for c in classes: picked_data = dataset.loc[(dataset.loc[:,label] == c),:].reset_index(drop=True) class_dfs.append(picked_data.loc[0:min(len(picked_data), max_size),:]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduce_class_size(dataset, reductionType, targetSize):\n\n classes = []\n classesContent = []\n ds_reduced = []\n originalDataset = dataset.copy()\n absOriginalLength = len(originalDataset)\n absTargetLength = 0\n targetMultiplicator = 0\n\n # calc absolute length to reduce to\n if (...
[ "0.73414516", "0.68224937", "0.6783226", "0.61126554", "0.5833041", "0.5807217", "0.58048767", "0.5798329", "0.5755408", "0.5639198", "0.56274307", "0.5619286", "0.56011754", "0.5576871", "0.5574115", "0.5558189", "0.55560374", "0.5554359", "0.55406946", "0.55294955", "0.5526...
0.7343867
0
Save prediction results to csv file for visualisation purposes.
def save_prediction(self, meta, y_pred, y, filename): df = pd.DataFrame(meta) df['y_pred'] = y_pred df['y'] = y print(df) df.loc[:, 'id'] = df.index self.df_to_csv(df, filename, store_header=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_results(predictions, filename):\n with open(filename, 'w') as f:\n f.write(\"id,ACTION\\n\")\n for i, pred in enumerate(predictions):\n f.write(\"%d,%f\\n\" % (i + 1, pred))", "def save_prediction(self):\n if DataLoader.data is None:\n messagebox.showerror(\...
[ "0.7703693", "0.7628422", "0.7522447", "0.74385107", "0.74357957", "0.7419766", "0.7419766", "0.736686", "0.73543096", "0.732228", "0.7308786", "0.7291229", "0.71699023", "0.71563935", "0.711707", "0.7090318", "0.7074257", "0.7062179", "0.70042425", "0.6984243", "0.6929999", ...
0.76600194
1
Upload all files from folder to bucket
def _upload_dir_to_bucket(self, path, ext_path): for file in os.listdir(path): self._upload_to_bucket(path+'/'+file, ext_path+'/'+file)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_files_s3(files, bucket):\n \n print('************************************')\n print('Uploading files to s3 bucket...')\n print('************************************')\n \n for i in range(len(files)):\n upload_file_s3(files[i], bucket)\n \n print('**********************...
[ "0.7796129", "0.76484376", "0.76440495", "0.7522285", "0.73205024", "0.7259498", "0.71569556", "0.69658166", "0.68993825", "0.6886849", "0.6884797", "0.67420983", "0.67358345", "0.6709969", "0.6703498", "0.66821843", "0.66715854", "0.66610366", "0.6659203", "0.6640648", "0.66...
0.7838725
0
Upload file to bucket if bucket is set and ext_filename is not None
def _upload_to_bucket(self, filename, ext_filename): if ext_filename is None: return if self.s3: self.bucket.upload_file(filename, ext_filename) logging.info('Uploaded {} to S3 with name {}'.format(filename, ext_filename)) if self.gs: try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_file(\n self, bucket_id: uplink.Path, filename: uplink.Path, file: uplink.Body\n ):\n pass", "def upload_file(Filename=None, Bucket=None, Key=None, ExtraArgs=None, Callback=None, Config=None):\n pass", "def upload_file(file, bucket_path, bucket=S3_BUCKET):\n # Bucket path sho...
[ "0.7600532", "0.74214303", "0.7285555", "0.7134322", "0.71040857", "0.71002007", "0.7091589", "0.7090663", "0.7078668", "0.707424", "0.70586765", "0.69802374", "0.69690824", "0.6930814", "0.69067895", "0.687239", "0.6847536", "0.68146276", "0.679449", "0.6766457", "0.67521816...
0.85554653
0
Download all files from bucket and save them to 'local_path'
def _download_dir_from_bucket(self, ext_path, local_path, force=False): if os.path.exists(local_path) and not force: logging.info('Path {} already exists. Not overwriting...'.format(local_path)) return if os.path.exists(local_path) and force: logging.info('Path {} alr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self, local_path): # noqa: D402\n data_location = self.download_url\n data_location = rewrite_s3_links_locally(data_location)\n response = requests.get(data_location)\n write_file_locally(response.content, local_path)", "def download_file(s3_path, local_path):\n s3.meta.c...
[ "0.71020555", "0.7054091", "0.7037894", "0.69815624", "0.6956301", "0.6908696", "0.68448865", "0.6791386", "0.6786215", "0.67604995", "0.67517626", "0.6706798", "0.66289604", "0.66087854", "0.65796745", "0.6552148", "0.6546638", "0.6536262", "0.650691", "0.6451316", "0.639979...
0.7218672
0
Download file from bucket and save it to 'local_filename'
def _download_from_bucket(self, ext_filename, local_filename, force=False): if os.path.exists(local_filename) and not force: logging.info('File {} already exists. Not overwriting...'.format(local_filename)) return if os.path.exists(local_filename) and force: logging.i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_file(s3_path, local_path):\n s3.meta.client.download_file(bucket_name, s3_path, local_path)", "def download_file(self, bucket_name, key_name, local_file_location):\n try:\n self.logger.info(\"Downloading {}/{} from S3 to {}\".format(bucket_name, key_name, local_file_location))\n...
[ "0.78716594", "0.7565938", "0.7506007", "0.7422166", "0.73331714", "0.7330301", "0.73252624", "0.72543865", "0.72113806", "0.7189365", "0.71500474", "0.71356577", "0.71005404", "0.70790374", "0.7073477", "0.70685893", "0.7034173", "0.7021857", "0.7018799", "0.700558", "0.7002...
0.8098665
0
Report CV results and save them to file
def report_cv_results(self, results, scores=['score'], filename=None, n_top=5): res = "" for score in scores: res += "{}\n".format(score) res += "-------------------------------\n" for i in range(1, n_top + 1): candidates = np.flatnonzero(results['ran...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_report(cv_rfc, lrc, x_test_variable, y_test_dep):\n # Ensure the function works\n try:\n cls.classification_report_image(\n cv_rfc, lrc, x_test_variable, y_test_dep)\n logging.info(\"Successfully Plotting Classification Results\")\n except Exception as err:\n loggi...
[ "0.65733397", "0.65376616", "0.6398993", "0.6282908", "0.6274721", "0.62072086", "0.6165067", "0.6141804", "0.6075014", "0.60728824", "0.60719407", "0.603311", "0.60245275", "0.59826034", "0.5944425", "0.5938252", "0.5937966", "0.5919031", "0.5869347", "0.5869213", "0.5863098...
0.68240047
0
locate droplets in a (potentially periodic) data set on a Cartesian grid This function locates droplets respecting periodic boundary conditions.
def _locate_droplets_in_mask_cartesian( grid: CartesianGridBase, mask: np.ndarray ) -> Emulsion: if mask.shape != grid.shape: raise ValueError( f"The shape {mask.shape} of the data is not compatible with the grid " f"shape {grid.shape}" ) # pad the array to simulate ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _locate_droplets_in_mask_cylindrical(\n grid: CylindricalSymGrid, mask: np.ndarray\n) -> Emulsion:\n assert np.all(mask.shape == grid.shape)\n\n if grid.periodic[1]:\n # locate droplets respecting periodic boundary conditions in z-direction\n\n # pad the array to simulate periodic bounda...
[ "0.76811284", "0.6554566", "0.6185524", "0.58874184", "0.5519401", "0.5501593", "0.54900706", "0.53688544", "0.52624065", "0.5220514", "0.51110923", "0.5086385", "0.506581", "0.50574595", "0.502888", "0.5023648", "0.49670285", "0.49498272", "0.4919114", "0.4904832", "0.490381...
0.71093625
1
locates droplets in a binary data set on a spherical grid
def _locate_droplets_in_mask_spherical( grid: SphericalSymGridBase, mask: np.ndarray ) -> Emulsion: assert np.all(mask.shape == grid.shape) # locate clusters in the binary image labels, num_labels = ndimage.label(mask) if num_labels == 0: return Emulsion([], grid=grid) # locate cluster...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _locate_droplets_in_mask_cylindrical_single(\n grid: CylindricalSymGrid, mask: np.ndarray\n) -> Emulsion:\n # locate the individual clusters\n labels, num_features = ndimage.label(mask)\n if num_features == 0:\n return Emulsion([], grid=grid)\n\n # locate clusters on the symmetry axis\n ...
[ "0.6334625", "0.6326938", "0.6280052", "0.62748045", "0.6138442", "0.5841916", "0.5814795", "0.5784163", "0.5732394", "0.5644218", "0.56330884", "0.5590427", "0.5507217", "0.54709375", "0.5447573", "0.5432364", "0.5410063", "0.54034096", "0.53786707", "0.5365377", "0.53360826...
0.6527605
0
locate droplets in a data set on a single cylindrical grid
def _locate_droplets_in_mask_cylindrical_single( grid: CylindricalSymGrid, mask: np.ndarray ) -> Emulsion: # locate the individual clusters labels, num_features = ndimage.label(mask) if num_features == 0: return Emulsion([], grid=grid) # locate clusters on the symmetry axis object_slice...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _locate_droplets_in_mask_cylindrical(\n grid: CylindricalSymGrid, mask: np.ndarray\n) -> Emulsion:\n assert np.all(mask.shape == grid.shape)\n\n if grid.periodic[1]:\n # locate droplets respecting periodic boundary conditions in z-direction\n\n # pad the array to simulate periodic bounda...
[ "0.69664097", "0.6491768", "0.5973075", "0.58128065", "0.5637239", "0.5464887", "0.5392235", "0.53456414", "0.52834636", "0.5262984", "0.5244792", "0.5209711", "0.51998144", "0.5157793", "0.51553285", "0.5138001", "0.5137105", "0.50955933", "0.50665283", "0.50569886", "0.5023...
0.6496282
1
locate droplets in a data set on a (periodic) cylindrical grid This function locates droplets respecting periodic boundary conditions.
def _locate_droplets_in_mask_cylindrical( grid: CylindricalSymGrid, mask: np.ndarray ) -> Emulsion: assert np.all(mask.shape == grid.shape) if grid.periodic[1]: # locate droplets respecting periodic boundary conditions in z-direction # pad the array to simulate periodic boundary conditions...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _locate_droplets_in_mask_cartesian(\n grid: CartesianGridBase, mask: np.ndarray\n) -> Emulsion:\n if mask.shape != grid.shape:\n raise ValueError(\n f\"The shape {mask.shape} of the data is not compatible with the grid \"\n f\"shape {grid.shape}\"\n )\n\n # pad the ...
[ "0.65388036", "0.6282355", "0.60239565", "0.56848073", "0.5602002", "0.5525652", "0.5487211", "0.5334124", "0.52467597", "0.52423966", "0.5184897", "0.5184084", "0.5181235", "0.5123486", "0.50454843", "0.50172555", "0.5012011", "0.5001637", "0.4987533", "0.49609968", "0.49154...
0.7693398
0
Locates droplets in the phase field This uses a binarized image to locate clusters of large concentration in the phase field, which are interpreted as droplets. Basic quantities, like position and size, are determined for these clusters.
def locate_droplets( phase_field: ScalarField, threshold: Union[float, str] = 0.5, modes: int = 0, minimal_radius: float = 0, refine: bool = False, interface_width: Optional[float] = None, ) -> Emulsion: assert isinstance(phase_field, ScalarField) dim = phase_field.grid.dim # dimensiona...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _locate_droplets_in_mask_cylindrical(\n grid: CylindricalSymGrid, mask: np.ndarray\n) -> Emulsion:\n assert np.all(mask.shape == grid.shape)\n\n if grid.periodic[1]:\n # locate droplets respecting periodic boundary conditions in z-direction\n\n # pad the array to simulate periodic bounda...
[ "0.58779204", "0.58106714", "0.5760057", "0.54264325", "0.51649725", "0.51187783", "0.5067118", "0.50534153", "0.50534153", "0.50201076", "0.5005486", "0.49400416", "0.49284068", "0.49158067", "0.4898579", "0.48766935", "0.48485488", "0.4811385", "0.47815025", "0.47782052", "...
0.63500845
0
Refines droplet parameters by fitting to phase field This function varies droplet parameters, like position, size, interface width, and potential perturbation amplitudes until the overlap with the respective phase field region is maximized. Here, we use a constraint fitting routine.
def refine_droplet( phase_field: ScalarField, droplet: DiffuseDroplet, least_squares_params: Optional[Dict[str, Any]] = None, ) -> DiffuseDroplet: assert isinstance(phase_field, ScalarField) if least_squares_params is None: least_squares_params = {} if not isinstance(droplet, DiffuseDro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def constrain_pars(model_info, pars):\n name = model_info['id']\n # if it is a product model, then just look at the form factor since\n # none of the structure factors need any constraints.\n if '*' in name:\n name = name.split('*')[0]\n\n if name == 'capped_cylinder' and pars['cap_radius'] <...
[ "0.5658608", "0.5568899", "0.5530349", "0.50715446", "0.50218", "0.5020094", "0.4985122", "0.49686703", "0.49606922", "0.49477375", "0.49405155", "0.49347383", "0.49186304", "0.49127778", "0.4878627", "0.4878266", "0.4875737", "0.4857548", "0.48561665", "0.48514897", "0.48336...
0.68589544
0
Calculates the structure factor associated with a field Here, the structure factor is basically the power spectral density of the field `scalar_field` normalized so that regridding or rescaling the field does not change the result.
def get_structure_factor( scalar_field: ScalarField, smoothing: Union[None, float, str] = "auto", wave_numbers: Union[Sequence[float], str] = "auto", add_zero: bool = False, ) -> Tuple[np.ndarray, np.ndarray]: logger = logging.getLogger(__name__) if not isinstance(scalar_field, ScalarField): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_length_scale(\n scalar_field: ScalarField,\n method: str = \"structure_factor_maximum\",\n full_output: bool = False,\n smoothing: Optional[float] = None,\n) -> Union[float, Tuple[float, Any]]:\n logger = logging.getLogger(__name__)\n\n if method == \"structure_factor_mean\" or method == ...
[ "0.5794057", "0.5752112", "0.575145", "0.5655662", "0.56215703", "0.55155873", "0.53893906", "0.53778607", "0.5346394", "0.5300327", "0.5237999", "0.5237276", "0.5218443", "0.5210143", "0.5189513", "0.5166773", "0.51101947", "0.51071626", "0.51015085", "0.50777686", "0.507221...
0.72728807
0
Create and return a stub test.
def CreateStubTest(phases=None, params=None): # pylint: disable=invalid-name test_metadata = htftest.TestMetadata('foo') # pylint: disable=protected-access if params is not None: test_metadata._parameter_list = ( parameters.TestParameterList(params.parameters)) return htftest.HTFTest(test_metadata,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateStubTest(phases=None): # pylint: disable=invalid-name\n test_metadata = phase_data.TestMetadata('foo')\n return phase_data.phase_data(test_metadata, phases or [])", "def test_stub(self):\n pass", "def create_stub(cls, proto_py_module, stub_name):\n\n return cls.create_stubs(proto_py_...
[ "0.7049483", "0.68726027", "0.65086746", "0.6226904", "0.59744567", "0.5875409", "0.5875409", "0.5869115", "0.5800327", "0.57175136", "0.5705263", "0.5691941", "0.5661378", "0.5658473", "0.5648882", "0.5639574", "0.5630987", "0.5609541", "0.55923575", "0.55062956", "0.5492857...
0.74640894
0
Logic which should be executed for given 'rsm_ctx'.
def handle(self, rsm_ctx): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_handle(self, rsm_ctx):\n return rsm_ctx.instance.type == NODE_TYPE_RESULT", "def handle(self, rsm_ctx):\n rsm_ctx.log(\n 'info',\n 'Starting executing for \"list\" operation for get usage ...'\n )\n\n execution_id = rsm_ctx.run_execution(wait=False)\n ...
[ "0.61911374", "0.6145054", "0.5788437", "0.57324094", "0.56074697", "0.5554602", "0.5442962", "0.5299849", "0.5204402", "0.5140094", "0.5080645", "0.5065991", "0.5039015", "0.5039015", "0.5039015", "0.5005746", "0.49829862", "0.49768415", "0.49702245", "0.4969788", "0.4960261...
0.7899221
0
Check support 'rsm_ctx' type by handler. Instance should be None.
def can_handle(self, rsm_ctx): return not rsm_ctx.instance.type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_handle(self, rsm_ctx):\n return False", "def can_handle(self, rsm_ctx):\n return rsm_ctx.instance.type == NODE_TYPE_RESULT", "def handle(self, rsm_ctx):\n rsm_ctx.log(\n 'info',\n 'Node instance has type with is not supported by '\n 'Resource Manage...
[ "0.6648118", "0.6646733", "0.63854903", "0.62018675", "0.62018675", "0.62018675", "0.6113427", "0.60652363", "0.5710701", "0.5709683", "0.5318473", "0.5054878", "0.4966977", "0.4897182", "0.4872651", "0.48110458", "0.47685593", "0.47521907", "0.47270998", "0.4708487", "0.4706...
0.7572694
0
Logic which should be executed for given 'rsm_ctx'. Write to log message that type is unsupported.
def handle(self, rsm_ctx): rsm_ctx.log( 'info', 'Node instance has type with is not supported by ' 'Resource Management Plugin. Skipping' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_handle(self, rsm_ctx):\n return not rsm_ctx.instance.type", "def can_handle(self, rsm_ctx):\n return rsm_ctx.instance.type == NODE_TYPE_RESULT", "def handle(self, rsm_ctx):\n pass", "def can_handle(self, rsm_ctx):\n return False", "def _process_msg(cls, msg):\n ra...
[ "0.6189271", "0.5799024", "0.5745125", "0.5314854", "0.5146376", "0.51199263", "0.48813412", "0.48813412", "0.48813412", "0.48692715", "0.4823746", "0.48163384", "0.4791396", "0.4765693", "0.47391534", "0.47356078", "0.47062707", "0.46968287", "0.46908936", "0.46611562", "0.4...
0.690277
0
Check support 'rsm_ctx' type by handler. Instance should be NODE_TYPE_PROJECT.
def can_handle(self, rsm_ctx): return rsm_ctx.instance.type == NODE_TYPE_PROJECT
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle(self, rsm_ctx):\n rsm_ctx.log(\n 'info',\n 'Node instance has type with is not supported by '\n 'Resource Management Plugin. Skipping'\n )", "def can_handle(self, rsm_ctx):\n return not rsm_ctx.instance.type", "def can_handle(self, rsm_ctx):\n ...
[ "0.6362641", "0.61811864", "0.61003655", "0.57622105", "0.5663", "0.5663", "0.5663", "0.5303613", "0.50670636", "0.49746954", "0.49681306", "0.48913604", "0.47937822", "0.47625598", "0.47432458", "0.46864262", "0.4640284", "0.46303535", "0.46094924", "0.45498383", "0.45277175...
0.76011074
0
Logic which should be executed for given 'rsm_ctx'. Run resolve project on 'rsm_ctx'.
def handle(self, rsm_ctx): rsm_ctx.log('info', 'Processing of project started') rsm_ctx.resolve_project()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval(hw, r):\n\n # Check that the hw path exists and is a directory. If so, try\n # to determine if the student has committed a build directory.\n if os.path.isdir(hw):\n find_build_dir(hw, r)\n return True\n else:\n # Diagnose the error and try to locate the actual\n # project directory.\n ...
[ "0.56092745", "0.5602606", "0.555728", "0.55155736", "0.5420812", "0.5266047", "0.522466", "0.5147111", "0.514152", "0.5106763", "0.5106763", "0.5106763", "0.5088506", "0.5057311", "0.5047965", "0.5040335", "0.5024697", "0.5017567", "0.4963319", "0.49532133", "0.49410152", ...
0.76606447
0
Set value by resource managment context instance
def _set_value(rsm_ctx, value, value_type, resource_name=None): value_dict = {value_type: value} if resource_name: value_dict['resource_name'] = resource_name rsm_ctx.log('debug', 'Setting {}', value_dict) rsm_ctx.set_value(**value_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_resource_data(self, resource, meta):", "def update_context(self, ctx):\r\n assert isinstance(ctx, dict)\r\n ctx[str(self.context_id)] = self.value", "def set_attribute(self, context: ResourceCommandContext, obj_ref: str, attr_name: str, attr_value: str) -> None:\n self.handler.set_...
[ "0.7004103", "0.64217883", "0.63418335", "0.63214225", "0.63117516", "0.62844723", "0.6276568", "0.6202078", "0.6202078", "0.6191413", "0.61662775", "0.6094014", "0.6078255", "0.6006722", "0.60014075", "0.5977802", "0.59605306", "0.5909131", "0.5898597", "0.5889289", "0.58892...
0.6990149
1
Check support 'rsm_ctx' type by handler. Instance should be NODE_TYPE_QUOTA.
def can_handle(self, rsm_ctx): return rsm_ctx.instance.type == NODE_TYPE_QUOTA
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_handle(self, rsm_ctx):\n return not rsm_ctx.instance.type", "def can_handle(self, rsm_ctx):\n return rsm_ctx.instance.type == NODE_TYPE_USAGE", "def can_handle(self, rsm_ctx):\n return rsm_ctx.instance.type == NODE_TYPE_USAGE", "def can_handle(self, rsm_ctx):\n return rsm_...
[ "0.6811578", "0.6618091", "0.6618091", "0.6618091", "0.65914714", "0.63905466", "0.633495", "0.6178352", "0.5966573", "0.57266796", "0.52386665", "0.5188582", "0.5182612", "0.48737982", "0.4849607", "0.48398957", "0.48367012", "0.48311907", "0.4817003", "0.4806151", "0.480050...
0.7906162
0
Logic which should be executed for given 'rsm_ctx'. Process quota state from properties and run set_value on 'rsm_ctx'.
def handle(self, rsm_ctx): self._process_runtime_properties( rsm_ctx, rsm_ctx.instance.runtime_properties, self.VALUE_TYPE_QUOTA )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle(self, rsm_ctx):\n pass", "def handle(self, rsm_ctx):\n runtime_properties = rsm_ctx.get_execution_result()\n\n rsm_ctx.log(\n 'info',\n 'Got {} runtime_properties after execution',\n runtime_properties.keys()\n )\n\n self._process_run...
[ "0.5784707", "0.57681483", "0.5694401", "0.565285", "0.554098", "0.5526146", "0.55199933", "0.5502226", "0.5368012", "0.52405834", "0.52204037", "0.52040344", "0.5194511", "0.51885706", "0.5176698", "0.5157406", "0.51350015", "0.50702596", "0.5042467", "0.50392616", "0.503521...
0.7451228
0
Check support 'rsm_ctx' type by handler. Instance should be NODE_TYPE_USAGE.
def can_handle(self, rsm_ctx): return rsm_ctx.instance.type == NODE_TYPE_USAGE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_handle(self, rsm_ctx):\n return rsm_ctx.instance.type == NODE_TYPE_RESULT", "def can_handle(self, rsm_ctx):\n return not rsm_ctx.instance.type", "def handle(self, rsm_ctx):\n rsm_ctx.log(\n 'info',\n 'Node instance has type with is not supported by '\n ...
[ "0.68845487", "0.6870086", "0.6720605", "0.65307677", "0.6116541", "0.5959433", "0.5403402", "0.5394847", "0.52130985", "0.51359606", "0.50499636", "0.5031325", "0.50037795", "0.4988742", "0.4931527", "0.48985812", "0.48725662", "0.48347872", "0.47168615", "0.471334", "0.4712...
0.74504733
1
Logic which should be executed for given 'rsm_ctx'. Run execution on 'rsm_ctx'.
def handle(self, rsm_ctx): rsm_ctx.log( 'info', 'Starting executing for "list" operation for get usage ...' ) execution_id = rsm_ctx.run_execution(wait=False) rsm_ctx.log( 'info', 'Execution started with ID: {} ...'.format(execution_id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle(self, rsm_ctx):\n pass", "def can_handle(self, rsm_ctx):\n return rsm_ctx.instance.type == NODE_TYPE_RESULT", "def handle(self, rsm_ctx):\n runtime_properties = rsm_ctx.get_execution_result()\n\n rsm_ctx.log(\n 'info',\n 'Got {} runtime_properties af...
[ "0.7543212", "0.58339036", "0.5705841", "0.56092376", "0.5581437", "0.5514848", "0.54928815", "0.5442906", "0.54387003", "0.54118896", "0.54112417", "0.54038066", "0.53368837", "0.53190327", "0.5260661", "0.5252265", "0.5252265", "0.52007675", "0.5192384", "0.51621497", "0.51...
0.6470867
1
Check support 'rsm_ctx' type by handler. Instance should be NODE_TYPE_USAGE.
def can_handle(self, rsm_ctx): return rsm_ctx.instance.type == NODE_TYPE_USAGE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_handle(self, rsm_ctx):\n return rsm_ctx.instance.type == NODE_TYPE_RESULT", "def can_handle(self, rsm_ctx):\n return not rsm_ctx.instance.type", "def handle(self, rsm_ctx):\n rsm_ctx.log(\n 'info',\n 'Node instance has type with is not supported by '\n ...
[ "0.68845487", "0.6870086", "0.6720605", "0.65307677", "0.6116541", "0.5959433", "0.5403402", "0.5394847", "0.52130985", "0.51359606", "0.50499636", "0.5031325", "0.50037795", "0.4988742", "0.4931527", "0.48985812", "0.48725662", "0.48347872", "0.47168615", "0.471334", "0.4712...
0.74504733
0
Logic which should be executed for given 'rsm_ctx'. Process state from properties and run set_value on 'rsm_ctx'.
def handle(self, rsm_ctx): runtime_properties = rsm_ctx.get_execution_result() rsm_ctx.log( 'info', 'Got {} runtime_properties after execution', runtime_properties.keys() ) self._process_runtime_properties( rsm_ctx, runtime_pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle(self, rsm_ctx):\n pass", "def handle(self, rsm_ctx):\n self._process_runtime_properties(\n rsm_ctx,\n rsm_ctx.instance.runtime_properties,\n self.VALUE_TYPE_QUOTA\n )", "def handle(self, rsm_ctx):\n rsm_ctx.log(\n 'info',\n ...
[ "0.6495517", "0.6103459", "0.58350176", "0.56913376", "0.5490284", "0.5385307", "0.53602254", "0.5344496", "0.5338183", "0.5319866", "0.5295569", "0.5289274", "0.5206606", "0.5166721", "0.51118433", "0.5051935", "0.5042953", "0.5034518", "0.5019281", "0.5019281", "0.4992732",...
0.70196915
0
Key in SUPPRESS list
def _suppress(self, key): return key in self.SUPPRESS
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keys(self, data, installer_context):", "def key(key):\n return key", "def secondary_keys(self):", "def _GetKeyString(self):", "def _GetKeyString(self):", "def extract_key_usage(self, ext):\n res = []\n fields = KU_FIELDS[:]\n\n # \"error-on-access\", real funny\n if...
[ "0.59111524", "0.56453145", "0.55836684", "0.547909", "0.547909", "0.544734", "0.5446958", "0.542185", "0.5421237", "0.5421237", "0.5408113", "0.54074985", "0.5386925", "0.5340487", "0.5334346", "0.5295114", "0.52809834", "0.52733964", "0.52320004", "0.5206396", "0.5179361", ...
0.57660186
1
Translate key by translate dict
def _translate(self, key): return self.TRANSLATE.get(key, key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(key, dictionary):\n if key in dictionary:\n return dictionary[key]\n if key in dictionary.values():\n return key\n raise Exception(\"no entry {} in dictionary {}\".format(key, dictionary))", "def _make_trans_from_dict(translations):\n\n from_str = ''\n to_str = ...
[ "0.7452892", "0.7021639", "0.6875848", "0.6788803", "0.6653619", "0.65519345", "0.6360589", "0.6328695", "0.62527615", "0.6251204", "0.6133195", "0.6096026", "0.6090223", "0.60032105", "0.5933524", "0.5926303", "0.59189796", "0.59064764", "0.59049064", "0.5901391", "0.5849293...
0.74695766
0
Check support 'rsm_ctx' type by handler. Instance should be NODE_TYPE_QUOTA and SYSTEM_NAME_OPENSTACK in 'system_name'.
def can_handle(self, rsm_ctx): return super(OpenstackQuotaHandler, self).can_handle(rsm_ctx) and \ SYSTEM_NAME_OPENSTACK in rsm_ctx.instance.system_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_handle(self, rsm_ctx):\n return rsm_ctx.instance.type == NODE_TYPE_QUOTA", "def can_handle(self, rsm_ctx):\n return not rsm_ctx.instance.type", "def handle(self, rsm_ctx):\n rsm_ctx.log(\n 'info',\n 'Node instance has type with is not supported by '\n ...
[ "0.6766187", "0.6549585", "0.6380219", "0.62915754", "0.62915754", "0.62915754", "0.6178638", "0.58965355", "0.5851137", "0.5643693", "0.51984125", "0.51205176", "0.5115497", "0.50924265", "0.50415015", "0.49992657", "0.4892618", "0.4861141", "0.4819281", "0.47552007", "0.474...
0.70649564
0
Check support 'rsm_ctx' type by handler. Instance should be NODE_TYPE_RESULT.
def can_handle(self, rsm_ctx): return rsm_ctx.instance.type == NODE_TYPE_RESULT
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_handle(self, rsm_ctx):\n return not rsm_ctx.instance.type", "def handle(self, rsm_ctx):\n rsm_ctx.log(\n 'info',\n 'Node instance has type with is not supported by '\n 'Resource Management Plugin. Skipping'\n )", "def can_handle(self, rsm_ctx):\n ...
[ "0.6539492", "0.6527251", "0.6194596", "0.6194596", "0.6194596", "0.58348286", "0.57641536", "0.57499075", "0.52276134", "0.5095498", "0.5037327", "0.4948946", "0.49151015", "0.48483157", "0.4833058", "0.47804075", "0.47727802", "0.47572267", "0.47519362", "0.46803394", "0.46...
0.77807736
0
Logic which should be executed for given 'rsm_ctx'. Dump state to runtime properties.
def handle(self, rsm_ctx): rsm_ctx.log( 'info', 'Dumping gathered data to runtime_properties of {} node instance', rsm_ctx.instance.id ) rsm_ctx.add_result_instance_id() rsm_ctx.set_runtime_properties({ 'data': rsm_ctx.dump() })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle(self, rsm_ctx):\n pass", "def handle(self, rsm_ctx):\n runtime_properties = rsm_ctx.get_execution_result()\n\n rsm_ctx.log(\n 'info',\n 'Got {} runtime_properties after execution',\n runtime_properties.keys()\n )\n\n self._process_run...
[ "0.6944394", "0.60357314", "0.55758333", "0.54697585", "0.52686495", "0.52058613", "0.5138877", "0.5134144", "0.5079232", "0.505829", "0.50382674", "0.49983215", "0.49911332", "0.49770048", "0.49382457", "0.49272338", "0.49066004", "0.49020687", "0.4894868", "0.48867136", "0....
0.68619585
1
Determine ticket id either from existing subject line or from uid If the Subject line contains an ID, it is taken. If it doesn't, a new one is generated.
def determine_ticket_ID(self): hashid = hashids.Hashids(salt=self.config.idSalt, alphabet=self.config.idAlphabet, min_length=self.config.idMinLength) # See if hashid is set in headers if self.parsed["X-Jicket-HashID"] is not None: self.tickethash = self.parsed["X-Jicket-HashID"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_subject_id(self, rec:str) -> int:\n raise NotImplementedError", "def get_ticket_id():\n return str(time.time()) + str(uuid.uuid4())", "def _get_ticket_id(self, str):\n pat = r'^\\s*#(\\d+)'\n try:\n return int(re.search(pat, str).group(1))\n except:\n ...
[ "0.6021244", "0.5966582", "0.5956366", "0.5919215", "0.58400536", "0.5819156", "0.5633356", "0.55684143", "0.5405211", "0.5354974", "0.5307806", "0.5300704", "0.5289483", "0.52597475", "0.5240629", "0.5164551", "0.51528645", "0.5145069", "0.51301694", "0.5126908", "0.51150215...
0.6965168
0
Convert text bodies to text that can be attached to an issue
def textfrombodies(self) -> str: type_priority = ["plain", "html", "other"] # TODO: Make configurable for texttype in type_priority: if texttype == "plain" and texttype in self.textbodies: """Text is plain, so it can be used verbatim""" return self.textbodie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(self, text):\r\n return text", "def generate_body(issue):\n markdown = \"### {}\\n\".format(issue.pop('title'))\n for k, v in issue.iteritems():\n markdown += \"- {}: {}\\n\".format(k, v)\n return markdown", "def convert_to_markdown(self, text: str) -> str:", "def get_te...
[ "0.61873615", "0.6027262", "0.58918947", "0.5888332", "0.5878906", "0.5850792", "0.58205616", "0.5773772", "0.5754406", "0.5704299", "0.56952536", "0.56866527", "0.5672063", "0.56352043", "0.562836", "0.56220996", "0.56156236", "0.5604763", "0.56015706", "0.55987185", "0.5596...
0.71296585
0
Save the given TF session at PATH = "./model/tmpmodel"
def _save_model(graph_or_sess): if isinstance(graph_or_sess, tf.Graph): ops = graph_or_sess.get_operations() for op in ops: if 'variable' in op.type.lower(): raise ValueError('Please input a frozen graph (no variables). Or pass in the session object.') wit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self):\n\n self.saver.save(self.sess, self.path + '/tensorflow-model', global_step=self.counter.count)", "def save_session(self):\n\n # Checkpoint directory. Tensorflow assumes this directory already exists so we need to create it\n checkpoint_dir = os.path.abspath(os.path.join(self.FLA...
[ "0.77613735", "0.756965", "0.75423574", "0.73797125", "0.7366821", "0.7349892", "0.71762145", "0.7025819", "0.6998633", "0.6955972", "0.69415617", "0.6939384", "0.6921636", "0.6920539", "0.6881578", "0.6872373", "0.6870211", "0.68608505", "0.6825167", "0.6805065", "0.6735286"...
0.79623353
0
Fix the markdown links based on the pages that we know.
def _fix_links(self, text, page_names): for n in page_names: text = text.replace(f"]({n})", f"]({n}.html)") text = text.replace(f"]({n}.md)", f"]({n}.html)") return text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_page_markdown(self, markdown, **kwargs):\n for autolink in self.config[\"autolinks\"]:\n markdown = replace_autolink_references(markdown, autolink[\"reference_prefix\"], autolink[\"target_url\"])\n\n return markdown", "def fix_links():\n pass", "def on_page_markdown(self, mar...
[ "0.7468987", "0.70825726", "0.6409713", "0.6033815", "0.5947633", "0.5921285", "0.5885464", "0.5884731", "0.5832796", "0.58249164", "0.57960886", "0.5768971", "0.57507855", "0.5704053", "0.55767506", "0.5538461", "0.5510497", "0.5480508", "0.54325324", "0.54244053", "0.540460...
0.7852134
0
Split the markdown into parts based on sections. Each part is either text or a tuple representing a section.
def _split(self): text = self.md self.parts = parts = [] self.headers = headers = [] lines = [] # Split in parts for line in text.splitlines(): if line.startswith(("# ", "## ", "### ", "#### ", "##### ")): # Finish pending lines ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_into_sections(text):\n headings_regex = re.compile(\n r'^={1,6}.*?={1,6}(?: *<!--.*?-->)?\\s*$', flags=re.M\n )\n sections = list()\n last_match_start = 0\n for match in headings_regex.finditer(text):\n match_start = match.start()\n if match_start > 0:\n sec...
[ "0.6592996", "0.62733644", "0.60852915", "0.6063004", "0.5859374", "0.5849308", "0.5828487", "0.5798614", "0.57628095", "0.5672283", "0.56307954", "0.5625874", "0.55943716", "0.5592244", "0.55725014", "0.55567396", "0.55356854", "0.5535604", "0.552459", "0.55119103", "0.54861...
0.77850777
0
Validate a redirected error response. All the URL components should match the original redirect_uri, with the exception of the parameters, which should contain an 'error' and an 'error_description' field of the provided types.
def assertValidRedirect(self, response, redirect_uri, expected_status_code, **kwargs): self.assertEqual(expected_status_code, response.status_code) # Split the url into parts. location = response.headers.get('Location') location_url = urlparse.urlparse(locati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_response(self, error, **kwargs):\n oauthlib_error = error.oauthlib_error\n error_response = {\n 'error': oauthlib_error,\n 'url': '{0}?{1}'.format(oauthlib_error.redirect_uri, oauthlib_error.urlencoded)\n }\n error_response.update(kwargs)\n\n if is...
[ "0.7122628", "0.65730166", "0.62523395", "0.6000711", "0.59799373", "0.58929646", "0.58686644", "0.58485216", "0.5775962", "0.5717465", "0.5591549", "0.5570456", "0.5543242", "0.5461019", "0.543455", "0.543455", "0.5410617", "0.5404725", "0.54023296", "0.5393356", "0.5376724"...
0.6597871
1
This test ensures that the authorize request against the oauth endpoint succeeds with expected values.
def test_valid_authorize_request(self): random_state = six.text_type(uuid.uuid4()) # Simple GET with various parameters response = self.get_json(path='/openid/authorize', expect_errors=True, state=random_state, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_oauth(self):\n oauth_headers = self._get_oauth_headers(self.user)\n self.client.logout()\n response = self.client.get(self.path(), **oauth_headers)\n assert response.status_code == 200\n body = {'user_id': 'staff', 'action': 'allow'}\n response = self.client.post(...
[ "0.74779457", "0.74457616", "0.72292477", "0.7201043", "0.7180546", "0.7083249", "0.7080737", "0.701164", "0.70015174", "0.6941109", "0.69249433", "0.68833077", "0.67708033", "0.6765852", "0.6744", "0.67292756", "0.66937137", "0.6668326", "0.6645099", "0.6577298", "0.65717685...
0.8130674
0
Assert that an invalid response_type redirects back to the redirect_uri and provides the expected error response.
def test_authorize_invalid_response_type(self): invalid_params = self.valid_params.copy() invalid_params['response_type'] = 'invalid_code' # Simple GET with invalid code parameters random_state = six.text_type(uuid.uuid4()) response = self.get_json(path='/openid/authorize', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_http_error_raise_with_redirect(self):\n\n resp = self.r(\n HTTPError(http_status.HTTP_201_CREATED, redirect_url='http://google.com/')\n )\n\n self.assertIsInstance(\n resp, werkzeug.wrappers.Response\n )\n\n self.assertEqual(302, resp.status_code)\n...
[ "0.75191337", "0.72961164", "0.7171664", "0.70651674", "0.6875958", "0.67515904", "0.6627203", "0.6615773", "0.65987235", "0.6589537", "0.6552112", "0.6536879", "0.6508044", "0.6480439", "0.63691235", "0.6355215", "0.6341384", "0.6288093", "0.62804973", "0.62268054", "0.61819...
0.7701483
0
Assert that an nonexistent response_type redirects back to the redirect_uri and provides the expected error response.
def test_authorize_no_response_type(self): invalid_params = self.valid_params.copy() del invalid_params['response_type'] # Simple GET with invalid code parameters random_state = six.text_type(uuid.uuid4()) response = self.get_json(path='/openid/authorize', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_authorize_invalid_response_type(self):\n invalid_params = self.valid_params.copy()\n invalid_params['response_type'] = 'invalid_code'\n\n # Simple GET with invalid code parameters\n random_state = six.text_type(uuid.uuid4())\n response = self.get_json(path='/openid/autho...
[ "0.7420597", "0.7164122", "0.6910888", "0.6648324", "0.6642587", "0.6474151", "0.64672065", "0.6405829", "0.6382179", "0.6363759", "0.63207835", "0.6319008", "0.62895614", "0.6289121", "0.62787527", "0.6247881", "0.6192791", "0.61116356", "0.61116356", "0.60881925", "0.608715...
0.73475444
1
Assert that an invalid scope redirects back to the redirect_uri and provides the expected error response.
def test_authorize_invalid_scope(self): invalid_params = self.valid_params.copy() invalid_params['scope'] = 'invalid_scope' # Simple GET with invalid code parameters random_state = six.text_type(uuid.uuid4()) response = self.get_json(path='/openid/authorize', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_authorize_invalid_redirect_uri(self):\n invalid_params = self.valid_params.copy()\n invalid_params['redirect_uri'] = 'not_a_valid_uri'\n\n # Simple GET with invalid code parameters\n random_state = six.text_type(uuid.uuid4())\n response = self.get_json(path='/openid/auth...
[ "0.75373936", "0.7251968", "0.7147685", "0.7066093", "0.6928313", "0.6903567", "0.66213906", "0.65763414", "0.65235853", "0.6513123", "0.6497357", "0.626261", "0.61775184", "0.61602324", "0.61488956", "0.6142485", "0.6129963", "0.6106142", "0.60907656", "0.5985967", "0.598029...
0.7770297
0
Assert that a nonexistent scope redirects back to the redirect_uri and provides the expected error response.
def test_authorize_no_scope(self): invalid_params = self.valid_params.copy() del invalid_params['scope'] # Simple GET with invalid code parameters random_state = six.text_type(uuid.uuid4()) response = self.get_json(path='/openid/authorize', expec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_authorize_invalid_scope(self):\n invalid_params = self.valid_params.copy()\n invalid_params['scope'] = 'invalid_scope'\n\n # Simple GET with invalid code parameters\n random_state = six.text_type(uuid.uuid4())\n response = self.get_json(path='/openid/authorize',\n ...
[ "0.75156254", "0.7148414", "0.7028421", "0.7019475", "0.7017566", "0.67602414", "0.6492892", "0.6403846", "0.6372125", "0.62288857", "0.6219358", "0.6178828", "0.6163945", "0.61515033", "0.6126656", "0.6096851", "0.60844594", "0.6039896", "0.6037854", "0.6014855", "0.5999588"...
0.72937465
1
Assert that an invalid redirect_uri returns a 400 message with the appropriate error message encoded in the body of the response.
def test_authorize_invalid_redirect_uri(self): invalid_params = self.valid_params.copy() invalid_params['redirect_uri'] = 'not_a_valid_uri' # Simple GET with invalid code parameters random_state = six.text_type(uuid.uuid4()) response = self.get_json(path='/openid/authorize', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_response_request(self, mock_post):\n self._mock_response(mock_post, valid=False)\n\n random_state = six.text_type(uuid.uuid4())\n\n # Simple GET with various parameters\n response = self.get_json(path='/openid/authorize_return',\n expect_...
[ "0.7055511", "0.70326936", "0.6937571", "0.6726953", "0.6695739", "0.6667875", "0.6663773", "0.6658823", "0.66554034", "0.6631071", "0.6492055", "0.6474287", "0.6418554", "0.6386279", "0.6319697", "0.6296205", "0.6216002", "0.6185745", "0.61735564", "0.6173064", "0.6152858", ...
0.76964027
0
Assert that a nonexistent redirect_uri returns a 400 message with the appropriate error message encoded in the body of the response.
def test_authorize_no_redirect_uri(self): invalid_params = self.valid_params.copy() del invalid_params['redirect_uri'] # Simple GET with invalid code parameters random_state = six.text_type(uuid.uuid4()) response = self.get_json(path='/openid/authorize', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_authorize_invalid_redirect_uri(self):\n invalid_params = self.valid_params.copy()\n invalid_params['redirect_uri'] = 'not_a_valid_uri'\n\n # Simple GET with invalid code parameters\n random_state = six.text_type(uuid.uuid4())\n response = self.get_json(path='/openid/auth...
[ "0.7718685", "0.7033793", "0.6927159", "0.69097126", "0.69086397", "0.6898485", "0.6685903", "0.66302705", "0.65627855", "0.652894", "0.6524669", "0.649647", "0.6418248", "0.6401584", "0.6385468", "0.6310627", "0.6294222", "0.62791204", "0.6268177", "0.6264218", "0.62368065",...
0.7158007
1
Set the mock response from the openid endpoint to either true or false.
def _mock_response(self, mock_post, valid=True): mock_post.return_value.status_code = 200 if valid: mock_post.return_value.content = \ 'is_valid:true\nns:http://specs.openid.net/auth/2.0\n' else: mock_post.return_value.content = \ 'is_vali...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_boolean(self):\n endpoint = self.api.boolean\n assert endpoint.openapi_types['body'] == (bool,)\n assert endpoint.settings['response_type'] == (bool,)", "def test_update_true(self, mock_decorator):\n BceInstitutionRepository.create(\n uai='0802145Z', is_institution...
[ "0.6240062", "0.6088881", "0.6007175", "0.59424764", "0.5702211", "0.5642949", "0.56002766", "0.5597038", "0.5544386", "0.5502624", "0.5480442", "0.5476116", "0.54389155", "0.54300946", "0.54158604", "0.5402787", "0.53936625", "0.538996", "0.53734565", "0.5373242", "0.5370819...
0.6738863
0
This test ensures that the access token request may execute properly with a valid token.
def test_valid_access_request(self): # Generate a valid auth token with base.HybridSessionManager(): authorization_code = auth_api.authorization_code_save({ 'user_id': 2, 'state': 'test_state', 'code': 'test_valid_code' }) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_read_o_auth_access_token(self):\n pass", "def test_create_o_auth_access_token(self):\n pass", "def test_access_token_get(self):\n client = oauth.Client(self.consumer, None)\n resp, content = client.request(self._uri('request_token'), \"GET\")\n\n self.assertEqual(int...
[ "0.8008994", "0.79901123", "0.7986423", "0.7827258", "0.76730573", "0.7581791", "0.7542795", "0.7538852", "0.7517634", "0.7500351", "0.7455751", "0.7445823", "0.7411423", "0.73875546", "0.7371738", "0.7253156", "0.72491294", "0.72450924", "0.72399", "0.7238495", "0.72369736",...
0.82178074
0
Assert that a newly created access token is valid if storyboard is installed in a multitude of timezones.
def test_valid_access_token_time(self): # Store the old TZ info, if it exists. old_tz = None if 'TZ' in os.environ: old_tz = os.environ['TZ'] # Convert now into every possible timezone out there :) for name in self.tested_timezones: # Override the 'defa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_expired_access_token_time(self):\n\n expired = datetime.datetime.now(pytz.utc) - datetime.timedelta(\n minutes=6)\n\n # Store the old TZ info, if it exists.\n old_tz = None\n if 'TZ' in os.environ:\n old_tz = os.environ['TZ']\n\n # Convert now into ...
[ "0.6694041", "0.60501355", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5970943", "0.5809005", "0.5798218", "0.56382155", ...
0.74466926
0
This test ensures that an access token is seen as expired if storyboard is installed in multiple timezones.
def test_expired_access_token_time(self): expired = datetime.datetime.now(pytz.utc) - datetime.timedelta( minutes=6) # Store the old TZ info, if it exists. old_tz = None if 'TZ' in os.environ: old_tz = os.environ['TZ'] # Convert now into every possible ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_valid_access_token_time(self):\n\n # Store the old TZ info, if it exists.\n old_tz = None\n if 'TZ' in os.environ:\n old_tz = os.environ['TZ']\n\n # Convert now into every possible timezone out there :)\n for name in self.tested_timezones:\n\n # Ove...
[ "0.77153397", "0.68467736", "0.68020415", "0.66638994", "0.655659", "0.6532942", "0.6463671", "0.64408976", "0.64147025", "0.64067024", "0.6335219", "0.63339216", "0.6268353", "0.62255085", "0.621401", "0.6190267", "0.6190267", "0.6190267", "0.6190267", "0.6190267", "0.619026...
0.7908679
0
This test ensures that invalid grant_type parameters get the appropriate error response.
def test_invalid_grant_type(self): # Generate a valid auth token with base.HybridSessionManager(): authorization_code = auth_api.authorization_code_save({ 'user_id': 2, 'state': 'test_state', 'code': 'test_valid_code', 'expires...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testInvalidGrantType(self):\n request = self.generateValidTokenRequest(arguments={'grant_type': b'grantType\\xFF\\xFF'},\n authentication=self._VALID_CLIENT)\n result = self._TOKEN_RESOURCE.render_POST(request)\n self.assertFailedTokenRequest...
[ "0.772801", "0.72654927", "0.726257", "0.70829815", "0.68463784", "0.677205", "0.6727337", "0.6633874", "0.651238", "0.6486372", "0.6486188", "0.64548945", "0.6451076", "0.6325722", "0.62595737", "0.6252418", "0.6246032", "0.6237852", "0.6236558", "0.6236232", "0.61953956", ...
0.8002551
0
This test ensures that a valid refresh token can be converted into a valid access token, and cleans up after itself.
def test_valid_refresh_token(self): # Generate a valid access code with base.HybridSessionManager(): authorization_code = auth_api.authorization_code_save({ 'user_id': 2, 'state': 'test_state', 'code': 'test_valid_code' }) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_authtoken_refresh(self):\n hagrid = models.User(username='hagrid', fullname='Rubeus Hagrid')\n auth_token = models.AuthToken(user=hagrid, algorithm='hmac-sha-1')\n existing_token = auth_token.token\n existing_secret = auth_token.secret\n auth_token.refresh()\n sel...
[ "0.75595343", "0.74704844", "0.7360822", "0.7301422", "0.7252117", "0.72328687", "0.72013396", "0.7191407", "0.71329045", "0.7123395", "0.71109587", "0.7087008", "0.7076181", "0.70589894", "0.70476675", "0.69455695", "0.6916871", "0.6894391", "0.6884534", "0.68592453", "0.683...
0.76067364
0
This test ensures that an invalid refresh token can be converted into a valid access token.
def test_invalid_refresh_token(self): content_type = 'application/x-www-form-urlencoded' # Generate an auth and a refresh token. resp_1 = self.app.post('/v1/openid/token', params={ 'refresh_token': 'invalid_refresh_token', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_legacy_client_invalid_refresh_token_expired_access_token(self):\n self.legacy_client._client._expires_at = 1\n self.legacy_client.token['refresh_token'] = 'invalidrefreshtoken'\n response = self.legacy_client.request('GET', urljoin(BASE_URL, MOCK_ENDPOINT))\n self.assertEquals(...
[ "0.77855164", "0.7776032", "0.76719224", "0.76533115", "0.73654115", "0.7338942", "0.7290583", "0.7267676", "0.7238647", "0.71473265", "0.7119978", "0.7110751", "0.70527965", "0.7029916", "0.69989884", "0.69802237", "0.69181126", "0.6860301", "0.68478835", "0.6846695", "0.682...
0.8209073
0
Test retrieving all players
def test_retrieve_players(self): Player.objects.create(name='Mayita', victories=0, defeats=0) Player.objects.create(name='Moiso', victories=0, defeats=0) res = self.client.get(PLAYERS_URL) players = Player.objects.all().order_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_gridironfootballplayers_get(self):\n pass", "def test_get_player(self):\n pass", "def test_player_index(self):\n player = Player(first_name='George', last_name='Smith')\n player.save()\n response = self.client.get(reverse('players'))\n self.assertQuerysetEqual...
[ "0.7851354", "0.7392498", "0.7249521", "0.7195039", "0.7023699", "0.69242185", "0.6841736", "0.68325335", "0.6792121", "0.6791838", "0.67904574", "0.6744118", "0.67069584", "0.6672156", "0.6652354", "0.6647714", "0.6608296", "0.6586247", "0.6585509", "0.6544839", "0.6533784",...
0.80052656
0
Test creating a new player
def test_create_player_successful(self): payload = {'name': 'Mayita', 'victories': 0, 'defeats': 0} self.client.post(PLAYERS_URL, payload) print('PLAYERS_URL: ',PLAYERS_URL) exists = Player.objects.filter( name=payload['name'] ).exists() self.assertTrue(exist...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_new_player(new_player, new_room):\n\n try:\n uuid.UUID(str(new_player.id), version=4)\n except ValueError:\n raise ValueError('new_player id is not valid uuid4')\n assert new_player.order_of_turn == 1\n assert new_player.score == 0\n assert new_player.token_presence is False\n...
[ "0.78461397", "0.78237635", "0.7688674", "0.76077133", "0.76061386", "0.75966895", "0.7172569", "0.711341", "0.6966639", "0.6960186", "0.6928948", "0.6839228", "0.67893827", "0.6780713", "0.67705965", "0.67641246", "0.6749246", "0.6720765", "0.66819185", "0.6681674", "0.66775...
0.8110652
0
Test creating a new player with invalid payload
def test_create_player_invalid(self): payload = {'name': ''} res = self.client.post(PLAYERS_URL, payload) self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_player_created(self):\n res = self.client().post('api/v1/players/new', headers={'Content-Type': 'application/json'}, data=json.dumps(self.player))\n json_data = json.loads(res.data)\n self.assertTrue(json_data.get('jwt_token'))\n self.assertEqual(res.status_code, 201)", "def test_create_play...
[ "0.7495499", "0.74699783", "0.738127", "0.718221", "0.69524", "0.67708266", "0.6658256", "0.66042596", "0.6594715", "0.6582349", "0.6539508", "0.6506546", "0.6504157", "0.6490392", "0.6451788", "0.64410824", "0.6428347", "0.64130753", "0.6399742", "0.6389613", "0.63864726", ...
0.8654237
0
Return the basic info of the current tree. return
def info(self): return nx.info(self.tree) # def children(self): """ Return the children of the current node. """ # return self.left, self.right
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_info(self):\r\n if not self.parent and self.key:\r\n print(\"######### ROOT #########\")\r\n print(\"------------------------\")\r\n print(\"key: %s\" % self.key)\r\n print(\"value: %s\" % self.value)\r\n print(\"color: %s\" % self.get_color())\r\n\r\n ...
[ "0.71606535", "0.6920607", "0.6735312", "0.6625062", "0.6625062", "0.6621492", "0.6614933", "0.6579641", "0.65775186", "0.6573978", "0.65506", "0.65506", "0.64760476", "0.64760476", "0.64760476", "0.64760476", "0.6467341", "0.64480984", "0.64376783", "0.6396005", "0.63847786"...
0.7387961
0
Return a list of operators based on deepfirst search algorithm. the order is from left to right parameter
def dfs_operators(self, node=None): if not node: node = self.get_nodes_from_position('root')[0] bfs_all_nodes = list(nx.dfs_edges(self.tree, node)) operators = [i for i, j in bfs_all_nodes] # operators = [i for i, j in bfs_all_nodes if self.tree.out_degree(j) == 0] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _search_brother_ops(self, graph, op_node):\n visited = [op_node.idx()]\n stack = []\n brothers = []\n for op in graph.next_ops(op_node):\n if (op.type() != 'conv2d') and (op.type() != 'fc') and (\n not op._is_bwd_op()):\n stack.append(op)...
[ "0.6276911", "0.5942017", "0.58628064", "0.57594097", "0.56592035", "0.56488216", "0.5646335", "0.5536815", "0.55339974", "0.5520272", "0.5457814", "0.54213226", "0.5388805", "0.53401655", "0.5337534", "0.53144145", "0.52870244", "0.52579343", "0.52437997", "0.52392375", "0.5...
0.63426775
0
Return a list of nodes of the position. parameter
def get_nodes_from_position(self, position=None): return [nodes for nodes, positions in self.tree.nodes(data=True) if positions["position"] == position]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nodes(self): \n return [n for n in self.iternodes()]", "def get_nodes(self):\n pass", "def get_node_list(self):\n return []", "def getNodes(self, pos=None):\n\t\tif pos==None: pos=self.pos\n\t\tW=self.plantAreaW\n\t\tL=self.plantAreaL\n\t\tcart=self.m.getCartesian\n\t\tpC=self.m.getC...
[ "0.77235353", "0.73504615", "0.73303485", "0.7233757", "0.71931404", "0.713033", "0.7059593", "0.70508826", "0.7001874", "0.6970905", "0.69392806", "0.6934877", "0.69146484", "0.6897836", "0.68802404", "0.68802404", "0.68802404", "0.6878907", "0.6866242", "0.6832237", "0.6695...
0.7450987
1
Return a float value of inclusion probability. pi_i = n / N, where n = |sequence| = |s| N = |population| = |M|
def inclusion_probability(M, s): # initialize a dictionary to store events with inclusion probabilites s_with_inclusion_probabilites = {} # calculating the events of intersection and difference. V = [i for i in M.tree.nodes() if not (i.__contains__('parallel') or i.__contains__('series'))] s_in_M ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probability_of_generating_containing_events(M, s):\n\n # initialize the probabilities of generating containing events.\n f = 1\n\n s_with_inclusion_probabilities = inclusion_probability(M, s)\n for v, p in s_with_inclusion_probabilities.items():\n f *= p\n\n return f", "def prob1(n):\n#...
[ "0.6631667", "0.64187765", "0.63519084", "0.6297203", "0.62468183", "0.61480355", "0.61434984", "0.609498", "0.6062884", "0.6046621", "0.6035067", "0.60236925", "0.60080016", "0.59939605", "0.598396", "0.59779894", "0.5967327", "0.5939666", "0.59200907", "0.5919952", "0.59193...
0.6789651
0
Return a float value of inclusion probability. f(pv, s) = product_{v in s}(pv) product_{v not in s}(1 pv)
def probability_of_generating_containing_events(M, s): # initialize the probabilities of generating containing events. f = 1 s_with_inclusion_probabilities = inclusion_probability(M, s) for v, p in s_with_inclusion_probabilities.items(): f *= p return f
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inclusion_probability(M, s):\n\n # initialize a dictionary to store events with inclusion probabilites\n s_with_inclusion_probabilites = {}\n\n # calculating the events of intersection and difference.\n V = [i for i in M.tree.nodes() if not (i.__contains__('parallel') or i.__contains__('series'))]\...
[ "0.65426224", "0.61161095", "0.61135066", "0.5821492", "0.57806534", "0.5777198", "0.5777198", "0.5770672", "0.57525903", "0.5751081", "0.5734077", "0.5697218", "0.5689497", "0.5657795", "0.5614329", "0.55981725", "0.5575849", "0.5567694", "0.5567694", "0.5539852", "0.5490724...
0.63304335
1
Return a int value of the number of completed extension of the SPorder. We store the number of extension of each subtree(subpartial order) such each node can have its partial order information with its current number of extension.
def number_of_extensions(M, root=None): sp_order_formula = [i for i in M.series_partial_order_representation(root) if (i.__contains__('series') or i.__contains__('parallel'))] while sp_order_formula: # Extend the children of the current operator operator = sp_order_for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_number_of_parts(score): \n number_of_parts = 0\n for e in score.recurse().parts:\n number_of_parts = number_of_parts + 1\n\n return( number_of_parts ) # get_number_of_parts ", "def depht(self, p):\n if self.is_root(p):\n return 0\n else:\n ...
[ "0.5881316", "0.5866302", "0.5593788", "0.5586631", "0.5544093", "0.5523313", "0.5400796", "0.5370281", "0.5363735", "0.53597265", "0.53486913", "0.5302492", "0.5282759", "0.52362657", "0.52335614", "0.5229352", "0.5222564", "0.5211037", "0.5194625", "0.5190381", "0.518178", ...
0.65274924
0
Returns a random number of closes based on close_parens_probabilities. close_parens_probabilities defaults to [0.772, 0.206, 0.021, 0.001]. This is roughly equivalent to each selection coming from a binomial distribution with n=4 and p=1/16.
def generate_close_count(self): prob = random.random() close_probabilities = reductions( lambda i, j: i + j, self.close_parens_probabilities ) + [1.0] parens = 0 while prob > close_probabilities[1]: parens += 1 del close_probabilit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_coefficients(self, n=3, max_range = 10):\n return np.random.uniform(-1*max_range, max_range, n)", "def generate_close_count(self):\n return 0", "def chance(n, p):\n total = 0.0\n for k in range(n+1):\n total += comb(n, k, exact=False) * p**k * (1-p) ** (n-k)\n return to...
[ "0.5542607", "0.5430894", "0.53839785", "0.53698313", "0.5318463", "0.530422", "0.5260695", "0.52213675", "0.5187429", "0.51843035", "0.5050707", "0.5049101", "0.50225484", "0.502187", "0.5020095", "0.5019308", "0.49802074", "0.4975735", "0.49733624", "0.49695677", "0.4961603...
0.7580884
0