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
return list of bits in number
def bits_list(number): # https://wiki.python.org/moin/BitManipulation if number == 0: return [0] else: # binary_literal string e.g. '0b101' binary_literal = bin(number) bits_string = binary_literal.lstrip('0b') # list comprehension bits = [int(bit_character) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bitlist(n):\n return [n >> i & 1 for i in range(7,-1,-1)]", "def _bits(num):\r\n return bin(int(num))[2:]", "def binary_encoding(k: int, bit_number: int=10) -> List[int]:\n return [k>>i & 1 for i in range(bit_number)]", "def __get_bit_values(self, number, size=32):\n res = list(self._...
[ "0.8127424", "0.8050236", "0.7666614", "0.75274515", "0.7512719", "0.7469839", "0.7446176", "0.7345393", "0.7344313", "0.7332414", "0.72998476", "0.7210258", "0.71295255", "0.7124242", "0.70642513", "0.70642513", "0.7048847", "0.7041419", "0.7011808", "0.69538057", "0.688378"...
0.8186028
0
return bit in number at location 2 exponent
def bit_at_twos_power(number, exponent): bits = bits_list(number) # NOTE: reverse() modifies object, returns None bits.reverse() if exponent > (len(bits) - 1): return 0 else: return bits[exponent]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bit(num, position):\n\treturn (num >> position) & 0b1", "def _get_bit(self, num, bit, mask=1):\n return (int(num) >> bit) & mask", "def get_bit(num, i):\r\n return 1 if num & 1 << i else 0", "def power_of_2(c):\n return n & (n - 1) == 0", "def _find_nearest_power_of_two(x):\n\n retu...
[ "0.74136764", "0.6971582", "0.68619984", "0.68498963", "0.6782197", "0.6750494", "0.6733378", "0.67329884", "0.6702873", "0.6669386", "0.66691667", "0.66691667", "0.6624408", "0.6621196", "0.657315", "0.6546286", "0.6543188", "0.65373", "0.65147185", "0.6459624", "0.64361835"...
0.72224295
1
return highest power of two in number
def twos_power_max(number): bits = bits_list(number) return len(bits) - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_power2(num):\n return 2 ** int(np.ceil(np.log2(num)))", "def _find_nearest_power_of_two(x):\n\n return 1 << (x - 1).bit_length()", "def _nearest_bigger_power_of_two(x: int) -> int:\n y = 2\n while y < x:\n y *= 2\n return y", "def _next_power_of_two(self, n):\n if n == 0...
[ "0.7722803", "0.77092505", "0.7696812", "0.75224876", "0.7414126", "0.7350261", "0.72898906", "0.72811985", "0.7175145", "0.7173635", "0.7150411", "0.71332145", "0.71239346", "0.71106535", "0.7095859", "0.7025772", "0.7020954", "0.69823575", "0.69276136", "0.6903265", "0.6882...
0.78875387
0
Expect a dictionary object, produce text in CSV format.
def create_csv_report(cls, instances): rows = [cls.format_aws_instance_csv(rep) for rep in sorted(instances.items())] # NOQA fieldnames = ["instance_id", "aws_account", "aws_region", "key_name", "launch_time", "vpc_id"] ephemeral_obj = io.BytesIO() csv_writer = csv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_to_csv(filename, dictionary, paramdict=True):\n if paramdict:\n filename += '_params'\n \n with open(filename + '.csv', 'w') as f:\n for key in dictionary.keys():\n if type(dictionary[key]) == tuple:\n f.write(\"%s,%s, %s \\n\"%(key, dictionary[key][0], dic...
[ "0.7108769", "0.7102249", "0.6928045", "0.6859614", "0.6837742", "0.66567266", "0.66533685", "0.6644183", "0.65137273", "0.644206", "0.6406594", "0.63586444", "0.6356051", "0.6343163", "0.6314986", "0.62683123", "0.6248978", "0.6235773", "0.623546", "0.62257725", "0.6212162",...
0.0
-1
Expect a dictionary object, produce text appropriate for stdout.
def create_stdout_report(cls, instances): pieces = [cls.format_aws_instance(rep) for rep in sorted(instances.items())] # NOQA result = "\n----------\n".join(pieces) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_dict(dictionary, format_=None):\n\n format_ = format_ or DEFAULT\n\n if format_ == TEXT:\n for key, value in iter(sorted(dictionary.items())):\n print(\"%s = %s\" % (key, value))\n elif format_ == DOCKERENV:\n for key, value in iter(sorted(dictionary.items())):\n ...
[ "0.6906092", "0.66687083", "0.66687083", "0.66272444", "0.6584296", "0.6557631", "0.64985704", "0.6484042", "0.6484042", "0.63379157", "0.6291753", "0.6272114", "0.62684363", "0.62559116", "0.6220073", "0.6214857", "0.61553854", "0.6144517", "0.61384547", "0.613189", "0.60918...
0.0
-1
Create a plaintext report for Slack.
def create_slack_reports(cls, channel_reference, default_channel, routing_rules, instances): organized = {} # Group by target Slack channel. for instance in instances: channel = Utility.get_channel_for_message(channel_reference, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_weekly_report_slack():\n quarterly_text = get_report_text(90)\n annual_text = get_report_text(365)\n text = (\n \"*Monthly Metrics Report*\\n\"\n \"This is an automated monthly report on some of our key metrics.\\n\\n\"\n f\"\\tIn the last 90 days we saw:\\n\\n{quarterly_text...
[ "0.7163552", "0.63148385", "0.62569815", "0.6144792", "0.59886944", "0.5957102", "0.59369105", "0.5888709", "0.5854675", "0.585184", "0.5844067", "0.57283854", "0.57240146", "0.5716271", "0.5695551", "0.5692515", "0.5688565", "0.56377584", "0.5634909", "0.562721", "0.56150633...
0.5431317
35
Format an AWS instance's metadata for reporting.
def format_aws_instance(cls, aws_instance): instance_id = "Instance ID: {instance}".format(instance=aws_instance[0]) # NOQA aws_account = "AWS Account: {account}".format(account=aws_instance[1]["aws_account"]) # NOQA aws_region = "AWS Region: {region}".format(region=aws_instance[1]["aws_region...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_aws_instance_csv(cls, aws_instance):\n result = {\"instance_id\": aws_instance[0],\n \"aws_account\": aws_instance[1][\"aws_account\"],\n \"aws_region\": aws_instance[1][\"aws_region\"],\n \"key_name\": aws_instance[1][\"key_name\"],\n ...
[ "0.6706454", "0.6214005", "0.58400214", "0.57573223", "0.5682506", "0.5593217", "0.5534054", "0.5494629", "0.54934895", "0.5475465", "0.5431762", "0.54230183", "0.5374503", "0.53482795", "0.53469235", "0.5299905", "0.5294458", "0.527383", "0.51930857", "0.5163742", "0.5160937...
0.70394367
0
Format an AWS instance's metadata for reporting in CSV format.
def format_aws_instance_csv(cls, aws_instance): result = {"instance_id": aws_instance[0], "aws_account": aws_instance[1]["aws_account"], "aws_region": aws_instance[1]["aws_region"], "key_name": aws_instance[1]["key_name"], "launch_time": aw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_aws_instance(cls, aws_instance):\n instance_id = \"Instance ID: {instance}\".format(instance=aws_instance[0]) # NOQA\n aws_account = \"AWS Account: {account}\".format(account=aws_instance[1][\"aws_account\"]) # NOQA\n aws_region = \"AWS Region: {region}\".format(region=aws_instanc...
[ "0.6753999", "0.6415332", "0.56931126", "0.5526823", "0.5469592", "0.54025054", "0.5367501", "0.5292463", "0.5250131", "0.52448654", "0.52434593", "0.5198777", "0.51984173", "0.51540196", "0.51104605", "0.51003814", "0.50938004", "0.50337195", "0.5009848", "0.50069076", "0.49...
0.747481
0
RD Station API use OAuth authentication method.
def __init__(self, client_id, client_secret, refresh_token=None, code=None, callback_url=None): self.base_url = 'https://api.rd.services' self.client_id = client_id self.client_secret = client_secret self.refresh_token = refresh_token if code: self.access_token = sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_oauth():\n\n # initial app authorization request - not tied to specific user\n request_token, request_token_secret = goodreads.get_request_token(header_auth=True)\n\n # assign request tokens to session for future use\n session['request_token'] = request_token\n session['request_token_secret'...
[ "0.68430936", "0.6825009", "0.68104076", "0.6695356", "0.6666678", "0.66485614", "0.6634933", "0.6587592", "0.65865326", "0.6556506", "0.65335166", "0.65335166", "0.65196073", "0.65141773", "0.65138084", "0.64944786", "0.648033", "0.6461008", "0.6450203", "0.64329815", "0.640...
0.62075526
30
It creates a webhook subscription.
def create_webhook(self, webhook_url, event_type='CONVERTED', include_relations=[]): print('Creating webhook...') api_url = f'{self.base_url}/integrations/webhooks' req_data = { "entity_type": "CONTACT", "event_type": f"WEBHOOK.{event_type}", "event_identifi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_webhook():\n\n response = requests.put(KAZOO_SERVER + ':8000/v2/accounts/' + ACC_ID + '/webhooks', headers=HEADERS, data=ws.jsonify(CHANNEL_DESTROY_WEBHOOKS))\n\n return response", "def create_subscription(self,\n body):\n\n return super().new_api_call_builder.r...
[ "0.7374728", "0.7267958", "0.708534", "0.6968992", "0.6943122", "0.6893747", "0.6887109", "0.6805869", "0.67693436", "0.65960854", "0.6314443", "0.62725574", "0.62692505", "0.6263543", "0.62518686", "0.61873096", "0.6151583", "0.6083862", "0.6073404", "0.6021803", "0.6016704"...
0.6431883
10
Connect to the PostgreSQL database. Returns a database connection.
def connect(): # returns the connection object to tournament # database from PostgreSQL return psycopg2.connect("dbname=tournament")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_to_db():\n return pg.connect(DB_CONN_STRING)", "def connect():\n conn = None\n try:\n # read connection parameters\n params = config(filename='./configs/database.ini',\n section='postgresql')\n\n # connect to the PostgreSQL server\n logger.i...
[ "0.86190194", "0.84299386", "0.8429464", "0.8308111", "0.82700765", "0.82314837", "0.81962186", "0.81663454", "0.8113811", "0.80987424", "0.8048103", "0.79992247", "0.79880154", "0.7977557", "0.7961168", "0.79450434", "0.7924049", "0.78908235", "0.7873477", "0.78695047", "0.7...
0.74600875
66
Remove all the match records from the database.
def deleteMatches(): # gets connection to tournament database in conn object conn = connect() # gets the cursor to execute queries c = conn.cursor() # executes delete query to delete all records in MATCH table c.execute("DELETE FROM MATCH;") # commits the changes perform on MATCH table after...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deleteAll(self):\n self.db.execute(\"DELETE FROM MATCH;\", ())", "def deleteMatches():\n conn = connect()\n c = conn.cursor()\n # Clears the \"matches\" table, but does not get rid of the table.\n c.execute(\"delete from matches;\")\n conn.commit()\n conn.close()", "def deleteMatch...
[ "0.7907006", "0.7667884", "0.7664419", "0.7592219", "0.7570883", "0.75260276", "0.7518946", "0.75174177", "0.75145423", "0.75019526", "0.7491591", "0.7479197", "0.74789554", "0.74743176", "0.7472819", "0.7464124", "0.74493855", "0.7303164", "0.7293325", "0.7290579", "0.722480...
0.74734604
14
Remove all the player records from the database.
def deletePlayers(): # gets connection to tournament database in conn object conn = connect() # gets the cursor to execute queries c = conn.cursor() # executes delete query to delete all records in PLAYER table c.execute("DELETE FROM PLAYER;") # commits the changes perform on PLAYER table af...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deletePlayers():\n with _connect_db() as (conn, cur):\n cur.execute(\"\"\"DELETE FROM players;\"\"\")\n conn.commit()", "def deletePlayers():\n conn = connect()\n c = conn.cursor()\n # Clears the \"players\" table, but does not get rid of the table.\n c.execute(\"delete from play...
[ "0.79152656", "0.7797487", "0.7717909", "0.7708946", "0.7708134", "0.7673693", "0.7624109", "0.76225203", "0.7621035", "0.7570029", "0.75598466", "0.75493866", "0.7514579", "0.75133157", "0.7485491", "0.7446517", "0.73848397", "0.7318164", "0.7262919", "0.72294337", "0.720686...
0.77352023
2
Returns the number of players currently registered.
def countPlayers(): # gets connection to tournament database in conn object conn = connect() # gets the cursor to execute queries c = conn.cursor() # executes select with count aggregate function query number of players # in PLAYER table c.execute("SELECT COUNT(*) FROM PLAYER;") # retrei...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_players(self) -> int:\n return self.param.number_of_players", "def countPlayers():\n conn = connect()\n cur = conn.cursor()\n cur.execute(\"SELECT COUNT(*) FROM players\")\n players = int(cur.fetchone()[0])\n conn.close()\n return players", "def countPlayers():\n with ...
[ "0.82761925", "0.82301927", "0.81162655", "0.81077707", "0.8069197", "0.8026064", "0.7994305", "0.7930107", "0.79146034", "0.78450596", "0.78395754", "0.7787708", "0.7766425", "0.77562374", "0.77113974", "0.7687248", "0.759404", "0.758135", "0.7548042", "0.7539884", "0.751975...
0.7104468
29
Adds a player to the tournament database. The database assigns a unique serial id number for the player. (This should be handled by your SQL database schema, not in your Python code.)
def registerPlayer(name): # gets connection to tournament database in conn object conn = connect() # gets the cursor to execute queries c = conn.cursor() # executes insert query which takes the name variable passed in arguments # of this method and adds a new player record to PLAYER table where ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def registerPlayer(playerName):\n\n tournName = \"Tournament for legacy tests\"\n\n # Connect to database\n conn, c = main.connect()\n\n # Insert a new player with this name\n SQL = \"INSERT INTO player (playerName) values (%s);\"\n data = (playerName, )\n c.execute(SQL, data)\n\n # If the ...
[ "0.7571331", "0.7488418", "0.7460844", "0.7456452", "0.7349081", "0.73410213", "0.730657", "0.72664267", "0.7244713", "0.7213591", "0.71821433", "0.71512973", "0.7140019", "0.71207255", "0.71172535", "0.70993054", "0.707552", "0.7067138", "0.7055108", "0.70531744", "0.7027579...
0.7729972
0
Returns a list of the players and their win records, sorted by wins. The first entry in the list should be the player in first place, or a player tied for first place if there is currently a tie.
def playerStandings(): # gets connection to tournament database in conn object conn = connect() # gets the cursor to execute queries c = conn.cursor() # executes select statement on STANDING view for getting results in # descending order of number of wins for each player c.execute("SELECT * ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def playerStandings():\n # place all players in a dictionary\n player_dict = {}\n conn, c = connect()\n c.execute(\"\"\"SELECT * FROM players;\"\"\")\n for row in c.fetchall():\n player_dict[row[0]] = [row[1], 0, 0]\n\n # count the number of win and matches in for all matches\n c.execut...
[ "0.7002294", "0.69581795", "0.68095344", "0.68075407", "0.66431624", "0.6599347", "0.6576619", "0.6328768", "0.6209237", "0.6179223", "0.6167885", "0.615951", "0.6109705", "0.6082518", "0.6076175", "0.605928", "0.6056515", "0.5985764", "0.59602445", "0.59505534", "0.5936894",...
0.60500395
17
Records the outcome of a single match between two players.
def reportMatch(winner, loser, draw): # gets connection to tournament database in conn object conn = connect() # gets the cursor to execute queries c = conn.cursor() # sql insert query to add new MATCH record in the MATCH table with # passing winner or loser player id and true or false for draw ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reportMatch(player1, player2, winner = None):\n #Check for Bye matchup (player1=player2)\n bye_match = False\n if player1 == player2:\n winner = player1\n bye_match = True\n\n #Generate random winner if no winner param is passed in\n if winner is None:\n rand = random.random...
[ "0.75769395", "0.7318565", "0.7162485", "0.715877", "0.7148469", "0.70839787", "0.70600444", "0.69540495", "0.6862129", "0.68571943", "0.6849386", "0.68365145", "0.68264997", "0.6822135", "0.68064857", "0.66964144", "0.66908497", "0.6688487", "0.6667407", "0.66199833", "0.659...
0.70029676
7
Returns a list of pairs of players for the next round of a match. Assuming that there are an even number of players registered, each player appears exactly once in the pairings. Each player is paired with another player with an equal or nearlyequal win record, that is, a player adjacent to him or her in the standings.
def swissPairings(): # retreives player standings i.e. id, player, wins, matches standings = playerStandings() # pairs for next round are stored in this array. next_round = [] # iterates on the standings results. As the results are already in # descending order, the pairs can be made using adja...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swissPairings():\n\n # Ok This is where things get interesting, how in the world should i solve this problem\n # A question to the udacity reviewer. Shouldn't standings be passed in to this function since weve already called it in tournament_test.testPairings\n\n #anyways\n\n nextRoundPlayers = []\...
[ "0.8103197", "0.7787016", "0.7717939", "0.76245844", "0.76115", "0.7596688", "0.7552793", "0.7453131", "0.7419286", "0.738509", "0.7381597", "0.72125864", "0.71837986", "0.714855", "0.7069176", "0.7043194", "0.7003615", "0.69710374", "0.6970802", "0.6916647", "0.6875584", "...
0.80501574
1
Adds two Reco objects, returns a Reco object.
def addReco(obj1,obj2): px = obj1.px + obj2.px py = obj1.py + obj2.py pz = obj1.pz + obj2.pz E = obj1.E + obj2.E return Reco(px,py,pz,E)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __add__(self, other):\n new = self.__class__()\n new.extend(self)\n new.extend(other)\n return new", "def __radd__(self, other):\n return self.runtime.add(self, other)", "def __add__(self, other):\n return self.add(other)", "def __radd__(self, other):\n\n ...
[ "0.6708373", "0.6588393", "0.6587373", "0.6527081", "0.6519195", "0.6519195", "0.6518886", "0.65113086", "0.6482993", "0.6482993", "0.6482993", "0.6482993", "0.6482993", "0.6482993", "0.6482993", "0.6479999", "0.6457409", "0.6420922", "0.6420922", "0.6419211", "0.6409279", ...
0.7727639
0
Converts a Reco object to a string.
def stringReco(obj): name = obj.get_name() name = obj._pid if (name is None) else name return ("pdg: " + name + " E: " + str(obj._E) + " px: " + str(obj._px) + " py: " + str(obj._py) + " pz: "+ str(obj._pz) + " mass: " + str(obj._m))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_(object_):\n return str(object_)", "def value_to_string(self, obj):\n value = self.value_from_object(obj)\n return value", "def _tostr(obj): # pragma: no cover\n return obj if isinstance(obj, str) else obj.decode()", "def obj_to_string(rental):\n string = rental.id + ';' +...
[ "0.6829037", "0.6601121", "0.6591872", "0.65873903", "0.6571199", "0.6557375", "0.6517904", "0.6511437", "0.6509183", "0.6501627", "0.64991844", "0.6456585", "0.636783", "0.636783", "0.636783", "0.6255697", "0.6255697", "0.624381", "0.62436426", "0.6181675", "0.6174107", "0...
0.6945018
0
Switch to another device.
def to(self, dev): self.weight = self.weight.to(dev) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_device(self):\n if self.state.ser:\n UsbHost.close_port(self.state.ser)\n device = self.CBDevices.currentText()\n if device:\n comport = self.devices[int(device)]\n self.state.ser = UsbHost.open_port(comport)\n if not self.state.ser:\n ...
[ "0.66676337", "0.6656939", "0.6473117", "0.629531", "0.6137485", "0.60558873", "0.6028521", "0.597831", "0.5977964", "0.59667236", "0.59458566", "0.59299034", "0.5924209", "0.5893226", "0.5882226", "0.5856656", "0.58389336", "0.5746957", "0.5674327", "0.5665239", "0.56431866"...
0.0
-1
Creates a password for the user and adds the user to openstack.
def add_user(self, user_email, first_name, last_name, password, role): course_m = CourseManager(current_user.session) group_m = GroupManager(current_user.session) user = self.create( name=user_email, domain=course_m.find(name='default').id, password=password...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_user(username, password):\n return create_user(username, password)", "def add_user(username, password):\n return create_user(username, password)", "def add_user(self, user, pw):\n self.db.execute(\"INSERT INTO user_credentials VALUES (?, ?)\", [user, pw])\n self.db.commit()...
[ "0.728109", "0.728109", "0.7239141", "0.70491415", "0.6990617", "0.6863269", "0.68306065", "0.68255174", "0.6821471", "0.6818305", "0.6790275", "0.67812306", "0.67568904", "0.6725345", "0.6660526", "0.66501254", "0.66493255", "0.66379577", "0.6637337", "0.66206384", "0.661209...
0.0
-1
Deletes a user and the network that belongs to that user. The mikrotik configurations are also removed.
def delete_user(self, user, instance_m): from resela.model.User import authenticate if user: mikrotik_m = MikrotikManager() lab_m = LabManager(current_user.session) group_m = GroupManager(current_user.session) user_m = UserManager(current_user.session) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_user(network, user):\n if user in network:\n del network[user]\n for u in network:\n connections = get_connections(network, u)\n if user in connections:\n i = connections.index(user)\n del connections[i]\n return network", "def de...
[ "0.7707111", "0.70516425", "0.6972116", "0.67819333", "0.67293984", "0.66955173", "0.66955173", "0.66955173", "0.66840297", "0.667016", "0.6612195", "0.6580813", "0.655327", "0.6516242", "0.64975977", "0.64706296", "0.64591783", "0.64546835", "0.6438795", "0.6430819", "0.6407...
0.6742137
4
Sends an email to the user who requested a new password or a confirmation email to a user who has reset his or her password. If email and password is set, a mail is sent to a newly registrated user. If email and token is set, a request to reset password is sent to the user with a link and a temporary token. If only the...
def email_user(to_email, password=None, token=None): try: if password and token: raise Exception('No email has been sent. Both token and password is set.') mail = Mail(APP) if to_email and password: message = Message( 'Resel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_emails():\n email = request.data['email'].strip()\n user = User.query.filter_by(email=email).first()\n option = \\\n request.data['option'].strip() # have a <select> in the frontend\n token = s.dumps(email, salt='email-confirm')\n\n msg = Message('Reset pass...
[ "0.7728737", "0.7559589", "0.748966", "0.7445745", "0.7434668", "0.7403786", "0.7355636", "0.7344078", "0.7325047", "0.7311936", "0.72110546", "0.7201742", "0.71804917", "0.7156649", "0.7125851", "0.7121934", "0.71122754", "0.70608777", "0.7039746", "0.69806916", "0.6928046",...
0.77339584
0
Returns the most recent transactions by members of government
def get_government_trading(gov_type: str, ticker: str = "") -> pd.DataFrame: if gov_type == "congress": if ticker: url = ( f"https://api.quiverquant.com/beta/historical/congresstrading/{ticker}" ) else: url = "https://api.quiverquant.com/beta/live...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query2(transaction):\n # Part 2a: Obtain ID of most-followed (same as query1)\n top_3_followed = query1(transaction)\n top_1_followed = top_3_followed[0]['personID']\n print(f\"Top most-followed person ID:\\n{top_1_followed}\")\n\n # Part 2b: Use ID of most-followed person and find their city o...
[ "0.5160677", "0.51275116", "0.50672626", "0.5051236", "0.50158", "0.5015026", "0.5006082", "0.49001202", "0.48673108", "0.4849451", "0.4826606", "0.4808726", "0.48059615", "0.47626555", "0.47515532", "0.4711577", "0.47064406", "0.4705023", "0.47003144", "0.4686806", "0.464722...
0.0
-1
Returns a persistent connection to the osgprod database.
def db_connection(): global dbconnection try: conn = dbconnection except: dbconnection = psycopg2.connect(user = dbuser, password = dbpass, host = dbserver, port = "5432", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_db_connection():\n db = sqlite3.connect(config.PERSISTENCE_LOCATION, check_same_thread=False)\n db.isolation_level = None\n db.row_factory = sqlite3.Row\n return db", "def get_db():\n if not hasattr(g, 'db_connection'):\n g.db_connection = connect_db()\n return g.db_connection", ...
[ "0.73980427", "0.7126742", "0.70921594", "0.69822115", "0.69624156", "0.6955797", "0.6952289", "0.69403976", "0.6924561", "0.6893482", "0.68846476", "0.6862271", "0.685671", "0.6850538", "0.6845601", "0.6834621", "0.6792339", "0.6782343", "0.6782343", "0.6779083", "0.6768656"...
0.0
-1
Uploads outfile to the storage element at dst_url under output directory outdir, returns 0 on success, raises an exception on error.
def upload(outfile, outdir): outpath = outdir + "/" + outfile my_env = os.environ.copy() my_env["X509_USER_PROXY"] = dst_cred for retry in range(0,99): try: subprocess.check_output(["globus-url-copy", "-create-dest", "-rst", "-stall-timeout", "300", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, url, output):\n\n shutil.copy2(self.get(url), output)", "def putFile(self, _src, _dst, delExisting = True):\n\n #-------------------- \n # Delete existing _dst from XNAT host.\n #-------------------- \n if delExisting:\n r = self.__...
[ "0.63402486", "0.6235955", "0.61301994", "0.6048785", "0.6006344", "0.5978161", "0.59224904", "0.58591557", "0.5799578", "0.5667479", "0.56134206", "0.56105936", "0.5528729", "0.54942703", "0.54917186", "0.5471971", "0.5471403", "0.5466291", "0.54457706", "0.5421599", "0.5386...
0.72268885
0
Gets the next output set to bind from the database, unpacks them into a temporary directory, and merges them at the input data file level into files in the output directory tree under the toplevel dir vers. If the bindings db does not already exit, you must manually call create_table_bindings before trying to invoke th...
def next(): iraw = 0 run = 0 seqno = 0 with db_connection() as conn: with conn.cursor() as curs: try: curs.execute("""SELECT rawdata.id,rawdata.run,rawdata.seqno, slices.block1,slices.block2, jobs.cluster,jobs.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge(self, ddb_files, out_ddb, description, cwd=None):\n\n # We work with absolute paths.\n ddb_files = [os.path.abspath(s) for s in list_strings(ddb_files)]\n\n out_ddb = out_ddb if cwd is None else os.path.join(os.path.abspath(cwd), out_ddb)\n\n if self.verbose:\n prin...
[ "0.5135086", "0.5105571", "0.5062106", "0.5051295", "0.4986725", "0.49431032", "0.48690206", "0.48451462", "0.4786839", "0.47686812", "0.47670457", "0.47470966", "0.4744025", "0.47428954", "0.47262472", "0.47167167", "0.47113854", "0.4703731", "0.4658417", "0.4654385", "0.464...
0.49548176
5
Merge the special events skim files from the individual jobs into a single skim file for each input raw data file. Returns 0 on success, nonzero on error.
def merge_evio_skims(run, seqno, slices): inset = {"BCAL-LED": "hd_rawdata_{0:06d}_{1:03d}+{2},{3}.BCAL-LED.evio", "DIRC-LED": "hd_rawdata_{0:06d}_{1:03d}+{2},{3}.DIRC-LED.evio", "FCAL-LED": "hd_rawdata_{0:06d}_{1:03d}+{2},{3}.FCAL-LED.evio", "CCAL-LED": "hd_rawdata_{0:06d}_{1:03d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_datasets(self):\n\n with open(self.mappings, \"r+\") as json_file:\n emsl_to_jgi = json.load(json_file)\n emsl_to_jgi_copy = copy.deepcopy(emsl_to_jgi)\n\n contaminant_file_loc = emsl_to_jgi[\"contaminant_file_loc\"]\n # run for each dataset\n ...
[ "0.58434606", "0.5828776", "0.5671057", "0.56308407", "0.5587917", "0.55824566", "0.54915506", "0.54796594", "0.5427828", "0.5424342", "0.54181063", "0.53949624", "0.53836256", "0.5380785", "0.53721344", "0.5371496", "0.5339565", "0.53391004", "0.5329548", "0.53231126", "0.53...
0.5119218
44
Merge the output root files from the individual jobs into a single root file for each input raw data file. Returns 0 on success, nonzero on error.
def merge_root_histos(run, seqno, slices): inset = {"hists": "hd_root.root", "tree_TS_scaler": "tree_TS_scaler.root", "tree_bcal_hadronic_eff": "tree_bcal_hadronic_eff.root", "tree_fcal_hadronic_eff": "tree_fcal_hadronic_eff.root", "tree_tof_eff": "tree_tof_eff.root", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_root_files(self, force=False):\n self.OutFilePath.parent.mkdir(exist_ok=True)\n cmd = f'hadd{\" -f\" if force else \"\"} {self.proteus_raw_file_path()} {self.Raw.OutFilePath} {self.Ref.OutFilePath} {self.Adc2Vcal.OutFilePath}'\n pinfo(cmd)\n check_call(cmd, shell=True)", "de...
[ "0.6730804", "0.6564732", "0.65505415", "0.64266163", "0.60904115", "0.60902333", "0.60311466", "0.60188913", "0.5925645", "0.59169954", "0.59121346", "0.59091747", "0.5899683", "0.58853364", "0.5863318", "0.5858405", "0.584055", "0.5825858", "0.5807685", "0.580593", "0.57860...
0.0
-1
Merge the output hddm files from the individual jobs into a single hddm file for each input raw data file. Returns 0 on success, nonzero on error.
def merge_hddm_output(run, seqno, slices): inset = {"REST": "dana_rest.hddm", "converted_random": "converted_random.hddm", } outset = {"REST": "dana_rest_{0:06d}_{1:03d}.hddm", "converted_random": "converted_random_{0:06d}_{1:03d}.hddm", } badslices = [] slice...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_output_files(self):\n namenode = self.runner.namenode\n for i in range(self.cnt_reducers):\n fname = '%s.%s' % (self.output_dir, reduce_output(self.id, i))\n namenode.create_file(fname)\n self.result_files.append(fname)\n self.open_files.append(f...
[ "0.64265794", "0.63644433", "0.6353053", "0.60704476", "0.6045988", "0.60319865", "0.598607", "0.59759074", "0.5901085", "0.58970237", "0.5886435", "0.5850782", "0.57940143", "0.5781016", "0.5780351", "0.5770798", "0.576806", "0.5740822", "0.57112277", "0.570429", "0.56991875...
0.6682864
0
Merge the job log hddm files from the individual jobs into a catenated log file for each input raw data file. Returns 0 on success, nonzero on error.
def merge_job_info(run, seqno, slices): inset = {"job_info": ["workscript.stdout", "workscript.stderr"], } outset = {"job_info": ["std_{0:06d}_{1:03d}.out", "std_{0:06d}_{1:03d}.err"], } tarset = {"job_info": "job_info_{0:06d}_{1:03d}.tgz", } badslices = [] slicepatt = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _consolidate_mp_logs(self):\n for i, fn in enumerate(self.logfiles):\n with open(fn) as f:\n logger.info(\"Log from thread {0}:\\n{1}\".format(i, f.read()))\n open(fn, \"w\").write(\"\")", "def merge_all_data(self):\n\n logging.info('***** Starting the m...
[ "0.6514452", "0.6379347", "0.61566144", "0.61549914", "0.59930986", "0.59826446", "0.59685177", "0.5903456", "0.5852834", "0.58354026", "0.5825984", "0.56945175", "0.56898165", "0.56841546", "0.56395817", "0.56382704", "0.5634285", "0.56220657", "0.5616418", "0.5598884", "0.5...
0.59504026
7
Looks up rawdata id iraw and unpacks the job output tarballs from all jobs that completed successfully into a new directory named iraw under the pwd. If iraw is not known, alternatively one can supply the run number and sequence number of the raw data input file.
def unpack(run=0, seqno=0, iraw=0): if iraw == 0 and run == 0: print("Usage: osgprod_bind.unpack(iraw=<iraw>)") print(" or: osgprod_bind.unpack(run=<run>, seqno=<seqno>)") return 0 if iraw: with db_connection() as conn: with conn.cursor() as curs: curs.execute("""SEL...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n onlyfiles = [f for f in listdir(RAWDATA_PATH) if isfile(join(RAWDATA_PATH, f))]\n for file in onlyfiles:\n create_RCSB_fastas(file)", "def initial_processing(subject_dir):\n # get subject name\n subject_name = subject_dir.parts[-1]\n\n # create ${subject_dir}/ASL and ${subject...
[ "0.5513317", "0.55078816", "0.5401565", "0.53775054", "0.53684473", "0.53684455", "0.5358436", "0.5356014", "0.5325273", "0.531172", "0.53011775", "0.52965647", "0.527821", "0.5257222", "0.52564025", "0.5237875", "0.52120996", "0.52038366", "0.5189393", "0.51522464", "0.51471...
0.5015862
31
Create dummy tensor of longest length to pad for adversary
def collate_adv(self, batch): dummy_adv_phone_tensor = torch.from_numpy(np.zeros(shape=(15,))) # 15 is max length of transcription sequence including SOS and EOS dummy_adv_phone_tensor = dummy_adv_phone_tensor.to(torch.float32) """Most everything else is the same""" spectrograms = [item...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_zeros(x):\n dim = tf.shape(x)[0]\n log2_dim = tf.math.log(tf.cast(dim, tf.float32)) / tf.math.log(2.0)\n pad_dim = tf.pow(2, tf.cast(tf.math.ceil(log2_dim), tf.int32))\n with tf.control_dependencies([tf.debugging.assert_rank(x, 1)]):\n return tf.pad(x, [[0, tf.maximum(0, pad_dim - dim)]])", "def s...
[ "0.69676924", "0.694997", "0.68974465", "0.67719644", "0.67479026", "0.6743997", "0.67088985", "0.67006475", "0.6668731", "0.66501755", "0.66375893", "0.66347855", "0.65708846", "0.6551476", "0.65336", "0.6531403", "0.65311104", "0.6521792", "0.6374594", "0.6359308", "0.63560...
0.0
-1
Return true if it's a JavaScript source.
def test_js_source(self): actual = is_js_source(self.view) self.assertTrue(actual)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_non_js_source(self):\n self.view.set_syntax_file(\"Packages/Python/Python.tmLanguage\")\n\n actual = is_js_source(self.view)\n\n self.assertFalse(actual)", "def is_js_file(fname):\r\n return REJS.search(fname) and \\\r\n TEST_INDICATOR not in fname", "def isJsFile(path):...
[ "0.72429377", "0.6709106", "0.66963446", "0.64444417", "0.62756056", "0.6237253", "0.6226813", "0.6111022", "0.5996234", "0.5935359", "0.58793366", "0.5862295", "0.58062017", "0.5804725", "0.5759924", "0.566558", "0.56178796", "0.5614935", "0.55970407", "0.55769956", "0.55665...
0.7687013
0
Return false if it's not a JS source.
def test_non_js_source(self): self.view.set_syntax_file("Packages/Python/Python.tmLanguage") actual = is_js_source(self.view) self.assertFalse(actual)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_js_source(self):\n actual = is_js_source(self.view)\n\n self.assertTrue(actual)", "def is_js_file(fname):\r\n return REJS.search(fname) and \\\r\n TEST_INDICATOR not in fname", "def isJsFile(path):\n return os.path.splitext(path)[1] == '.js'", "def has_source_file( self ):...
[ "0.7866086", "0.6981806", "0.68132186", "0.6648081", "0.63434523", "0.62751704", "0.62293243", "0.61936146", "0.6170908", "0.6103844", "0.60846484", "0.60547394", "0.6031727", "0.6030578", "0.5997301", "0.5979819", "0.5919813", "0.58965653", "0.5846535", "0.58112514", "0.5780...
0.7661912
1
combine all similarity measures into single score
def similarity_score(a,b): jsc_scaler = 15 ocs_scaler = 5 tcss_scaler = 0.05 jaccard_similarity_coefficient_score = jsc_scaler * jaccard_similarity_coefficient(a,b) overlap_coefficient_score = ocs_scaler * overlap_coefficient(a,b) total_char_similarity_score = tcss_scaler * total_char_similarity(a,b) total_scor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def similarity_search(self):\n self.ssr = {gene: self.ssw.get_phenotypically_similar_genes(phenotypes, taxon=self.taxon) for gene, phenotypes in self.gene2phenotype_associations.items()}\n self.results = [ssr.get_results() for ssr in self.ssr.values()]\n self.phenogene_score = reduce(lambda x,...
[ "0.65878206", "0.64811784", "0.62395096", "0.6237274", "0.6205374", "0.6188678", "0.61824363", "0.6181081", "0.61457", "0.6135755", "0.61197", "0.6090049", "0.6086925", "0.6083988", "0.6074309", "0.6043134", "0.60306597", "0.60225576", "0.60199016", "0.6013829", "0.6005431", ...
0.6321166
3
Simple test of applyFunction() function. The function we'll apply is exp(x) so this is equivalent to the test_exp tests above
def test_applyFunction(self): ptwise_linear = XYs1d(axes=XYs1d.defaultAxes(labelsUnits={ XYs1dModule.yAxisIndex: ('crossSection', 'b'), XYs1dModule.xAxisIndex: ('energy_in', 'eV')}), data=[[1e-5, 1.0], [20.0e6, 21.0]]) self.assertAlmostEqual(ptwise_linear.evaluate(15.0e6), 16.0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exp(self):\n funcs = ['exp', 'exp_']\n for func in funcs:\n tensor = get_random_test_tensor(max_value=2)\n encrypted = SharedTensor(tensor)\n reference = getattr(tensor, func)()\n encrypted_out = getattr(encrypted, func)()\n self._check(...
[ "0.63081706", "0.6230978", "0.61486775", "0.6126683", "0.6062297", "0.5937917", "0.5935332", "0.58760333", "0.5758355", "0.5745007", "0.5745007", "0.5663189", "0.5640548", "0.5635015", "0.5623988", "0.5621284", "0.55899805", "0.5588484", "0.5581032", "0.55406785", "0.5523366"...
0.73073655
0
Tests of traversing up GNDS hierarchy
def test_parent(self): self.assertEqual( self.xs_const.ancestor, None ) self.assertEqual( self.xs_const.rootAncestor, self.xs_const ) self.assertEqual( self.xs_const.ancestor, None ) self.xs_const.setAncestor( 'fred' ) self.assertEqual( self.xs_const.ancestor, 'fred' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_Tree():", "def traverseTree(mdsnode,dead_branches=False,depth=float('Nan'),current_depth=0,noisy=False,strict=False,tags=False):\n tagdict={}\n if isinstance(mdsnode,mds.tree.Tree): \n mdsnode=mdsnode.getNode(\"\\\\TOP\")\n \n name = get_mds_shortname(mdsnode) \n me = Branch(...
[ "0.6712216", "0.6288564", "0.6222426", "0.61912704", "0.6082186", "0.6045664", "0.6010632", "0.6006964", "0.59376144", "0.5929815", "0.59266883", "0.59031993", "0.5889081", "0.5888845", "0.5888638", "0.58834285", "0.58627", "0.58545256", "0.58476526", "0.5847015", "0.5845282"...
0.0
-1
Filters list of CRAN packages and metadata for a given array of software mentions
def build_df(packages, software_mentions, cran_links, titles): df = pd.DataFrame({'CRAN Package' : packages, 'CRAN Link' : cran_links, 'Title' : titles}) df = df[df['CRAN Package'].isin(software_mentions)] return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _filter_installed_packages(self, packages):\n filtered_packages = []\n for package in packages:\n name = package.name\n for installed in self._top_installed_repository.find_packages(name):\n if installed.key == package.key:\n break\n ...
[ "0.61648244", "0.59064674", "0.586823", "0.58534795", "0.58129144", "0.57932645", "0.5780702", "0.574569", "0.54876506", "0.5449792", "0.54124254", "0.5338315", "0.5329355", "0.5319731", "0.53164315", "0.5304868", "0.5286493", "0.52616996", "0.5226314", "0.5220258", "0.520920...
0.57852787
6
Retrieves links and metadata from the CRAN repository for a list of software mentions.
def get_cran_df(software_mentions, filename = None, save_new = True): filename_exists = exists(filename) if filename_exists and not save_new: print('- Retrieving saved CRAN file:', filename) return pd.read_csv(filename) elif not filename_exists and not save_new: raise Exception('- Sorry, the file', f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getContributors(auth):\n users = []\n r = requests.get(url='https://gist.github.com/paulmillr/2657075/',\n auth=auth)\n soup = BeautifulSoup(r.text, 'html.parser')\n users = [tr.select_one('a').text for tr in soup('tbody')[0].select('tr')]\n return users", "def collect_citation_meta...
[ "0.5758305", "0.56982356", "0.55455464", "0.53961664", "0.53705347", "0.5366114", "0.53286135", "0.5226537", "0.5211295", "0.51962847", "0.5171388", "0.51701033", "0.5125818", "0.50910467", "0.50589", "0.5043194", "0.5025954", "0.50184816", "0.5018108", "0.5009344", "0.500316...
0.0
-1
Loads the schedulers state.
def load_state_dict(self, state_dict): self.__dict__.update(state_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_state_dict(self, state: dict):\n for o, dct in zip(self.optimizers, state.get('optimizers', [])):\n o.load_state_dict(dct)\n for s, dct in zip(self.schedulers, state.get('schedulers', [])):\n s.load_state_dict(dct)", "def _load_state_dict(self, state: dict):\n ...
[ "0.6747899", "0.6747899", "0.6669607", "0.6487705", "0.64369476", "0.64369476", "0.64369476", "0.64369476", "0.64369476", "0.64369476", "0.64369476", "0.64369476", "0.64369476", "0.6360741", "0.6294948", "0.62494737", "0.6181577", "0.61719745", "0.61689407", "0.61068344", "0....
0.0
-1
Creates all database tables.
def initdb(): db.create_all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tables():\n db.create_all()", "def create_tables():\n db.create_all()", "def create_all_tables():\n\tcommon_db.create_all_tables()", "def create_tables():\n db.create_all()", "def create_db_tables():\n\n try:\n webapp.dbsql.create_all()\n webapp.dbsql.session.co...
[ "0.90490264", "0.90490264", "0.90303427", "0.8878403", "0.8667726", "0.8665649", "0.86038023", "0.8575255", "0.85521376", "0.8430205", "0.8323267", "0.8294338", "0.80128086", "0.79913557", "0.79555404", "0.79508626", "0.7938032", "0.7930278", "0.79032606", "0.78875494", "0.78...
0.743903
72
Drops all database tables.
def dropdb(): db.drop_all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop_all_tables():\n\tcommon_db.drop_all_tables()", "def drop_all_tables(args):\n engine = sqlalchemy.create_engine(CONFIG.db_uri)\n print(\"Dropping all tables on {}...\".format(CONFIG.db_uri), end=\" \")\n Base.metadata.drop_all(bind=engine)\n print(\"finished.\")", "def drop_tables() -> None...
[ "0.8857266", "0.8710739", "0.84407437", "0.84020525", "0.8315211", "0.8266745", "0.800701", "0.7992689", "0.79507643", "0.794851", "0.7897835", "0.7893143", "0.7868288", "0.7847475", "0.7834109", "0.7800142", "0.77895695", "0.7765368", "0.77633756", "0.77343154", "0.7734028",...
0.7677401
34
Fix a 3D dataset recursively to enforce watertight manifolds, it is copyonly. It does not change the source.
def fix( resolution: int = typer.Option( 5_000, help="the number of leaf nodes of octree. The face number increases linearly with the resolution.", ), simplify: bool = typer.Option( False, help="if True, tries to simplify the obtained manifold" ), manifold_check: bool = typer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fix_data(self, cube: Cube) -> Cube:\n return cube", "def test_fix_data(self):\n cube = self.fix.fix_data(self.cube)\n np.testing.assert_allclose(cube.data[0], 1.0)\n np.testing.assert_allclose(cube.data[2], 2.0)\n assert not np.ma.is_masked(cube.data[0])\n assert np....
[ "0.5982272", "0.5936331", "0.57506317", "0.5538353", "0.55340886", "0.54715705", "0.54591495", "0.5380183", "0.53772956", "0.53655994", "0.5328793", "0.5279874", "0.5272796", "0.5261189", "0.52566725", "0.5224833", "0.5178111", "0.51780534", "0.5166307", "0.5141794", "0.51339...
0.5803143
2
Generates authentication signature and return it in a dictionary
def generate_auth_dict(self) -> Dict[str, str]: # api.exchange.bitcoin.com uses Basic Authentication https://api.exchange.bitcoin.com/#authentication message = self.api_key + ":" + self.secret_key signature = base64.b64encode(bytes(message, "utf8")).decode("utf8") return { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_signature(self):\n sig_contents = \\\n self.payload + \".\" + \\\n b64encode(b\"application/xml\").decode(\"ascii\") + \".\" + \\\n b64encode(b\"base64url\").decode(\"ascii\") + \".\" + \\\n b64encode(b\"RSA-SHA256\").decode(\"ascii\")\n sig_hash...
[ "0.6962848", "0.6560777", "0.63824123", "0.63468164", "0.62796557", "0.62087584", "0.6205923", "0.6185844", "0.61836755", "0.6151539", "0.61321473", "0.61204165", "0.60580724", "0.6041897", "0.60394365", "0.60393846", "0.60349697", "0.6024893", "0.6023378", "0.6000974", "0.59...
0.7768794
0
Generates authentication headers required by bitcoin_com
def get_headers(self) -> Dict[str, str]: header_dict = self.generate_auth_dict() return { "Authorization": "Basic " + header_dict["signature"], "Content-Type": 'application/json', }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getHeaders():\n userid = rhev_settings.USERNAME\n passwd = rhev_settings.PASSWORD\n # base64.encodestring adds trailing \\n. \n auth = base64.encodestring(\"%s:%s\" % (userid, passwd)).rstrip(\"\\n\")\n headers = {\"Content-Type\": \"application/xml\",\n \"Accept\": \"applica...
[ "0.7698527", "0.7321881", "0.731975", "0.7242912", "0.7227", "0.7122539", "0.71201617", "0.711637", "0.7112385", "0.7055011", "0.70260453", "0.69531006", "0.69452506", "0.6907244", "0.6905155", "0.6896297", "0.6872004", "0.68131626", "0.68109024", "0.6805357", "0.67865443", ...
0.7026986
10
get queries the database on model, starting with key, ordered by order. It receives count + 1 items, returning count and setting a next field to the count + 1 item key. It then reverses the sort, and grabs count objects, returning the last as a the previous.
def get(cls, count=10, q_filters={}, search=None, start=None, model=None, \ order='ASC', order_by='__key__'): # argument validation if model == None: raise ValueError('You must pass a model to query') # a valid model object will have a gql method. if callable(mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _Next(self, count=None):\n if count is not None and (not isinstance(count, (int, long)) or count <= 0):\n raise datastore_errors.BadArgumentError(\n 'Argument to _Next must be an int greater than 0; received %s (a %s)' %\n (count, typename(count)))\n\n if self.__buffer:\n if count...
[ "0.5825054", "0.57874614", "0.5762056", "0.57196856", "0.5508844", "0.543483", "0.54082257", "0.5403575", "0.53032744", "0.5227761", "0.5183222", "0.51502746", "0.51306784", "0.51216686", "0.51101565", "0.5067596", "0.5039265", "0.49751845", "0.49702373", "0.4947512", "0.4947...
0.5722251
3
Write a JSON dictionary (with formatting) to a file.
def write_json(fd, data, indent=DEFAULT_JSON_INDENT): print(json.dumps(data, indent=indent), file=fd)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_json(fname, dictionary, overwrite=False, verbose=False):\n if op.exists(fname) and not overwrite:\n raise FileExistsError(f'\"{fname}\" already exists. '\n 'Please set overwrite to True.')\n\n json_output = json.dumps(dictionary, indent=4)\n with open(fname, ...
[ "0.8473659", "0.8349206", "0.8287237", "0.8284883", "0.8232919", "0.8181084", "0.8142443", "0.7959556", "0.7923507", "0.7899531", "0.7847865", "0.7776783", "0.7734701", "0.7602273", "0.759944", "0.7568202", "0.7562128", "0.7525241", "0.75060785", "0.7493676", "0.74867713", ...
0.7724335
13
Write the log list to a file in CSV format.
def write_csv(fd, data): # df = pd.DataFrame.from_dict(data) df = pd.io.json.json_normalize(data) print(df.to_csv(index=False), file=fd)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_to_csv(self, log):\n if os.path.isfile(self.GENERATE_FILE):\n os.remove(self.GENERATE_FILE)\n\n with open(self.GENERATE_FILE, \"w\") as f:\n f.write(\"date, time, username, succes, label\\n\")\n\n for entry in log:\n f.write(str(entry[0].date...
[ "0.7428112", "0.7227314", "0.72092676", "0.7194344", "0.7063981", "0.7051082", "0.69845295", "0.69353986", "0.69166434", "0.6862596", "0.6825977", "0.6797636", "0.677685", "0.67385906", "0.6696633", "0.6678054", "0.66654414", "0.6664616", "0.66165817", "0.6615615", "0.6590226...
0.0
-1
Memoize the return value for each call to f(args). Then when called again with same args, we can just look it up.
def memo(f): # Peter Norvig's cache = {} def _f(*args): try: return cache[args] except KeyError: cache[args] = result = f(*args) return result except TypeError: # some element of args can't be a dict key return f(*args) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def memoize(f):\r\n cache = {}\r\n\r\n def rval(*args, **kwargs):\r\n kwtup = tuple(kwargs.items())\r\n key = (args, kwtup)\r\n if key not in cache:\r\n val = f(*args, **kwargs)\r\n cache[key] = val\r\n else:\r\n val = cache[key]\r\n return ...
[ "0.8172702", "0.81722903", "0.8114816", "0.8114816", "0.8114816", "0.809287", "0.79903597", "0.7919817", "0.7799661", "0.76765585", "0.76765585", "0.75987655", "0.7522499", "0.7510138", "0.750118", "0.7474494", "0.740921", "0.7344802", "0.73361546", "0.7307906", "0.72194403",...
0.7604618
11
bspline basis function c = number of control points. n = number of points on the curve. degree = curve degree
def bspline_basis(c, n, degree): # Create knot vector and a range of samples on the curve kv = np.array([0] * degree + [i for i in range(c - degree + 1)] + [c - degree] * degree, dtype='int') # knot vector u = np.linspace(0, c - degree, n) # samples range # Cox - DeBoor recursive fu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bspline(cv, n=100, degree=3, periodic=False):\n cv = np.asarray(cv)\n count = cv.shape[0]\n\n # Closed curve\n if periodic:\n kv = np.arange(-degree,count+degree+1)\n factor, fraction = divmod(count+degree+1, count)\n cv = np.roll(np.concatenate((cv,) * factor + (cv[:fraction],...
[ "0.7293481", "0.7283197", "0.7199199", "0.6930515", "0.68969107", "0.68087196", "0.6772325", "0.67143494", "0.6530433", "0.6447313", "0.6427295", "0.63659334", "0.63659334", "0.6351063", "0.63298196", "0.6279631", "0.6192802", "0.61839586", "0.6183348", "0.6149349", "0.609567...
0.85616636
0
Converts a string in scientific notation format to a float in regular format
def sci_notation_to_float(n): if 'e' in n: exponent = float(n[n.find('e') + 1:]) number = float(n[:n.find('-') - 1]) number *= 10**exponent return number return n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_float(self, s: str) -> float:\n return int(s[:-1]) / 1e9 if s.endswith('n') else float(s[:-1])", "def read_endf_float(string):\n if string.strip() == \"\":\n return 0.0\n if \".\" in string:\n strsplit = string.split('.')\n return float(strsplit[0]+\".\"+strsplit[1].repl...
[ "0.7992028", "0.7631141", "0.7486856", "0.74595267", "0.7453234", "0.74226296", "0.7370093", "0.7352414", "0.7284855", "0.7278769", "0.72506315", "0.7243346", "0.7219503", "0.7211098", "0.7196211", "0.719186", "0.7183101", "0.7158389", "0.71015143", "0.70598835", "0.6937231",...
0.7549512
2
Parses needed information from HAAR training data in an XML
def haar_parser(): tree = ET.parse('haarcascade_frontalface_alt.xml') root = tree.getroot() stage_number = 0 for haar_data in root.findall('haarcascade_frontalface_alt'): for stage in haar_data.findall('stages'): for underscore in stage.findall('_'): for tree in und...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_train_data(training_set, language):\n print \"Reading training set: \" + training_set\n xmldoc = minidom.parse(training_set)\n lex_list = xmldoc.getElementsByTagName('lexelt')\n training_output = {}\n\n print \"Processing training set and training models...\"\n for node in lex_list:\n ...
[ "0.6703193", "0.60255843", "0.59246445", "0.5912362", "0.5693699", "0.56034493", "0.55347985", "0.5478435", "0.5460303", "0.5457903", "0.54251546", "0.5424459", "0.53948337", "0.5363094", "0.5358695", "0.5322238", "0.5317914", "0.5302025", "0.5210451", "0.5201718", "0.5198267...
0.688683
0
Provide a configuration for testing.
def setUp(self) -> None: self.config = TMConfiguration( "q2", TMTape( tape="abcdefghij", blank_symbol=".", current_position=2, ), ) self.config2 = MTMConfiguration( "q1", ( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUpConfig(self):\n pass", "def configuration():", "def configure_test(self, test, config_json):\n pass", "def config(self, **kw):\n self.cfg_fixture.config(**kw)", "def test_config_class():\n assert config is not None", "def test_configuration(self):\n self.assert...
[ "0.7677674", "0.7560945", "0.75177604", "0.7468991", "0.727222", "0.7245467", "0.7211508", "0.7211508", "0.71387666", "0.71387666", "0.7129564", "0.71272254", "0.70441407", "0.70441407", "0.7002823", "0.698103", "0.69522583", "0.68959874", "0.68959874", "0.68742955", "0.68720...
0.0
-1
Should return a string representation ot the given configuration.
def test_repr_config(self) -> None: self.assertEqual( repr(self.config), "TMConfiguration('q2', TMTape('abcdefghij', '.', 2))" ) self.assertEqual( repr(self.config2), "MTMConfiguration('q1', (TMTape('abcdefghij', '.', 2), " + "TMTape('klmnopq', '.'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__():\n return str(_config)", "def __str__(self):\n config_str = 'Configurations\\n'\n config_str += pprint.pformat(self.__dict__)\n return config_str", "def _config_str(config: Config) -> str:\n _C = config\n\n __C: CN = CN({\"RANDOM_SEED\": _C.random_seed})\n common_...
[ "0.8179262", "0.7857372", "0.7363686", "0.736264", "0.7243665", "0.71599424", "0.71418977", "0.7087945", "0.6956395", "0.69093025", "0.68716145", "0.68227834", "0.67673093", "0.6715892", "0.6702617", "0.6695986", "0.6667891", "0.66585165", "0.6611901", "0.65899265", "0.658992...
0.6567749
22
Should print the given configuration to stdout.
def test_print_config(self) -> None: out = io.StringIO() with contextlib.redirect_stdout(out): self.config.print() self.assertEqual( out.getvalue().rstrip(), "{}: {}\n{}".format("q2", "abcdefghij", "^".rjust(7)), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_configuration():\n configlog.info(\"-\" * 50)\n configlog.info(\"Initializing with the following configuration\")\n configlog.info(\"Check constants.py to change any of the following\")\n configlog.info(\"-\" * 50)\n configlog.info(\"COMPANY_NAME: {}\".format(COMPANY_NAME))\n configlog....
[ "0.7587259", "0.7523338", "0.7368167", "0.7342062", "0.7209493", "0.71788865", "0.7166884", "0.7094218", "0.6971661", "0.6958332", "0.6929667", "0.69253343", "0.6881229", "0.6872495", "0.6839328", "0.68237674", "0.67180383", "0.6690289", "0.6649938", "0.6621531", "0.65711033"...
0.7887999
0
Should print each machine configuration to stdout.
def test_print_configs(self, print_config: MagicMock) -> None: tape1 = TMTape( tape="01010101", blank_symbol=".", current_position=0, ) tape2 = TMTape( tape="x1010101", blank_symbol=".", current_position=-1, ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_config(self):\n for pod in self.pods:\n for lb in pod.limbs:\n print '%s limb %s ' % (pod.name, lb.name)\n for br in lb.branches:\n br.printInfo()\n sys.stdout.flush()", "def print_seeds(self):\n for key in self.CONFIG.key...
[ "0.69533426", "0.6825423", "0.6796512", "0.66759825", "0.66358614", "0.65241665", "0.6459319", "0.63130814", "0.6197961", "0.618339", "0.61394787", "0.61050266", "0.60956085", "0.60902673", "0.6064124", "0.60114497", "0.5990517", "0.5986336", "0.5973117", "0.59216833", "0.591...
0.63539267
7
Should be able to iterate over a Turing machine tape.
def test_tape_iteration(self) -> None: tape = TMTape( tape="abcdef", blank_symbol=".", current_position=2, ) self.assertEqual(tuple(tape), ("a", "b", "c", "d", "e", "f"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self) -> Iterator[str]:\n return iter(self.tape)", "def test_machine_get_tape(self):\n self.machine.add_state('0 ,R, ,R, ,R, a,N,!')\n self.machine.init_tape(' aba caba_caba caba ')\n assert self.machine.get_tape() == 'aba caba caba caba'", "def test_machine_i...
[ "0.62442267", "0.58754504", "0.56811714", "0.5394346", "0.5377582", "0.5257124", "0.52406955", "0.52118194", "0.51803154", "0.51783246", "0.5150232", "0.5150232", "0.51491994", "0.51241785", "0.51049644", "0.5098543", "0.5087977", "0.50546545", "0.5031224", "0.50128055", "0.5...
0.6964048
0
Should print tape contents as a string without spaces.
def test_get_symbols_as_str(self) -> None: tape = TMTape( tape="abcdef", blank_symbol=".", current_position=2, ) self.assertEqual(tape.get_symbols_as_str(), "abcdef")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printTape(self):\n print(self.loadedTape.tape)", "def __str__(self):\n tapeline = self.tape.format(\n self.index - 10, self.index + 11) + ' : state {}'.format(self.state)\n pointline = ' ' * 10 + '^' + ' ' * 11 + \\\n ' : index {}'.format(self.index)\n\n retu...
[ "0.6766568", "0.6310775", "0.6097003", "0.60133976", "0.60097545", "0.5993959", "0.58844167", "0.57744575", "0.57032126", "0.56988627", "0.56829554", "0.5672349", "0.56661415", "0.56618303", "0.5640181", "0.5631739", "0.56209093", "0.5618605", "0.56118405", "0.55996954", "0.5...
0.6144317
2
Main method that manages supported CLI commands.
def parse(): parser = argparse.ArgumentParser(prog='ebrctl') parser.add_argument('action', action='store_true') parent_parser = argparse.ArgumentParser(add_help=False) parent_parser.add_argument('vnic_mac') parent_parser.add_argument('device_id') parent_parser.add_argument('fabric') parent_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli():\n config, auth, execute_now = read_command_line_arguments()\n main(config, auth, execute_now)", "def main_cli():\n pass", "def cli():\n pass", "def cli() -> None:", "def cli() -> None:", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():...
[ "0.8019155", "0.79849946", "0.7895816", "0.7866512", "0.7866512", "0.78625804", "0.78625804", "0.78625804", "0.78625804", "0.78625804", "0.78625804", "0.78625804", "0.78625804", "0.78625804", "0.78625804", "0.78625804", "0.78625804", "0.78625804", "0.78625804", "0.78625804", ...
0.0
-1
Opens a cloud manifest file at `path` Converts headers of file to lowercase since partners choose to capitalize arbitrarily returns dictionary
def read_data_from_cloud_manifest(path: str) -> dict: with open_cloud_file(path, 'r') as csv_file: def clean_file_header(header: str) -> str: return header.strip().lower() data_to_ingest = {'rows': []} csv_reader = csv.DictReader(csv_file, delimiter=",") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_manifest(path: Path):\n with open(path, \"rt\") as fin:\n data = json_load(fin)\n return Manifest.schema().load(data, many=True)", "def get_manifest(path: str):\n base_url = urlparse(path.strip(\"/\"))\n if base_url.scheme != \"s3\":\n raise click.UsageError(\n ...
[ "0.6254436", "0.5879989", "0.5814724", "0.5759604", "0.5759604", "0.56664675", "0.5661104", "0.56387746", "0.5431581", "0.5358934", "0.5356918", "0.52470446", "0.51743126", "0.5156279", "0.5142583", "0.51353735", "0.50975263", "0.5095046", "0.50825524", "0.50421375", "0.50267...
0.591603
1
Simple check for column names in the model
def validate_columns(self, fieldnames, dao): unstored_columns = ['blank'] expected_columns = dao.model_type.__table__.columns.keys() + unstored_columns for column_name in fieldnames: if column_name not in expected_columns: raise AttributeError(f"{self.file_path}: {col...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_defined_table_columns(model):\n inst = inspect(model)\n columns_from_model = [c_attr.key for c_attr in inst.mapper.column_attrs]\n _, columns = run_mysql(f\"SELECT * FROM {model.__tablename__} LIMIT 1;\")\n\n assert len(columns) == len(columns_from_model)\n assert set(columns) == set(column...
[ "0.7103625", "0.71008795", "0.7066106", "0.6932352", "0.68645114", "0.68028975", "0.6765049", "0.67301756", "0.6637777", "0.65766287", "0.6562689", "0.6500888", "0.6491967", "0.64716387", "0.6445888", "0.64357543", "0.64071035", "0.6393606", "0.6348869", "0.6317435", "0.62963...
0.6846554
5
Entrypoint for SMS Workflow execution. Creates a SmsJobController and determines which process to run
def execute_workflow(self): logging.info(f"called {self.job} with {self.file_type}") job_params = { "job": self.job, "job_run_dao": self.job_run_dao, "incident_dao": self.incident_dao, "subprocess": self.file_type } with SmsJobController(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startComponent(self):\n\n # create message service instance\n self.ms = MessageService()\n\n # register\n self.ms.registerAs(\"MergeAccountant\")\n\n # subscribe to messages\n self.ms.subscribeTo(\"MergeAccountant:StartDebug\")\n self.ms.subscribeTo(\"MergeAccou...
[ "0.56484526", "0.55505526", "0.5288705", "0.52483284", "0.5208785", "0.5174079", "0.51654077", "0.51620835", "0.5160946", "0.51558024", "0.5151097", "0.51483196", "0.51433206", "0.5128541", "0.51023465", "0.5086026", "0.5081889", "0.50711775", "0.50601345", "0.50407666", "0.5...
0.68931174
0
Main method for ingestion jobs.
def job_ingestion(self): # Map a file type to a DAO if self.file_type == SmsFileTypes.SAMPLE_LIST: self.file_dao = SmsSampleDao() elif self.file_type == SmsFileTypes.N0: self.file_dao = SmsN0Dao() else: self.file_dao = None if self.file_dao: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n spark = create_spark_session()\n\n input_data = config['STORAGE']['INPUT_DATA']\n output_data = config['STORAGE']['OUTPUT_DATA']\n\n process_song_data(spark, input_data, output_data)\n process_log_data(spark, input_data, output_data)", "def run_job(self):\n try:\n s...
[ "0.6997714", "0.68329793", "0.6822117", "0.6762344", "0.6738576", "0.6704812", "0.66714764", "0.66658384", "0.65523964", "0.6488315", "0.64466643", "0.6445014", "0.6421937", "0.6421163", "0.6390063", "0.6383545", "0.63780874", "0.63768274", "0.63713306", "0.63640106", "0.6357...
0.6597942
8
Main method for generation jobs.
def job_generation(self): # Map a file type to a DAO if self.file_type == SmsFileTypes.N1_MC1: self.file_dao = SmsN1Mc1Dao() else: self.file_dao = None if self.file_dao: source_data = self.file_dao.source_data(recipient=self.recipient) i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n # get arguments from command line\n args = parse_arguments()\n\n # checks on the output file\n # if args.stats_only:\n # assert args.output, \"The output file was not provided\"\n if args.output and os.path.exists(args.output):\n warnings.warn(\"Overwriting task file \" +...
[ "0.7010729", "0.6841828", "0.67838526", "0.67346454", "0.66830397", "0.6663848", "0.66300994", "0.65998673", "0.6383176", "0.63787377", "0.63738227", "0.6341983", "0.63118374", "0.62905675", "0.62900835", "0.62722236", "0.6258422", "0.62582326", "0.6255362", "0.62542695", "0....
0.6215068
27
Process the prune/clear command.
async def process_prune( channel, amount, user_id: int, ctx=None, inter=None, allowed_mentions=None ): user = await User.get(user_id) if amount not in range(PRUNE_MIN, PRUNE_MAX): return await send_message( PRUNE_MIN, PRUNE_MAX, key="not_in_range", use...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(self, *extra_args):\n self.arguments.message = 'Pruned MediaWiki: %s' % self.arguments.branch\n if not self.arguments.delete:\n self.arguments.message += ' [keeping static files]'\n self.arguments.force = False\n return super(Clean, self).main(*extra_args)", "def p...
[ "0.6189046", "0.5942759", "0.5925492", "0.58126813", "0.5764557", "0.5754827", "0.57539445", "0.57497984", "0.56477517", "0.5625253", "0.5578176", "0.5539403", "0.54893595", "0.5482096", "0.54248", "0.5415695", "0.5357811", "0.5355897", "0.5350661", "0.5341999", "0.5336706", ...
0.55016893
12
Add a command prefix to a guild.
async def process_prefix_add_remove( guild: disnake.Guild, prefix: str, ctx: commands.Context = None, inter: AppCmdInter = None, allowed_mentions=None, add=False, ): await create_guild_model(guild) guild = await Guild.get(guild.id) if add: await guild.add_prefix(prefix) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def prefix(self, ctx, prefix):\n if prefix.strip() == \"\":\n raise exceptions.Warning(\"Prefix cannot be empty.\")\n\n if prefix.startswith(\" \"):\n raise exceptions.Warning(\"Prefix cannot start with a space.\")\n\n if len(prefix) > 32:\n raise excepti...
[ "0.7765609", "0.7438157", "0.7337754", "0.72621065", "0.71957946", "0.7084846", "0.7023182", "0.7022211", "0.6995119", "0.6882482", "0.68795705", "0.68495554", "0.68444985", "0.6843278", "0.683003", "0.6727373", "0.6712273", "0.6662263", "0.66496396", "0.64985317", "0.6413639...
0.7127585
5
Process the adding of an emoji to a server.
async def process_add_emoji( emoji, emoji_name, user_id, ctx: commands.Context = None, inter: AppCmdInter = None, allowed_mentions=None, ): response_deferred = await defer_inter(inter) url = emoji if not isinstance(emoji, disnake.PartialEmoji) else emoji.url user = await User.get(use...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def add_emoji(\n client,\n event,\n emoji: ('str', 'The emoji to add.'),\n name: ('str', 'Custom name to add the emoji with.') = None\n):\n if not client.is_owner(event.user):\n abort('Owner only!')\n \n emoji = parse_emoji(emoji)\n if emoji is None:\n abort('That\\'s no...
[ "0.67287016", "0.6683286", "0.6535552", "0.63595986", "0.61546665", "0.61545706", "0.6151", "0.6147468", "0.60753864", "0.602852", "0.5925072", "0.58887196", "0.5861602", "0.58516765", "0.57721126", "0.5765197", "0.57616425", "0.5761379", "0.56382954", "0.55763", "0.555645", ...
0.7052691
0
Send the command prefixes of a guild.
async def process_prefix_list( guild: disnake.Guild, ctx: commands.Context = None, inter: AppCmdInter = None, allowed_mentions=None, ): await create_guild_model(guild) guild = await Guild.get(guild.id) msg = f"The following are the custom prefixes for {guild.name}:\n" + ", ".join( gu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def on_guild_join(self, guild: discord.Guild):\n with open(\"./config/prefixes.json\", \"r\") as f:\n prefixes = json.load(f)\n\n prefixes[str(guild.id)] = \".\"\n\n with open(\"./config/prefixes.json\", \"w\") as f:\n json.dump(prefixes, f, indent=4)", "async def...
[ "0.72532135", "0.70512486", "0.6933154", "0.67259693", "0.66195005", "0.65402573", "0.65276223", "0.6477757", "0.6397897", "0.6349567", "0.63149333", "0.6312094", "0.62954944", "0.6294326", "0.62471807", "0.62218827", "0.6151493", "0.61468345", "0.61232364", "0.6099351", "0.6...
0.74725825
0
Autocomplete typing for the command prefixes in a guild.
async def auto_complete_type_guild_prefixes( inter: disnake.AppCmdInter, user_input: str ) -> List[str]: await create_guild_model(inter.guild) guild = await Guild.get(inter.guild_id) return guild.prefixes[:24]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def process_prefix_list(\n guild: disnake.Guild,\n ctx: commands.Context = None,\n inter: AppCmdInter = None,\n allowed_mentions=None,\n):\n await create_guild_model(guild)\n guild = await Guild.get(guild.id)\n msg = f\"The following are the custom prefixes for {guild.name}:\\n\" + \", \...
[ "0.6334425", "0.61928004", "0.59438735", "0.5882108", "0.58367133", "0.5759399", "0.56862473", "0.566724", "0.5637605", "0.5576028", "0.55751395", "0.55580425", "0.5514969", "0.54804295", "0.5447843", "0.54456246", "0.5445153", "0.54353315", "0.54343086", "0.53711796", "0.536...
0.79266447
0
Add a reaction role.
async def process_add_reaction_role( user_id, description, ctx=None, inter=None, allowed_mentions=None ): user = await User.get(user_id) response_deferred = await defer_inter(inter, ephemeral=True) view = disnake.ui.View(timeout=None) view.add_item(RoleDropdown(description)) await send_message( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def rolemenu_add_role(self,\n interaction: discord.Interaction,\n name: str,\n role: discord.Role,\n emoji: str = None,\n description: str = None):\n ...
[ "0.74878365", "0.7185206", "0.7157245", "0.71171796", "0.70440525", "0.7006333", "0.6889938", "0.68790966", "0.6827275", "0.6738522", "0.67022955", "0.6666086", "0.6641454", "0.662785", "0.6625806", "0.66136146", "0.6613041", "0.66006094", "0.65936184", "0.6589437", "0.656451...
0.6762945
9
Post the reaction roles message
async def reaction_roles_post(inter: MessageInteraction, description, roles): view = disnake.ui.View(timeout=None) for role in roles: view.add_item(disnake.ui.Button(label=role.name, custom_id=role.id)) messages = await send_message(msg=description, channel=inter.channel, view=view) for message ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def setroles(self, ctx):\n if not has_permissions(ctx, MOD_ROLE):\n await ctx.send(\"You do not have sufficient permissions to perform this command\", hidden=True)\n return False\n\n def check(m):\n return m.author == ctx.author\n\n roles_dict = {}\n ...
[ "0.70767516", "0.7048763", "0.70305854", "0.67609715", "0.66043484", "0.6424783", "0.63169235", "0.6300088", "0.6295008", "0.6281987", "0.62049335", "0.6064257", "0.605706", "0.60347486", "0.6028766", "0.6005439", "0.60031676", "0.5964373", "0.59568113", "0.5954478", "0.59193...
0.858319
0
Handles role reaction button presses. A 'on_button_click' listener.
async def handle_role_reaction_press(interaction: disnake.MessageInteraction): if interaction.message not in await ReactionRoleMessage.get_all(): return role_id = int(interaction.component.custom_id) member: disnake.Member = interaction.author user = await User.get(member.id) role = member....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def subscribe_command(self, ctx: commands.Context, *_) -> None: # We don't actually care about the args\n view = RoleButtonView(ctx.author, self.assignable_roles)\n await ctx.send(\n \"Click the buttons below to add or remove your roles!\",\n view=view,\n delet...
[ "0.5762249", "0.5668957", "0.5659755", "0.5601932", "0.5597881", "0.55494606", "0.5509019", "0.550365", "0.54933995", "0.54303074", "0.5379965", "0.53338444", "0.5327616", "0.5321051", "0.5281076", "0.52789605", "0.52783185", "0.5262219", "0.52602375", "0.5247453", "0.5199621...
0.6394534
0
Plateau in refractive index below 330nm for Glass, edge of data artifact
def refractive_index(self): wd = np.arange(80,820,10) nd = self.boundary.imat.refractive_index(wd) plt.plot(wd, nd) return wd, nd
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_index_of_surface_gate(data, setup={}):\n alts = data['alt']\n return np.argmin(np.abs(alts), 1)", "def test_no_backg_subt():\n \n test_object = fa.read_in_envision(data_csv=HsHis6_PEX5C_vs_HsPEX5C, platemap_csv=Hs_His6_PEX5C_vs_HsPEX5C_platemap, data_type='plate', size=384)\n test_object.c...
[ "0.5831233", "0.5830266", "0.5719483", "0.563902", "0.55948025", "0.55843574", "0.5583961", "0.5577517", "0.55708694", "0.5549658", "0.55016595", "0.5486436", "0.54773384", "0.54688746", "0.5463584", "0.54448295", "0.53914726", "0.5348724", "0.5341465", "0.5329872", "0.531499...
0.618945
0
Read h5 format data file
def read_data(path): with h5py.File(path, 'r') as hf: data = np.array(hf.get('data')) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_hdf5(path_to_file):\n\n print(\"\\nReading HDF5 file: \", path_to_file)\n file = h5py.File(path_to_file, 'r')\n\n # List the groups\n groups = list(file.keys())\n print(\"Groups available: \", groups)\n\n # Read Zemax Metadata\n zemax_metadata = {}\n print(\"\\nZemax Metadata:\")\n...
[ "0.7600226", "0.756424", "0.7475437", "0.74319535", "0.74319535", "0.7393015", "0.72876596", "0.7209565", "0.71935135", "0.7171935", "0.7154797", "0.7107951", "0.70604193", "0.70279646", "0.70197207", "0.70096785", "0.6915676", "0.68875426", "0.6883653", "0.6829923", "0.67898...
0.7660385
0
Preprocess single image file (1) Read original image as YCbCr format (and grayscale as default) (2) Normalize (3) Apply image file with bicubic interpolation
def preprocess(path, scale=3): image = imread(path, is_grayscale=True) # Must be normalized image = (image-127.5 )/ 127.5 input_ = scipy.ndimage.interpolation.zoom(input_, (scale/1.), prefilter=False) return input_
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalise(image):", "def preprocess(img):\n \n scaler=StandardScaler() ## scaler object to perform preprocessing\n img=scaler.fit_transform(img) ## zero-center and normalize\n \n return img", "def preprocess(path, img_w, img_h):\n #print(path)\n img = cv2.imre...
[ "0.67356676", "0.6674581", "0.6586979", "0.6573389", "0.6537538", "0.65024185", "0.64687973", "0.64650357", "0.64465904", "0.6442704", "0.6418419", "0.640712", "0.6392954", "0.6363671", "0.6362483", "0.6359591", "0.6263613", "0.6258477", "0.6247825", "0.624503", "0.6207113", ...
0.6635638
2
Make input data as h5 file format Depending on 'is_train' (flag value), savepath would be changed.
def make_data(sess, data, data_dir): if FLAGS.is_train: #savepath = os.path.join(os.getcwd(), os.path.join('checkpoint',data_dir,'train.h5')) savepath = os.path.join('.', os.path.join('checkpoint',data_dir,'train.h5')) if not os.path.exists(os.path.join('.',os.path.join('checkpoint',data_dir))): o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to_hd5(out_file, x_train, y_train, x_val, y_val, x_test, y_test):\n data = h5py.File(out_file, \"w\")\n train_data = data.create_group(\"train_data\")\n train_data.create_dataset(\"x_train\", data=x_train)\n train_data.create_dataset(\"y_train\", data=y_train)\n if x_val is not None:\n ...
[ "0.7217005", "0.70193493", "0.684831", "0.6649944", "0.6624915", "0.656537", "0.6552267", "0.64465964", "0.63645554", "0.6273017", "0.62496", "0.61882937", "0.6150306", "0.610883", "0.6098114", "0.6088304", "0.60781205", "0.6075722", "0.6039973", "0.6017013", "0.59959936", ...
0.71147066
1
Read image using its path. Default value is grayscale, and image is read by YCbCr format as the paper said.
def imread(path, is_grayscale=True): if is_grayscale: return scipy.misc.imread(path, flatten=True, mode='YCbCr').astype(np.float) else: return scipy.misc.imread(path, mode='YCbCr').astype(np.float)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def imread(path, is_grayscale=True):\n if is_grayscale:\n #flatten=True 以灰度图的形式读取 \n return scipy.misc.imread(path, flatten=True, mode='YCbCr').astype(np.float)\n else:\n return scipy.misc.imread(path, mode='YCbCr').astype(np.float)", "def imread(path, is_grayscale=True):\n if is_grayscale:\n ...
[ "0.778447", "0.77261835", "0.7638995", "0.75208247", "0.74676746", "0.74573797", "0.7367039", "0.722754", "0.721408", "0.72122663", "0.71996546", "0.7183188", "0.70761466", "0.7057287", "0.7026387", "0.70155853", "0.6943071", "0.6942862", "0.69331473", "0.689974", "0.6891293"...
0.7768587
1
To scale down and up the original image, first thing to do is to have no remainder while scaling operation. We need to find modulo of height (and width) and scale factor. Then, subtract the modulo from height (and width) of original image size. There would be no remainder even after scaling operation.
def modcrop(image, scale=3): if len(image.shape) == 3: h, w, _ = image.shape h = h - np.mod(h, scale) w = w - np.mod(w, scale) image = image[0:h, 0:w, :] else: h, w = image.shape h = h - np.mod(h, scale) w = w - np.mod(w, scale) image = image[0:h, 0:w] return image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale_down(image:np.array)->np.array:\n src = image\n scale_percent = 25\n width = int(src.shape[1] * scale_percent / 100)\n height = int(src.shape[0] * scale_percent / 100)\n dsize = (width, height)\n output = cv2.resize(src, dsize)\n return output", "def Rescale(self):\r\n picWi...
[ "0.72712576", "0.7073858", "0.7063879", "0.6822762", "0.6660474", "0.66532725", "0.6620047", "0.6618878", "0.660835", "0.65937185", "0.653122", "0.65161115", "0.64969885", "0.648761", "0.64868206", "0.64707977", "0.64599156", "0.6456482", "0.6456482", "0.64336264", "0.6403879...
0.5729484
90
Read image files and make their subimages and saved them as a h5 file format.
def input_setup_MS(sess,config,data_dir,index=0): # Load data path if config.is_train: data = prepare_data(sess, dataset=data_dir) sub_input_sequence = [] padding = 0 if config.is_train: for i in xrange(len(data)): input_=(imread(data[i])-127.5)/127.5 if len(input_.shape) == 3: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_and_write_output(predictions_path,output_path,inpDir):\n \n filenames= sorted(os.listdir(predictions_path)) \n for filename in filenames:\n \n # read the 3 channel output image from the neural network\n image=cv2.imread(os.path.join(predictions_path,filename))\n \...
[ "0.67509365", "0.6384123", "0.635404", "0.62878686", "0.6287435", "0.62700456", "0.6264196", "0.62362057", "0.6180607", "0.6161816", "0.6144989", "0.6094709", "0.6090776", "0.6078111", "0.60713965", "0.60598326", "0.6051427", "0.60020304", "0.5998716", "0.5987901", "0.5978740...
0.0
-1
Read image files and make their subimages and saved them as a h5 file format.
def input_setup_PAN(sess,config,data_dir,index=0): if config.is_train: data = prepare_data(sess, dataset=data_dir) sub_input_sequence = [] padding = 0 if config.is_train: for i in xrange(len(data)): input_=(imread(data[i])-127.5)/127.5 if len(input_.shape) == 3: h, w, _ = input_.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_and_write_output(predictions_path,output_path,inpDir):\n \n filenames= sorted(os.listdir(predictions_path)) \n for filename in filenames:\n \n # read the 3 channel output image from the neural network\n image=cv2.imread(os.path.join(predictions_path,filename))\n \...
[ "0.67501724", "0.6385571", "0.635447", "0.6286945", "0.62869215", "0.62683004", "0.62626487", "0.6237303", "0.617954", "0.61628073", "0.6144604", "0.6095783", "0.60903996", "0.60788053", "0.60707295", "0.60599494", "0.60516787", "0.60040814", "0.59981525", "0.5988912", "0.597...
0.0
-1
Dynamically generate options for resource group form field based on the user's selection for Environment. This method requires the user to set the resource_group parameter as dependent on environment.
def generate_options_for_resource_group(control_value=None, **kwargs): if control_value is None: return [] env = Environment.objects.get(id=control_value) if CB_VERSION_93_PLUS: # Get the Resource Groups as defined on the Environment. The Resource Group is a # CustomField that is o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_options_for_cloudbolt_environment(group=None, **kwargs):\n envs = Environment.objects.filter(\n resource_handler__resource_technology__name='Google Cloud Platform') \\\n .select_related('resource_handler')\n if group:\n group_env_ids = [env.id for env in group.get_available_...
[ "0.6358487", "0.5937777", "0.55043066", "0.54691523", "0.54691523", "0.54691523", "0.54691523", "0.54691523", "0.54691523", "0.54691523", "0.54691523", "0.54691523", "0.54691523", "0.54691523", "0.54691523", "0.54691523", "0.54691523", "0.54691523", "0.54691523", "0.54691523", ...
0.6859024
0
Get the client using newer methods from the CloudBolt main repo if this CB is running a version greater than 9.2.1. These internal methods implicitly take care of much of the other features in CloudBolt such as proxy and ssl verification. Otherwise, manually instantiate clients without support for those other CloudBolt...
def _get_client(handler): if CB_VERSION_93_PLUS: from resourcehandlers.azure_arm.azure_wrapper import configure_arm_client wrapper = handler.get_api_wrapper() sql_client = configure_arm_client(wrapper, sql.SqlManagementClient) else: # TODO: Remove once versions <= 9.2.1 are no l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_client_impl(self):\n api_version = self._get_api_version(None)\n if api_version not in self._client_impls:\n self._create_client_impl(api_version)\n return self._client_impls[api_version]", "def raw_client(self):\r\n warnings.warn(\"raw_client is deprecated. use se...
[ "0.7103304", "0.6904759", "0.65741783", "0.6360245", "0.6288746", "0.62776977", "0.6226399", "0.6196101", "0.6190632", "0.6187057", "0.6171933", "0.61647344", "0.61564815", "0.6148251", "0.61479414", "0.60850495", "0.6072552", "0.60554427", "0.604616", "0.6028892", "0.5996603...
0.5521968
92
Deserialize datetime object into string form for JSON processing.
def dump_datetime(value): if value is None: return None return [value.strftime("%Y-%m-%d"), value.strftime("%H:%M:%S")]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize_datetime(self, obj):\r\n if isinstance(obj, datetime.datetime):\r\n return obj.isoformat()\r\n raise TypeError(\"Type not serializable\")", "def json_datetime_serializer(obj):\n\n if isinstance(obj, datetime):\n serial = obj.isoformat()\n return serial\n ...
[ "0.69946605", "0.69832784", "0.6899136", "0.6865027", "0.6813981", "0.6750276", "0.6649766", "0.6633779", "0.65959406", "0.6547565", "0.65440494", "0.6539357", "0.6486496", "0.6480947", "0.64407444", "0.63945824", "0.6365423", "0.63568634", "0.6337701", "0.6311433", "0.629324...
0.5694063
78
Run the linter and return the exit code.
def run(args=None): parser = init_argument_parser() options = parser.parse_args(args if args is not None else sys.argv[1:]) stdin_filename = None file_names = set(options.files) checked_files = set() # Read input from STDIN if not sys.stdin.isatty(): with tempfile.NamedTemporaryFil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lint_command(argv) -> CommandResult:\n app = FlakeHellApplication(program=NAME, version=VERSION)\n try:\n app.run(argv)\n app.exit()\n except SystemExit as exc:\n return int(exc.code), ''\n raise RuntimeError('unreachable')", "def run(self):\n success = False\n ...
[ "0.7377753", "0.70567983", "0.6740494", "0.67318183", "0.6663239", "0.6513022", "0.6471138", "0.6430389", "0.63975984", "0.63959485", "0.63455653", "0.6329475", "0.63124686", "0.6284871", "0.6266829", "0.6210904", "0.6164137", "0.6136608", "0.61339283", "0.6081217", "0.605742...
0.53075475
88
Returns a new initialized argument parser.
def init_argument_parser(): parser = argparse.ArgumentParser(prog=NAME, description=DESCRIPTION) # The files argument is optional as STDIN is always read parser.add_argument(dest='files', metavar='FILE', nargs='*', default=[], help='one or more files or paths') parser.add_argum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_parser():\n\n parser = parser.ArgumentParser()\n return parser", "def get_parser():\n parser = ArgumentParser(\n description=__doc__, formatter_class=ArgumentDefaultsHelpFormatter\n )\n parser.add_argument(\n \"-s\", \"--sentence\", dest=\"sentence\", help=\"sentence,...
[ "0.7757528", "0.7674221", "0.766556", "0.75634253", "0.7486213", "0.7486213", "0.74758685", "0.74569213", "0.74259055", "0.7384082", "0.737286", "0.7365048", "0.7327146", "0.73229235", "0.7290896", "0.7204032", "0.7203092", "0.71918964", "0.71847415", "0.7169976", "0.7169976"...
0.0
-1
Return the initialized output formatter based upon the configuration.
def initialize_formatter(config): if config.json: # pylint: disable=R1705 return formatters.JsonFormatter() elif config.severity: # pylint: disable=R1705 return formatters.SeverityFormatter(config.colored) return formatters.Formatter(config.colored)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_formatter(self):\n return SectionedFormatter(\n sections=self.sections,\n width=self.terminal_width,\n max_width=self.max_content_width,\n )", "def set_formatter_string(config: dict):\n formatter_str = \"%(levelname)s %(name)s\"\n\n if config.get(\"fo...
[ "0.6507591", "0.59741753", "0.5937114", "0.5926568", "0.5859191", "0.58575606", "0.5845092", "0.5838448", "0.5783071", "0.57651764", "0.57422423", "0.5739221", "0.5724411", "0.56877214", "0.56793237", "0.56695", "0.5667886", "0.566292", "0.56339353", "0.56309354", "0.56209934...
0.74388397
0
Returns the sorted list of problems.
def sort_problems(problems): # Note: sort() doesn't return the sorted list; rather, it sorts the list # in place problems.sort( key=lambda problem: ( problem.filename, problem.linenumber, problem.rule.id ) ) return problems
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def problem_list(self):\r\n return [{\r\n 'location': location, 'problem_name': name,\r\n 'num_graded': self.DUMMY_DATA['problem_list_num_graded'],\r\n 'num_pending': self.DUMMY_DATA['problem_list_num_pending'],\r\n 'num_required': self.DUMMY_DATA['problem_list_nu...
[ "0.6703581", "0.6595729", "0.62168723", "0.6204288", "0.6180413", "0.61678904", "0.6021558", "0.5934097", "0.5893262", "0.58796406", "0.58487594", "0.5641037", "0.5635462", "0.5628445", "0.5586737", "0.5583212", "0.54723084", "0.5472102", "0.547204", "0.5451602", "0.54358476"...
0.75329185
0
This is the stub name that will be used to generate the processed filenames and is the assumed stub for the raw data filename.
def get_dataset_name(self): return self.dataset_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getfilename(self):\n pass", "def data_filename(self) -> str: # type: ignore[return-value]\n return os.path.abspath(self.name) # type: ignore", "def GetFileName(self) -> \"char const *\":\n return _itkVTKPolyDataReaderPython.itkVTKPolyDataReaderMF2_GetFileName(self)", "def filename...
[ "0.6384839", "0.63739693", "0.6017186", "0.6008499", "0.5945327", "0.59224993", "0.58893055", "0.5883021", "0.5876685", "0.5855248", "0.58311427", "0.5830096", "0.5818306", "0.5797959", "0.57899445", "0.5784805", "0.5756411", "0.5752741", "0.57516646", "0.57437134", "0.569571...
0.0
-1
Returns the name of the class attribute to be used for classification.
def get_class_attribute(self): return self.class_attr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self) -> str:\n return self.class_names[self.class_num]", "def get_attribute_class(self, attr_name):\n return self.attrs.get_attribute_class(attr_name)", "def class_name(self) -> str:\n return pulumi.get(self, \"class_name\")", "def get_attribute_class(self):\n return sel...
[ "0.7220845", "0.7191606", "0.7166631", "0.70328903", "0.6854248", "0.68273634", "0.68061316", "0.6639919", "0.66164047", "0.65259147", "0.64209676", "0.64048225", "0.63896745", "0.637577", "0.637577", "0.6366623", "0.6366623", "0.63627464", "0.63504124", "0.63288695", "0.6326...
0.7351364
0
Returns the value used in the dataset to indicate the positive classification choice.
def get_positive_class_val(self, tag): # FIXME this dependence between tags and metadata is bad; don't know how to fix it right now if tag == 'numerical-binsensitive': return 1 else: return self.positive_class_val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __value_of(sentiment):\n if sentiment == 'positive': return 1\n if sentiment == 'negative': return -1\n return 0", "def get_prediction_from_score(score):\n if(score >= 0.03):\n return 'Positive'\n elif(score <= -0.03):\n return 'Negative'\n else:\n return 'Neutral'", ...
[ "0.6920214", "0.6468132", "0.6377437", "0.6298673", "0.6298673", "0.6276346", "0.62528133", "0.62347436", "0.6230235", "0.61446166", "0.61428374", "0.6095599", "0.60748625", "0.6050616", "0.6050616", "0.6050616", "0.6050616", "0.6029829", "0.60096", "0.5973834", "0.5958873", ...
0.73992556
0
Returns a list of the names of any sensitive / protected attribute(s) that will be used for a fairness analysis and should not be used to train the model.
def get_sensitive_attributes(self): return self.sensitive_attrs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __listAttr(self):\n attr = dir(self) # already sorted\n filter = []\n for name in attr:\n if name[:2] == '__': pass\n elif name[:10] == '_HelpDoc__': pass # used to mask private attr\n elif name in self.__exclude: pass\n else: filter.append(name)...
[ "0.70694345", "0.66682184", "0.6661344", "0.66439575", "0.66118485", "0.654151", "0.6416619", "0.6314357", "0.63003594", "0.626828", "0.6239923", "0.62366736", "0.62366736", "0.6221969", "0.6175809", "0.61643624", "0.61223054", "0.6114993", "0.61009276", "0.6096935", "0.60964...
0.7331742
0
Same as get_sensitive_attributes, but also includes the joint sensitive attribute if there is more than one sensitive attribute.
def get_sensitive_attributes_with_joint(self): if len(self.get_sensitive_attributes()) > 1: return self.get_sensitive_attributes() + ['-'.join(self.get_sensitive_attributes())] return self.get_sensitive_attributes()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sensitive_attributes(self):\n return self.sensitive_attrs", "def get_sensitive_terms(self):\n sensitive_terms_dict = {}\n for attribute in self.__non_redundant_entity_attributes:\n for record_id, sensitive_terms in self.__df[attribute].dropna().iteritems():\n ...
[ "0.7723388", "0.61657095", "0.5457752", "0.53589123", "0.5331123", "0.5112113", "0.5105332", "0.51015556", "0.5088783", "0.50400466", "0.5025615", "0.5014114", "0.5013227", "0.49880865", "0.4979075", "0.495395", "0.4940964", "0.49345672", "0.49345672", "0.49008775", "0.489157...
0.85016006
0
Returns a list in the same order as the sensitive attributes list above of the privileged class name (exactly as it appears in the data) of the associated sensitive attribute.
def get_privileged_class_names(self, tag): # FIXME this dependence between tags and privileged class names is bad; don't know how to # fix it right now if tag == 'numerical-binsensitive': return [1 for x in self.get_sensitive_attributes()] else: return self.privil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDataAttributes(self):\n asRet = [];\n asAttrs = dir(self);\n for sAttr in asAttrs:\n if sAttr[0] == '_' or sAttr[0] == 'k':\n continue;\n if sAttr in self.kasInternalAttributes:\n continue;\n oValue = getattr(self, sAttr);...
[ "0.70606923", "0.7041535", "0.69863814", "0.6956516", "0.6759619", "0.66697687", "0.66511804", "0.6639891", "0.64760447", "0.638376", "0.6333704", "0.632314", "0.62966156", "0.61981976", "0.6196645", "0.6196645", "0.6156528", "0.6151096", "0.61357003", "0.6134827", "0.6129417...
0.7225402
0
Same as get_privileged_class_names, but also includes the joint sensitive attribute if there is more than one sensitive attribute.
def get_privileged_class_names_with_joint(self, tag): priv_class_names = self.get_privileged_class_names(tag) if len(priv_class_names) > 1: return priv_class_names + ['-'.join(str(v) for v in priv_class_names)] return priv_class_names
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_privileged_class_names(self, tag):\n # FIXME this dependence between tags and privileged class names is bad; don't know how to\n # fix it right now\n if tag == 'numerical-binsensitive':\n return [1 for x in self.get_sensitive_attributes()]\n else:\n return ...
[ "0.73706985", "0.6840645", "0.6202078", "0.594918", "0.5039532", "0.50019443", "0.49859846", "0.49820405", "0.49799612", "0.49191874", "0.49018767", "0.48560244", "0.48521727", "0.48503172", "0.48184666", "0.478812", "0.47643054", "0.47436982", "0.47109863", "0.47010607", "0....
0.7298145
1
Returns a list of features that should be expanded to onehot versions for numericalonly algorithms. This should not include the protected features or the outcome class variable.
def get_categorical_features(self): return self.categorical_features
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onehot_features(data):\n\n# Binary Features\n columns = ['Weekend', 'Revenue']\n for col in columns:\n data[col] = data[col].apply(lambda x: float(1) if x else float(0))\n\n columns = ['Month', 'OperatingSystems', 'Browser', 'Region', 'TrafficType',\n 'VisitorType']\n for col...
[ "0.66784006", "0.64435947", "0.6321415", "0.6291115", "0.6268722", "0.6225658", "0.61513215", "0.6115024", "0.6107136", "0.6081699", "0.6007897", "0.600501", "0.60009587", "0.5978102", "0.5973954", "0.59635854", "0.5962802", "0.59291697", "0.59200054", "0.5908913", "0.5896621...
0.5930906
17
Takes a pandas dataframe and modifies it to do any data specific processing. This should include any ordered categorical replacement by numbers. The resulting pandas dataframe is returned.
def data_specific_processing(self, dataframe): return dataframe
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_data(df):\r\n \r\n # list of categories to use as column names \r\n categories_cols = [names.split('-')[0] for names in df['categories'][0].split(';')]\r\n \r\n # creating 36 individual category columns\r\n for i in range(len(categories_cols)):\r\n df[categories_cols[i]] = [int(r...
[ "0.72517514", "0.7021752", "0.6957841", "0.69419897", "0.6836155", "0.6820173", "0.67918307", "0.6785911", "0.6761052", "0.67148185", "0.67098016", "0.6694147", "0.66585565", "0.6657991", "0.6594431", "0.6561653", "0.65530825", "0.65374434", "0.6511466", "0.6479127", "0.64500...
0.5775189
57
This method implements any data specific missing data processing. Any missing data not replaced by values in this step will be removed by the general preprocessing script.
def handle_missing_data(self, dataframe): return dataframe
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clean(self, dataset):\n # Replace missing values with numpy's NaN. The missing value is\n # usually 1e+20, but values can be like 1.0000002e+20, which is\n # different. Ergo the inequality.\n for var in dataset.data_vars.itervalues():\n if 'missing_value' in var.attrs:...
[ "0.6957376", "0.6862694", "0.6733841", "0.6647942", "0.6541775", "0.6535181", "0.64431393", "0.6377302", "0.63732034", "0.6310155", "0.62766635", "0.6204777", "0.6177998", "0.6141851", "0.6130127", "0.6126659", "0.60847795", "0.6082589", "0.6067625", "0.6064571", "0.6064571",...
0.5833492
43
A passing grade in the Ricci data is defined as any grade above a 70 in the combined oral and written score. (See Miao 2010.)
def passing_grade(row): if row['Combine'] >= 70.0: return 1 else: return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grade(self):\n if round(self.numAvg,0) >= 70:\n return round(self.numAvg,0)\n elif self.PassSummer:\n return 70\n elif round(self.numAvg,0) >= 55 and not self.PassSummer:\n return round(self.numAvg,0)\n else:\n return 55", "def calc_grad...
[ "0.7085485", "0.6440944", "0.63578296", "0.63572264", "0.6289942", "0.6267479", "0.60695726", "0.59769577", "0.5956954", "0.59330213", "0.5848372", "0.5821019", "0.58090127", "0.58062154", "0.57650155", "0.57590044", "0.5737819", "0.5693649", "0.5693649", "0.5689963", "0.5680...
0.7371235
0