query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Sets the pinterest of this StoreProfile.
def pinterest(self, pinterest): self._pinterest = pinterest
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repaid_interest(self, repaid_interest):\n\n self._repaid_interest = repaid_interest", "def paid_interest(self, paid_interest):\n\n self._paid_interest = paid_interest", "def set_profile(self, profile: str):\n self._profile = profile", "def pinterest(self):\n return self._pinte...
[ "0.6722862", "0.66200674", "0.5696167", "0.5647955", "0.5599525", "0.5578526", "0.5578526", "0.5271597", "0.5177461", "0.5171312", "0.51635766", "0.5154178", "0.50973547", "0.50973547", "0.5083053", "0.5078245", "0.50472605", "0.500781", "0.49349016", "0.48526222", "0.4851890...
0.76808065
0
Gets the linkedin of this StoreProfile.
def linkedin(self): return self._linkedin
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_profile(self):\n return self.user.profile", "def customer_profile_oid(self):\n return self._customer_profile_oid", "def linkedin(self, linkedin):\n\n self._linkedin = linkedin", "def facebook(self):\n return self._facebook", "def spinnaker_link_id(self):\n re...
[ "0.5506056", "0.54694885", "0.5464488", "0.544704", "0.54469264", "0.54198897", "0.529772", "0.5277959", "0.52728975", "0.5262846", "0.52600217", "0.5232096", "0.5193333", "0.51623476", "0.51113135", "0.5104671", "0.5104671", "0.50951856", "0.5093852", "0.5092114", "0.5088513...
0.78746176
0
Sets the linkedin of this StoreProfile.
def linkedin(self, linkedin): self._linkedin = linkedin
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linkedin(self):\n return self._linkedin", "def set_profile(self, profile: str):\n self._profile = profile", "def ssl_profile_id(self, ssl_profile_id):\n\n self._ssl_profile_id = ssl_profile_id", "def bank_link_id(self, bank_link_id):\n\n self._bank_link_id = bank_link_id", "...
[ "0.58889306", "0.56160456", "0.53995335", "0.5340398", "0.52321786", "0.50734967", "0.50274986", "0.49676663", "0.4957416", "0.4908219", "0.4908219", "0.48871168", "0.48871168", "0.48871168", "0.48871168", "0.48871168", "0.48276922", "0.47811252", "0.47811252", "0.47811252", ...
0.7773678
0
Returns the model properties as a dict
def to_dict(self): result = {} for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n return self.properties", "def to_dict(self):\n return self.properties", "def get_properties(self):\n return self.properties", "def asdict(self):\n return self._prop_dict", "def json(self):\n rv = {\n prop: getattr(self, prop)\n f...
[ "0.77510405", "0.77510405", "0.7340475", "0.7332751", "0.72966254", "0.7279297", "0.71605986", "0.7158926", "0.7150192", "0.7150192", "0.71295094", "0.7126986", "0.71232593", "0.7108824", "0.7061796", "0.7045647", "0.7031775", "0.7021527", "0.6965974", "0.69579446", "0.689874...
0.0
-1
Returns the string representation of the model
def to_str(self): return pprint.pformat(self.to_dict())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self) -> str:\n # noinspection PyUnresolvedReferences\n opts = self._meta\n if self.name_field:\n result = str(opts.get_field(self.name_field).value_from_object(self))\n else:\n ...
[ "0.85856134", "0.7814518", "0.77898884", "0.7751367", "0.7751367", "0.7712228", "0.76981676", "0.76700574", "0.7651133", "0.7597206", "0.75800353", "0.7568254", "0.7538184", "0.75228703", "0.7515832", "0.7498764", "0.74850684", "0.74850684", "0.7467648", "0.74488163", "0.7442...
0.0
-1
For `print` and `pprint`
def __repr__(self): return self.to_str()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pprint(*args, **kwargs):\n if PRINTING:\n print(*args, **kwargs)", "def print_out():\n pass", "def custom_print(*objects):\n print(*objects, sep=OFS, end=ORS)", "def _print(self, *args):\n return _ida_hexrays.vd_printer_t__print(self, *args)", "def _printable(self):\n ...
[ "0.75577617", "0.73375154", "0.6986672", "0.698475", "0.6944995", "0.692333", "0.6899106", "0.6898902", "0.68146646", "0.6806209", "0.6753795", "0.67497987", "0.6744008", "0.6700308", "0.6691256", "0.6674591", "0.6658083", "0.66091245", "0.6606931", "0.6601862", "0.6563738", ...
0.0
-1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, StoreProfile): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.84568954", "0.83923674", "0.81447554", "0.81407183", "0.81326675", "0.80941343", "0.8092415", "0.8092415", "0.8092415", "0.8085536", "0.8085536", "0.8076502", "0.8076502", "0.8066026" ]
0.0
-1
Find StoreProfile Return single instance of StoreProfile by its ID. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.get_store_profile_by_id(store_profile_id, async=True) >>> result = thread.get()
def get_store_profile_by_id(cls, store_profile_id, **kwargs): kwargs['_return_http_data_only'] = True if kwargs.get('async'): return cls._get_store_profile_by_id_with_http_info(store_profile_id, **kwargs) else: (data) = cls._get_store_profile_by_id_with_http_info(store_pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_store_profile_by_id(cls, store_profile_id, store_profile, **kwargs):\n kwargs['_return_http_data_only'] = True\n if kwargs.get('async'):\n return cls._update_store_profile_by_id_with_http_info(store_profile_id, store_profile, **kwargs)\n else:\n (data) = cls._u...
[ "0.63915527", "0.63843274", "0.6318377", "0.5724052", "0.5701306", "0.54446805", "0.53150785", "0.5143096", "0.4992562", "0.4986166", "0.4973808", "0.4719636", "0.4691104", "0.4680017", "0.4658049", "0.46112853", "0.45759177", "0.44076565", "0.44049278", "0.4393338", "0.42727...
0.8730352
0
Find StoreProfile Return single instance of StoreProfile by its ID. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.get_store_profile_by_id_with_http_info(store_profile_id, async=True) >>> result = thread.get()
def _get_store_profile_by_id_with_http_info(cls, store_profile_id, **kwargs): all_params = ['store_profile_id'] all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') query_param...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_store_profile_by_id(cls, store_profile_id, **kwargs):\n kwargs['_return_http_data_only'] = True\n if kwargs.get('async'):\n return cls._get_store_profile_by_id_with_http_info(store_profile_id, **kwargs)\n else:\n (data) = cls._get_store_profile_by_id_with_http_inf...
[ "0.7816626", "0.64097476", "0.6147514", "0.6006541", "0.59723264", "0.53484225", "0.5099231", "0.5085659", "0.47771797", "0.46476695", "0.46338823", "0.44602963", "0.4456509", "0.44503453", "0.44325805", "0.4348327", "0.42658782", "0.42495495", "0.4229194", "0.419231", "0.417...
0.6877337
1
Replace StoreProfile Replace all attributes of StoreProfile This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.replace_store_profile_by_id(store_profile_id, store_profile, async=True) >>> result = thread.get()
def replace_store_profile_by_id(cls, store_profile_id, store_profile, **kwargs): kwargs['_return_http_data_only'] = True if kwargs.get('async'): return cls._replace_store_profile_by_id_with_http_info(store_profile_id, store_profile, **kwargs) else: (data) = cls._replace_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_store_profile_by_id(cls, store_profile_id, store_profile, **kwargs):\n kwargs['_return_http_data_only'] = True\n if kwargs.get('async'):\n return cls._update_store_profile_by_id_with_http_info(store_profile_id, store_profile, **kwargs)\n else:\n (data) = cls._u...
[ "0.6885914", "0.67330694", "0.58773977", "0.52470475", "0.48954603", "0.48951447", "0.46389085", "0.46356404", "0.4261312", "0.42433482", "0.4155907", "0.41291982", "0.4085003", "0.40291345", "0.40245122", "0.3992258", "0.3954855", "0.39477804", "0.39375296", "0.39363688", "0...
0.90080243
0
Replace StoreProfile Replace all attributes of StoreProfile This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.replace_store_profile_by_id_with_http_info(store_profile_id, store_profile, async=True) >>> result = thread.get()
def _replace_store_profile_by_id_with_http_info(cls, store_profile_id, store_profile, **kwargs): all_params = ['store_profile_id', 'store_profile'] all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_store_profile_by_id(cls, store_profile_id, store_profile, **kwargs):\n kwargs['_return_http_data_only'] = True\n if kwargs.get('async'):\n return cls._replace_store_profile_by_id_with_http_info(store_profile_id, store_profile, **kwargs)\n else:\n (data) = cls....
[ "0.8170745", "0.68115836", "0.63280797", "0.5807022", "0.5075471", "0.48232785", "0.47805983", "0.46873397", "0.4332378", "0.4276011", "0.42586622", "0.4145666", "0.41445535", "0.40397325", "0.40256742", "0.3964165", "0.39558113", "0.39429614", "0.39224705", "0.38937378", "0....
0.75694054
1
Update StoreProfile Update attributes of StoreProfile This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.update_store_profile_by_id(store_profile_id, store_profile, async=True) >>> result = thread.get()
def update_store_profile_by_id(cls, store_profile_id, store_profile, **kwargs): kwargs['_return_http_data_only'] = True if kwargs.get('async'): return cls._update_store_profile_by_id_with_http_info(store_profile_id, store_profile, **kwargs) else: (data) = cls._update_stor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_store_profile_by_id(cls, store_profile_id, store_profile, **kwargs):\n kwargs['_return_http_data_only'] = True\n if kwargs.get('async'):\n return cls._replace_store_profile_by_id_with_http_info(store_profile_id, store_profile, **kwargs)\n else:\n (data) = cls....
[ "0.7230002", "0.6507754", "0.6222082", "0.5933953", "0.57766426", "0.5688438", "0.5120334", "0.50300246", "0.4894006", "0.48243746", "0.4710169", "0.45956504", "0.44562137", "0.44239208", "0.43874782", "0.436339", "0.43628344", "0.43378687", "0.43211722", "0.4285686", "0.4280...
0.9047932
0
Update StoreProfile Update attributes of StoreProfile This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.update_store_profile_by_id_with_http_info(store_profile_id, store_profile, async=True) >>> result = thread.get()
def _update_store_profile_by_id_with_http_info(cls, store_profile_id, store_profile, **kwargs): all_params = ['store_profile_id', 'store_profile'] all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_req...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_store_profile_by_id(cls, store_profile_id, store_profile, **kwargs):\n kwargs['_return_http_data_only'] = True\n if kwargs.get('async'):\n return cls._update_store_profile_by_id_with_http_info(store_profile_id, store_profile, **kwargs)\n else:\n (data) = cls._u...
[ "0.7928884", "0.67196536", "0.6655126", "0.55981606", "0.5541704", "0.53547645", "0.52973676", "0.51050305", "0.5037265", "0.5022932", "0.49508855", "0.45662946", "0.44526258", "0.4443034", "0.44325635", "0.43953535", "0.43644917", "0.42962268", "0.4286784", "0.426136", "0.42...
0.722869
1
Get all movies route
def get_movies(jwt): movies = Movie.query.all() return jsonify({ 'success': True, 'movies': [movie.format() for movie in movies], }), 200
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_movies(request):\n if request.method == 'GET':\n movies = Movie.objects.order_by('name')\n serializer = MovieSerializer(movies, many=True)\n return Response(serializer.data)", "def movie_videos(request, pk):\n if request.method == 'GET':\n videos_list = MovieVideos.objec...
[ "0.7742146", "0.7230303", "0.7064236", "0.6997405", "0.6962273", "0.69121444", "0.68483716", "0.6779101", "0.6698465", "0.6678601", "0.6657824", "0.66232103", "0.6595847", "0.6585631", "0.6572597", "0.6547498", "0.6511486", "0.64866924", "0.642735", "0.6354116", "0.63046557",...
0.72856766
1
Delete a movie route
def delete_movie(jwt, id): movie = Movie.query.get(id) if movie is None: abort(404) try: movie.delete() return jsonify({ 'success': True, 'movie': movie.format() }) except Exception: db.session.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_movie():\n id = request.params.get('id')\n mongo_mgr.remove_film_from_user(id, aaa.current_user.id)", "def delete(movie_id):\n # Get the movie requested\n movie = Movie.query.filter(Movie.movie_id == movie_id).one_or_none()\n\n if movie is not None:\n db.session.delete(movie)\n ...
[ "0.7260056", "0.709274", "0.69803184", "0.6904613", "0.6852933", "0.68357", "0.67031413", "0.6664916", "0.6658868", "0.6561526", "0.6529412", "0.6449366", "0.6430928", "0.63980275", "0.6344401", "0.6318153", "0.6313243", "0.6305587", "0.62727016", "0.62486285", "0.6244405", ...
0.6903512
4
Initializies a fish txn
def __init__(self, guid=str(uuid.uuid4()), speciesId=Species, caughtLat=0, caughtLong=0, consumption=Consumption): self.guid = guid self.speciesId = speciesId self.caughtLat = caughtLat self.caughtLong = caughtLong self.consumption = consumption
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_init_txn(txn_id: int, obj_list: List[DBObject]) -> Transaction:\n ops: List[Operation] = [\n Operation(Operation.Type.SET_ISOLATION, isolation_level=\"serializable\"),\n Operation(Operation.Type.BEGIN),\n ]\n for obj in obj_list:\n ops.append(Operation(...
[ "0.67724586", "0.60533", "0.59476703", "0.591012", "0.58926576", "0.5855534", "0.5810235", "0.58037305", "0.57931745", "0.57596964", "0.5751396", "0.5724733", "0.5712768", "0.56691617", "0.56058145", "0.55534434", "0.5549239", "0.55250436", "0.54997325", "0.54996955", "0.5491...
0.0
-1
Function to simulate a match. Default is bestof3 (bo=3.0).
def simulate_match(match_id, bo=3.0) -> None: match = Match.query.filter_by(id=match_id).first() team1_players = get_players(match.team1_id) team2_players = get_players(match.team2_id) team1_stats = get_team_stats(team1_players) team2_stats = get_team_stats(team2_players) print(f"{team1_stat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_best_match(fpl_teams: List[str], team: str) -> Tuple[str, int]:\n best_ratio = 0.0\n best_match = None\n for t in fpl_teams:\n if fuzz.partial_ratio(t, team) > best_ratio:\n best_ratio = fuzz.partial_ratio(t, team)\n best_match = t\n print(f\"Best match {best_match...
[ "0.60931844", "0.589409", "0.5861468", "0.5861468", "0.5857502", "0.58077043", "0.57967186", "0.57451254", "0.5688954", "0.5674925", "0.56129646", "0.55973643", "0.556644", "0.5498064", "0.5433851", "0.5433238", "0.54306746", "0.54222906", "0.5384293", "0.53633946", "0.536205...
0.5627846
10
Get all players of selected team
def get_players(team_id: int) -> list[Player]: players = Player.query.filter_by(team_id=team_id).order_by(Player.position.asc()).all() return players
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def players(self):\n return Player.objects.filter(team=self)", "def get_queryset(self):\n team = get_object_or_404(models.Team, pk=self.kwargs.get('pk'))\n\n return team.players.all()", "def find_players_for_team(self, team, src='roster', season=None):\n # creating class wide variab...
[ "0.8154742", "0.81417346", "0.74465084", "0.7443704", "0.74062914", "0.7386604", "0.73597777", "0.7359635", "0.73586553", "0.7317149", "0.7243132", "0.7095316", "0.70782214", "0.7025894", "0.69796264", "0.69472075", "0.68935966", "0.68594855", "0.68502784", "0.6816583", "0.67...
0.75472665
2
Calculate total stats of the team.
def get_team_stats(players: list[Player]) -> dict[int]: team_stats = {} total_reaction = 0 total_mechanical_skill = 0 total_tactical_skill = 0 total_game_knowledge = 0 total_xp = 0 for player in players: total_reaction += player.reaction total_mechanical_skill += player.me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_stats(self):\n if self.stats is not None:\n return\n self.stats = np.zeros(STEPS_MAX + 1)\n for m in self.missions:\n m.compute_stats()\n self.stats += 100 * m.stats\n self.stats /= len(self.missions)", "def calculate_stats(team_id, current...
[ "0.6866724", "0.6516617", "0.6500267", "0.6473973", "0.6449329", "0.6411839", "0.6410906", "0.63989806", "0.63727915", "0.632475", "0.6292756", "0.62803626", "0.6275075", "0.6271541", "0.625797", "0.62562364", "0.6236313", "0.62358105", "0.6187147", "0.6176917", "0.6176071", ...
0.6613851
1
Calculate effective stats. Return sum of ("randomized") total stats.
def get_effective_team_stats(team_stats: dict) -> int: # TODO: Problem effective stats <-> value # value = int((reaction * 0.5 + technical_skill * 1.5 + tactical_skill * 1.5 + game_knowledge) * xp) stats_sum = 0 for value in team_stats.values(): stats_sum += value * random.uniform(0.5, 1.5) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_stats(self):\n if self.stats is not None:\n return\n self.stats = np.zeros(STEPS_MAX + 1)\n for m in self.missions:\n m.compute_stats()\n self.stats += 100 * m.stats\n self.stats /= len(self.missions)", "def advancedStats():", "def theore...
[ "0.65244913", "0.6386114", "0.6129381", "0.610131", "0.6085135", "0.60286623", "0.6028354", "0.5958826", "0.5949397", "0.5928458", "0.58879834", "0.58813953", "0.5875047", "0.5824438", "0.5799078", "0.5780108", "0.576829", "0.5763093", "0.5756476", "0.5743684", "0.5735743", ...
0.68073934
0
mol > SMARTS matching the Rgroup 'mol' contain a single wildcard atom ("") with one single bond to the rest of the Rgroup. The molecule will be modified. Pass in a copy if you do not want the modification.
def rgroup_mol_to_smarts(mol): wildcard_idx = -1 suffixes = [] n = len(Chem.GetMolFrags(mol)) if n > 1: raise ValueError("more than one fragment found") # Could also check for n == 0. Decided to leave that # for the check for no wildcard atom. for idx, atom in enumerate(mol.Ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_smarts(prefix, atom_idxs):\n\n offmol = Molecule.from_file(prefix + '.mol2')\n fix_carboxylate_bond_orders(offmol)\n remove_charge_and_bond_order_from_guanidinium(offmol)\n remove_charge_and_bond_order_from_imidazole(offmol)\n if prefix in prefix2pmd_struct:\n pmd_struct = prefix2pmd_struct[prefix]...
[ "0.57086635", "0.53255963", "0.52779776", "0.52594936", "0.5152631", "0.51259947", "0.51239645", "0.5014598", "0.5004343", "0.4995221", "0.49575746", "0.49478635", "0.4945811", "0.49111938", "0.49016553", "0.48735607", "0.48373216", "0.48363814", "0.4813805", "0.4777415", "0....
0.70200217
0
Get config and setup loggings.
def __init__(self): self.config = config.setup() self.log = logging.getLogger(__name__) #This block gets interface and interface type from config file self._lookupInterfaces() #And this one does the same for disks. self._lookupDisks() self.search_headers = self.co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setup_logging(self):\n if self.app_config_has(\"logging\"):\n log_config = self.app_config()[\"logging\"]\n filename_list = [\n v['filename'] for k, v in\n _find_config_tree(log_config, \"filename\")\n ]\n # pre-create directory ...
[ "0.7607648", "0.7588957", "0.75570923", "0.7547118", "0.74819624", "0.7454039", "0.7398106", "0.73862493", "0.737794", "0.7348632", "0.73138654", "0.72121304", "0.7185064", "0.7152719", "0.71460485", "0.6936869", "0.69306505", "0.69051725", "0.6895435", "0.6892809", "0.688080...
0.0
-1
Define a new VM and add to hypervisor's store (does not start).
def create(self, vm_name, vm_uuid, vm_mem, vm_cpu, vm_family, vm_storage_layout, vm_network_layout, vm_install=False, vm_disks=None, vm_interfaces=None): try: vm_name = common.validate_hostname(vm_name) vm_cpu = common.validate_cpu(vm_cpu) vm_mem = common.valid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vm_define(vm_hostname):\n\n vm_dataset_obj = Query({'hostname': vm_hostname}, VM_ATTRIBUTES).get()\n hv = Hypervisor(vm_dataset_obj['hypervisor'])\n vm = VM(vm_dataset_obj, hv)\n\n hv.define_vm(vm)\n vm.start()\n\n log.info('VM {} defined and booted on {}'.format(\n vm_hostname, vm_dat...
[ "0.72462046", "0.7084012", "0.69555926", "0.69184834", "0.6790503", "0.6762119", "0.674548", "0.6679661", "0.6475049", "0.6424034", "0.6388372", "0.63595206", "0.6341347", "0.63302255", "0.63032603", "0.6279953", "0.6267465", "0.6252254", "0.618644", "0.61360556", "0.61345094...
0.57859725
38
get info on virtual machine(s)
def get(self, vm_name=None): data = [] #if no vm name get all if vm_name == None: #get list of all inactive and active vm_defined_list = self.conn.listDefinedDomains() vm_active_list = self.conn.listDomainsID() #iterate over these lists and get som...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_vm_info(virtual_machine):\n summary = virtual_machine.summary\n print(summary.runtime.host)\n print(\"Name : \", summary.config.name)\n print(\"Template : \", summary.config.template)\n print(\"Path : \", summary.config.vmPathName)\n print(\"Guest : \", summary.config...
[ "0.78250873", "0.7777055", "0.72798175", "0.6973283", "0.6763325", "0.6741461", "0.67388153", "0.6705541", "0.66399944", "0.65303344", "0.64401144", "0.6427855", "0.64228326", "0.64188737", "0.6413726", "0.6398095", "0.6393969", "0.63704747", "0.63703114", "0.6359646", "0.635...
0.65598553
9
Takes a single integer uuid and returns a hypervisor uuid string.
def _format_uuid(self, uuid): uuid_format = self.uuid_format uuid_list=uuid_format.split("-") pad=len(uuid_list[-1]) last_element=uuid.zfill(pad) formatted_uuid=uuid_format.replace(uuid_list[-1], last_element) return formatted_uuid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_uuid():\n\n x = uuid.uuid1()\n return str(x)", "def get_uuid():\n return str(uuid4())", "def uuid(_uuid=uuid4):\n return str(_uuid())", "def _get_uuid():\n return str(uuid.uuid4())", "def get_uuid():\n\n return str(uuid.uuid4())", "def uuid():\n from dallinger.experiment impo...
[ "0.6936618", "0.6669143", "0.6630766", "0.6627001", "0.65930474", "0.6509678", "0.6505401", "0.6468874", "0.6449521", "0.6441322", "0.6419844", "0.6360948", "0.6335129", "0.6232654", "0.62048185", "0.61722976", "0.6160718", "0.61583483", "0.6124891", "0.6112527", "0.6082667",...
0.59507173
39
(1) Load the pretrained model as you want. cf) one needs to check structure of model using 'print(model)' to remove last fc layer from the model. (2) Replace final fc layer (score values from the ImageNet) with new fc layer (image feature). (3) Normalize feature vector.
def __init__(self, embed_size): super(ImgEncoder, self).__init__() model = models.vgg19(pretrained=True) in_features = model.classifier[-1].in_features # input size of feature vector model.classifier = nn.Sequential( *list(model.classifier.children())[:-1]) # remove last ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_feature_extractor(model_spec, device):\n\n model_type = model_spec['name']\n model_weights_fp = model_spec['weights']\n\n if model_type == 'imagenet_swav':\n # or could load from hub model\n # model = torch.hub.load('facebookresearch/swav', 'resnet50')\n\n model = models.resn...
[ "0.6508916", "0.647881", "0.62611306", "0.62576836", "0.62413275", "0.62312806", "0.61876196", "0.61420417", "0.60549223", "0.6035336", "0.5963078", "0.5956212", "0.5878851", "0.58751345", "0.58721024", "0.5851814", "0.58508164", "0.58107203", "0.58000624", "0.579756", "0.578...
0.5883833
12
Extract feature vector from image vector.
def forward(self, image): with torch.no_grad(): img_feature = self.model(image) # [batch_size, vgg16(19)_fc=4096] img_feature = self.fc(img_feature) # [batch_size, embed_size] l2_norm = img_feature.norm(p=2, dim=1, keepdim=True).detach() im...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feature_vector(features, vector):\n clean_features = set(features)\n new_features_vector = featurize(vector,clean_features)\n return new_features_vector", "def get_feature_vector(cc, img, quiet=False):\n savefilename = config.get_classifier_featvect_name(cc.d.images[img]) \n if os.path.isfile(sav...
[ "0.723498", "0.70396745", "0.6905612", "0.6813259", "0.6793178", "0.67845076", "0.67324674", "0.6692512", "0.6624082", "0.65999305", "0.64614755", "0.6454294", "0.639072", "0.63578135", "0.63244885", "0.6235124", "0.6233415", "0.6231634", "0.62276125", "0.6224812", "0.6222247...
0.5971847
35
(1) Load the pretrained model as you want. cf) one needs to check structure of model using 'print(model)' to remove last fc layer from the model. (2) Replace final fc layer (score values from the ImageNet) with new fc layer (image feature). (3) Normalize feature vector.
def __init__(self, embed_size): super(ImgAttentionEncoder, self).__init__() vggnet_feat = models.vgg19(pretrained=True).features modules = list(vggnet_feat.children())[:-2] self.cnn = nn.Sequential(*modules) self.fc = nn.Sequential(nn.Linear(self.cnn[-3].out_channels, embed_size)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_feature_extractor(model_spec, device):\n\n model_type = model_spec['name']\n model_weights_fp = model_spec['weights']\n\n if model_type == 'imagenet_swav':\n # or could load from hub model\n # model = torch.hub.load('facebookresearch/swav', 'resnet50')\n\n model = models.resn...
[ "0.65092003", "0.64794374", "0.62624794", "0.6257945", "0.62417585", "0.623221", "0.61880994", "0.6142489", "0.605473", "0.6035347", "0.59637624", "0.59565693", "0.58833426", "0.587841", "0.5875034", "0.5871775", "0.58518755", "0.585052", "0.5811056", "0.5800574", "0.5797375"...
0.0
-1
Extract feature vector from image vector.
def forward(self, image): with torch.no_grad(): img_feature = self.cnn(image) # [batch_size, vgg16(19)_fc=4096] img_feature = img_feature.view(-1, 512, 196).transpose(1,2) # [batch_size, 196, 512] img_feature = self.fc(img_feature) #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feature_vector(features, vector):\n clean_features = set(features)\n new_features_vector = featurize(vector,clean_features)\n return new_features_vector", "def get_feature_vector(cc, img, quiet=False):\n savefilename = config.get_classifier_featvect_name(cc.d.images[img]) \n if os.path.isfile(sav...
[ "0.7233698", "0.70406526", "0.69059145", "0.68126327", "0.67930293", "0.67834014", "0.67336965", "0.66922224", "0.6623824", "0.66014224", "0.6465457", "0.64553666", "0.6389174", "0.6358477", "0.6324781", "0.6234497", "0.6233336", "0.62327045", "0.62272906", "0.6225994", "0.62...
0.5586595
81
Extract feature vector from image vector.
def forward(self, vi, vq): hi = self.ff_image(vi) hq = self.ff_questions(vq).unsqueeze(dim=1) ha = torch.tanh(hi+hq) if self.dropout: ha = self.dropout(ha) ha = self.ff_attention(ha) pi = torch.softmax(ha, dim=1) self.pi = pi vi_attended = (pi ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feature_vector(features, vector):\n clean_features = set(features)\n new_features_vector = featurize(vector,clean_features)\n return new_features_vector", "def get_feature_vector(cc, img, quiet=False):\n savefilename = config.get_classifier_featvect_name(cc.d.images[img]) \n if os.path.isfile(sav...
[ "0.7233698", "0.70406526", "0.69059145", "0.68126327", "0.67930293", "0.67834014", "0.67336965", "0.66922224", "0.6623824", "0.66014224", "0.6465457", "0.64553666", "0.6389174", "0.6358477", "0.6324781", "0.6234497", "0.6233336", "0.62327045", "0.62272906", "0.6225994", "0.62...
0.0
-1
add keyword and definition
def add(self, keyword, definitions): for x_temp in definitions: self.query(term1='kd',term2=keyword,term3=x_temp.strip(),action='set')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_keyword(x):\n ParsingTmp.keywords.append(x)", "def addkeyword(self, line):\n self.__keywords.append(line)", "def _add_keyword(self, collection_id, name, doc, args):\n argstring = json.dumps(args)\n self.db.execute(\"\"\"\n INSERT INTO keyword_table\n (c...
[ "0.7283657", "0.6951977", "0.6501668", "0.637323", "0.627265", "0.6201769", "0.6195948", "0.6053392", "0.599446", "0.5979317", "0.5978442", "0.5872311", "0.58630645", "0.58427155", "0.58426094", "0.58192027", "0.581771", "0.5801726", "0.5795179", "0.5790755", "0.5788727", "...
0.7007009
1
delete keyword and definitions
def delete(self, keyword, definitions): print(keyword,definitions) if self.query(term1='kd',term2=keyword,action='in'): self.query('kd',term2=keyword,term3=definitions,action='delete')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, keyword, key):", "def clearkeywords(self):\n self._kw = []", "def __delete__(self):\n pass", "def __del__( self ):\n self.suggest = None", "def __delitem__(name):", "def delete_keyword(self,\r\n index,\r\n keywords):\r\n\r\...
[ "0.74702096", "0.7002308", "0.65803707", "0.6457464", "0.6437793", "0.63251454", "0.63163745", "0.6285149", "0.62682515", "0.6161684", "0.6147692", "0.6125022", "0.6120671", "0.61187184", "0.6075958", "0.6071208", "0.6052744", "0.60449016", "0.6044379", "0.60272896", "0.60027...
0.6997695
2
load in a list of keyword defintions. Take note that the load function is shared by Key_Definitions and Abbreviate, which allows instantiations of both classes to be passed into the defauly_from_notes class, which is used to store default values as notes!
def load(self, entrylist): for l_temp in entrylist: l_temp = l_temp.lstrip(UNDERLINE) l_temp = l_temp.strip() deleting = False if l_temp[0] == TILDA: l_temp = l_temp[1:] deleting = True key, definitions =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setKeys():\n keywords['c++'] = {}\n with open('cppkeywords.txt', 'r') as f:\n for i in f:\n i = i.strip('\\n')\n words = map(str, i.split())\n key = words[0]\n words.pop(0)\n keywords['c++'][key] = list(words)\n for j in words:\n ...
[ "0.6430218", "0.6349492", "0.61182344", "0.5958178", "0.59183687", "0.58844674", "0.58372104", "0.5812766", "0.56749487", "0.5655142", "0.55723095", "0.55625", "0.55394584", "0.54954296", "0.5452131", "0.54218405", "0.5420313", "0.5389519", "0.53589875", "0.5347116", "0.53359...
0.5500482
13
opens up console for adding and deleting
def console(self): go_on = True while go_on: console = DisplayList([self.headings.ADD_MENU, self.headings.DELETE_MENU, self.headings.SHOW_MENU, self.headings.CLEAR_MENU, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():"...
[ "0.68789744", "0.68789744", "0.68789744", "0.68789744", "0.68789744", "0.68789744", "0.68789744", "0.68789744", "0.68789744", "0.68789744", "0.68789744", "0.68789744", "0.68789744", "0.68789744", "0.68789744", "0.68789744", "0.68789744", "0.68789744", "0.68789744", "0.68789744"...
0.63786864
72
The option to pass in a single castable object allows the caller to pass in a generic parameters object.
def _clean_outlets(self, outlets): if type(outlets) not in (ListType, TupleType): try: outlets = [int(outlets)] except ValueError as error: self.logger.error(error) raise FaucetteError("Invalid Identifier: {0}".format(outlets)) else...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_typed_arg_value(self, given_value, param_def, strict):\n param_type = param_def[\"type\"]\n if isinstance(given_value, unicode):\n # Convert all unicode to str in UTF-8\n given_value = given_value.encode(\"utf8\") # Make all unicode into str\n\n if isinstance(gi...
[ "0.6160036", "0.6059971", "0.5989422", "0.56647456", "0.56622344", "0.5628297", "0.5623227", "0.55747044", "0.5546357", "0.55175835", "0.5489792", "0.54616684", "0.5440036", "0.54196477", "0.5373999", "0.53366464", "0.5326163", "0.53133523", "0.52979803", "0.527979", "0.52731...
0.0
-1
For each id in outlets, turn on the given outlet Turns off all outlets not in outlets.
def run(self, outlets): self.logger.info("Turning on Power Outlet(s): {0}".format(outlets)) outlets = self._clean_outlets(outlets) try: self.naxxx.turn_on_switches(outlets, turn_others_off=True) except (TypeError, timeout) as error: self.logger.error(error) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_off_outlets(self, outlets):\n raise NotImplementedError(\"Base class: cannot be called directly\")", "def turn_off_outlets(self, outlets):\n self.on_all()\n expect_outlets = [\"1\" if str(i) in outlets else \"0\" for i in range(1, 9)]\n self._set_status(\"off\", \"\".join(exp...
[ "0.747731", "0.7348738", "0.7257707", "0.6781844", "0.65884185", "0.6149306", "0.61180854", "0.5572101", "0.5465428", "0.5424018", "0.539571", "0.51904845", "0.5188841", "0.5187099", "0.5186177", "0.5049095", "0.5015085", "0.50117457", "0.5009249", "0.49960807", "0.49933535",...
0.5346153
11
turns on parameters.naxxx.identifier (this is backwards, maybe I'll fix it)
def __call__(self, parameters): self.run(parameters.naxxx.parameters.identifier) return parameters.naxxx.parameters.switch
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_identifier(self):", "def identifier(self):", "def eidr_identifier(title):\n pass", "def get_NID():\n return NID", "def _identifier_suffix(self):\r\n return ''", "def id_func(param):\n if isinstance(param, dict) and \":name:\" in param:\n return param[\":name:\"]\n\n retv...
[ "0.60412794", "0.6016335", "0.5777312", "0.5477473", "0.541173", "0.53217673", "0.53217673", "0.53215224", "0.5260008", "0.5200848", "0.5200848", "0.5200848", "0.5158552", "0.5158552", "0.5158552", "0.5158552", "0.5158552", "0.513342", "0.51062983", "0.51062983", "0.50932395"...
0.49023545
34
Method to create article
def create(): form = ArticleForm(request.form) # Check request method and validate form if request.method == 'POST' and form.validate(): data = {} data['article_id'] = uuid.uuid4().hex data['title'] = form.title.data data['description'] = form.description.data ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_article(self):\n user = self.create_a_user()\n article = Article.objects.create(\n title=self.title,\n description=self.description,\n body=self.body, author=user.profile)\n article.save()\n return article", "def create(self, request, *args,...
[ "0.78544533", "0.78266454", "0.77324504", "0.75673413", "0.7447276", "0.74091214", "0.7299027", "0.7261779", "0.71751803", "0.7134457", "0.7070301", "0.69083244", "0.6894355", "0.68876684", "0.67777807", "0.66050875", "0.6600249", "0.65917283", "0.6536983", "0.6536484", "0.64...
0.74157333
5
Method to edit article
def edit(article_id): response = table.get_item( Key={'article_id': article_id} ) data = response.get('Item') if data is None: flash('Unable to get Article') return redirect(url_for('article.list')) form = ArticleForm(title=data.get('title'), description=data....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_article(article_id):\n \n if 'username' in session: \n article = mongo.db.articles.find_one_or_404(\n {'_id': ObjectId(article_id)})\n form=BlogForm()\n form.title.data = article['title']\n form.content.data = article['content']\n return render_template(...
[ "0.76601505", "0.75712985", "0.7510601", "0.73624593", "0.72984743", "0.72970414", "0.7139743", "0.7122538", "0.6966379", "0.6927488", "0.6715361", "0.6619541", "0.6610386", "0.6589296", "0.6546817", "0.65229577", "0.6499349", "0.6493403", "0.64138454", "0.6377686", "0.635768...
0.7569876
2
Method to delete articles
def delete(article_id): response = table.get_item( Key={'article_id': article_id} ) data = response.get('Item') if data is None: flash('Unable to get Article') return redirect(url_for('article.list')) # Delete article for a particular id response = tabl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, request, slug=None, **kwargs):\n article_delete = self.get_object()\n article_delete.delete()\n return Response({\"message\": {\"Article was deleted successful\"}},\n status.HTTP_200_OK)", "def delete_article(request):\n try:\n articles = req...
[ "0.76918834", "0.7601677", "0.70637554", "0.70417756", "0.7014008", "0.69774073", "0.69435436", "0.69435436", "0.6910365", "0.6821638", "0.68169576", "0.6725997", "0.67074484", "0.6696825", "0.66846013", "0.6676643", "0.6666631", "0.66332805", "0.66320467", "0.6517449", "0.65...
0.7504216
2
Method to list articles
def list(): articles = [] if request.method == 'GET': # Get all articles response = table.scan() articles = response.get('Items') return render_template('article/articles.html', articles=articles, title='List Articles')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_articles():\n\n return template(\"index\", articles=get_articles())", "def list(request):\n assert isinstance(request, HttpRequest)\n login = request.user and request.user.is_authenticated()\n article_list = get_article_list('-released_at',login)\n page_no = request.GET.ge...
[ "0.81339246", "0.77708673", "0.77106726", "0.7600298", "0.7563043", "0.74696064", "0.7430495", "0.7395493", "0.7299747", "0.7248591", "0.71522486", "0.71458757", "0.7080076", "0.7039615", "0.70225227", "0.69767743", "0.6974272", "0.69250077", "0.68745464", "0.6824897", "0.674...
0.8311782
0
using std to sample
def _reparameterized_sample(self, mean, std): eps = torch.zeros(std.size(), device=self.device, dtype=torch.float32).normal_() eps = eps.requires_grad_() return eps.mul(std).add_(mean)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample(self, x):", "def sample(self):\r\n raise NotImplementedError", "def sample(self):", "def sample(self):\n raise NotImplementedError", "def sample(self):\n raise NotImplementedError", "def easy_sample(self, num, **kwargs):\n return self.preprocess(self.sample(num, **kwargs), ...
[ "0.72181743", "0.72121453", "0.7129097", "0.7029962", "0.7029962", "0.7025113", "0.6988181", "0.67338353", "0.6712279", "0.6660627", "0.6658523", "0.6655808", "0.6618941", "0.661355", "0.6567642", "0.6535041", "0.6529886", "0.65227395", "0.64837104", "0.6480157", "0.6434616",...
0.0
-1
Using std to compute KLD
def _kld_gauss(self, mean_1, std_1, mean_2, std_2): kld_element = (2 * torch.log(std_2) - 2 * torch.log(std_1) + (std_1.pow(2) + (mean_1 - mean_2).pow(2)) / std_2.pow(2) - 1) return 0.5 * torch.sum(kld_element)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MyKLD(X,Y): \n mu1,mu2 = tuple(np.mean(X,axis=0))\n sigma1,sigma2 = tuple(np.std(X,axis=0))\n m1,m2 = tuple(np.mean(X,axis=0))\n s1,s2 = tuple(np.std(X,axis=0))\n rho = np.corrcoef(X,rowvar=False)[0,1]\n r = np.corrcoef(Y,rowvar=False)[0,1]\n \n return (\n ((mu1-m1)**2/s1**2 - 2*r...
[ "0.65608275", "0.6495427", "0.6388361", "0.6362294", "0.6353022", "0.62305105", "0.6116456", "0.603199", "0.5952262", "0.5912953", "0.59015536", "0.5883916", "0.58513033", "0.5816932", "0.5816932", "0.5814648", "0.58139706", "0.58111626", "0.57957405", "0.5779569", "0.5765859...
0.68209976
0
Defines the method of backing up a given source directory to a given destination directory. This can be cloud storage, or local storage. Extend as needed.
def backup_directory(self, source_directory, destination_directory): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload(self, source, dest):\n if os.path.isdir(source):\n self.upload_dir(source, dest)\n else:\n self.upload_file(source, dest)", "def __init__(self, source, destination, to_exclude=None, backup_mode=False):\n self.source_path = Path(source)\n if not self.so...
[ "0.59127825", "0.56023175", "0.55130535", "0.54906297", "0.5483752", "0.5462733", "0.5449736", "0.5394394", "0.5329382", "0.5312164", "0.5284632", "0.5262213", "0.522391", "0.5159552", "0.51097876", "0.50974935", "0.50910157", "0.50833803", "0.50830215", "0.5079891", "0.50763...
0.76584774
0
Adjust from "C010104J" to "010104J"
def adjust_event_name(event_name): pos=find_first_digit(event_name) return event_name[pos:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_code(code):\n if len(str(code)) == 9:\n code = str(0) + str(code)\n else:\n code = str(code)\n return code", "def convert_to_3digit_icd9(dx_str):\n\n if dx_str.startswith(\"E\"):\n if len(dx_str) > 4:\n return dx_str[:4]\n else:\n ...
[ "0.58788437", "0.5662549", "0.55500376", "0.552887", "0.55143815", "0.55123943", "0.55109835", "0.5373359", "0.5364813", "0.5359949", "0.5359568", "0.535121", "0.53482306", "0.53471386", "0.534095", "0.5340377", "0.5333102", "0.5330964", "0.5299675", "0.5296796", "0.5288481",...
0.0
-1
Create model from json.
def from_json(recipe_item_json): return RecipeItem( recipe_item_json.get('hash', None), recipe_item_json.get('uid', None) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_json(data: Dict[str, Any]) -> 'ModelData':\n return ModelData(data.get(\"name\"),\n data.get(\"type\"),\n data.get(\"value\"),\n data.get(\"units\"))", "def from_json(cls, factory, json_data):\n data = deepcopy(json_da...
[ "0.7584196", "0.7180405", "0.7118459", "0.710242", "0.7052127", "0.70423496", "0.7041804", "0.6896937", "0.6863662", "0.6847984", "0.6832809", "0.68271583", "0.6817734", "0.68111944", "0.6752456", "0.6734141", "0.6680335", "0.6679268", "0.6679268", "0.6672973", "0.66457385", ...
0.0
-1
Nothing to link to.
async def link_to(self, *args): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def none(self):", "def nothing(self, **kwargs):\n pass", "def untargeted(self):\n\t\tpass", "def nothing():\n pass", "def getLink(self):", "def remove_link():", "def _nothing(): # pylint: disable=useless-return\n logger.debug(\"Popping Nothing browser\")\n return", "def test_...
[ "0.67356193", "0.6638476", "0.66160876", "0.6379988", "0.630224", "0.6239193", "0.6184818", "0.598639", "0.5937633", "0.59231615", "0.58695924", "0.58492273", "0.5845607", "0.57870734", "0.5763318", "0.5756482", "0.5728031", "0.56960976", "0.5669017", "0.56675535", "0.5667553...
0.59181815
10
Get a generator for the sentiment140 dataset
def read_sentiment140(sentiment140Path = "/data/sentiment140/sentiment140.csv"): senti140Cache = join(cacheDir, "sentiment140.json") # create cached file if necessary if not exists(senti140Cache): ensureCache() # request path to file if necessary if not sentiment140Path: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_datset_train_tokenization(dataset,tokenizer,tokenizer_trainer,batch_size : int):\n def make_batch_iter(dataset):\n for i in range(0, len(dataset), batch_size):\n yield dataset[i : i + batch_size][\"code\"]\n tokenizer.train_from_iterator(make_batch_iter(), trainer=tokenizer_trainer...
[ "0.579957", "0.5767048", "0.566364", "0.5578555", "0.55195534", "0.55175805", "0.5503977", "0.548946", "0.5487189", "0.5425907", "0.5422613", "0.54139125", "0.5405894", "0.5393405", "0.537747", "0.536713", "0.53608227", "0.53551483", "0.53534335", "0.5350869", "0.53487885", ...
0.5752471
2
This is a product detail page
def parse_product(self, resp): loader = ItemLoader(item=EstateProperty(), response=resp) loader.add_value("url", resp.request.url) # for the standard fields, extraction is straight forward for field, xpath in list(self.standard_fields.items()): loader.add_xpath(field, xpath)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product_detail(request, product_id):\n product = get_object_or_404(Product, pk=product_id)\n\n context = {\n 'product': product,\n }\n\n return render(request, 'products/product_detail.html', context)", "def product_detail(request, product_id):\n product = get_object_or_404(Product, pk=...
[ "0.7995133", "0.799367", "0.79175687", "0.7891754", "0.78548807", "0.7840161", "0.777783", "0.74206805", "0.73896027", "0.7324561", "0.7230787", "0.7154684", "0.71281475", "0.7088942", "0.7077914", "0.6984795", "0.6962265", "0.6950258", "0.69489735", "0.6927835", "0.6794354",...
0.0
-1
traverse all items of the site map page, and jump to each universe
def parse(self, r): blocs = r.xpath("//article[@itemtype='https://schema.org/Product']//a/@href").extract() if blocs: for product_sheet_link in blocs: next_page = r.urljoin(f"http://qazaimmobilier.la-boite-immo.com{product_sheet_link}") yield scrapy.Request(ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _navigate_by_xpath(self):\n for path in self.xpath_map:\n for _ in range(3):\n try:\n element = self._safe_load_by_xpath(path)\n except TimeoutException:\n continue\n try:\n element.click()\n...
[ "0.5625968", "0.5555737", "0.5463182", "0.53743976", "0.5298413", "0.5246444", "0.5235991", "0.5219882", "0.51956594", "0.51549697", "0.5124449", "0.5116654", "0.5095035", "0.5090441", "0.50755215", "0.50367707", "0.50259906", "0.50226104", "0.49552536", "0.49424377", "0.4941...
0.0
-1
Add an item to the end of the list
def enqueue(self, item): self._data.append(item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append(self, item):\n self.update([item])", "def push(self, item):\n self.list.prepend(item)", "def append(self, item):\n self.items.append(item)", "def append(self, item):\n if self.full or self.pre_allocated:\n # overwrite\n self.data[self.cur] = item\n...
[ "0.77532566", "0.76214004", "0.76042455", "0.75483656", "0.7540327", "0.73940676", "0.73794615", "0.7314427", "0.73064935", "0.7303679", "0.7299703", "0.7291256", "0.7217318", "0.72149986", "0.7205079", "0.7200797", "0.71670574", "0.7160828", "0.71586007", "0.7157405", "0.715...
0.0
-1
Remove an item from the front of the queue
def dequeue(self): return self._data.pop(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, index):\n if index < 0 or index >= len(self):\n raise AttributeError(\"i must be >= 0 and < size of queue\")\n if index == 0:\n oldItem = self._front.data\n self._front = self._front.next\n else:\n probe = self._front\n wh...
[ "0.7815219", "0.76872534", "0.74000555", "0.7393507", "0.7384512", "0.7374035", "0.7322571", "0.72559536", "0.7239803", "0.72386444", "0.72248185", "0.7208291", "0.7184179", "0.7180836", "0.7114184", "0.70383704", "0.7013562", "0.70062613", "0.69631684", "0.69572324", "0.6944...
0.0
-1
Show the first item in the queue
def peak(self): return self._data[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(self):\n\n if self.front == None:\n print(\"Queue is empty\")\n return\n\n while self.front.next != None:\n print(self.front.data)\n self.front = self.front.next\n\n print(self.front.data)", "def front(self):\n if self.is_empty():\...
[ "0.70929486", "0.6990839", "0.6889084", "0.6791144", "0.67798465", "0.6776689", "0.67238736", "0.6712028", "0.6704928", "0.66911215", "0.66911215", "0.66309386", "0.6600098", "0.6574153", "0.65491384", "0.6539144", "0.6505998", "0.65021825", "0.65021825", "0.64553887", "0.640...
0.0
-1
Is the queue empty?
def is_empty(self): # If the queue is an empty list, self._data would return False # So if the queue is empty we want to return true # modify with not self._data return not self._data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return self.queue == []", "def is_empty(self):\n return len(self.the_queue) == 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return len(self.__queue) > 0", "def ...
[ "0.92403233", "0.9186681", "0.91693956", "0.91693956", "0.914682", "0.9137048", "0.9083102", "0.90663934", "0.9037946", "0.8976355", "0.89380217", "0.8915447", "0.89138514", "0.8908865", "0.8884015", "0.88772047", "0.88772047", "0.88771504", "0.881595", "0.87687516", "0.87408...
0.8465951
26
Evaluate a math expression.
def evaluate(expression: str) -> Any: # Compile the expression try: code = compile(expression, "<string>", "eval") except SyntaxError as e: print(f"The given function is not syntactically correct! Error:\n{e}") return "ERROR" # Validate allowed names for name in code.co_name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluateExpression(expr):\n\toperators = {ast.Add: op.add, ast.Sub: op.sub, ast.Mult: op.mul,\n\t\t\t\t ast.Div: op.truediv, ast.USub: op.neg, ast.Pow: myPow}\n\tnode = ast.parse(expr.strip(), mode='eval')\n\treturn evaluate(node.body,operators)", "async def mathCommand(self, ctx: commands.Context, *, expres...
[ "0.76386607", "0.74728054", "0.738483", "0.7322606", "0.72649604", "0.71900386", "0.7125232", "0.7107985", "0.70723546", "0.693018", "0.690977", "0.6902856", "0.6885781", "0.6881404", "0.6773269", "0.67303216", "0.6716657", "0.6655935", "0.66292024", "0.660734", "0.6581735", ...
0.6952929
9
set enviroment when testing is finished
def tearDown(self): # Empty objects in engine FileStorage._FileStorage__objects = {} # Remove file.json if exists if os.path.exists("file.json"): os.remove("file.json")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n test_env_setup()", "def test_environ() -> None:\n os.environ[\"TEST\"] = \"tester\"\n assert os.getenv(\"TEST\") == \"tester\"", "def SetupEnvironment(self):\n pass", "def set_test_environment():\n import flask_monitoringdashboard\n\n flask_monitoringdashboard.config....
[ "0.7905997", "0.72786754", "0.7244529", "0.7141739", "0.7139373", "0.7108662", "0.7099855", "0.70238376", "0.6955741", "0.6881782", "0.6878592", "0.68440104", "0.6825371", "0.66754454", "0.66534513", "0.66433084", "0.66433084", "0.664163", "0.66227937", "0.6578687", "0.657868...
0.0
-1
Test for help quit command
def test_quit(self): _help = 'Quit method to exit form cmd ' _help += 'program (Usage: quit)\n' with patch('sys.stdout', new=StringIO()) as f: HBNBCommand().onecmd("help quit") self.assertEqual(f.getvalue(), _help)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def help_quit(self):\n print(\"Quit command to exit the program\")", "def test_help_menu(run):\n out, _err = run(dork.cli.help_menu)\n assert 'Help' in out, 'Help wasnt found'", "def test_running_main_asking_for_help(exopy_qtbot):\n try:\n main(['-h'])\n # TODO make sure no window...
[ "0.7975989", "0.7809279", "0.7795099", "0.75589925", "0.7469315", "0.7389906", "0.7254667", "0.71827996", "0.7147187", "0.7124692", "0.71146154", "0.7090947", "0.7077401", "0.7061455", "0.7054729", "0.7033535", "0.70295733", "0.7015609", "0.70015436", "0.6989946", "0.6965797"...
0.78453577
1
Test for help EOF command
def test_EOF(self): _help = 'EOF method to exit cmd program\n' with patch('sys.stdout', new=StringIO()) as f: HBNBCommand().onecmd("help EOF") self.assertEqual(f.getvalue(), _help)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def help_EOF(self):\n print(\"EOF command to exit the program\")", "def test_help():\n p = Popen([\"flake8\", \"-h\"], stdin=DEVNULL, stdout=PIPE)\n out, err = p.communicate()\n\n assert not p.returncode, err\n assert b\" --rst-\" in out, \"rst options should appear in help text\"\n assert ...
[ "0.7814861", "0.6840323", "0.682285", "0.6771325", "0.6691922", "0.66432154", "0.6638987", "0.65848243", "0.65820116", "0.65715337", "0.65700805", "0.6554623", "0.6478868", "0.6476633", "0.6472357", "0.64624023", "0.6448147", "0.6446672", "0.64462125", "0.6438984", "0.6373719...
0.7711327
1
Test for help all command
def test_all(self): _help = "[Usage: all <class name>]or [Usage: all] or "\ "[Usage: <class name>.all()]\n" with patch('sys.stdout', new=StringIO()) as f: HBNBCommand().onecmd("help all") self.assertEqual(f.getvalue(), _help)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_help_all():\n assert HELP.handle_msg(f'{KEY_HELP}', True)\n assert HELP.get_reply() == HELP.all()", "def _help(self):\n self.onecmd('help')", "def help():", "def test_help(self):\n run_nbgrader([\"fetch\", \"--help-all\"])", "def help():\n print(UI.HELP)", "def test_he...
[ "0.8296886", "0.78399265", "0.76488346", "0.75032806", "0.7473458", "0.74622065", "0.7453301", "0.7443302", "0.74311626", "0.74061614", "0.7388418", "0.7367555", "0.7358134", "0.7353398", "0.7353398", "0.7344077", "0.73254955", "0.73254955", "0.73225653", "0.7258732", "0.7248...
0.8111
1
Test for help count command
def test_count(self): _help = "[Usage: <class name>.count()]\n" with patch('sys.stdout', new=StringIO()) as f: HBNBCommand().onecmd("help count") self.assertEqual(f.getvalue(), _help)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def count(self, ctx):\r\n if ctx.invoked_subcommand is None:\r\n await self.bot.send_cmd_help(ctx)", "def test_get_help(self):\r\n subcommands = list(self.testcommand.subparser.choices.keys())\r\n help_message = self.testcommand.get_help()\r\n self.assertEqual(len(sub...
[ "0.75281185", "0.73635864", "0.73583245", "0.69102603", "0.68941146", "0.6889329", "0.68857396", "0.684668", "0.6831447", "0.68222845", "0.6820815", "0.677524", "0.6770784", "0.66523445", "0.65595186", "0.6530274", "0.6493138", "0.6479575", "0.64395267", "0.6424902", "0.64247...
0.7937025
0
Test for help create command
def test_create(self): _help = "[Usage: create <class name>]\n" with patch('sys.stdout', new=StringIO()) as f: HBNBCommand().onecmd("help create") self.assertEqual(f.getvalue(), _help)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def help_create(self):\n print(CREATE)", "def test_createExplicitHelp(self):\n self.assertSuccessStatus(self._makeConfig(None), [\"create\", \"--help\"])\n self.assertSpacelessEqual(self._createHelpText, sys.stdout.getvalue())", "def test_createImplicitHelp(self):\n self.assertSucce...
[ "0.821615", "0.80362326", "0.7831576", "0.73222435", "0.71913487", "0.7164001", "0.7053205", "0.7050169", "0.7048808", "0.69262415", "0.6863194", "0.68171686", "0.67816836", "0.67768836", "0.6774403", "0.67573375", "0.6697847", "0.6696483", "0.6686176", "0.6676658", "0.664191...
0.80459565
1
Test for help EOF command
def test_destroy(self): _help = "[Usage: destroy <class name> <id>] or "\ "[Usage: <class name>.destroy(<id>)]\n" with patch('sys.stdout', new=StringIO()) as f: HBNBCommand().onecmd("help destroy") self.assertEqual(f.getvalue(), _help)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def help_EOF(self):\n print(\"EOF command to exit the program\")", "def test_EOF(self):\n _help = 'EOF method to exit cmd program\\n'\n with patch('sys.stdout', new=StringIO()) as f:\n HBNBCommand().onecmd(\"help EOF\")\n self.assertEqual(f.getvalue(), _help)", "def t...
[ "0.7814861", "0.7711327", "0.6840323", "0.682285", "0.6771325", "0.6691922", "0.66432154", "0.6638987", "0.65848243", "0.65820116", "0.65715337", "0.65700805", "0.6554623", "0.6478868", "0.6476633", "0.6472357", "0.64624023", "0.6448147", "0.6446672", "0.64462125", "0.6438984...
0.5614437
94
Test for help show command
def test_show(self): _help = "[Usage: show <class name> <id>] or "\ "[Usage: <class name>.show(<id>)]\n" with patch('sys.stdout', new=StringIO()) as f: HBNBCommand().onecmd("help show") self.assertEqual(f.getvalue(), _help)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_help():\n pass", "def test_cli_help(self):\n output = self.update_command('-h')", "def test_help(self):\n rc, stdout, _, msg = OIM().request('--help')\n self.assertEqual(rc, 0, \"Bad return code when requesting help\\n%s\" % msg)\n self.assert_(re.search(r'[Uu]sage:', st...
[ "0.8180918", "0.8130957", "0.8068485", "0.79682034", "0.7954869", "0.7911351", "0.78816515", "0.7789425", "0.7738428", "0.7727183", "0.7686819", "0.76671684", "0.7662415", "0.7648457", "0.7632693", "0.76228017", "0.760799", "0.75646275", "0.75377357", "0.7522406", "0.752026",...
0.8166448
1
Test for help update command
def test_update(self): _help = "[Usage: update <class name> <id> <attribute name> "\ '"<attribute value>"] or [Usage: <class name>.update(<id>,'\ "<attribute name>, <attribute value>)]\n" with patch('sys.stdout', new=StringIO()) as f: HBNBCommand().onecmd("hel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def help_command(update: Update) -> None:\n #update.message.reply_text('Help!')", "def test_cli_help(self):\n output = self.update_command('-h')", "def help_command(update: Update, context: CallbackContext) -> None:\n update.message.reply_text(messages.HELP_TEXT)", "def help_command(update, cont...
[ "0.8009928", "0.80061376", "0.78645617", "0.78326833", "0.7810123", "0.77930987", "0.77930987", "0.77930987", "0.77930987", "0.7790812", "0.77864474", "0.77864474", "0.77864474", "0.77864474", "0.77677536", "0.77677536", "0.7711605", "0.7607265", "0.74595445", "0.7458147", "0...
0.8465423
0
Test for help a command that doesnt exist
def test_help(self): _help = "*** No help on hello\n" with patch('sys.stdout', new=StringIO()) as f: HBNBCommand().onecmd("help hello") self.assertEqual(f.getvalue(), _help)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_z_z_func_command_help(self):\n\t\ttheResult = False\n\t\ttry:\n\t\t\ttheOutputtext = checkPythonCommand([getPythonCommand(),\n\t\t\t\tstr(\"code/restart_service.py\"),\n\t\t\t\tstr(\"--help\")\n\t\t\t], stderr=subprocess.STDOUT)\n\t\t\tif (str(\"usage\") in str(theOutputtext)):\n\t\t\t\ttheResult = True\n...
[ "0.7935794", "0.7885288", "0.76955265", "0.7591789", "0.75866014", "0.7574106", "0.7404712", "0.73186", "0.73052967", "0.7287947", "0.7283292", "0.7270635", "0.7253407", "0.72346866", "0.722983", "0.71773964", "0.7169335", "0.716009", "0.7152241", "0.7145454", "0.7129714", ...
0.68756163
42
Test for create command
def test_create(self): with patch('sys.stdout', new=StringIO()) as f: HBNBCommand().onecmd("create") self.assertEqual(f.getvalue().strip(), "** class name missing **") with patch('sys.stdout', new=StringIO()) as f: HBNBCommand().onecmd("create hello") self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create(self):\n pass", "def test_create_run(self):\n pass", "def create():\n pass", "def test_create_get(self):\n self.shell.onecmd(\"create %s/one 'hello'\" % (self.tests_path))\n self.shell.onecmd(\"get %s/one\" % (self.tests_path))\n self.assertEqual(\"hello\...
[ "0.8388714", "0.8212966", "0.76444477", "0.7614718", "0.7576536", "0.75600594", "0.7498102", "0.7442122", "0.7427988", "0.7427988", "0.7267213", "0.720819", "0.72002864", "0.7152349", "0.71347785", "0.7102996", "0.70754933", "0.70478445", "0.70454884", "0.7044487", "0.7013584...
0.67037165
56
Command that does not exist
def test_unknown(self): msg = "*** Unknown syntax: asd\n" with patch('sys.stdout', new=StringIO()) as f: HBNBCommand().onecmd("asd") st = f.getvalue() self.assertEqual(msg, st)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unknown_command(self, cmd, *parms):\n print >>sys.stderr, \"Unknown command '%s'\" % (cmd)", "def test_unknown_command(self):\n\n self.assertRaises(commands.CommandNotFoundError,\n self.commands.run_command,\n '<unknown_command>', '')", "def test_non_existant_com...
[ "0.72393066", "0.71139747", "0.71039575", "0.7085819", "0.6988437", "0.6966232", "0.69556355", "0.69098675", "0.6893541", "0.6660726", "0.66503125", "0.6637588", "0.6583469", "0.6526445", "0.6492791", "0.64878964", "0.64712316", "0.643606", "0.6383709", "0.6372442", "0.633919...
0.0
-1
Set up for every test
def setUpClass(cls): FileStorage._FileStorage__file_path = TestConsole.jsfile_test
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup( self ):", "def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass", "def setUp(self):\n MainTests.setUp(self)", "def setUp(self):\n logging.debug('setting up')", "def setUp(self):\n logging.debug('setting up')", "def setUp(self) :\n ...
[ "0.82234544", "0.8219093", "0.812081", "0.80717546", "0.80717546", "0.8026287", "0.801255", "0.8008916", "0.8005044", "0.8005044", "0.7992284", "0.7992284", "0.7989961", "0.7964557", "0.79610807", "0.795153", "0.7944417", "0.7944417", "0.7944417", "0.7944417", "0.7944417", ...
0.0
-1
tear down method for every test
def tearDown(self): if os.path.isfile(TestConsole.jsfile_test): os.remove(TestConsole.jsfile_test)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def teardown(self):", "def teardown(self):", "def teardown(self):", "def teardown(self) -> None:", "def teardown(self) -> None:", "def teardown(self) -> None:", "def teardown(self):\n pass", "def teardown(self):\n pass", "def teardown(self):\n pass", "def teardown(self):\n ...
[ "0.8533994", "0.8533994", "0.8533994", "0.85234696", "0.85234696", "0.85234696", "0.8471538", "0.8471538", "0.8471538", "0.8232655", "0.8225784", "0.8225784", "0.82098633", "0.82046795", "0.81246233", "0.80925506", "0.80870926", "0.80863076", "0.80781347", "0.80781347", "0.80...
0.0
-1
The Console code is PEP8 conformant?
def test_console_pep8_conformance(self): style = pep8.StyleGuide(quiet=True) result = style.check_files(['console.py']) self.assertEqual(result.total_errors, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exercise_b2_106():\r\n pass", "def exercise_b2_107():\r\n pass", "def exercise_b2_27():\r\n pass", "def exercise_b2_113():\r\n pass", "def test_console_test_pep8_conformance(self):\n pep8style = pep8.StyleGuide(quiet=True)\n result = pep8style.check_files(\n ...
[ "0.63976634", "0.63633114", "0.63586324", "0.6333517", "0.62372625", "0.6214321", "0.6198205", "0.6192162", "0.61512053", "0.6126677", "0.6068211", "0.60681", "0.6059583", "0.6059583", "0.6059583", "0.6059583", "0.60431296", "0.59663385", "0.59333456", "0.59319454", "0.592013...
0.64043087
0
The Console Test code is PEP8 conformant?
def test_console_test_pep8_conformance(self): pep8style = pep8.StyleGuide(quiet=True) result = pep8style.check_files( ['tests/test_console.py']) self.assertEqual(result.total_errors, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_T01():", "def test_4_4_1_1(self):\n pass", "def test_pep8_conformance_unitests(self):\n\n print(\"\\r\\n\")\n\n # Get the path to current directory\n path = os.path.dirname(os.path.realpath(__file__))\n\n self.run_check(path)", "def test_fix_code_typical_code():\r\...
[ "0.7011378", "0.69812995", "0.6958264", "0.6845147", "0.6755974", "0.6752443", "0.6744751", "0.67348087", "0.6713477", "0.6713477", "0.6695414", "0.66454345", "0.6638336", "0.66130424", "0.66130424", "0.65806705", "0.65683943", "0.6547168", "0.6547168", "0.65346116", "0.65265...
0.6901394
3
Console has some documentation?
def test_console_documented(self): self.assertTrue self.assertTrue (len(HBNBCommand.__doc__) >= 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_usage():\n print >> sys.stderr, __doc__", "def usage():\n print(__doc__.strip())", "def help():", "def info():\n print __doc__\n sys.exit(1)", "def help():\n \n pass", "def main():\n system('cls||clear')\n\n #Print a docstring.\n print (main.__doc__)", "def pr...
[ "0.7123195", "0.7117843", "0.7078036", "0.7023829", "0.69797957", "0.69652635", "0.69319", "0.6784893", "0.6784893", "0.676406", "0.6728578", "0.6728533", "0.6728533", "0.6699519", "0.6699519", "0.6619316", "0.661552", "0.661552", "0.6601918", "0.6577686", "0.6577686", "0.6...
0.738676
0
Function for setting up design matrix and target arrays from the data set.
def create_design_matrix(features): onehotencoder = OneHotEncoder(categories='auto') design_matrix = ColumnTransformer( [("", onehotencoder, [2, 3]),], remainder='passthrough' ).fit_transform(features) scaler = StandardScaler(with_mean=False) desi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(self):\n in_dataset, out_dataset = self.get_datasets()\n \n out_dataset[0].create_dataset(in_dataset[0])\n\n in_pData, out_pData = self.get_plugin_datasets()\n\n in_pData[0].plugin_data_setup( '',)\n out_pData[0].plugin_data_setup( 'PROJECTION','multiple')", "def set...
[ "0.63055754", "0.627022", "0.62513274", "0.60941803", "0.5989574", "0.5984991", "0.5984991", "0.5939598", "0.5816822", "0.58061713", "0.57516867", "0.5750045", "0.57417756", "0.5741299", "0.5717026", "0.56837565", "0.56523263", "0.5651874", "0.56468844", "0.5646362", "0.56457...
0.0
-1
Constructor for the class
def __init__(self, stcSeps=r'[\.!\?]', wrdSeps=r'[,\:;\-\s=\(\)\+]'): self._stcSeps = stcSeps self._wrdSeps = wrdSeps self._wordCounter = collections.defaultdict(int) self._totalWords = 0 self._totalSentences = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self) -> None:\n # TODO: Provide the complete constructor for this object", "def __init__(self, **kwds):\n raise NotImplementedError", "def __init__ (self):\n pass", "def __init__ (self) :", "def __init__(self, *args, **kwargs):\n raise NotImplementedError", "def ...
[ "0.8680699", "0.8443078", "0.83839977", "0.8367647", "0.8279727", "0.8221321", "0.82151175", "0.82151175", "0.82151175", "0.82151175", "0.8192266", "0.8192266", "0.81764275", "0.81764275", "0.81764275", "0.81764275", "0.81155384", "0.8103886", "0.8103886", "0.8103886", "0.808...
0.0
-1
returns the total number of words, the number of unique words found and the list of words sorted by frequency.
def getWordStats(self): wordList = [] for key, value in sorted(self._wordCounter.iteritems(), key=itemgetter(1), reverse=True): wordList.append((key, value)) return (self._totalWords, len(self._wordCounter), wordList)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def computeWordsFrequencies(self):\n token_stream = self._tokenize(self.readable)\n token_map = self._countTokens(token_stream)\n # print token_map.items()\n return sorted(token_map.items(), key = lambda x : x[1], reverse = True)", "def word_stats(word_counts):\n num_unique = len(w...
[ "0.82478946", "0.7837993", "0.7692093", "0.76145416", "0.7522109", "0.7475098", "0.74090457", "0.7388512", "0.7319989", "0.7316529", "0.7257525", "0.7250237", "0.72460485", "0.723805", "0.71964103", "0.71629226", "0.71556455", "0.7108204", "0.70809466", "0.7047488", "0.704357...
0.7097937
18
Returns the total number of sentences processed and the average sentence length (in words) of all sentences processed, which is the total number of words divided by the total number of sentences.
def getStcStats(self): return (self._totalSentences, float(self._totalWords) / float(self._totalSentences))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_avg_sentence_length(self):\n sentences = self.blob.sentences\n average_sentence_length = np.mean(np.array([len(sentence.words) for sentence in sentences]))\n return average_sentence_length", "def get_total_sentences(self):\n\t\t\n\t\t# loop through batches and add up all their indivi...
[ "0.8071898", "0.75698644", "0.71527207", "0.71192783", "0.7065193", "0.7056585", "0.70276576", "0.69853246", "0.69765174", "0.69650185", "0.68737763", "0.6854604", "0.68240684", "0.6748946", "0.6707196", "0.66954225", "0.65792274", "0.65066314", "0.6400189", "0.63982564", "0....
0.67006797
15
Analyses an entire sentence, parsing and counting words. Punctuation is ignored.
def anlSentence(self, sentence): cleanStr = re.sub(self._wrdSeps, " ", re.sub(self._stcSeps, "", sentence)) for word in cleanStr.split(): self._wordCounter[word] += 1 self._totalWords += 1 else: self._totalSentences += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_sentence(self, text):\n l = []\n tokens = word_tokenize(text)\n print(tokens)\n skip = 0\n i = -1 # index of token in tokens list\n for token in tokens:\n i += 1\n if skip:\n skip -= 1\n # CORONA TERMS:\n ...
[ "0.70589197", "0.69209796", "0.6828709", "0.6791208", "0.67304224", "0.66707826", "0.6661829", "0.6652238", "0.6629492", "0.66103625", "0.65925443", "0.64734167", "0.6472126", "0.64579594", "0.64431465", "0.6437404", "0.6429816", "0.64242053", "0.6423713", "0.64206934", "0.64...
0.72092193
0
Analyses all the text in inputFile, processing sentences as they are terminated. Returns when finished processing inputFile
def anlText(self, inputFile): strBuf = "" splitter = re.compile(self._stcSeps) for rawLine in inputFile: line = rawLine.replace("\n", "") if (not splitter.search(line)): # Don't have a full sentence yet strBuf += " " + line else: # Found a se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _process_input_file(filename, vocab, stats):\n tf.logging.info(\"Processing input file: %s\", filename)\n processed = []\n\n predecessor = None # Predecessor sentence (list of words).\n current = None # Current sentence (list of words).\n successor = None # Successor sentence (list of words).\n\n for ...
[ "0.65726054", "0.65164816", "0.62853193", "0.62791026", "0.6115081", "0.6024861", "0.60202426", "0.5978504", "0.5953397", "0.59255266", "0.59150344", "0.5895512", "0.58695745", "0.5869046", "0.58022076", "0.57821476", "0.5744696", "0.5698293", "0.5693778", "0.5682117", "0.568...
0.7031776
0
Generate glue code for \c node .
def generate_glue_code(self, node, data, symbol_table): def gen(node): return self.generate_glue_code(node, data, symbol_table) def generate_ext_stub(cls): """ shared code for class/interface """ # Qualified name (C Version) qname = '_'.join(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeCyml(node):\n p = CymlGenerator(node)\n p.visit(node)\n code= ''.join(p.result)\n return code", "def _(self, node: FunctionDef):\n body_nodes = []\n for n in node.body:\n curr_piece = self.visit(n)\n if len(curr_piece) > 0:\n body_nodes.appe...
[ "0.6312741", "0.6188707", "0.6159543", "0.60228896", "0.6012296", "0.58697903", "0.57211494", "0.56055295", "0.5585588", "0.55714947", "0.55676794", "0.5546521", "0.55153173", "0.54783416", "0.54536825", "0.5433122", "0.54280394", "0.54189694", "0.5398492", "0.53685", "0.5346...
0.56549567
7
shared code for class/interface
def generate_ext_stub(cls): # Qualified name (C Version) qname = '_'.join(symbol_table.prefix+[cls.name]) self.exts.append(qname) if self.config.verbose: import sys mod_name = '.'.join(symbol_table.prefix[1:]+[cls.name]) sy...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interfaces(self):", "def interfaces(self):", "def __call__(self):\n raise NotImplementedError", "def common(self):", "def _create_impl(self):", "def __call__(self):\r\n raise NotImplementedError('override me')", "def _build_impl(self):", "def __call__(self):\n raise NotImplem...
[ "0.6923856", "0.6923856", "0.6787956", "0.6781784", "0.67067426", "0.66779804", "0.6674417", "0.665005", "0.65893334", "0.65893334", "0.6560817", "0.6542899", "0.64904106", "0.6462506", "0.63872236", "0.63872236", "0.63872236", "0.63790584", "0.6375192", "0.631152", "0.631152...
0.0
-1
Generate client code for a method interface. \param method sexpression of the method's SIDL declaration \param symbol_table the symbol table of the SIDL file \param ci a ClassInfo object This is currently a noop, since the UPC calling convention is identical to the IOR.
def generate_client_method(self, symbol_table, method, ci, has_impl): (Method, Type, (MName, Name, Extension), Attrs, Args, Except, From, Requires, Ensures, DocComment) = method abstract = member_chk(sidlir.abstract, Attrs) #final = member_chk(sidlir.final, Attrs) static = mem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_server_method(self, symbol_table, method, ci):\n\n def convert_arg((arg, attrs, mode, typ, name)):\n \"\"\"\n Extract name and generate argument conversions\n \"\"\"\n iorname = name\n return iorname, (arg, attrs, mode, typ, name)\n\n\n ...
[ "0.78004867", "0.54117334", "0.52709347", "0.5230398", "0.5158314", "0.51276183", "0.5121379", "0.5015564", "0.5001117", "0.4953076", "0.49037513", "0.48770258", "0.48766863", "0.4863278", "0.48568517", "0.47815692", "0.4779487", "0.47770593", "0.47039717", "0.46978799", "0.4...
0.79929334
0
Chapel Skeleton (clientside Chapel bindings) Generate a Skeleton in Chapel.
def generate_skeleton(self, ci, qname): symbol_table = ci.epv.symbol_table cls = ci.co # Skeleton (in Chapel) self.pkg_chpl_skel.gen(ir.Import('.'.join(symbol_table.prefix))) self.pkg_chpl_skel.new_def('use sidl;') objname = '.'.join(ci.epv.symbol_table.prefix+[ci.epv....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeSkeleton(self):\n model = \"phase_5/models/char/cog\" + string.upper(self.style.body) + \"_robot-zero\"\n anims = self.generateAnimDict()\n\n # remember the current anim\n anim = self.getCurrentAnim()\n\n # grab the drop shadow\n dropShadow = self.dropShadow\n ...
[ "0.66044444", "0.587571", "0.57283276", "0.5613182", "0.55756", "0.54531306", "0.54285294", "0.54172045", "0.5361487", "0.53608173", "0.52986", "0.52859664", "0.52261084", "0.52190334", "0.5209471", "0.51796484", "0.51643616", "0.514965", "0.513393", "0.5127358", "0.50976783"...
0.69149214
0
Chapel Impl (serverside Chapel implementation template) Start generating a module_Impl.chpl file in Chapel.
def begin_impl(self, qname): # new file for the toplevel package self.pkg_chpl_skel = ChapelFile(qname+'_Skel') #self.pkg_chpl_skel.main_area.new_def('proc __defeat_dce(){\n') # new file for the user implementation self.pkg_impl = ChapelFile(qname+'_Impl') self.pkg_impl....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GenPy(mod,fname):\n f = open(fname, 'w')\n title = \"\"\"#\n# This file is generated automatically\n# Author:IAN\n# http://www.iknot.org\n\"\"\"\n f.write(title)\n for i in mod.__dict__.keys():\n s = \"def \" + i + \"():\" + \"\\n\"\n f.write(s)\n s = \" return\"\n f....
[ "0.6240082", "0.62050146", "0.6026402", "0.5986625", "0.59765106", "0.588383", "0.58597726", "0.58080757", "0.5797474", "0.57337195", "0.5695626", "0.56927705", "0.5691082", "0.56275", "0.56160545", "0.55935496", "0.5569858", "0.5560001", "0.555906", "0.5548208", "0.55443746"...
0.6781022
0
Chapel Impl (serverside Chapel implementation template) Finish generating the module_Impl.chpl file in Chapel.
def end_impl(self, qname): # write the Chapel skeleton to disk self.pkg_chpl_skel.write() # deal with the impl file if self.pkg_enums_and_structs: self.pkg_impl._header.append(chpl_gen(ir.Import(qname))) impl = qname+'_Impl.chpl' # Preserve code written by ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def begin_impl(self, qname):\n # new file for the toplevel package\n self.pkg_chpl_skel = ChapelFile(qname+'_Skel')\n #self.pkg_chpl_skel.main_area.new_def('proc __defeat_dce(){\\n')\n\n # new file for the user implementation\n self.pkg_impl = ChapelFile(qname+'_Impl')\n s...
[ "0.6669867", "0.6221501", "0.6092544", "0.59780663", "0.5924718", "0.5749706", "0.57371974", "0.5709888", "0.56842494", "0.5661227", "0.55686927", "0.5557476", "0.5520124", "0.5503", "0.5470936", "0.5459828", "0.5390152", "0.53870183", "0.5374737", "0.53564644", "0.5333069", ...
0.679863
0
Write the packagewide definitions (enums, structs).
def generate_server_es_defs(self, pkg_symbol_table, es, qname): pkg_chpl = ChapelFile(qname) pkg_h = CFile(qname) pkg_h.genh(ir.Import('sidlType')) for es in self.pkg_enums_and_structs: es_ior = babel.lower_ir(pkg_symbol_table, es, header=pkg_h, qualify_names=True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_flags(self):\n\n self.cmake.write(\n '################# Flags ################\\n'\n '# Defines Flags for Windows and Linux. #\\n'\n '########################################\\n\\n'\n )\n\n self.define_group_properties()\n self.define_windows_f...
[ "0.61658555", "0.59416616", "0.59193116", "0.5899004", "0.58855397", "0.58615124", "0.5847306", "0.5817268", "0.57639414", "0.5752702", "0.57504827", "0.57068235", "0.56778485", "0.5658562", "0.56423926", "0.5642087", "0.56082004", "0.55855227", "0.552412", "0.5521999", "0.54...
0.0
-1
Generate server code for a method interface. This function generates a Ccallable skeleton for the method and generates a Skeleton of Chapel code complete with splicer blocks for the user to fill in. \param method sexpression of the method's SIDL declaration \param symbol_table the symbol table of the SIDL file \param c...
def generate_server_method(self, symbol_table, method, ci): def convert_arg((arg, attrs, mode, typ, name)): """ Extract name and generate argument conversions """ iorname = name return iorname, (arg, attrs, mode, typ, name) # Chapel skeleton...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_client_method(self, symbol_table, method, ci, has_impl):\n (Method, Type, (MName, Name, Extension), Attrs, Args,\n Except, From, Requires, Ensures, DocComment) = method\n\n abstract = member_chk(sidlir.abstract, Attrs)\n #final = member_chk(sidlir.final, Attrs)\n s...
[ "0.7590919", "0.6018988", "0.54044896", "0.5334083", "0.52877223", "0.51919335", "0.51591736", "0.51446867", "0.51081574", "0.5091529", "0.5066033", "0.49953592", "0.49737975", "0.491844", "0.4906915", "0.48684186", "0.4846144", "0.48234162", "0.47987446", "0.47579494", "0.46...
0.8426865
0
Extract name and generate argument conversions
def convert_arg((arg, attrs, mode, typ, name)): iorname = name return iorname, (arg, attrs, mode, typ, name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_arg_name(self, arg, variable_name):", "def convert_arg(node):\n if isinstance(node, ast.Name):\n return node.id\n else:\n return convert_literal_node(node)", "def _name_from_args(func, _, params):\n return \"{}_{}\".format(func.__name__, \"_\".join(str(arg) for arg in params.arg...
[ "0.66685903", "0.6599033", "0.65203696", "0.6483481", "0.6416871", "0.63621765", "0.63456565", "0.6166476", "0.60300237", "0.6014451", "0.60043615", "0.59995824", "0.5983003", "0.5949238", "0.5939162", "0.58347726", "0.58151877", "0.58072317", "0.5789486", "0.57871276", "0.57...
0.7363041
0
Unauthenticated users are redirected to the login screen.
def test_login_required(self): response = self.client.get(reverse("upload-form")) # See if a temporary redirect happens... self.assertEqual(response.status_code, 302) # Slightly redundant, but could alert early about unexpected changes/issues. self.assertIsInstance(response, H...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deny_access():\n flash('You must login first.')\n return redirect(url_for('home'))", "def unauthorized_handler(self):\n return flask.redirect(\"/login\")", "def unauthorized():\n flash(\"You must be logged in to view that page.\")\n return redirect(url_for(\"auth.login_view\"))", "def ...
[ "0.76734066", "0.7642473", "0.7596786", "0.7472385", "0.74398303", "0.7406799", "0.73732406", "0.7365459", "0.7322922", "0.7294877", "0.7252337", "0.72414875", "0.7239106", "0.72310627", "0.72267795", "0.7203325", "0.7185352", "0.71704066", "0.7160235", "0.7126403", "0.709778...
0.0
-1
Trivial test to make sure a passsword form is presented.
def test_access_is_password_protected(self): # Directly create an Upload object in the DB. upload = create_url_upload("https://google.com/robots.txt") response = self.client.get(reverse("upload-access", args=[upload.id])) # Ensure request does not error, no special code expected here. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_display_form(self):\n\n result = self.client.get(\"/registration\")\n self.assertIn(b\"password\", result.data)", "def test_new_password(self):\n form_data = self.form_data(self.pwd)\n form = self.form(data=form_data, user=self.u)\n self.assertFalse(form.is_valid())", ...
[ "0.7771708", "0.70576406", "0.69420385", "0.6938648", "0.682961", "0.6773995", "0.6731067", "0.6706823", "0.66917425", "0.66666794", "0.66390103", "0.66277546", "0.6614821", "0.6600192", "0.65904146", "0.65855426", "0.6555913", "0.65348256", "0.65200144", "0.651709", "0.64871...
0.63261867
35
Submit a form to the /upload endpoint and check if DB is properly populated.
def test_url_upload_creates_db_entry_properly(self): self.client.force_login(self.test_user) response = self.client.post( reverse("upload-form"), {"upload_type": "url_upload", "url": "https://fb.com/robots.txt"}, ) upload_obj = response.context["upload"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_import_upload(self):\r\n self._login_admin()\r\n\r\n # verify we get the form\r\n res = self.app.get('/admin/import')\r\n self.assertTrue(\r\n '<form' in res.body,\r\n 'Should have a form in the body for submitting the upload')\r\n\r\n res = self._u...
[ "0.70045006", "0.66376483", "0.6618763", "0.6537085", "0.65171796", "0.64366305", "0.64360416", "0.6377764", "0.63724375", "0.6279118", "0.62628216", "0.625561", "0.62060446", "0.62044924", "0.6181957", "0.6139727", "0.6114572", "0.61072445", "0.61064935", "0.6055241", "0.597...
0.6063657
19
Submit a form to the /upload endpoint and check if DB is properly populated.
def test_file_upload_creates_db_entry_properly(self): video_file = SimpleUploadedFile( "jfk_evidence.mp4", b"...", content_type="video/mp4" ) self.client.force_login(self.test_user) response = self.client.post( reverse("upload-form"), {"upload_type": "file_uploa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_import_upload(self):\r\n self._login_admin()\r\n\r\n # verify we get the form\r\n res = self.app.get('/admin/import')\r\n self.assertTrue(\r\n '<form' in res.body,\r\n 'Should have a form in the body for submitting the upload')\r\n\r\n res = self._u...
[ "0.70047826", "0.66386986", "0.6617603", "0.6536145", "0.6515379", "0.64358026", "0.6434752", "0.6377525", "0.6371604", "0.6277218", "0.62550026", "0.62048537", "0.6203805", "0.61793137", "0.6139055", "0.61151433", "0.61065376", "0.6105746", "0.60638183", "0.6055329", "0.5974...
0.62625927
10
Will also test if access counter is properly incremented.
def test_password_unlocks_access_redirect(self): test_url = "https://github.com/robots.txt" upload_obj = create_url_upload(test_url) self.assertEqual(upload_obj.successful_attempts, 0) response = self.client.post( reverse("upload-access", args=[upload_obj.id]), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_counter(self):\n self.assertEqual(self._n_registered, 1)", "def test_generation_increment_race(self, cache):\n from ccui.core.cache import CachingHttpWrapper\n\n wrapper = CachingHttpWrapper(\"wrapped\", [\"perms\"], [\"BucketName\"])\n\n # Simulate a second wrapper having wo...
[ "0.6907559", "0.63098127", "0.6305665", "0.62275547", "0.6173132", "0.6007258", "0.5993111", "0.5989962", "0.598092", "0.59587955", "0.5940014", "0.5874408", "0.58714736", "0.58540154", "0.5837869", "0.5808028", "0.58034235", "0.5786072", "0.5738846", "0.5736381", "0.57206213...
0.0
-1
Calculate a Gaussianweighted histogram. Drop a gaussian kernel on top of each data point. For every point, calculate the probability that the point lies in each bin, by evaluating the CDF of the Gaussian associated with each point. Sum the results across all bins and return the result. Converges to an ordinary histogra...
def numpy_gw_hist(data, bins, scale): data = np.atleast_1d(data) bins = np.atleast_1d(bins) nbins, ndata = bins.size, data.size scale = np.zeros(ndata) + scale logsm_bin_matrix = np.repeat( bins, ndata).reshape((nbins, ndata)).astype('f4') data_matrix = np.tile(data, nbins).reshape((nb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cuda_gw_hist(data, bins, scale, gw_hist_out):\n # find where this job goes over\n start = cuda.grid(1)\n stride = cuda.gridsize(1)\n\n # define some useful things\n bot = bins[0]\n sqrt2 = math_sqrt(2.)\n\n # loop over the data set - each thread now looks at one data point.\n for i in r...
[ "0.68829334", "0.63679624", "0.6258546", "0.61666834", "0.61578655", "0.61466706", "0.61356294", "0.6091921", "0.6059925", "0.60129106", "0.6010567", "0.60052973", "0.59860414", "0.5970528", "0.5956114", "0.5942941", "0.59030044", "0.5894491", "0.58888406", "0.5884427", "0.58...
0.70027906
0
Increment weighted bin counts in gw_hist_out, given an array of bins
def cuda_gw_hist(data, bins, scale, gw_hist_out): # find where this job goes over start = cuda.grid(1) stride = cuda.gridsize(1) # define some useful things bot = bins[0] sqrt2 = math_sqrt(2.) # loop over the data set - each thread now looks at one data point. for i in range(start, dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def numpy_gw_hist(data, bins, scale):\n data = np.atleast_1d(data)\n bins = np.atleast_1d(bins)\n nbins, ndata = bins.size, data.size\n\n scale = np.zeros(ndata) + scale\n\n logsm_bin_matrix = np.repeat(\n bins, ndata).reshape((nbins, ndata)).astype('f4')\n data_matrix = np.tile(data, nbin...
[ "0.63970953", "0.63832986", "0.6286262", "0.62791854", "0.61924654", "0.61763406", "0.6149406", "0.6016555", "0.60134465", "0.5990124", "0.5987075", "0.5971388", "0.59386116", "0.59300625", "0.59142697", "0.5889856", "0.5870431", "0.5831633", "0.5780326", "0.57768726", "0.576...
0.6434656
0
helper function to sample an index from a probability array
def _sample(preds, temperature=1.0): preds = np.asarray(preds).astype('float64') preds = np.log(preds) / temperature exp_preds = np.exp(preds) preds = exp_preds / np.sum(exp_preds) probas = np.random.multinomial(1, preds, 1) return np.argmax(probas)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample(probs):\n\n probs = probs / probs.sum()\n return np.random.choice(np.arange(len(probs)), p=probs.flatten())", "def torch_sample(array, indexes, desired_shape):\n torch_arr = torch.tensor(array, dtype=torch.float32)\n indexed = torch_arr[[indexes[0], indexes[1]]]\n return indexed.reshape...
[ "0.71752286", "0.7037483", "0.68420094", "0.6789547", "0.67868006", "0.67363536", "0.6717828", "0.67061967", "0.66783816", "0.6661097", "0.6645274", "0.66310203", "0.6601521", "0.6580942", "0.6580942", "0.6580942", "0.6580736", "0.6548197", "0.6487856", "0.64461774", "0.64256...
0.60964197
52
DDL Create the tables
def make(self): fp = open('delicious.ddl', 'r') dml = fp.read() print dml self.connection.executescript(dml)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tables():\n db.create_all()", "def create_tables():\n db.create_all()", "def create_tables(self):\n for query in table_create_sql:\n self.cursor.execute(query)\n\n self.commit()", "def create_tables():\n db.create_all()", "def create_tables() -> None:\n ...
[ "0.81612206", "0.81612206", "0.8152945", "0.7987516", "0.77574205", "0.76791966", "0.76293725", "0.7576411", "0.7527473", "0.7519382", "0.7517612", "0.75165296", "0.7501143", "0.74902815", "0.7425339", "0.739474", "0.73895895", "0.73620796", "0.7354249", "0.73505133", "0.7301...
0.0
-1
Create a delicious sqlite db (file) with name db_name. The file will be written in user dir (~) .ci/delicious/dat
def create(self, db_name): path = self.get_path(db_name) if not os.path.exists(path): fp = open(path, 'wb') fp.close() self.connect(db_name) self.make() else: self.connect(db_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_db():\n # check for DB existance\n db_file = vmcheckerpaths.db_file()\n if not os.path.isfile(db_file):\n create_db_tables(db_file)\n else:\n _logger.info('Skipping existing Sqlite3 DB file %s' % db_file)", "def create_db(db_file):\n conn = None\n try:\n conn = s...
[ "0.76865566", "0.7664732", "0.7513654", "0.74683404", "0.74023956", "0.73285156", "0.72989464", "0.7265425", "0.7177515", "0.7116019", "0.7084576", "0.7066481", "0.7061552", "0.70601076", "0.7034217", "0.69948953", "0.6970059", "0.6960579", "0.6943786", "0.69381577", "0.69321...
0.7193139
8
Delete sqlite db with name db_name
def remove(self, db_name): path = self.get_path(db_name) os.remove(path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_database(self, db_name):\n seqids = self.read_sequence_ids()\n if seqids.has_key(db_name):\n del seqids[db_name]\n self.write_sequence_ids(seqids)\n self._announce_updates({'type' : 'deleted_db', 'data' : db_name})", "def drop_db() -> None:\n \n if os.e...
[ "0.84356683", "0.8193929", "0.8140582", "0.80409026", "0.79433674", "0.7903291", "0.78916323", "0.78744906", "0.7873493", "0.76403874", "0.75261354", "0.7505911", "0.74803185", "0.74803185", "0.74803185", "0.74803185", "0.74803185", "0.74803185", "0.74803185", "0.74803185", "...
0.76604414
9
Loads training dataset from json file.
def load_data(data_path): with open(data_path, "r") as fp: data = json.load(fp) # convert lists to numpy arrays X = np.array(data["mfcc"]) y = np.array(data["labels"]) print("Data succesfully loaded!") return X, y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_training_data(\n self,\n train_data_file=\"datasets/train_data.json\",\n test_data_file=\"datasets/test_data.json\",\n ):\n train_data = pd.read_json(train_data_file)\n test_data = pd.read_json(test_data_file)\n return train_data, test_data", "def load_traini...
[ "0.7791417", "0.77091134", "0.71129453", "0.7023149", "0.6983698", "0.6925755", "0.68933195", "0.6848632", "0.67826897", "0.67730176", "0.66925955", "0.6674508", "0.665269", "0.663998", "0.6631841", "0.66312736", "0.6623587", "0.66214395", "0.66078985", "0.6588369", "0.658062...
0.0
-1