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
Test case for get_case_by_id
def test_get_case_by_id(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_case(loqusdbapi, mocker):\n # GIVEN a loqusdb api\n case_id = 'a_case'\n # WHEN fetching a case with the adapter\n mocker.patch.object(subprocess, 'check_output')\n loqusdb_output = (b\"{'_id': 'one_case', 'case_id': 'one_case'}\\n\"\n b\"{'_id': 'a_case', 'case_id'...
[ "0.7206168", "0.7135359", "0.70535195", "0.6983086", "0.69185466", "0.6779661", "0.6560765", "0.6444879", "0.6441801", "0.643984", "0.64307916", "0.6415146", "0.63614887", "0.63151497", "0.6309817", "0.6308288", "0.6291289", "0.62707704", "0.62072265", "0.62045175", "0.616458...
0.949092
0
Test case for get_cases_for_dict
def test_get_cases_for_dict(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def navigate_case_dictionary(case_list_for_run, num_cases):", "def test_create_results_dict_1(self):\n dict = find_domains.create_results_dict(self.rps_results)\n with self.subTest():\n self.assertEqual(len(dict.keys()), 4)\n with self.subTest():\n self.assertEqual(len(...
[ "0.70761895", "0.65705884", "0.647785", "0.6304288", "0.6191103", "0.61260873", "0.6123775", "0.60676205", "0.60428697", "0.60196096", "0.59500134", "0.58859193", "0.5870065", "0.5868873", "0.5839127", "0.5819128", "0.57976145", "0.5794307", "0.57906353", "0.57838327", "0.576...
0.93498963
0
Test case for get_sync_history
def test_get_sync_history(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_tracker_getHistory():\n\n trackers, cap = init_tracker()\n tr = trackers[0]\n tr.addHistory([1, 1, 1, 1])\n\n assert tr.getHistory()[1] == [1, 1, 1, 1]", "def test_get_team_history(self):\n pass", "def QueryHistory(self):\n return []", "def testGetHistory(self):\n self.maxDi...
[ "0.692454", "0.68217295", "0.6417337", "0.63609856", "0.6296297", "0.6270521", "0.6258328", "0.6244751", "0.62230396", "0.6212335", "0.6196629", "0.60348105", "0.602882", "0.5997421", "0.5959013", "0.5924428", "0.5920476", "0.59072894", "0.58979166", "0.58102685", "0.57995194...
0.9430264
0
Test case for update_case
def test_update_case(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_scenario(self):\n pass", "def test_update(self):\n pass", "def test_update(self):\n pass", "def test_update(self):\n pass", "def test_add_or_update_case(self):\n pass", "def test_update_record(self):\n pass", "def test_update_one(self):\n ...
[ "0.8599205", "0.849513", "0.849513", "0.849513", "0.8350617", "0.8206942", "0.81498384", "0.81489325", "0.78003776", "0.75835353", "0.75727797", "0.7463717", "0.7440917", "0.7428357", "0.7388373", "0.7385997", "0.73503935", "0.7333985", "0.73062307", "0.7268944", "0.72565717"...
0.93751144
0
Unset key from the encryptor and decryptor
def unset_cipher(self, key_name=None): if key_name is None: if self.key_name is not None: message_key_types.unset_cipher(self.key_name) if self.pending_key_name is not None: message_key_types.unset_cipher(self.pending_key_name) else: me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def del_key(self):\n # Deleting the values from the self.key and self.cryptor attributes.\n self.key=None\n self.cryptor=None", "def clear_key(self, key):\r\n return self.handler.clear_key(key_to_code(key))", "def tearDown(self) -> None:\n\n del self.private_key\n del self...
[ "0.79658395", "0.6650825", "0.6479646", "0.64384425", "0.62364286", "0.6223678", "0.62217623", "0.61869067", "0.61497605", "0.6120932", "0.6093871", "0.60819805", "0.60426354", "0.6033569", "0.6002724", "0.5995064", "0.5992837", "0.5932019", "0.59261566", "0.5922496", "0.5895...
0.6914403
1
Set timer for key revocation
def _set_delete_timer(self, key_name, timeout): if key_name is not None: #print("(%d) _set_delete_timer:" % int(time.time()), key_name.hex()[:10], timeout) query_management.QueryEntry(expire_after=timeout, callback_expire=remove_old_key, data={KeyT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __updateElapsedTime(self):\n if self._keyCodeTime != 0.0 and \\\n (globalClock.getFrameTime() - self._keyCodeTime) >= self._timeout:\n self.notify.debug(\"Key code timed out. Resetting...\")\n self.reset()\n messenger.send(KeyCodes.CLEAR_CODE_E...
[ "0.6193708", "0.6188828", "0.61632437", "0.61356395", "0.6049411", "0.5949552", "0.5939341", "0.58892876", "0.5877896", "0.584273", "0.58422077", "0.5806897", "0.57887334", "0.57828623", "0.5779299", "0.5777707", "0.571499", "0.5553746", "0.55466074", "0.5524556", "0.5522834"...
0.6783776
0
Returns the presence for this channel
def presence(self, params=None, timeout=None): params = params or {} path = '/channels/%s/presence' % self.__name return self.__ably._get(path, params=params, timeout=timeout).json()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def presence(self):\n return self.slack_client.api_call(\"users.getPresence?user=\"+self.user_id)", "def isHumanPresence(self):\n\t\treturn self.humanPresence", "def online(self):\n api_call = self.presence()\n if api_call.get('ok'):\n # retrieve all users so we can find our bot...
[ "0.78225", "0.65050405", "0.63529664", "0.6173057", "0.5725983", "0.5710549", "0.5505179", "0.54912657", "0.54869306", "0.54740065", "0.5472166", "0.5465967", "0.5449083", "0.5377885", "0.5373487", "0.5356357", "0.534464", "0.53218323", "0.52983725", "0.52873003", "0.528721",...
0.80038244
0
Get an existing Assessment resource's state with the given name, id, and optional extra properties used to qualify the lookup.
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None) -> 'Assessment': opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) __props__ = AssessmentArgs.__new__(AssessmentArgs) __props__.__dict__["additional_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None) -> 'Assessment':\n opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))\n\n __props__ = dict()\n\n __props__[\"additional_data\"] = None\n __pr...
[ "0.6976486", "0.608855", "0.5846438", "0.5757699", "0.5648362", "0.55919707", "0.5582545", "0.55817664", "0.55264586", "0.55085826", "0.550386", "0.5496845", "0.54861027", "0.5467891", "0.54414856", "0.53757304", "0.53509825", "0.53232807", "0.5311685", "0.52735114", "0.52480...
0.6898669
1
Links relevant to the assessment
def links(self) -> pulumi.Output['outputs.AssessmentLinksResponse']: return pulumi.get(self, "links")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getLink(self):", "def exam_url(self, obj):\n request = self.context.get(\"request\")\n return reverse(\"exam-detail\", args=[obj.id], request=request)", "def get_absolute_url(self):\n return reverse('trait_browser:source:studies:pk:detail', kwargs={'pk': self.pk})", "def href(self, r...
[ "0.6158211", "0.5980082", "0.5797147", "0.57784724", "0.5716922", "0.5695942", "0.56922674", "0.56786233", "0.5670207", "0.5577552", "0.5543779", "0.5527378", "0.5521695", "0.5521499", "0.5518003", "0.55149287", "0.551347", "0.5483872", "0.5457637", "0.5448972", "0.5433619", ...
0.65279543
0
Describes properties of an assessment metadata.
def metadata(self) -> pulumi.Output[Optional['outputs.SecurityAssessmentMetadataPropertiesResponse']]: return pulumi.get(self, "metadata")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metadata(self) -> global___SummaryMetadata:", "def metadata(self) -> Optional[pulumi.Input['SecurityAssessmentMetadataPropertiesArgs']]:\n return pulumi.get(self, \"metadata\")", "def get_assessment_metadata(self):\n return Metadata(**settings.METADATA['assessment_id'])", "def describe(self...
[ "0.64961946", "0.64541817", "0.6290093", "0.6145428", "0.6084069", "0.6051594", "0.60471356", "0.5994781", "0.5933389", "0.59084606", "0.58996195", "0.5870387", "0.5848383", "0.5837634", "0.5826372", "0.5826372", "0.5818724", "0.58181715", "0.5814273", "0.5807516", "0.5801381...
0.6462961
1
Details of the resource that was assessed
def resource_details(self) -> pulumi.Output[Any]: return pulumi.get(self, "resource_details")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource_details (self):\n return (f\"[Title:\\\"{self.get_title()}\\\"] [Author:{self.get_author()}] [Publisher:{self.get_publisher()}] [Year:{self.get_year()}]\")", "def resource(self):\n return str(self._resource)", "def resource(self):\n return self._resource", "def resource(...
[ "0.76440537", "0.7001793", "0.6875115", "0.6875115", "0.6875115", "0.6875115", "0.6875115", "0.6875115", "0.6875115", "0.686545", "0.6756598", "0.6750164", "0.66482615", "0.6627125", "0.6553682", "0.6521818", "0.6483526", "0.64652663", "0.6450048", "0.6442991", "0.63966125", ...
0.7746103
0
Test get_type_for_key_path with Simple Key Path
def test_get_type_for_key_path_simple_path(test_schema): assert get_type_for_key_path(test_schema, "Age") == "integer"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_type_for_key_path_multi_level(test_schema):\n assert (\n get_type_for_key_path(test_schema, \"EmploymentInformation.Beneficiary.Name\")\n == \"string\"\n )", "def test_get_type_for_key_path_invalid_key_path(test_schema):\n assert get_type_for_key_path(test_schema, \"foo.bar\")...
[ "0.7844626", "0.75669205", "0.74641645", "0.7052028", "0.65783304", "0.65595055", "0.65575176", "0.62750286", "0.59552884", "0.59359103", "0.5933874", "0.59200144", "0.58311874", "0.5820171", "0.5779001", "0.5731968", "0.5724418", "0.5718408", "0.5717397", "0.5695019", "0.567...
0.84244055
0
Test get_type_for_key_path with key path of one level deep
def test_get_type_for_key_path_depth_one_level(test_schema): assert ( get_type_for_key_path(test_schema, "EmploymentInformation.OriginalHireDate") == "string" )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_type_for_key_path_multi_level(test_schema):\n assert (\n get_type_for_key_path(test_schema, \"EmploymentInformation.Beneficiary.Name\")\n == \"string\"\n )", "def test_get_type_for_key_path_simple_path(test_schema):\n assert get_type_for_key_path(test_schema, \"Age\") == \"int...
[ "0.81315565", "0.7790559", "0.73348916", "0.6510662", "0.63362354", "0.6123883", "0.5945233", "0.59033793", "0.5871133", "0.58505154", "0.58181745", "0.579614", "0.5716585", "0.56624275", "0.5648696", "0.56418836", "0.5635143", "0.5609441", "0.5574678", "0.55583984", "0.55554...
0.78562295
1
Test get_type_for_key_path with multi level key path
def test_get_type_for_key_path_multi_level(test_schema): assert ( get_type_for_key_path(test_schema, "EmploymentInformation.Beneficiary.Name") == "string" )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_type_for_key_path_simple_path(test_schema):\n assert get_type_for_key_path(test_schema, \"Age\") == \"integer\"", "def test_get_type_for_key_path_depth_one_level(test_schema):\n assert (\n get_type_for_key_path(test_schema, \"EmploymentInformation.OriginalHireDate\")\n == \"strin...
[ "0.78702086", "0.77100694", "0.718522", "0.6605864", "0.6282174", "0.62626797", "0.5969291", "0.59365714", "0.59263676", "0.5847719", "0.5822397", "0.5740006", "0.5724306", "0.57241476", "0.56666523", "0.56429887", "0.563662", "0.5624624", "0.56129014", "0.55840045", "0.55359...
0.8355806
0
Test get_type_for_key_path with invalid key path
def test_get_type_for_key_path_invalid_key_path(test_schema): assert get_type_for_key_path(test_schema, "foo.bar") == None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_type_for_key_path_simple_path(test_schema):\n assert get_type_for_key_path(test_schema, \"Age\") == \"integer\"", "def test_get_type_for_key_path_multi_level(test_schema):\n assert (\n get_type_for_key_path(test_schema, \"EmploymentInformation.Beneficiary.Name\")\n == \"string\"\...
[ "0.7941828", "0.74922115", "0.73346525", "0.67035246", "0.6578848", "0.64337885", "0.64240384", "0.64203644", "0.6280829", "0.6259001", "0.6171811", "0.61548215", "0.61433345", "0.61050516", "0.6074959", "0.60654056", "0.6059521", "0.6050425", "0.60475475", "0.6045783", "0.60...
0.8730529
0
Evaluate and apply formatting on template, apply any art if provided. Any additional parameters are passed as extra variables to the template. The extra variables have priority when there's conflicting variable names.
def run(self, template: str, art: Optional[str] = None, **kwargs: Any) -> str: variables = self.__dict__ variables.update(kwargs) template = CustomFormats().format(template, **variables) if art: art = art.format(nfo=template) template = art for m in re.f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render(template, variables={}):\r\n\treturn prettify( parse(template).render(dict(variables.items())) )", "def format_template(template, *args):\n return textwrap.dedent(template % args).strip()", "def formatEval(self, template, attrs, scale=1, noScale=None):\n # Boat width not stored, so calcula...
[ "0.5875008", "0.58742577", "0.58426213", "0.5590589", "0.5554982", "0.5440268", "0.5436101", "0.53913677", "0.5359046", "0.5331052", "0.530326", "0.5283194", "0.5190745", "0.51852167", "0.5137004", "0.51337534", "0.5114587", "0.50861675", "0.5056899", "0.5040804", "0.5000452"...
0.6679136
0
Get an IMDB ID from either the media's global tags, or the config. Since IMDB IDs are required for this project, it will bug the user for one interactively if not found.
def get_imdb_id(self, imdb_id: Any) -> str: if not imdb_id: general_track = self.media_info.general_tracks[0].to_data() imdb_id = general_track.get("imdb") if not imdb_id: print("No IMDB ID was provided but is required...") while not imdb_id or not isinstance(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alternative_media_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"alternative_media_id\")", "def imdb_id(title):\n pass", "def _get_id(mf, url=None):\n\n\tprops = mf['properties']\n\n\tif 'uid' in props:\n\t\treturn props['uid'][0]\n\telif 'url' in props:\n\t\treturn props['...
[ "0.5761104", "0.5743748", "0.559037", "0.5428841", "0.5407892", "0.5339938", "0.5334296", "0.53217006", "0.5253112", "0.52254945", "0.52251637", "0.5214888", "0.5210509", "0.5178844", "0.5142981", "0.5113672", "0.5091264", "0.5082251", "0.5070948", "0.5068511", "0.5062682", ...
0.64897996
0
Get a TMDB ID from either the media's global tags, or the config. It will raise a ValueError if the provided ID is invalid.
def get_tmdb_id(self, tmdb_id: Any) -> Optional[str]: if not tmdb_id: general_track = self.media_info.general_tracks[0].to_data() tmdb_id = general_track.get("tmdb") if not tmdb_id: print("Warning: No TMDB ID was provided...") return None if not se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tvdb_id(self, tvdb_id: Any) -> Optional[int]:\n if not tvdb_id:\n general_track = self.media_info.general_tracks[0].to_data()\n tvdb_id = general_track.get(\"tvdb\")\n if not tvdb_id:\n print(\"Warning: No TVDB ID was provided...\")\n return None\n ...
[ "0.64487255", "0.5630184", "0.5409801", "0.54041606", "0.54024845", "0.53911626", "0.5343543", "0.53333956", "0.5306317", "0.5306317", "0.5306317", "0.5306317", "0.5306317", "0.5306317", "0.52967757", "0.52887344", "0.52816087", "0.5266011", "0.52260435", "0.522252", "0.52078...
0.64089936
1
Get a TVDB ID from either the media's global tags, or the config. It will raise a ValueError if the provided ID is invalid.
def get_tvdb_id(self, tvdb_id: Any) -> Optional[int]: if not tvdb_id: general_track = self.media_info.general_tracks[0].to_data() tvdb_id = general_track.get("tvdb") if not tvdb_id: print("Warning: No TVDB ID was provided...") return None if isinst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tmdb_id(self, tmdb_id: Any) -> Optional[str]:\n if not tmdb_id:\n general_track = self.media_info.general_tracks[0].to_data()\n tmdb_id = general_track.get(\"tmdb\")\n if not tmdb_id:\n print(\"Warning: No TMDB ID was provided...\")\n return None\n ...
[ "0.60287786", "0.5454019", "0.5437956", "0.5360313", "0.5346196", "0.5333645", "0.5321893", "0.52784383", "0.5270552", "0.5240752", "0.5226761", "0.5213634", "0.5184168", "0.5155326", "0.5155326", "0.5155326", "0.5155326", "0.5155326", "0.5155326", "0.51372594", "0.5098536", ...
0.694675
0
Scrape Title Name and Year (including e.g. 2019) from IMDB
def get_title_name_year(self) -> Tuple[str, str]: r = self.session.get(f"https://www.imdb.com/title/{self.imdb}") if r.status_code != 200: raise ValueError(f"An unexpected error occurred getting IMDB Title Page [{r.status_code}]") imdb_page = html.unescape(r.text) imdb_title ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrape_movie_page(dom):\n # to save the information\n info = []\n\n # find the information block needed\n header = dom.find(\"div\", \"title_wrapper\")\n\n # find the title and strip the string\n name_dom = header.h1.get_text().encode(\"utf-8\")\n name = str(name_dom)[2:-16]\n info.appe...
[ "0.6832312", "0.6682347", "0.66435677", "0.6387017", "0.637413", "0.63639027", "0.633812", "0.6296725", "0.61997265", "0.6172732", "0.6140767", "0.61179507", "0.60745186", "0.60595584", "0.59533656", "0.59527224", "0.5951921", "0.5943582", "0.5937595", "0.59366393", "0.592958...
0.7373919
0
Calculate total episode count based on neighbouring sameextension files.
def get_tv_episodes(self) -> int: return len(glob.glob(os.path.join( os.path.dirname(self.file), f"*{os.path.splitext(self.file)[-1]}" )))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n_episodes(self):\n raise NotImplementedError", "def return_episode_num(name):\n return int(name.split(\".\")[0].split(\"ep_\")[1]) # Use split to return only the episode number needed to sort the files in increasing order", "def _get_total_games(self) -> int:\n files = get_tfr_filenames(...
[ "0.58617145", "0.5788146", "0.5688501", "0.5621688", "0.551865", "0.5483126", "0.54120064", "0.54120064", "0.5410899", "0.5262325", "0.52515316", "0.5230109", "0.52180594", "0.52164894", "0.5211398", "0.52089113", "0.52078176", "0.5205271", "0.5205262", "0.5201948", "0.518634...
0.6543224
0
Retrieve the release name based on the file used during MediaInfo. If a season was specified, but an episode number was not, it presumes the release is a Pack. Hence when pack, it uses the parent folder's name as the release name.
def get_release_name(self) -> str: if self.season is not None and self.episode is None: return os.path.basename(os.path.dirname(self.file)) return os.path.splitext(os.path.basename(self.file))[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getApplicationReleaseName(self) -> unicode:\n ...", "def title(self):\n if self.file_name is None:\n return None\n else:\n fname = os.path.split(self.file_name)[-1]\n fname, *ext = fname.rsplit('.', 1)\n procgen = ext and ext[0] in ('json', 'ya...
[ "0.59712", "0.59365255", "0.58621913", "0.57642496", "0.5731158", "0.5726277", "0.57143974", "0.5686276", "0.5618006", "0.557107", "0.5563853", "0.5559816", "0.5543877", "0.55142844", "0.55000263", "0.5495673", "0.5444121", "0.5430501", "0.5416234", "0.54096", "0.5329431", ...
0.81937546
0
Get a wide banner image from fanart.tv. Currently restricts banners to Englishonly.
def get_banner_image(self, tvdb_id: int) -> Optional[str]: if not tvdb_id: return None if not self.fanart_api_key: raise ValueError("Need Fanart.tv api key for TV titles!") r = self.session.get(f"http://webservice.fanart.tv/v3/tv/{tvdb_id}?api_key={self.fanart_api_key}")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_banner(self, width=300, height=85):\n img_path = IMG_PATH + os.sep + CARD_BANNER\n banner_img = Image.open(img_path)\n banner_img = banner_img.resize((width, height))\n return banner_img", "def banner_wrapper(banner_url):\n # so simple\n return '{url}<img src=...
[ "0.63562655", "0.5907053", "0.58398026", "0.56723255", "0.55253977", "0.55232245", "0.55212253", "0.5516398", "0.532808", "0.5248593", "0.52476937", "0.52444804", "0.5240686", "0.51916087", "0.51215434", "0.5034326", "0.5020774", "0.5014858", "0.49858487", "0.4975781", "0.496...
0.6869307
0
Return a list of a brief subtitle overview persubtitle. e.g. English, Forced, SubRip (SRT) English, SubRip (SRT) English, SDH, SubRip (SRT) Spanish, Latin American (SDH), SubRip (SRT) The bit of text between the Language and the Subtitle format is the Track Title. It can be of any format, but it is recommended to be us...
def get_subtitle_print(subs: List[Track]) -> List[str]: data = [] if not subs: data.append("--") for sub in subs: line_items = [] # following sub.title tree checks and supports three different language and title scenarios # The second scenario is ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_title(self) -> list:\n scanning = False # start of a title is found, this may be the second of later part of that.\n ret = [] # to return\n temp = [] # deal with mutiple line titles.\n for page in self.pdf.pages:\n text = page.extract_text()\n # it's p...
[ "0.6559989", "0.626816", "0.61477166", "0.59452933", "0.5862041", "0.58259624", "0.57575667", "0.5716959", "0.57007366", "0.56698", "0.566014", "0.5631774", "0.56170785", "0.5601238", "0.55479985", "0.55277705", "0.55247784", "0.55187654", "0.5466009", "0.5463526", "0.5434021...
0.73892254
0
The mins method returns the lower bounds of the action spaces' parameters.
def mins(self) -> Tensor: return self._ranges[:, 0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mins(self):\n return self._mins", "def bounds(self) -> Tensor:\n return torch.cat([self.mins, self.mins + self.ranges], dim=-2)", "def mins(self):\n return self.intervals[:, 0]", "def argminX( self ):\n min = 1e30\n minX = None\n for i in range( 0, self.GetN() ):\n ...
[ "0.65231216", "0.63490486", "0.6329805", "0.6140933", "0.604615", "0.5979384", "0.59507585", "0.5943575", "0.5881969", "0.5867249", "0.58545846", "0.5735611", "0.5735611", "0.5695982", "0.568224", "0.5630734", "0.56240106", "0.55890894", "0.556751", "0.55503213", "0.55368114"...
0.6706375
0
The maxs method returns the upper bounds of the action spaces' parameters.
def maxs(self) -> Tensor: return self._ranges[:, 1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maxs(self):\n return self._maxs", "def get_parameters_max(self):\n maxValues = numpy.zeros(self.get_num_parameters())\n i = 0\n for p in self.parameters:\n maxValues[i] = p.get_max_value()\n i += 1\n return maxValues", "def get_bounds(self):\n ...
[ "0.6918863", "0.66844064", "0.6673597", "0.6575035", "0.6552709", "0.6513679", "0.6467321", "0.6414459", "0.62708175", "0.62123346", "0.620865", "0.62085176", "0.62085176", "0.6191484", "0.6156986", "0.6142866", "0.6112747", "0.6100505", "0.6096278", "0.60705197", "0.60639876...
0.6770987
1
The _generate_iterator method creates an iterator which runs over all possible parameter combinations
def _generate_iterator(self) -> Iterable: params: List[Tensor] = [] for angle_range in self._ranges: lin_space: Tensor = linspace(angle_range[0], angle_range[1], steps=self._num_steps) params.append(lin_space) power: int dims: int for i in range(0, self._n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n for p in self.param_grid:\n # Always sort the keys of a dictionary, for reproducibility\n items = sorted(p.items())\n if not items:\n yield {}\n else:\n keys, values = zip(*items)\n for v in produc...
[ "0.7333558", "0.6785712", "0.67566705", "0.67345154", "0.66711015", "0.66702646", "0.66659456", "0.64822334", "0.6465031", "0.64270854", "0.64160955", "0.6409563", "0.638886", "0.638886", "0.638886", "0.638886", "0.6387711", "0.6350889", "0.6341186", "0.6333276", "0.6317058",...
0.73833257
0
Function to rotate one vector to another, inspired by vrrotvec.m in MATLAB
def vrrotvec(a,b): a = normalize(a) b = normalize(b) ax = normalize(np.cross(a,b)) angle = np.arccos(np.minimum(np.dot(a,b),[1])) if not np.any(ax): absa = np.abs(a) mind = np.argmin(absa) c = np.zeros((1,3)) c[mind] = 0 ax = normalize(np.cross(a,c)) r = n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svecRotate(v, T):\n \n return svec(Rotate(smat(v), T))", "def _rot(theta, vec):\n\n rmat = scipy.array([[scipy.cos(theta), -1*scipy.sin(theta)],\n [scipy.sin(theta), scipy.cos(theta)]]) \n return scipy.dot(rmat,vec)", "def rotate_vectors(q, vec):\n rot_vec = []\n fo...
[ "0.73906195", "0.7337561", "0.72559744", "0.70578516", "0.702117", "0.6936926", "0.69332725", "0.6840454", "0.68362135", "0.6819142", "0.6817099", "0.67670673", "0.6754099", "0.6747304", "0.67367476", "0.6716166", "0.6703668", "0.6696891", "0.66868734", "0.6665173", "0.660386...
0.7442148
0
Sort the buses reversed by their period, having tagged them with their position in the sequence, which is their c value. >>> list(prep_input(EXAMPLE_BUSES)) [(59, 4), (31, 6), (19, 7), (13, 1), (7, 0)]
def prep_input(buses): return sorted([(bus, offset) for offset, bus in enumerate(buses) if bus], reverse=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_bc_freqs(bc_freqs):\r\n\r\n bcs_list = []\r\n for curr_key in bc_freqs.keys():\r\n bcs_list.append((curr_key, int(bc_freqs[curr_key])))\r\n\r\n bcs_list = sorted(bcs_list, key=itemgetter(1), reverse=True)\r\n\r\n sorted_bcs = []\r\n for curr_bc in bcs_list:\r\n sorted_bcs.a...
[ "0.5366377", "0.5326399", "0.532053", "0.5228897", "0.5217887", "0.5176579", "0.5169902", "0.51473904", "0.513209", "0.5101623", "0.50995326", "0.5060153", "0.50267196", "0.5010616", "0.5007883", "0.4982695", "0.49244604", "0.49026328", "0.49025616", "0.4894752", "0.48676687"...
0.6246531
0
Reduce a bunch of periodic signals to a single signal. The value of x that answers the puzzle is the first place ( c + x ) % T = 0, that is to say, c + x = T, or x = Tc. >>> solve_buses(prep_input(EXAMPLE_BUSES)) 1068781
def solve_buses(prepared_buses): T, c = functools.reduce(combine_signals, prepared_buses) return T - c
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution2(inp):\n inp = get_lines(inp)\n notes = inp[1].split(\",\")\n\n offsets = {}\n for i, bus in enumerate(notes):\n if bus == 'x':\n continue\n bus = int(bus)\n offsets[bus] = i\n buses = set(offsets)\n old_buses = buses.copy()\n\n def search(bus, offs...
[ "0.5621422", "0.5476572", "0.5280086", "0.5161614", "0.5074294", "0.49908358", "0.49579656", "0.48839134", "0.48619267", "0.48579392", "0.48389107", "0.48320952", "0.4826791", "0.48213837", "0.48160282", "0.4811936", "0.48002857", "0.4795177", "0.47753403", "0.4768853", "0.47...
0.76751333
0
Method opening all images to test their validity.
def verify_images(root_dir, root_listdir): counter = 0 for index, image_dir in enumerate(root_listdir): images_listdir = os.listdir(root_dir + "/" + image_dir) list_of_images_indices = [ image_index for image_index in range(3, len(images_listdir) - 1) if imag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_images(self):\n self.roses.save_image()\n all_images = Images.get_all_images()\n self.assertTrue(len(all_images)<1)", "def load_from_images(self):\n logging.debug(\"load_from_images called\")\n return True", "def images_exist(self):\n pass", "def test_rea...
[ "0.6742113", "0.62553185", "0.6229397", "0.6169011", "0.61681324", "0.6136686", "0.60898274", "0.60487515", "0.5997627", "0.5935533", "0.58759665", "0.58210576", "0.5768145", "0.5766127", "0.5718156", "0.5691568", "0.5679888", "0.56696707", "0.5667723", "0.5602127", "0.557296...
0.663587
1
for a given template and list of extensions, find every file related to that template which has one of the extensions.
def find_template_companion_files(template: Path, extensions: Iterable[str], recurse_up_to: Path = None) -> Set[Path]: files_to_check = [] # Get a list of all file names to look for in each folder data_file_names = [] basename = template.name.split('.')[0] for i in range(len(template.suffixes)): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_files_by_extension(\n files: list ,\n extensions: list\n):\n filtered_files = []\n for file in files:\n file_ext = os.path.splitext(file)[-1].lower()\n file_ext = _remove_dot_from_extension(file_ext)\n for extension in extensions:\n ext = _remove_dot_from_exte...
[ "0.6474418", "0.63438606", "0.63118434", "0.6272479", "0.6263339", "0.6136152", "0.6116507", "0.6069046", "0.60550666", "0.6040801", "0.599823", "0.5954619", "0.5945622", "0.59430933", "0.5937887", "0.58905417", "0.58869183", "0.5864783", "0.58605796", "0.58385235", "0.581291...
0.74726915
0
Transform x elementwise through an affine function y = exp(s)x + t where s = st[...,0] and t = st[...,1] with s.shape == x.shape == t.shape The Jacobian for this transformation is the coordinatewise product of the scaling factors J = prod(es[...,i],i)
def element_wise_affine(x, st, compute_jacobian=True): es = torch.exp(st[..., 0]) t = st[..., 1] logj = None if compute_jacobian: logj = torch.sum(torch.log(es), dim=-1) return es * x + t, logj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inverse_element_wise_affine(x, st, compute_jacobian=True):\n es = torch.exp(-st[..., 0])\n t = st[..., 1]\n logj = None\n if compute_jacobian:\n logj = torch.sum(torch.log(es), dim=-1)\n\n return es * (x - t), logj", "def affine(params, x):\n return np.dot(params['w'], x) + params['b']...
[ "0.7174713", "0.6328652", "0.6287944", "0.6152823", "0.6144677", "0.5968129", "0.5957975", "0.5921042", "0.5909272", "0.5798729", "0.5789589", "0.5777053", "0.56403214", "0.5585435", "0.55693203", "0.5553606", "0.5544687", "0.5482424", "0.5461267", "0.54540503", "0.54315287",...
0.8046413
0
Transform x elementwise through an affine function y = exp(s)(x t) where s = st[...,0] and t = st[...,1] with s.shape == x.shape == t.shape This is the inverse of `element_wise_affine` above for the same set of parameters st The Jacobian for this transformation is the coordinatewise product of the scaling factors J = p...
def inverse_element_wise_affine(x, st, compute_jacobian=True): es = torch.exp(-st[..., 0]) t = st[..., 1] logj = None if compute_jacobian: logj = torch.sum(torch.log(es), dim=-1) return es * (x - t), logj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def element_wise_affine(x, st, compute_jacobian=True):\n es = torch.exp(st[..., 0])\n t = st[..., 1]\n logj = None\n if compute_jacobian:\n logj = torch.sum(torch.log(es), dim=-1)\n\n return es * x + t, logj", "def transform(fn):\n def _(vec, dt):\n return np.einsum(\n 'ji,...
[ "0.83168423", "0.6524651", "0.6448697", "0.6208682", "0.6185584", "0.60859853", "0.60077345", "0.6005692", "0.6002416", "0.585732", "0.5842322", "0.57764435", "0.5741281", "0.5718799", "0.57156426", "0.57109356", "0.5676722", "0.56560165", "0.5641633", "0.56377053", "0.563442...
0.77893174
1
Initialize the axis ranges from proviuded Plot or renderer.
def initialize_axis_ranges(self, plot, transform=None): if transform is None: def transform(x): return x elif isinstance(transform, int): ndigits = transform def transform(x): return round(x, ndigits) # Avoid UI polluting with...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_axes(self):\n mini, maxi = self._get_extremes()\n self.y_axis.min = mini\n self.y_axis.max = maxi\n self.y_axis._max_min()\n\n if not None in [s.xvalues for s in self]:\n mini, maxi = self._get_extremes('xvalues')\n self.x_axis.min = mini\n ...
[ "0.71792495", "0.7129534", "0.68548447", "0.67877525", "0.6537042", "0.64943486", "0.641954", "0.6235867", "0.6223747", "0.6188791", "0.61873025", "0.61726326", "0.6160985", "0.6133905", "0.61263645", "0.61139727", "0.61138016", "0.61124223", "0.60551167", "0.60020185", "0.60...
0.7375276
0
Create an archive from the given tree, upload, and untar it.
def upload_tar_from_git(): require("release", provided_by=[deploy]) tree = prompt("Please enter a branch or SHA1 to deploy", default="master") local("git archive --format=tar %s | gzip > %s.tar.gz" % (tree, env['release'])) sudo("mkdir %(path)s/releases/%(release)s" % env) put("%(release)s.tar.gz" %...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tar(self):\n with tarfile.open(self.tgzfile, \"w:gz\") as tar_handle:\n for root, _, files in os.walk(self.dirname):\n for file in files:\n tar_handle.add(os.path.join(root, file))", "def untar(conn, tarball, path):\n conn.run(f\"tar xf {tarball} -C...
[ "0.6552709", "0.6145302", "0.59912825", "0.590548", "0.5857982", "0.5824896", "0.5788129", "0.57454973", "0.5727448", "0.5701735", "0.5637337", "0.5634134", "0.5598457", "0.55868477", "0.5579905", "0.5539658", "0.5536656", "0.5533471", "0.5514017", "0.5374604", "0.53565294", ...
0.6242641
1
Symlink to the new current release.
def symlink_current_release(): require("release", provided_by=[deploy]) with cd("%(path)s/releases" % env): sudo("ln -s %(release)s current_tmp && mv -Tf current_tmp current" % env)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def symlink():\n releases()\n env.current_path = '/root/your_project/current'\n run('rm %(current_path)s' % env)\n run('ln -s %(current_release)s %(current_path)s' % env)", "def symlink(timestamp):\n if exists(env.current_dir):\n run('rm -r %(current_dir)s' % env)\n run('ln -s %s %s' % (...
[ "0.85483825", "0.7888362", "0.6896718", "0.6580014", "0.640067", "0.6382023", "0.609916", "0.59879214", "0.598062", "0.58782184", "0.5851017", "0.5815926", "0.5792104", "0.57686156", "0.57686156", "0.57261956", "0.57167125", "0.5602009", "0.55953795", "0.55733645", "0.5570685...
0.8182266
1
Remove older releases, keeping the last `keep_num` intact.
def cleanup(keep_num=5): keep_num = int(keep_num) assert keep_num > 0, "[ERROR] keep_num must be > 0; refusing to proceed." with cd("%(path)s/packages" % env): package_files = sorted(run("ls -1").split()) package_files = [_.replace(".tar.gz", "") for _ in package_files] with cd("%(pat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _deleteOldVersionsByAge(self, model, max_age, number_to_keep=None):\r\n adapter = getVersionManagementAdapter(model)\r\n\r\n version_ids = self._getOldVersionIds(adapter)\r\n if number_to_keep is not None:\r\n if len(version_ids) < number_to_keep:\r\n return\r\n ...
[ "0.64156675", "0.6380838", "0.63680077", "0.56757736", "0.544219", "0.5342159", "0.5324215", "0.52694285", "0.5213804", "0.51900595", "0.51862675", "0.5181022", "0.51753306", "0.51589394", "0.51021165", "0.50865173", "0.50815326", "0.5056275", "0.5055268", "0.505497", "0.5032...
0.69273704
0
Give each Node uniform splits of data. Nodes will have same amounts of data.
def uniform_split(self, nr_agents): indices = np.linspace(start=0, stop=self.samples.shape[0], num=nr_agents + 1, dtype=int).tolist() self.samples = self.partition(self.samples, indices, nr_agents) self.labels = self.partition(self.labels, indices, nr_agents)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_data(self):\r\n print('split data')\r\n np.random.shuffle(self.dataList)\r\n l = len(self.dataList)/self.fold\r\n self.dataList = [self.dataList[i*l: (i+1)*l] for i in range(self.fold-1)] + [self.dataList[(self.fold-1)*l:]] # each element in the list is splitted data list\r",...
[ "0.6593751", "0.64535356", "0.6275442", "0.624764", "0.6210491", "0.61586165", "0.61282647", "0.6122043", "0.6105798", "0.6105246", "0.6102763", "0.60595816", "0.6045628", "0.6025434", "0.60080785", "0.5965141", "0.5959221", "0.59428424", "0.5918808", "0.59182876", "0.5914056...
0.6529111
1
This function computes the distribution internal parameters from its two first moments.
def _compute_internals(self, moments): [mean, stdv] = moments internals = {} internals['a'] = mean - np.sqrt(3) * stdv internals['b'] = mean + np.sqrt(3) * stdv return internals
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_internals(self, moments):\n\n [mean, stdv] = moments\n internals = {}\n internals['mu'] = mean\n internals['sigma'] = stdv\n\n return internals", "def _compute_internals(self, moments):\n\n [mean, stdv] = moments\n internals = {}\n internals['k...
[ "0.6455378", "0.6220392", "0.6185545", "0.6109156", "0.6106636", "0.60708535", "0.60512894", "0.60178155", "0.5966822", "0.59502286", "0.58735156", "0.5850575", "0.58171284", "0.5816514", "0.57661724", "0.5720821", "0.57173246", "0.57122564", "0.5709464", "0.57005703", "0.565...
0.6434524
1
This function computes the distribution internal parameters from its two first moments.
def _compute_internals(self, moments): [mean, stdv] = moments internals = {} internals['mu'] = mean internals['sigma'] = stdv return internals
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_internals(self, moments):\n\n [mean, stdv] = moments\n internals = {}\n internals['a'] = mean - np.sqrt(3) * stdv\n internals['b'] = mean + np.sqrt(3) * stdv\n\n return internals", "def _compute_internals(self, moments):\n\n [mean, stdv] = moments\n i...
[ "0.6434524", "0.6434524", "0.6220392", "0.6185545", "0.6109156", "0.6106636", "0.60708535", "0.60512894", "0.60178155", "0.5966822", "0.59502286", "0.58735156", "0.5850575", "0.58171284", "0.5816514", "0.57661724", "0.5720821", "0.57173246", "0.57122564", "0.5709464", "0.5700...
0.6455378
0
Provides a Step Functions Activity data source Example Usage ```python import pulumi import pulumi_aws as aws sfn_activity = aws.sfn.get_activity(name="myactivity") ```
def get_activity_output(arn: Optional[pulumi.Input[Optional[str]]] = None, name: Optional[pulumi.Input[Optional[str]]] = None, opts: Optional[pulumi.InvokeOptions] = None) -> pulumi.Output[GetActivityResult]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_activities():\n pass", "def get_activity(arn: Optional[str] = None,\n name: Optional[str] = None,\n opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetActivityResult:\n __args__ = dict()\n __args__['arn'] = arn\n __args__['name'] = name\n opts = pul...
[ "0.652813", "0.64412045", "0.6052704", "0.60521966", "0.59815174", "0.5974512", "0.58580536", "0.58321756", "0.57499844", "0.57043284", "0.5635826", "0.5635826", "0.55382925", "0.5494571", "0.5475397", "0.5416918", "0.53558916", "0.5349023", "0.53315115", "0.5306385", "0.5292...
0.64874995
1
get the cvxpy variable associated with this layer
def get_cvxpy_variable(self, channel_indx=None): if channel_indx is None: output_channels = cp.hstack( [ self.layer_input[cur_channel_indx] for cur_channel_indx in range(self.n_in_channels) ] ) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xvar ( self ) :\n return self.__xvar", "def x ( self ) :\n return self.xvar", "def var(self, name):\n return self.get_ground_vector('!Var:{}'.format(name))", "def var(self, name):\n return self.get_ground_vector('!Var:{}'.format(name))", "def var(self, name):\n ret...
[ "0.6952394", "0.6349231", "0.6311073", "0.6311073", "0.6311073", "0.6210869", "0.614176", "0.61036706", "0.6093137", "0.5973595", "0.5904504", "0.58920914", "0.5774172", "0.5744649", "0.5726218", "0.5713547", "0.56973785", "0.56402665", "0.5625536", "0.5621677", "0.5595852", ...
0.7194828
0
returns number of output channels
def get_n_channels(self): return self.n_out_channels
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n_channels(self):\n return len(self.channels)", "def num_channels_per_output(cls) -> list[tuple[int, ...]]:\n return [\n (16, 24, 40, 112, 320),\n (16, 24, 40, 112, 320),\n (16, 24, 48, 120, 352),\n (24, 32, 48, 136, 384),\n (24, 32, 56, 16...
[ "0.7895569", "0.78375614", "0.7822447", "0.77712107", "0.763508", "0.7623057", "0.76186246", "0.75209033", "0.7185467", "0.717589", "0.71026057", "0.70969474", "0.7064426", "0.7045207", "0.6935932", "0.6927934", "0.69142646", "0.68657845", "0.6865311", "0.6837313", "0.6834410...
0.86962193
0
Constructs a BiRealNet18 model.
def birealnet18(pretrained=False, **kwargs): model = BiRealNet(BasicBlock, [4, 4, 4, 4], **kwargs) return model
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resnet18(pretrained=False, **kwargs):\n model = ResNet(BasicBlock, [2, 2, 2, 2], **kwargs)\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet18']))\n fc = transfer_fc(model.fc)\n model.fc = fc\n return model", "def birealnet34(pretrained=False, **kwargs):\n ...
[ "0.6268504", "0.620634", "0.6204012", "0.61781776", "0.616232", "0.61510354", "0.61510354", "0.61510354", "0.61510354", "0.61510354", "0.6100227", "0.6087697", "0.6079006", "0.6012798", "0.5975343", "0.59738714", "0.59638786", "0.5960628", "0.5948427", "0.5936224", "0.5920398...
0.70269394
1
Constructs a BiRealNet34 model.
def birealnet34(pretrained=False, **kwargs): model = BiRealNet(BasicBlock, [6, 8, 12, 6], **kwargs) return model
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def birealnet18(pretrained=False, **kwargs):\n model = BiRealNet(BasicBlock, [4, 4, 4, 4], **kwargs)\n return model", "def birealnet18(pretrained=False, **kwargs):\n model = BiRealNet(BasicBlock, [4, 4, 4, 4], **kwargs)\n return model", "def resnet34(bitW, bitA, pretrained=False, **kwargs):\n mo...
[ "0.6753302", "0.6753302", "0.63931054", "0.63634723", "0.6265441", "0.6239585", "0.6229357", "0.6220196", "0.6198277", "0.6196694", "0.6196694", "0.6196694", "0.61152387", "0.6085224", "0.60785514", "0.6060138", "0.60452986", "0.6025176", "0.6025176", "0.6025176", "0.60139596...
0.73481995
0
Clears the peak_to_peer info which can get quite large.
async def clear_sync_info(self) -> None: self.peak_to_peer = orderedDict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear(self):\n self._fingerprint = 0", "def clear(self):\n self.mismatch_error = None\n self.pt_outs = None\n self._onnx_graph = None\n self.upper_graph_info = None\n self.lower_graph_info = None", "def clear(self):\n self.molo_tcp_pack.clear()\n self...
[ "0.6206844", "0.58822215", "0.5839706", "0.5757953", "0.57487977", "0.5747801", "0.5705526", "0.5700115", "0.5695211", "0.56707", "0.5589478", "0.5570707", "0.5559506", "0.55220956", "0.55071974", "0.55066085", "0.5479404", "0.5468562", "0.5449649", "0.5447672", "0.5441297", ...
0.7599027
0
Make a hex string from the venue names to use as a unique id. Only the last 8 characters are used for the unique id.
def make_unique_id(venue_list): md5_hash = md5() for name in venue_list: md5_hash.update(name) hash_hex = md5_hash.hexdigest() return hash_hex[-8:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_uuid():\n parts = [Record._hex_string(k) for k in Record.UUID_PARTS]\n return \"-\".join(parts)", "def _unique_id():\n id = \"\"\n for i in xrange(0,8):\n id += choice(ascii_letters)\n return id", "def format_unique_id(address: str) -> str:\n return address.replace(\"...
[ "0.7108777", "0.67829424", "0.67574894", "0.66712064", "0.66090417", "0.6605987", "0.6547099", "0.643587", "0.6423709", "0.64172685", "0.6412221", "0.6411684", "0.63644415", "0.63502777", "0.6323095", "0.62953424", "0.6283156", "0.62323576", "0.61994445", "0.61936736", "0.610...
0.8124629
0
Raises a ValueError if matrix `value` is not square.
def assert_square(name: str, value: np.ndarray) -> None: if not len(value.shape) == 2 or value.shape[0] != value.shape[1]: raise ValueError(f"{name} must be a square")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_square(self):\n if self.rows != self.cols:\n raise IndexError(\"Matrix is not square\")", "def test_change_basis_raises_not_square(self, fun):\n A = np.random.rand(4, 6)\n with pytest.raises(ValueError, match=\"The input matrix is not square\"):\n fun(A)", "...
[ "0.70691025", "0.6647211", "0.62668157", "0.62668157", "0.6163664", "0.6089783", "0.6032893", "0.5889549", "0.58770996", "0.58336306", "0.57889503", "0.57666147", "0.5684565", "0.5575981", "0.5559106", "0.5558494", "0.553429", "0.55041176", "0.5487154", "0.5484843", "0.547051...
0.7312172
0
Calculates the Shannon entropy for probabilities `ps` with `base`.
def shannon_entropy(ps: np.ndarray, base: int = 2) -> float: return -np.sum(ps * np.log(ps) / np.log(base))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy(self, base: int = None):\n\n # shannon entropy in nats\n fdist_ = self.fdist\n fdist_[\"prob\"] = fdist_[\"freq\"] / fdist_[\"freq\"].sum()\n fdist_[\"logp\"] = np.log(fdist_[\"prob\"])\n fdist_[\"nats\"] = -fdist_[\"prob\"] * fdist_[\"logp\"]\n entropy_ = fdis...
[ "0.76036006", "0.67516744", "0.6684365", "0.6516514", "0.64760756", "0.62832654", "0.6267193", "0.62411416", "0.6221311", "0.62205845", "0.6211119", "0.6175704", "0.61547273", "0.59715253", "0.5954994", "0.59400564", "0.58892614", "0.5873213", "0.58565325", "0.5835365", "0.58...
0.8918445
0
Simply tests if `img` has 3 channels.
def is_rgb(img: np.ndarray) -> bool: return len(img.shape) >= 1 and img.shape[-1] == 3
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_rgb(im):\n if(im.ndim == 3):\n return True\n else:\n return False", "def rgb(self) -> bool:\n return self.image_shape[2] == 3", "def is_RGB(self,img_path):\n image=Image.open(img_path)\n image=np.asarray(image)\n if(len(image.shape)<3):\n return...
[ "0.72373766", "0.7074375", "0.67956823", "0.6699473", "0.66691566", "0.6518619", "0.65036654", "0.62500054", "0.62126744", "0.6188705", "0.61673236", "0.61294484", "0.61257964", "0.6089409", "0.594763", "0.59257436", "0.5916708", "0.5915381", "0.58001804", "0.5760735", "0.574...
0.74561703
0
Converts an array [..., channels] of RGB values to HSI color values (H in rad). RGB values are assumed to be normalized to (0, 1).
def rgb_to_hsi(image: np.ndarray) -> np.ndarray: if not is_rgb(image): raise ValueError("Input needs to be an array of RGB values") r = image[..., 0] g = image[..., 1] b = image[..., 2] out = np.zeros_like(image) # allequal = (img == img[:, :, 0, np.newaxis]).all(axis=-1) with n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rgb2hsl_img(rgb):\r\n \r\n def core(_rgb, _hsl):\r\n\r\n irgb = _rgb.astype(np.uint16)\r\n ir, ig, ib = irgb[:, :, 0], irgb[:, :, 1], irgb[:, :, 2]\r\n h, s, l = _hsl[:, :, 0], _hsl[:, :, 1], _hsl[:, :, 2]\r\n\r\n imin, imax = irgb.min(2), irgb.max(2)\r\n iadd, isub = i...
[ "0.6703506", "0.6296489", "0.6287106", "0.60505944", "0.59786993", "0.5978399", "0.59774935", "0.59652996", "0.5940715", "0.59046626", "0.58576584", "0.5831712", "0.58161163", "0.58112276", "0.5776856", "0.57461786", "0.57437605", "0.5730638", "0.5720245", "0.56746477", "0.56...
0.7039188
0
Converts an array [..., channels] of RGB values to Digital Y'CbCr (0255). RGB values are assumed to be normalized to (0, 1). Don't forget to cast to uint8 for pillow.
def rgb_to_ycbcr(image: np.ndarray) -> np.ndarray: """ from RGB (0-1). """ if not is_rgb(image): raise ValueError("Input needs to be an array of RGB values") m = np.array( [ [+065.481, +128.553, +024.966], [-037.797, -074.203, +112.000], [+112.000,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rgb_to_ycbcr(image: torch.Tensor) -> torch.Tensor:\n r: torch.Tensor = image[..., 0, :, :]\n g: torch.Tensor = image[..., 1, :, :]\n b: torch.Tensor = image[..., 2, :, :]\n\n delta: float = 0.5\n y: torch.Tensor = 0.299 * r + 0.587 * g + 0.114 * b\n cb: torch.Tensor = (b - y) * 0.564 + delta\...
[ "0.65595174", "0.65373284", "0.65213215", "0.6495782", "0.64475703", "0.64128786", "0.6219854", "0.6115602", "0.5978177", "0.5957845", "0.59014165", "0.5828215", "0.5691829", "0.5660269", "0.5658129", "0.56305027", "0.5622264", "0.5549955", "0.55226725", "0.5519686", "0.55096...
0.6613111
0
Returns a triangular matrix with random value between 0 and 1 uniformly.
def random_triangular_matrix(size: int, lower: bool = True) -> np.ndarray: a = np.random.uniform(0, 1, (size, size)) if lower: ind = np.triu_indices(5, 1) else: ind = np.tril_indices(5, 1) a[ind] = 0 return a
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_rand_mat(dim=3):\n tmp = npr.uniform(-1, 1, (dim,dim))\n\n # make matrix symmetric\n for i in range(dim):\n for j in range(i+1, dim):\n tmp[i,j] = tmp[j,i]\n\n return tmp", "def random_matrix(rows, cols):\n return np.random.randn(rows, cols)", "d...
[ "0.6796665", "0.6433331", "0.6395273", "0.63390714", "0.63257", "0.6278706", "0.61659557", "0.61443967", "0.60865873", "0.5927011", "0.5907153", "0.5863584", "0.5841046", "0.58366776", "0.57918566", "0.5788798", "0.5776318", "0.57745236", "0.57488704", "0.5734677", "0.5692929...
0.74994147
0
Performs batched calculation of `v^T A v` transform. Special case of bilinear form `x^T A y`
def batch_vTAv(A: np.ndarray, v: np.ndarray) -> np.ndarray: """ Faster than Av = np.matmul(A, v[...,:,None]) # [B, X, 1] return np.matmul(v[...,None,:], Av).squeeze((-2, -1)) # [B] """ return np.einsum("...k,...kl,...l->...", v, A, v)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f(t, x, n, v):\n total = 0\n for i in range(n+1):\n for j in range(n+1):\n for k in range(v):\n total = t[i][j] * x[i][j][k]", "def __call__(self, x, y):\n #- TODO: compare speed to solution at\n #- http://stackoverflow.com/questions/12729228/simple-effici...
[ "0.59027725", "0.58240545", "0.57738847", "0.5771491", "0.56887174", "0.5658218", "0.56540334", "0.56478906", "0.5588295", "0.55453885", "0.5531856", "0.55062973", "0.548991", "0.5472191", "0.54176724", "0.541392", "0.5401743", "0.5387512", "0.53842276", "0.53838414", "0.5374...
0.6895596
0
Performs a batched inner product over the last dimension. Replacement for deprecated `from numpy.core.umath_tests import inner1d`.
def batch_inner(a: np.ndarray, b: np.ndarray, verify: bool = True) -> np.ndarray: if verify and a.shape != b.shape: raise ValueError("All dimensions have to be equal") if a.shape[-1] == 0: return np.empty_like(a) return np.einsum("...i,...i->...", a, b) # faster than np.sum(a * b, axis=-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_outer_product(a, b):\n a, b = normalize_and_check_ndim([a, b], 2)\n # This is a batchwise version of the matrix multiplication approach\n # used for outer_product(), see explanation there.\n return a[:, :, np.newaxis] * b[:, np.newaxis, :]", "def outer_product(input_sets, axis=0):\n out ...
[ "0.7076053", "0.6733254", "0.6566906", "0.6538848", "0.6200467", "0.5971671", "0.5898091", "0.5882279", "0.586811", "0.58539116", "0.5828389", "0.58158463", "0.57993835", "0.5773256", "0.57691", "0.570448", "0.5675385", "0.5650381", "0.5588937", "0.55867285", "0.5513858", "...
0.6739568
1
`probs` values ndarray `k` take the smallest `k` elements, if `reverse` is False and the largest `k` if `reverse` is True `axis` sorting and selection axis.
def batchtopk( probs: np.ndarray, k: Optional[int] = None, axis: int = -1, reverse: bool = False ) -> Tuple[np.ndarray, np.ndarray]: if k is not None and k <= 0: raise ValueError("k must be larger than 0. Use None to chose all elements.") if axis != -1: raise ValueError("Only last axis sup...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tflite_top_k_probs(probs, k):\n\n if k > 0:\n return np.flip(probs[0].argsort()[-k:])\n else:\n return np.flip(probs[0].argsort())", "def tf_top_k_probs(probs, k):\n\n if k > 0:\n return probs.argsort()[-k:][::-1]\n else:\n return probs.argsort()[:][::-1]", "def indi...
[ "0.7283214", "0.6759031", "0.58316225", "0.58071005", "0.5797564", "0.57924837", "0.5782279", "0.5650926", "0.55970734", "0.5593298", "0.558886", "0.5553999", "0.5523884", "0.548393", "0.5477123", "0.5454491", "0.5419435", "0.5367509", "0.5322573", "0.5320744", "0.5307545", ...
0.7433971
0
Calcuates the sum of the logs of the diagonal elements (batchwise if necessary)
def logtrace(m: np.ndarray) -> np.ndarray: """ note: performance cannot easily be improve by numba. `np.diagonal` not supported by numba 0.52.0 """ return np.sum(np.log(np.diagonal(m, axis1=-2, axis2=-1)), axis=-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trace(X):\r\n return extract_diag(X).sum()", "def trace(X):\n return extract_diag(X).sum()", "def ln_sum_i_neq_j(x):\n\tiw_size = x.size(0)\n\tbatch_size = x.size(1)\n\n\t# TODO: Would torch.expand instead of torch.repeat make this faster?\n\tinv_mask = torch.eye(iw_size).unsqueeze(dim=2).repeat(1, 1...
[ "0.6600348", "0.6512393", "0.63457274", "0.62601304", "0.62387985", "0.6219907", "0.6185488", "0.6124841", "0.6087076", "0.606045", "0.6032963", "0.6027041", "0.6024959", "0.60206836", "0.60127777", "0.6009793", "0.598619", "0.5973478", "0.5966066", "0.58722997", "0.58696294"...
0.6544133
1
Shifts `pvals` by the largest value in the last dimension before the exp is calculated to prevent overflow (batchwise if necessary). Can be used if probabilities are normalized again later.
def shiftedexp(pvals: np.ndarray) -> np.ndarray: if pvals.shape[-1] == 0: return np.empty_like(pvals) return np.exp(pvals - np.amax(pvals, axis=-1)[..., None])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def benjamini_hochberg_step_down(pvals):\r\n tmp = fdr_correction(pvals)\r\n corrected_vals = empty(len(pvals))\r\n max_pval = 1.\r\n for i in argsort(pvals)[::-1]:\r\n if tmp[i] < max_pval:\r\n corrected_vals[i] = tmp[i]\r\n max_pval = tmp[i]\r\n else:\r\n ...
[ "0.62695336", "0.6066202", "0.58225965", "0.57363963", "0.5489803", "0.5446892", "0.5247545", "0.52059096", "0.5191071", "0.51882726", "0.5157705", "0.5066351", "0.5033633", "0.4979771", "0.4901542", "0.4892328", "0.48860258", "0.48807552", "0.48794442", "0.48614326", "0.4850...
0.7399692
0
Sample from list of probabilities `pvals` with replacement. The probabilities don't need to be normalized.
def sample_probabilities(pvals: np.ndarray) -> Callable[[], int]: return Sampler(np.cumsum(pvals))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _correct_p_values(self, p_vals):\r\n num_tests = len([p_val for p_val in p_vals if p_val is not None])\r\n corrected_p_vals = []\r\n for p_val in p_vals:\r\n if p_val is not None:\r\n corrected_p_vals.append(min(p_val * num_tests, 1))\r\n else:\r\n ...
[ "0.62992084", "0.5945291", "0.57297397", "0.55846256", "0.5577901", "0.5562105", "0.54901296", "0.539993", "0.5361088", "0.5338176", "0.5308725", "0.53033537", "0.5288212", "0.52389336", "0.52308893", "0.52133656", "0.520034", "0.5190075", "0.5185366", "0.5180876", "0.5169325...
0.6719965
0
Sample from the categorical distribution using `pvals`.
def categorical(pvals: np.ndarray) -> int: return sample_probabilities(pvals)() # faster than: np.argmax(np.random.multinomial(1, normalize(pvals)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_probabilities(pvals: np.ndarray) -> Callable[[], int]:\n\n return Sampler(np.cumsum(pvals))", "def sample_categorical(distribution):\n sample = random.random()\n for event, prob in distribution.items():\n if sample < prob:\n return event\n sample -= prob\n raise Va...
[ "0.6776044", "0.650533", "0.64588654", "0.6282057", "0.6240135", "0.6240135", "0.62277555", "0.6160603", "0.6149961", "0.60994315", "0.60755867", "0.60755867", "0.60755867", "0.6050657", "0.6038272", "0.6014659", "0.5976859", "0.5965328", "0.59274614", "0.5909927", "0.5828886...
0.7592371
0
Convert a population (list of observations) to a CDF.
def population2cdf(population: np.ndarray) -> np.ndarray: population = np.sort(population) return np.searchsorted(population, population, side="right") / len(population)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cdf(self,x):\n if hasattr(x,'__len__'):\n returnCdf = np.array([self.cdf(i) for i in x])\n else:\n returnCdf = self._distribution.cdf(x)\n return returnCdf", "def cdf(self,x):\n coordinate = distribution1D.vectord_cxx(len(x))\n for i in range(len(x)):\n coordinate[i] = x[i]\n ...
[ "0.6000258", "0.56762284", "0.56762284", "0.55965334", "0.54399467", "0.54305595", "0.5391821", "0.5380843", "0.53685206", "0.5361804", "0.53427804", "0.5326272", "0.52933216", "0.5286579", "0.5269808", "0.5198982", "0.5191929", "0.5165977", "0.5149848", "0.51354104", "0.5111...
0.62257254
0
Convert a discrete PDF into a discrete CDF.
def pmf2cdf(pdf: np.ndarray) -> np.ndarray: cdf = np.cumsum(pdf) return cdf / cdf[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cdf_to_pdf(cdf):\n pdf = deepcopy(cdf)\n pdf[1:] -= pdf[:-1].copy()\n return pdf", "def pdf(self,x):\n return self.categoricalDist.pdf(x)", "def pdf(self,x):\n if x in self.values:\n pdfValue = self.mapping[x]\n else:\n if self.isFloat:\n vals = sorted(list(self.values))\...
[ "0.69857043", "0.61699057", "0.59049094", "0.5864199", "0.58318394", "0.57629466", "0.573494", "0.5734838", "0.56632376", "0.5655967", "0.56498164", "0.56412953", "0.558819", "0.55852294", "0.5578906", "0.5552537", "0.5533782", "0.5533782", "0.551519", "0.5459205", "0.5448148...
0.6718552
1
Calculate stochastic matrix `pm` to the power of infinity, by finding the eigenvector which corresponds to the eigenvalue 1.
def inf_matrix_power(pm: np.ndarray, dtype=np.float64) -> np.ndarray: w, v = np.linalg.eig( pm ) # scipy.linalg.eig would probably by faster as it can return the left and right eigen vectors if not np.isclose(w[0], 1.0): raise ValueError("The first eigenvalue is not none. Is this a right ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_E0(self) -> float:\n noisy = self.kernel_eigenvectors_[-1].copy()\n np.random.shuffle(noisy)\n\n kernel_eigenvectors = self.kernel_eigenvectors_[:-1]\n kernel_eigenvectors.append(noisy)\n\n eigenvectors_matrix = scipy.sparse.csr_matrix(\n np.column_stack(...
[ "0.62551945", "0.60196066", "0.59203595", "0.5908042", "0.589194", "0.5879424", "0.5878952", "0.5874368", "0.5866997", "0.5835588", "0.58008105", "0.5785766", "0.5769242", "0.576087", "0.5740334", "0.5668045", "0.55842084", "0.5565213", "0.5563019", "0.55508184", "0.55072254"...
0.763889
0
Replace colored pixels with a `neutral_color`. The `ratio` defines the 'colorfulness' above which level the pixel should be replace. I.e. if the `ratio` is 1 nothing will be replaced, if `ratio` is 0 only strict greys are kept unmodified.
def remove_color(img: np.ndarray, ratio: float, neutral_color: Tuple[int, int, int] = RGB_WHITE) -> None: channels = img.shape[-1] assert channels == 3, "Not a 3 channel color image" norm = np.std(np.array(RGB_YELLOW)) # this is the same for all pure colors sd = np.std(img, axis=-1) img[sd > rat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ratio_to_rgb(ratio):\n b = 0\n if round(ratio, 1) == 0.5:\n r = 255\n g = 255\n elif ratio < 0.5:\n r = int(ratio * 2 * 255.0)\n g = 255\n else:\n r = 255\n g = int((1.0 - ratio) * 2 * 255.0)\n rgb = (r, g, b)\n\n return rgb", "def set_neutral(self)...
[ "0.4983211", "0.48789826", "0.48116347", "0.4737011", "0.47265878", "0.46818957", "0.4571823", "0.45462266", "0.44600105", "0.4397929", "0.42731524", "0.427132", "0.4269558", "0.42693788", "0.42575642", "0.42499575", "0.42406985", "0.42318156", "0.4226033", "0.4211065", "0.41...
0.7399279
0
np.broadcast_shapes requires `numpy==1.20.0`, which is not available for `python < 3.7`.
def broadcast_shapes(*shapes: Tuple[int, ...]) -> Tuple[int, ...]: arrays = [np.empty(shape) for shape in shapes] return np.broadcast(*arrays).shape
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_broadcast_dims():\r\n test((1, 2, 3))\r\n test((2, 1, 3))\r\n test((2, 3, 1))\r\n test2((1, 2, 3))\r\n test2((2, 1, 3))\r\n test2((2, 3, 1))", "def broadcast_shape(*shapes, **kwargs):\n strict = kwargs.pop(\"strict\", False)\n reversed_shape = []\n for shape in shapes:\n ...
[ "0.63662064", "0.631577", "0.6181781", "0.60380113", "0.59342825", "0.5925404", "0.58053595", "0.57856745", "0.57498085", "0.56896067", "0.55596524", "0.55482703", "0.548472", "0.548077", "0.540709", "0.5397413", "0.53940207", "0.5373903", "0.53049004", "0.526517", "0.5237194...
0.6529921
0
Batched center of mass calculation of 2d arrays
def center_of_mass_2d(arr: np.ndarray, dtype=np.float32) -> np.ndarray: total = np.sum(arr, axis=(-1, -2)) grids = np.ogrid[[slice(0, i) for i in arr.shape[-2:]]] with np.errstate(invalid="ignore"): results = np.array([np.sum(arr * grid.astype(dtype), axis=(-1, -2)) / total for grid in grids], dtyp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def centerOfMass(data):\r\n dd = []\r\n for d in data:\r\n dd.append(d.coordinate)\r\n\r\n data = dd\r\n data = np.array(data)\r\n n = len(data)\r\n x = sum(data[:,0])\r\n y = sum(data[:,1])\r\n z = sum(data[:,2])\r\n x/=n\r\n y/=n\r\n z/=n\r\n return x,y,z,n", "def _ce...
[ "0.7113222", "0.6913504", "0.68147796", "0.66269344", "0.6623906", "0.6605114", "0.6573181", "0.6555954", "0.65233356", "0.65076435", "0.6476598", "0.64425707", "0.6414334", "0.6406729", "0.63674235", "0.63496435", "0.6226081", "0.6160094", "0.61026037", "0.6084239", "0.60666...
0.74505234
0
validate_target verifies that target is a valid MAC address, IP address or hostname
def validate_target(target, arp_table): try: mac = mac_address(target) return mac except TypeError: pass try: ip = ip_address(target) if ip in arp_table.keys(): return arp_table[ip].mac except TypeError: pass if target in arp_table: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_target(target: str) -> bool:\n try:\n gethostbyname(target)\n except (gaierror, UnicodeError):\n return False\n return True", "def validateIP():\n try:\n s = socket.inet_aton(args.target)\n except socket.error:\n print(\"\")\n pri...
[ "0.7149191", "0.64991635", "0.64354825", "0.63836634", "0.62301147", "0.62007254", "0.6052976", "0.6006137", "0.59964573", "0.5994269", "0.59239537", "0.58881646", "0.58818513", "0.5870957", "0.5835328", "0.57881117", "0.575523", "0.5737461", "0.57259214", "0.5655272", "0.563...
0.76750195
0
[authorize and initialize spotify client]
def init_auth_client(self): with open("config.yml", 'r') as ymlfile: cfg = yaml.load(ymlfile) token = util.prompt_for_user_token( cfg['username'], scope=cfg['scope'], client_id=cfg['spotipy_client_id'], client_secret=cfg['spotipy_client_secret'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_user(self) -> Any:\n return \\\n spotipy.Spotify(auth_manager=spotipy.oauth2.SpotifyOAuth(scope=\"playlist-modify-public\",\n client_id=self._public_id, client_secret=self._secret_id,\n redirect_uri=self._redirect_uri))", "def authe...
[ "0.7275522", "0.7169035", "0.7160154", "0.7054514", "0.70088327", "0.6976066", "0.6880722", "0.6798923", "0.6781801", "0.67027813", "0.66602165", "0.6602743", "0.64574254", "0.6410066", "0.6331362", "0.63175875", "0.62989295", "0.6185303", "0.6183346", "0.6170306", "0.6090339...
0.78885454
0
[creates a new playlist with given name, desc with given limts]
def create_new_playlist(self, name, desc=''): pl_names, _, _ = self.list_playlists() if name in pl_names: self.logger.debug( 'Playlist Name Already Exists, please use another name') else: pl = self.sp.user_playlist_create( self.user, name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_playlist(self, playlist_name):\n print(\"create_playlist needs implementation\")", "def create_playlist():\n sp = credentials()\n sp.user_playlist_create('truetiming', name='Billboard Hot 100')", "def create_playlist(self, data):\n pass", "def create_playlist(self, playlist_nam...
[ "0.7272547", "0.68430287", "0.673538", "0.6641419", "0.661609", "0.65667766", "0.6543431", "0.6541754", "0.6530266", "0.6512793", "0.6474164", "0.64047396", "0.63702667", "0.6338417", "0.6316106", "0.6193181", "0.617585", "0.61417544", "0.60676473", "0.6046706", "0.5912048", ...
0.7137164
1
Method which calculates TS Percentage metric for a player
def set_ts_percentage(self): bx = self.get_standard_stats() ptos = float(bx["t2p_conv"]*2 + bx["t3p_conv"]*3 + bx["tl_conv"]) tcInt = float(bx["t2p_int"] + bx["t3p_int"]) tsAttempts = float(tcInt + (0.44*float(bx["tl_int"]))) result = 0.00 if tsAttempts > 0.00: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pct(self):\n\t\treturn self.bottle.pct()", "def percentCheck(currentTimeLabel, totalTimeLabel):\n # Updated 11/19/16\n try:\n progPercent = float(currentTimeLabel) / float(totalTimeLabel) * 100\n except (ValueError , ZeroDivisionError):\n progPercent = 0\n \n return progPerce...
[ "0.67912775", "0.67874295", "0.66820705", "0.6615735", "0.6549017", "0.65139776", "0.65139776", "0.6465816", "0.64634633", "0.6446837", "0.64173675", "0.64117974", "0.6390257", "0.63858217", "0.6356354", "0.6316925", "0.6298419", "0.62818795", "0.6281119", "0.6268235", "0.622...
0.745896
0
Method which calculate USG% for each player from each team
def set_usg_percentage(self): bx = self.get_standard_stats() team = self.get_team_stats() tcInt = bx["t2p_int"] + bx["t3p_int"] a = tcInt + (Decimal('0.44')*bx["tl_int"]) + bx["turnovers"] b = team["minutes"]/5 c = (team["t2p_int"] + team["t3p_int"]) + (Decimal('0.44')*te...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_player_score():\n\n progress_bar = ProgressBar(label=\"Computing universes\")\n\n survivals_count = 0\n for i in range(PARALLEL_UNIVERSES_COUNT):\n if simulate_universe():\n survivals_count += 1\n progress_bar.set_progression((i + 1) / PARALLEL_UNIVERSES_COUNT)\n\n ...
[ "0.67434204", "0.6500815", "0.6359718", "0.63065845", "0.63019216", "0.6301762", "0.6299715", "0.6148283", "0.6126874", "0.6103746", "0.59502584", "0.59436804", "0.59398586", "0.5932481", "0.58808863", "0.58741057", "0.58336693", "0.58299714", "0.57860583", "0.5785277", "0.57...
0.6911841
0
Method which calculate Total Rebound Percentage
def set_total_reb_percentage(self): bx = self.get_standard_stats() team = self.get_team_stats() opp_team = self.get_opp_team_stats() player_rebounds = bx["reb_def"] + bx["reb_of"] team_rebounds = team["reb_def"] + team["reb_of"] opp_team_rebounds = opp_team["reb_def"] + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_total_reb_of_percentage(self):\n bx = self.get_standard_stats()\n team = self.get_team_stats()\n opp_team = self.get_opp_team_stats()\n result = 0.00\n try:\n if bx[\"reb_of\"] > 0 and bx[\"minutes\"] > 0:\n result = ((bx[\"reb_of\"] * (team[\"mi...
[ "0.6523484", "0.6491968", "0.63697445", "0.6303792", "0.6300233", "0.62549525", "0.6121597", "0.6087575", "0.60844654", "0.6044818", "0.6027688", "0.6009361", "0.5989413", "0.5969596", "0.59609574", "0.59609574", "0.59606254", "0.5904455", "0.5899307", "0.58770585", "0.584258...
0.6903449
0
Method which calculate Total Rebound Defensive Percentage
def set_total_reb_def_percentage(self): bx = self.get_standard_stats() team = self.get_team_stats() opp_team = self.get_opp_team_stats() result = 0.00 try: if bx["minutes"] > 0 and bx["minutes"] > 0: result = ((bx["reb_def"] * (team["minutes"]/5)) / (b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_real_percent(self):\n if not (self.votes and self.score):\n return 0\n return 100 * (self.get_real_rating() / self.field.range)", "def set_total_reb_percentage(self):\n bx = self.get_standard_stats()\n team = self.get_team_stats()\n opp_team = self.get_opp_te...
[ "0.6720814", "0.65615296", "0.64223516", "0.63799196", "0.63289535", "0.63207704", "0.63154423", "0.62732965", "0.6261528", "0.6167289", "0.6124796", "0.61081874", "0.6068133", "0.60473025", "0.5999613", "0.5988745", "0.59840715", "0.5983306", "0.5973883", "0.59696484", "0.59...
0.6653622
1
Method which calculate Steals Percentage of a player
def set_steals_percentage(self): bx = self.get_standard_stats() team = self.get_team_stats() opp_team = self.get_opp_team_stats() poss = self.get_team_possessions() result = 0.00 if bx["minutes"] > 0: result = ((bx["steals"] * (team["minutes"]/Decimal('5'))) /...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_percent(self, n):\n controlled = 0.00\n for i in range(len(self.tile_contents)):\n if(self.tile_contents[i].player_number == n):\n controlled += 1.00\n \n return float(controlled / self.paint_blocks)", "def winning_percentage(self):\n return fl...
[ "0.6973858", "0.68804467", "0.68694776", "0.6837882", "0.6696774", "0.65600723", "0.6460961", "0.6452967", "0.64353186", "0.6403429", "0.6403429", "0.6369753", "0.6368016", "0.63537014", "0.63537014", "0.63495165", "0.6336215", "0.632231", "0.62704694", "0.6268536", "0.626853...
0.77550447
0
Method which calculate Assists Percentage of a player
def set_assists_percentage(self): bx = self.get_standard_stats() team = self.get_team_stats() team_tc_conv = team["t2p_conv"] + team["t3p_conv"] player_tc_conv = bx["t2p_conv"] + bx["t3p_conv"] result = 0.00 try: if bx["minutes"] > 0: result = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_percent(self):\n if not (self.votes and self.score):\n return 0\n return 100 * (self.get_rating() / self.field.range)", "def get_percent(self, n):\n controlled = 0.00\n for i in range(len(self.tile_contents)):\n if(self.tile_contents[i].player_number == n...
[ "0.7001746", "0.68421483", "0.6813", "0.67631215", "0.67387015", "0.6656908", "0.6627645", "0.6627645", "0.6618226", "0.6604493", "0.66013306", "0.6542234", "0.6510403", "0.64416814", "0.64405453", "0.64405453", "0.64318055", "0.64273596", "0.63814425", "0.63652843", "0.63540...
0.767859
0
Method which calculate Ratio Assists Per Turnover of a player
def set_assists_per_turnover(self): bx = self.get_standard_stats() ratio = bx["assists"] if bx["turnovers"] > 0: ratio = bx["assists"] / bx["turnovers"] self.assists_per_turnover = "%.2f" % round(ratio, 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def player_ratio(self, ctx):\r\n player = ctx.message.content.split(' ')[1]\r\n if os.environ.get(\"WoW_Token\") is None:\r\n return\r\n else:\r\n async with aiohttp.ClientSession().get('https://us.api.battle.net/wow/character/zul\\'jin/' + player + '?fields=pvp&loc...
[ "0.69899476", "0.66916925", "0.66868806", "0.661133", "0.64811707", "0.63243896", "0.62888366", "0.62563837", "0.623092", "0.6226826", "0.6220208", "0.62145406", "0.6178597", "0.6162016", "0.6135676", "0.6127374", "0.6116254", "0.60962725", "0.60838556", "0.6064083", "0.60435...
0.7008181
0
Method which calculate Assists Ratio of a player
def set_assists_ratio(self): bx = self.get_standard_stats() tcInt = float(bx["t2p_int"] + bx["t3p_int"]) denominador = tcInt + (0.44 * float(bx["tl_int"])) + float(bx["assists"]) +float(bx["turnovers"]) numerador = float(bx["assists"]) result = 0.00 if denominador > 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def player_ratio(self, ctx):\r\n player = ctx.message.content.split(' ')[1]\r\n if os.environ.get(\"WoW_Token\") is None:\r\n return\r\n else:\r\n async with aiohttp.ClientSession().get('https://us.api.battle.net/wow/character/zul\\'jin/' + player + '?fields=pvp&loc...
[ "0.72646964", "0.64316165", "0.6352074", "0.6281999", "0.6247194", "0.6209247", "0.6207199", "0.61734754", "0.61600745", "0.61037296", "0.609562", "0.607315", "0.60665053", "0.60465765", "0.6046293", "0.60187536", "0.6009164", "0.59791255", "0.5958189", "0.59420407", "0.58815...
0.7257836
1
Method which calculate Defensive Ratio of a player. The total points received in 100 possessions
def set_defensive_ratio(self): bx = self.get_standard_stats() team = self.get_team_stats() opp_team = self.get_opp_team_stats() if bx["minutes"] > 0: opp_fga = opp_team["t2p_int"] + opp_team["t3p_int"] opp_fgm = opp_team["t2p_conv"] + opp_team["t3p_conv"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def player_ratio(self, ctx):\r\n player = ctx.message.content.split(' ')[1]\r\n if os.environ.get(\"WoW_Token\") is None:\r\n return\r\n else:\r\n async with aiohttp.ClientSession().get('https://us.api.battle.net/wow/character/zul\\'jin/' + player + '?fields=pvp&loc...
[ "0.6531963", "0.6401618", "0.61817557", "0.6132738", "0.6081823", "0.6071461", "0.60199296", "0.5966795", "0.5962311", "0.59621847", "0.5957963", "0.59393156", "0.59319943", "0.5922137", "0.5918801", "0.5913682", "0.5907549", "0.58991516", "0.5896585", "0.5889761", "0.5885497...
0.65123755
1
Method which calculate Offensive Ratio of a player. The total points scored in 100 possessions
def set_offensive_ratio(self): bx = self.get_standard_stats() team = self.get_team_stats() opp_team = self.get_opp_team_stats() if bx["minutes"] > 0 and (bx["t2p_int"] + bx["t3p_int"]) > 0: fgm = bx["t2p_conv"] + bx["t3p_conv"] fga = bx["t2p_int"] + bx["t3p_int"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def player_ratio(self, ctx):\r\n player = ctx.message.content.split(' ')[1]\r\n if os.environ.get(\"WoW_Token\") is None:\r\n return\r\n else:\r\n async with aiohttp.ClientSession().get('https://us.api.battle.net/wow/character/zul\\'jin/' + player + '?fields=pvp&loc...
[ "0.6951562", "0.6515817", "0.644771", "0.6344681", "0.62165296", "0.62093073", "0.61908257", "0.6157803", "0.6073757", "0.60568166", "0.6025391", "0.60042846", "0.5987803", "0.5981942", "0.5976337", "0.5951976", "0.5948813", "0.5936161", "0.593527", "0.593107", "0.5930244", ...
0.6635203
1
auth_data will be used used as request_data in strategy
def set_input_data(self, request, auth_data): request.auth_data = auth_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_oauth_data():", "def __init__(self, my_data, my_auth):\n self.user = my_auth.user\n self.password = my_auth.password\n self.my_data = my_data", "def authenticate(self, request):\n auth_data = super().authenticate(request)\n if not auth_data:\n return auth_d...
[ "0.6669421", "0.6569925", "0.63427466", "0.61100876", "0.6065976", "0.6054941", "0.6029151", "0.60213995", "0.6012752", "0.5897798", "0.5737002", "0.5730088", "0.56567615", "0.5615505", "0.56064767", "0.55513734", "0.5519616", "0.5500598", "0.5468376", "0.5468376", "0.5440677...
0.71807003
0
Tests that only 'admin' can add a product
def test_only_admin_can_create_product(self): resp = self.admin_create_user() reply = self.attendant_login() token = reply['token'] product = dict( prod_name='NY_denims', category='denims', stock=20, price=150 ) resp = self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_non_admin_cannot_delete_product(self):\n resp = self.admin_register()\n reply = self.admin_login()\n token = reply['token']\n product = dict(\n prod_name='NY_denims',\n category='denims',\n stock=20,\n price=150\n )\n re...
[ "0.7732614", "0.766534", "0.746467", "0.73577404", "0.7302724", "0.7297793", "0.7198699", "0.7088031", "0.706756", "0.69749635", "0.6925475", "0.6893543", "0.6830343", "0.68255603", "0.6805827", "0.68006784", "0.677526", "0.67369896", "0.6678268", "0.66471297", "0.6601341", ...
0.8407797
0
Tests that 'admin' can add a product
def test_admin_create_product(self): resp = self.admin_register() reply = self.admin_login() token = reply['token'] product = dict( prod_name='NY_denims', category='denims', stock=20, price=150 ) resp = self.client.post( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_only_admin_can_create_product(self):\n resp = self.admin_create_user()\n reply = self.attendant_login()\n token = reply['token']\n product = dict(\n prod_name='NY_denims',\n category='denims',\n stock=20,\n price=150\n )\n ...
[ "0.8125268", "0.78284925", "0.7689276", "0.74345493", "0.7312975", "0.72979146", "0.71163535", "0.709621", "0.70959914", "0.7021732", "0.6964215", "0.6953487", "0.6913336", "0.6887993", "0.6846328", "0.6843517", "0.6843496", "0.68297696", "0.67998624", "0.6782752", "0.6768684...
0.79675835
1
Test admin cannot create a product with a blacklisted token
def test_cannot_create_product_with_blacklisted_token(self): resp = self.admin_register() reply = self.admin_login() token = reply['token'] resp = self.client.delete( '/api/v1/logout', headers={'Authorization': 'Bearer {}'.format(token)} ) reply =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cannot_view_a_product_with_blacklisted_token(self):\n resp = self.admin_register()\n reply = self.admin_login()\n token = reply['token']\n product = dict(\n prod_name='NY_denims',\n category='denims',\n stock=20,\n price=150\n ...
[ "0.82479733", "0.7897591", "0.7884179", "0.78223985", "0.7625364", "0.7585557", "0.7400365", "0.7375994", "0.72420007", "0.7152579", "0.7103639", "0.70389014", "0.6944365", "0.6929796", "0.68858266", "0.68301815", "0.67753994", "0.6750073", "0.6746582", "0.66715974", "0.66688...
0.8788049
0
Tests that 'admin' cannot add a product with empty fields
def test_admin_cannot_create_product_with_empty_fields(self): resp = self.admin_register() reply = self.admin_login() token = reply['token'] product = dict( prod_name='', category='', stock=20, price=150 ) resp = self.client...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cannot_make_sale_with_missing_fields(self):\n reply = self.admin_add_product()\n\n resp = self.admin_create_user()\n reply = self.attendant_login()\n token = reply['token']\n sale = dict(products = [\n {\n \"prod_name\":\"\", \n \...
[ "0.7727357", "0.71426547", "0.71228373", "0.6888725", "0.6875848", "0.68659735", "0.68113697", "0.6800745", "0.6779112", "0.67721987", "0.6709652", "0.66885155", "0.6665036", "0.6651361", "0.6607132", "0.66057837", "0.66039413", "0.65725106", "0.6552758", "0.6544897", "0.6522...
0.8373025
0
Tests that product_name field cannot contain a number
def test_Product_name_cannot_contain_a_number(self): resp = self.admin_register() reply = self.admin_login() token = reply['token'] product = dict( prod_name='NY_3', category='denims', stock=20, price=150 ) resp = self.clien...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_category_cannot_contain_a_number(self):\n resp = self.admin_register()\n reply = self.admin_login()\n token = reply['token']\n product = dict(\n prod_name='NY_denims',\n category='4dens',\n stock=20,\n price=150\n )\n re...
[ "0.6742002", "0.6642998", "0.6555487", "0.6555487", "0.6454647", "0.62910545", "0.62258327", "0.6198766", "0.6166252", "0.61075205", "0.5994341", "0.5968352", "0.5964386", "0.595047", "0.5949145", "0.5943742", "0.59381294", "0.591026", "0.5901904", "0.5901547", "0.58894527", ...
0.76176125
0
Tests that category field cannot contain a number
def test_category_cannot_contain_a_number(self): resp = self.admin_register() reply = self.admin_login() token = reply['token'] product = dict( prod_name='NY_denims', category='4dens', stock=20, price=150 ) resp = self.clien...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_isNumericCategory(self):\r\n obs = self.overview_map.isNumericCategory('Treatment')\r\n self.assertEqual(obs, False)\r\n\r\n obs = self.overview_map.isNumericCategory('DOB')\r\n self.assertEqual(obs, True)", "def test_isNumericCategory(self):\n obs = self.overview_map....
[ "0.69292754", "0.6892475", "0.68267983", "0.68267983", "0.6329393", "0.60511804", "0.6026339", "0.60021937", "0.5988064", "0.5981536", "0.5980512", "0.5917058", "0.59100056", "0.59020984", "0.5897836", "0.5872285", "0.58462423", "0.58406997", "0.58369875", "0.58208215", "0.58...
0.70390165
0
Tests that stock and price fields must be numbers
def test_stock_and_price_must_be_numbers(self): resp = self.admin_register() reply = self.admin_login() token = reply['token'] product = dict( prod_name='NY_denims', category='denims', stock='stock', price='money' ) resp = s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_sale_with_price_not_digit_format(self):\n self.register_admin_test_account()\n token = self.login_admin_test()\n\n response = self.app_test_client.post('{}/saleorder'.format(\n self.base_url), json={'name': \"Hand Bag\", 'price': \"1500\", 'quantity': 3, 'totalamt': \"\...
[ "0.73344076", "0.72246283", "0.72246283", "0.68624747", "0.66491514", "0.6644348", "0.66039526", "0.65944123", "0.6510274", "0.64985764", "0.6415647", "0.6365934", "0.6306292", "0.6289345", "0.6277049", "0.6271073", "0.62253267", "0.6222383", "0.6221313", "0.616871", "0.61683...
0.7861267
0
Tests that product already exists in the Inventory
def test_product_exists_in_inventory(self): resp = self.admin_register() reply = self.admin_login() token = reply['token'] product = dict( prod_name='NY_denims', category='denims', stock=20, price=150 ) resp = self.client.po...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_view_product_that_doesnot_exist_in_inventory(self):\n resp = self.admin_register()\n reply = self.admin_login()\n token = reply['token']\n product = dict(\n prod_name='NY_denims',\n category='denims',\n stock=20,\n price=150\n ...
[ "0.7496905", "0.7326862", "0.71235555", "0.68696725", "0.6750119", "0.6638737", "0.65924627", "0.6544556", "0.65392476", "0.6516768", "0.6488533", "0.6471995", "0.64518577", "0.6451675", "0.64378035", "0.63537824", "0.6353224", "0.63370115", "0.6325946", "0.6315863", "0.63116...
0.81727195
0
Tests that a user can view a product in the Inventory
def test_view_a_product(self): resp = self.admin_register() reply = self.admin_login() token = reply['token'] product = dict( prod_name='NY_denims', category='denims', stock=20, price=150 ) resp = self.client.post( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_product_show(self):\n\n self.selenium.get(\"http://localhost:8000/\")\n response = self.selenium.find_element(By.ID, \"id_product_name\")\n response.send_keys(\"frosties\")\n response.send_keys(Keys.ENTER)\n self.assertTemplateUsed('selected_product.html')", "def te...
[ "0.6914857", "0.68370014", "0.68132645", "0.67801803", "0.6777728", "0.6743917", "0.67292273", "0.6651706", "0.663699", "0.6590794", "0.6579514", "0.654358", "0.6536533", "0.64720875", "0.64325994", "0.6371396", "0.63542134", "0.63323015", "0.6293569", "0.6277347", "0.6251508...
0.74070454
0
Tests that a user cannot view a product in the Inventory with blacklisted token
def test_cannot_view_a_product_with_blacklisted_token(self): resp = self.admin_register() reply = self.admin_login() token = reply['token'] product = dict( prod_name='NY_denims', category='denims', stock=20, price=150 ) resp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cannot_view_all_products_with_blacklisted_token(self):\n resp = self.admin_register()\n reply = self.admin_login()\n token = reply['token']\n product = dict(\n prod_name='NY_denims',\n category='denims',\n stock=20,\n price=150\n ...
[ "0.77314836", "0.7319002", "0.68258417", "0.6709656", "0.66352224", "0.6600747", "0.65926576", "0.65914124", "0.6580106", "0.6573959", "0.6558386", "0.65569514", "0.6534714", "0.6512719", "0.6504638", "0.64704", "0.6448948", "0.6437487", "0.6420581", "0.6419264", "0.63966596"...
0.79721093
0
Tests that a user can view all products in the Inventory
def test_view_all_products(self): resp = self.admin_register() reply = self.admin_login() token = reply['token'] product = dict( prod_name='NY_denims', category='denims', stock=20, price=150 ) resp = self.client.post( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_products_logged_in(self):\n\n # Log in seller\n self.client.login(username=\"test_seller\", password=\"secret\")\n\n # Issue a GET request\n response = self.client.get(reverse('website:products'))\n\n # Check that the response is 200\n self.assertEqual(respon...
[ "0.72330284", "0.71533865", "0.70860183", "0.6867175", "0.6790764", "0.67349434", "0.6666839", "0.6636514", "0.66316766", "0.6597527", "0.65619427", "0.6444273", "0.6425292", "0.642249", "0.6402104", "0.64012486", "0.6383176", "0.6383148", "0.6321953", "0.6320072", "0.6299333...
0.7486654
0
Tests that a user cannot view all products in the Inventory with blacklisted token
def test_cannot_view_all_products_with_blacklisted_token(self): resp = self.admin_register() reply = self.admin_login() token = reply['token'] product = dict( prod_name='NY_denims', category='denims', stock=20, price=150 ) r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cannot_view_a_product_with_blacklisted_token(self):\n resp = self.admin_register()\n reply = self.admin_login()\n token = reply['token']\n product = dict(\n prod_name='NY_denims',\n category='denims',\n stock=20,\n price=150\n ...
[ "0.77733105", "0.7087671", "0.67957276", "0.6761181", "0.675135", "0.67509085", "0.66980356", "0.6541592", "0.65259844", "0.6448291", "0.64465666", "0.6436873", "0.64326245", "0.64205766", "0.6409761", "0.6387554", "0.6384848", "0.6369056", "0.63571316", "0.63104194", "0.6281...
0.8038467
0
Tests that a user cannot view a product that doesnot exist in the Inventory
def test_view_product_that_doesnot_exist_in_inventory(self): resp = self.admin_register() reply = self.admin_login() token = reply['token'] product = dict( prod_name='NY_denims', category='denims', stock=20, price=150 ) resp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cannot_sale_nonexistant_product(self):\n reply = self.admin_add_product()\n\n resp = self.admin_create_user()\n reply = self.attendant_login()\n token = reply['token']\n sale = dict(products = [\n {\n \"prod_name\":\"Paris_heels\", \n ...
[ "0.72640157", "0.6747577", "0.6742351", "0.6686189", "0.66764927", "0.6665994", "0.6556591", "0.6439238", "0.6401339", "0.6370489", "0.6360187", "0.6351575", "0.6346178", "0.63409466", "0.63361067", "0.6330177", "0.6312651", "0.62697184", "0.6259748", "0.62596893", "0.6218498...
0.73303914
0
Tests that a user cannot view products from empty Inventory
def test_view_products_from_empty_inventory(self): resp = self.admin_register() reply = self.admin_login() token = reply['token'] resp = self.client.get( '/api/v1/products', headers={'Authorization': 'Bearer {}'.format(token)} ) reply = json.loads...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_admin_cannot_delete_product_from_empty_Inventory(self):\n resp = self.admin_register()\n reply = self.admin_login()\n token = reply['token']\n \n resp = self.client.delete(\n '/api/v1/products/1',\n content_type='application/json',\n head...
[ "0.74154675", "0.72096145", "0.7158583", "0.693217", "0.6781853", "0.6733253", "0.66969836", "0.65152705", "0.64797616", "0.64615333", "0.6445138", "0.6428424", "0.63962966", "0.6393635", "0.63872916", "0.63662773", "0.633816", "0.6332057", "0.63152456", "0.6308194", "0.63058...
0.78474796
0
Tests that a user cannot view a product with invalid id
def test_view_product_with_invalid_id(self): resp = self.admin_register() reply = self.admin_login() token = reply['token'] product = dict( prod_name='NY_denims', category='denims', stock=20, price=150 ) resp = self.client.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_detail_odd_product_id_permission(self):\n self.assertEqual(self.product_2.id, 2)\n\n token = Token.objects.create(user=self.user_1)\n headers = {\n 'HTTP_AUTHORIZATION': 'Token ' + str(token)\n }\n response = self.client.get(\n '/api/products/{}/'.f...
[ "0.7096591", "0.6907471", "0.6797254", "0.6654126", "0.665064", "0.6630695", "0.6613442", "0.6613442", "0.6613442", "0.66119534", "0.65806687", "0.6550584", "0.6499338", "0.64979565", "0.64979565", "0.64979565", "0.6494183", "0.64578736", "0.64060956", "0.63708884", "0.634357...
0.75562716
0
Test that product cannot be updated successfully with blacklisted token
def test_cannot_update_product_with_blacklisted_token(self): resp = self.admin_register() reply = self.admin_login() token = reply['token'] product = dict( prod_name='NY_denims', category='denims', stock=20, price=150 ) resp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cannot_create_product_with_blacklisted_token(self):\n resp = self.admin_register()\n reply = self.admin_login()\n token = reply['token']\n\n resp = self.client.delete(\n '/api/v1/logout',\n headers={'Authorization': 'Bearer {}'.format(token)}\n )\n ...
[ "0.7377064", "0.7333218", "0.7190565", "0.7068335", "0.70310974", "0.69859517", "0.67677313", "0.6604328", "0.65338165", "0.65273803", "0.6446804", "0.6441972", "0.64315784", "0.64071953", "0.6401291", "0.6390641", "0.6355562", "0.6326239", "0.6304661", "0.62910193", "0.62794...
0.80966264
0
Test that you cant updated a nonexistant product
def test_update_nonexistant_product(self): resp = self.admin_register() reply = self.admin_login() token = reply['token'] product_update = dict( prod_name='NY_jeans', category='denims', stock=50, price=180 ) resp = self.clie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_nonexist(self):\n promotion = PromotionFactory()\n promotion.id = '1cak41-nonexist'\n try:\n promotion.update()\n except KeyError:\n self.assertRaises(KeyError)", "def test_update_not_my_product(self):\n post_data = {\n \"categor...
[ "0.74883664", "0.74142987", "0.7132973", "0.7130076", "0.6898503", "0.6843232", "0.676572", "0.6739922", "0.67206293", "0.67113554", "0.66875863", "0.6684773", "0.668369", "0.66656035", "0.6630668", "0.6606419", "0.65949506", "0.6585263", "0.65486664", "0.65191656", "0.651270...
0.7994515
0
Test that product cannot be updated with unauthorised user
def test_unauthorized_product_update(self): resp = self.admin_create_user() reply = self.attendant_login() token = reply['token'] product_update = dict( prod_name='NY_jeans', category='denims', stock=50, price=180 ) resp = s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_not_my_product(self):\n post_data = {\n \"category\": {\n \"name\": \"general\",\n \"index\": 0\n },\n \"name\": \"Producto 2 modified\",\n \"description\": \"Descripcion de producto 2 modified\",\n \"sellin...
[ "0.7472202", "0.74601954", "0.730332", "0.72697306", "0.71795666", "0.71784", "0.7131658", "0.70938385", "0.7079321", "0.6975282", "0.695774", "0.6886112", "0.68209416", "0.68174875", "0.6791423", "0.6772019", "0.6765322", "0.6752393", "0.67434675", "0.66997343", "0.6691479",...
0.80988926
0
Test that product cannot be updated with empty fields
def test_update_product_with_empty_fields(self): resp = self.admin_register() reply = self.admin_login() token = reply['token'] product = dict( prod_name='NY_denims', category='denims', stock=20, price=150 ) resp = self.clie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_product_required_fields(self):\n data = {\n 'pk': 1,\n 'name': None,\n 'description': '''\n Yogurt also spelled yoghurt, yogourt or yoghourt,\n is a food produced by bacterial fermentation of milk.\n '''\n }\n ...
[ "0.802753", "0.7568224", "0.7292608", "0.7203753", "0.7033387", "0.69645137", "0.6949159", "0.6943705", "0.69149756", "0.691329", "0.690093", "0.6899394", "0.6895893", "0.68875086", "0.6824652", "0.6816774", "0.68002254", "0.6785967", "0.6772013", "0.67623484", "0.6751942", ...
0.8045699
0