query stringlengths 9 9.05k | document stringlengths 10 222k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Returns an alphabet that is consistent with the provided list of words in sorted order. Assumes there is at least one possible alphabet for the sequence of words (i.e. no cycles) | def parse_alphabet(words):
letters = Graph()
for i in range(len(words) - 1):
for l in words[i]:
letters.add_vertex(l) # make sure all the letters are in the graph
let_idx = first_uncommon_letter(words[i], words[i+1])
if let_idx != -1:
letters.add_edge(words[i][let... | [
"def adv_alpha_sort_by_word_length(words):\n\n # Alternate, pre-sort method\n #\n # d = {}\n # for w in words:\n # d.setdefault(len(w), []).append(w)\n # for v in d.values():\n # v.sort()\n # return sorted(d.items())\n\n d = {}\n for w in words:\n d.setdefault(len(w), []).ap... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Auxiliary function that checks that one letter comes before another one in a given alphabet. Assumes alphabet is a List. | def check_order(self, alphabet, let1, let2):
return alphabet.index(let1) < alphabet.index(let2) | [
"def less_letter(self,a,b):\n return (self.rank(a)<=self.rank(b))",
"def is_alphabetized(roster, ordering):\n for i, person in enumerate(roster):\n if i < (len(roster)-1):\n #ignore if same person 2x\n if person == roster[i+1]:\n continue\n #if rost... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks that there are no repeating letters in the alphabet | def check_unique(self, alphabet):
letters_set = set()
for let in alphabet:
if let in letters_set:
return False
else:
letters_set.add(let)
return True | [
"def letter_repeated(word: string) -> bool:\n for _, letter_seq in groupby(sorted(word)):\n if len(list(letter_seq)) > 1:\n return True\n return False",
"def test_3_duplicate_alphabet_count():\n word = \"mississippi\"\n print(word)\n alphabets = list(word)\n for i in alphabets:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Read the contents of a text file into a list and return the list. Each element in the list will contain one line of text from the text file. | def read_list(filename):
# Create an empty list named text_list.
text_list = []
# Open the text file for reading and store a reference
# to the opened file in a variable named text_file.
with open(filename, "rt") as text_file:
# Read the contents of the text
# file one line at a ti... | [
"def read_txt(path):\n with open(path) as f:\n lines = f.readlines()\n lines = [x.strip() for x in lines]\n return lines",
"def file_to_list(file_name):\n lines = []\n with open(file_name) as f:\n lines = f.read().splitlines()\n return lines",
"def read_file_line_to_list(file_path):\n f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test bcrypt maximum password length. The bcrypt algorithm has a maximum password length of 72 bytes, and ignores any bytes beyond that. | def test_long_password(self):
# Create a password with a 72 bytes length
password = 'A' * 72
pw_hash = self.flask_bcrypt.generate_password_hash(password)
# Ensure that a longer password yields the same hash
self.assertTrue(self.flask_bcrypt.check_password_hash(pw_hash, 'A' * 80)... | [
"def test_long_password(self):\n\n # Create a password with a 72 bytes length\n password = 'A' * 72\n pw_hash = self.flask_bcrypt.generate_password_hash(password)\n # Ensure that a longer password **do not** yield the same hash\n self.assertFalse(self.flask_bcrypt.check_password_h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test the work around bcrypt maximum password length. | def test_long_password(self):
# Create a password with a 72 bytes length
password = 'A' * 72
pw_hash = self.flask_bcrypt.generate_password_hash(password)
# Ensure that a longer password **do not** yield the same hash
self.assertFalse(self.flask_bcrypt.check_password_hash(pw_hash... | [
"def test_long_password(self):\n\n # Create a password with a 72 bytes length\n password = 'A' * 72\n pw_hash = self.flask_bcrypt.generate_password_hash(password)\n # Ensure that a longer password yields the same hash\n self.assertTrue(self.flask_bcrypt.check_password_hash(pw_hash... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a graph and a namespace for a local context. | def __init__(self, name, globalContext, propertiesDict):
self.__name = name
self.__globalContext = globalContext
self.__localNS = Namespace(self.__globalContext[1][0:self.__globalContext[1].find("#")] + "/context#")[self.__name]
self.__graph = Graph(self.__globalContext[0].store, self.__... | [
"def create_graph(self, graph_name):",
"def Graph(*av, **kw):\n g = rdflib.Graph(*av, **kw)\n import krdf\n if krdf.namespace_manager is None:\n krdf.namespace_manager = g.namespace_manager\n else:\n g.namespace_manager = krdf.namespace_manager\n return g",
"def __init__(self):\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets all the important information related to a local context. | def getInfo(self):
return (self.__name, self.__graph, self.__globalContext[1], self.__localNS) | [
"def context(self):\n return self.__service.context()",
"def determine_contexts(self):\n return []",
"def inject_into_context():\n return dict(\n dev_server = running_local # Variable dev_server is True if running on the GAE development server\n )",
"def localcontext(ctx=None):\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Module to create a service ticket | def create_ticket(service_msg,user_name,pass_word,api_key):
headers = {'Accept': 'application/vnd.pagerduty+json;version=2',\
'Authorization': 'Token token={token}'.format(token=api_key)}
payload = {'note': {'content': "High CPU/Memory or Low Diskspace noticed. \
Staus of the service is " + str(service... | [
"def create_ticket(self, **kwargs):\n\n all_params = ['ticket']\n all_params.append('callback')\n\n params = locals()\n for key, val in iteritems(params['kwargs']):\n if key not in all_params:\n raise TypeError(\n \"Got an unexpected keyword a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get create canvas/create new canvas >>> cnv = getCanvas ( 'glnewCanvas' , width = 1200 , height = 1000 ) | def getCanvas ( name = 'glCanvas' , ## canvas name
title = 'Ostap' , ## canvas title
width = canvas_width , ## canvas width
height = canvas_height ) : ## canvas height
cnv = _canvases.get ( name , None )
if not cnv :
## create new ca... | [
"def getCanvas ( name = 'glCanvas' , ## canvas name \n title = 'Ostap' , ## canvas title\n width = 1000 , ## canvas width\n height = 800 ) : ## canvas height\n cnv = _canvases.get ( name , None )\n if not cnv :\n ## create new can... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A bit simplified version for TCanvas print It Alows to create several output file types at once if extension is equal to `tar` or `tgz`, single (gzipped) tarfiles is created if extension is equal to `zip`, single ziparchive is created >>> canvas.print_ ( 'A' ) >>> canvas.save ( 'A' ) ditto >>> canvas >> 'fig' ditto | def _cnv_print_ ( cnv , fname , exts = ( 'pdf' , 'png' , 'eps' , 'C' ,
'jpg' , 'gif' , 'json' , 'svg' ) ) :
#
cnv.Update ()
from ostap.logger.utils import rootWarning
n , e = os.path.splitext ( fname )
el = e.lower()
if n and el in all_extensions ... | [
"def cli(ctx, version, path, save_dir, runtype, verbose, very_verbose, max_sites):\n if version:\n click.echo(\"xtal2png version: {}\".format(__version__))\n return\n if verbose:\n setup_logging(loglevel=logging.INFO)\n if very_verbose:\n setup_logging(loglevel=logging.DEBUG)\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all known canvases | def getCanvases () :
return _canvases.keys() | [
"def try_all_gpus():\r\n ctx_list = []\r\n try:\r\n for i in range(16):\r\n ctx = mx.gpu(i)\r\n _ = nd.array([0], ctx=ctx)\r\n ctx_list.append(ctx)\r\n except:\r\n pass\r\n if not ctx_list:\r\n ctx_list = [mx.cpu()]\r\n return ctx_list",
"def ca... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Perform partition of Canvas into pads with no intermargins canvas = ... nx = 3 , ny = 2 pads = canvas.partition ( nx , ny ) | def canvas_partition ( canvas ,
nx ,
ny ,
left_margin = margin_left ,
right_margin = margin_right ,
bottom_margin = mar... | [
"def partition_pixels(*args, **kwargs): # real signature unknown; restored from __doc__\n pass",
"def _do_partition(total, maxelements, around=None, maxdz=None):\n if (around is None) != (maxdz is None):\n raise ValueError(\"Cannot define center or radius alone.\")\n\n if maxelements =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
deleter for the created pad structure | def _cnv_del_pads_ ( self ) :
while self.pads :
key , pad = self.pads.popitem ()
if pad :
logger.verbose ( 'delete pad %s' % pad .GetName() )
del pad | [
"def __del__(self):\n self.usb_port.close()",
"def __del__( self ):\n\t\tLiFlame.degrid()",
"def _destroy(self):\n self._dict._destroy()",
"def __del__(self):\n self.cleanup()",
"def deinit(self) -> None:\n self._is_deinited()\n self._pad.deinit()\n self._cursor.dei... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Split canvas in ydirection into nonequal pads, proportionally to heights >>> canvas = ... >>> pads = canvas.vsplit ( [1,2,1] ) | def canvas_vsplit ( canvas ,
heights ,
left_margin = margin_left ,
right_margin = margin_right ,
bottom_margin = margin_bottom ,
top_margin = margin_top ,
... | [
"def canvas_partition ( canvas , \n nx ,\n ny ,\n left_margin = margin_left , \n right_margin = margin_right , \n bottom_ma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Perform partition of Canvas into 1x2 nonequal pads with no intermargins >>> canvas = ... >>> pads = canvas.pull_partition ( 4.0 ) toppad 4times larger | def canvas_pull ( canvas ,
ratio = 4.0 ,
left_margin = margin_left ,
right_margin = margin_right ,
bottom_margin = margin_bottom ,
top_margin = margin_top ,
... | [
"def canvas_partition ( canvas , \n nx ,\n ny ,\n left_margin = margin_left , \n right_margin = margin_right , \n bottom_ma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw sequence of object on sequence of pads, the label font size is adjusted to be uniform (in pixels) >>> pads = ... >>> frames = ... >>> draw_pads ( frames , pads , fontsize = 25 ) | def draw_pads ( objects ,
pads ,
fontsize = 36 ,
trim_left = False ,
trim_right = False ) :
assert isinstance ( fontsize , int ) and 5 < fontsize , 'Invalid fontsize %s [pixels] ' % fontsize
for obj , pad_ in z... | [
"def SetupPad(): # -> TPad\n yplot = 0.65\n yratio = 0.33\n y3 = 0.99\n y2 = y3-yplot\n y1 = y2-yratio\n x1 = 0.01\n x2 = 0.99\n\n pad = ROOT.TPad(\"pad\", \"plot pad\", x1, y1, x2, y3)\n pad.SetTopMargin(0.05)\n pad.SetBottomMargin(0.12)\n pad.SetLeftMargin(0.14)\n pad.SetRightM... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calls Pygame rect superconstructor and adds an associated type value | def __init__(self, type, x, y, width, height):
super(TypedRect, self).__init__(x, y, width, height)
self.type = type | [
"def create_rect():\n pass",
"def __init__(self, length, width, transform):\n self.length = length\n self.width = width\n self.area = length * width\n self.transform = transform\n bottom_left = (-length/2, -width/2)\n top_left = (-length/2, width/2)\n top_right ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Applies objectspecific gravity to deltaY | def apply_grav(self):
if self.deltaY == 0:
self.deltaY = 1
else:
self.deltaY += self.gravity | [
"def gravity(self): \n if self.change_y == 0:\n \n self.change_y = 1\n \n else:\n self.change_y +=self.grav\n \n \n if self.rect.y >= SCREEN_HEIGHT - self.rect.height and self.change_y >= 0:\n self.change_y = 0\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Moves all rect members on x axis by delta value | def moveX(self):
for rect in self.rects:
rect.x += self.deltaX
#self.drawing_rect.x += self.deltaX
| [
"def deltaX(self, xDelta):\n self.x += xDelta\n self.rect.x = round(self.x)",
"def add_x(self, x):\n self._xy[0] += x\n self.rect.x = self._xy[0]",
"def move_x(self, val: int) -> None:\n self.x_pos += val",
"def move(self, delta_x=0, delta_y=0):\n self.x += Decimal(st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Moves all rect members on y axis by delta value | def moveY(self):
for rect in self.rects:
rect.y += self.deltaY
#self.drawing_rect.y += self.deltaY
| [
"def deltaY(self, yDelta):\n self.y += yDelta\n self.rect.y = round(self.y)",
"def move_y(self, val: int) -> None:\n self.y_pos += val",
"def add_y(self, y):\n self._xy[1] += y\n self.rect.y = self._xy[1]",
"def move_y(self, amount=40):\n self.y_coor += amount\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Stops vertical movement of all rect members | def stopY(self):
self.deltaY = 0 | [
"def exit(self):\r\n self.rect.x = 1000\r\n self.rect.y = 750",
"def robot_down(self):\t\r\n\t self.y = self.y + 1\r\n\t if self.y > 9:\r\n\t\t self.y = 9",
"def moveY(self):\r\n for rect in self.rects:\r\n rect.y += self.deltaY\r\n #self.drawing_rect.y += self.de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts game ID to name using the API. | def game_id_to_name(session, game_id):
# Make a query.
query = f"games"
payload = {'id': game_id}
# Make a request.
response = request_query(session, query, payload)
if not response:
print(f"gameIDtoName error. No response from API. Game ID: {game_id}")
return None
# Parse ... | [
"def id_to_name(player_id):\n query = \"SELECT name FROM players WHERE id=%s\"\n parameter = (player_id,)\n\n with connect_to_db() as database:\n database['cursor'].execute(query, parameter)\n player_name = database['cursor'].fetchone()[0]\n\n return player_name",
"def name_for_id(id):\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove the enemy from the expedition | def retreat(self, enemy):
self.expedition.remove(enemy) | [
"def enemy_destroyed(self):\n self.scoreboard['enemies_destroyed'] += 1",
"def ignore_enemy(self, name: str) -> None:\n\n if name in self._enemies:\n self._enemies.remove(name)",
"def add_enemy(self, e):\n self.enemies.append(e)",
"def _dec_enemy_count(self):\n if (self.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
We've just used the Category information from the goals app to create labels, so let's remove any of the preexisting labels from questions, since they are now irrelevant. | def remove_prior_survey_labels(apps, schema_editor):
for q in apps.get_model("survey", "BinaryQuestion").objects.all():
q.labels.clear()
for q in apps.get_model("survey", "LikertQuestion").objects.all():
q.labels.clear()
for q in apps.get_model("survey", "MultipleChoiceQuestion").objects.a... | [
"def clear_labels(self):\n from casepro.statistics.models import DailyCount, datetime_to_date\n\n day = datetime_to_date(self.created_on, self.org)\n for label in self.labels.all():\n DailyCount.record_removal(day, DailyCount.TYPE_INCOMING, label)\n\n Labelling.objects.filter(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize the Azure network class. | def __init__(self,
az_account: 'account.AZAccount') -> None:
self.az_account = az_account
self.network_client = network.NetworkManagementClient(
self.az_account.credentials, self.az_account.subscription_id) | [
"def __init__(self):\n # We initialize the \"networks\" attribute with an empty dictionary.\n self.networks = {}",
"def _configure_manager(self):\r\n self._manager = CloudNetworkManager(self, resource_class=CloudNetwork,\r\n response_key=\"network\", uri_base=\"os-networksv2\")... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates required elements for creating a network interface. | def _CreateNetworkInterfaceElements(
self,
name_prefix: str,
region: Optional[str] = None) -> Tuple[Any, ...]:
if not region:
region = self.az_account.default_region
# IP address
public_ip_name = '{0:s}-public-ip'.format(name_prefix)
# Virtual Network
vnet_name = '{0:s}-vne... | [
"def _setup_interface(self):\n\n # Create and set the interface up.\n self._ip.link(\"add\", ifname=self.interface, kind=\"dummy\")\n dev = self._ip.link_lookup(ifname=self.interface)[0]\n self._ip.link(\"set\", index=dev, state=\"up\")\n\n # Set up default route for both IPv6 and... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Just enter blank for the prompt 'testpmd> ' | def blank_enter(self):
time.sleep(2)
self.dut.send_expect(" ", "testpmd> ") | [
"def step_see_prompt(context):\n context.cli.expect('wharfee> ')",
"def step_expect_prompt(context):\n context.cli.expect('wharfee> ')",
"def test_prompting(self):\n pass",
"def prompt(self):\n\t\t_globals._console.write(f'{self.prompt_str} ')",
"def test_guitab_print_tab_blank(monkeypatch, cap... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the detail info from the output of pmd cmd 'show port info '. | def get_detail_from_port_info(self, key_str, regx_str, port):
out = self.dut.send_expect("show port info %d" % port, "testpmd> ")
find_value = self.get_value_from_str(key_str, regx_str, out)
return find_value | [
"def get_ports(module, switch, peer_switch, task, msg):\n cli = pn_cli(module)\n cli += ' switch %s port-show hostname %s' % (switch, peer_switch)\n cli += ' format port no-show-headers '\n return run_command(module, cli, task, msg).split()",
"def getPortDescription(self):\n portnum = self.getPortN... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the specified port MAC. | def get_port_mac(self, port_id):
return self.get_detail_from_port_info("MAC address: ", "([0-9A-F]{2}:){5}[0-9A-F]{2}", port_id) | [
"def get_nic_by_mac(self, mac):\n results = list(self.baremetal.ports(address=mac, details=True))\n try:\n return results[0]\n except IndexError:\n return None",
"def get_macbookmac():\n input = os.popen('ifconfig en0')\n return ''.join([x.split()[1] for x in input... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the socket id which the specified port is connectting with. | def get_port_connect_socket(self, port_id):
return self.get_detail_from_port_info("Connect to socket: ", "\d+", port_id) | [
"def socket_id(self):\n return self._test_protocol.socket_id",
"def socketPort(self):\n\n if not self.isBound():\n return None\n\n return self._port",
"def select_unused_port():\n s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n s.bind(('localhost', 0))\n addr, po... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the socket id which the specified port memory is allocated on. | def get_port_memory_socket(self, port_id):
return self.get_detail_from_port_info("memory allocation on the socket: ", "\d+", port_id) | [
"def _find_free_port():\n import socket\n\n sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n # Binding to port 0 will cause the OS to find an available port for us\n sock.bind((\"\", 0))\n port = sock.getsockname()[1]\n sock.close()\n # NOTE: there is still a chance the port could be ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the specified port link status now. | def get_port_link_status(self, port_id):
return self.get_detail_from_port_info("Link status: ", "\d+", port_id) | [
"def get_port_status(cluster, lswitch_id, port_id):\n try:\n r = do_request(HTTP_GET,\n \"/ws.v1/lswitch/%s/lport/%s/status\" %\n (lswitch_id, port_id), cluster=cluster)\n except exception.NotFound as e:\n LOG.error(_(\"Port not found, Error: %s\"), st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the specified port link speed now. | def get_port_link_speed(self, port_id):
return self.get_detail_from_port_info("Link speed: ", "\d+", port_id) | [
"def _get_speed(self):\n reply = self.query(command = b'/1?37\\r', port = self.port)\n number = reply['value']\n debug('get_speed(): reply = {}, and number = {}'.format(reply,number))\n return reply",
"def get_speed(self):\n return float(self.send('speed?'))",
"def get_speed(s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the specified port link mode, duplex or siplex. | def get_port_link_duplex(self, port_id):
return self.get_detail_from_port_info("Link duplex: ", "\S+", port_id) | [
"def get_bond_mode(self, bond_port):\n return self.get_info_from_bond_config(\"Bonding mode: \", \"\\d*\", bond_port)",
"def get_port(self) -> str:\n return self.__serial.port",
"def get_port():\n port = 0\n if sys.platform.startswith('darwin'):\n port = glob.glob('/dev/tty.usbmodem*'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the promiscuous mode of port. | def get_port_promiscuous_mode(self, port_id):
return self.get_detail_from_port_info("Promiscuous mode: ", "\S+", port_id) | [
"def get_switching_mode(self):\n self.board_socket.send(bytes.fromhex(\"10 00 01 00\"))\n temp = self.board_socket.recv(1024)\n return(temp[3])",
"def get_bond_mode(self, bond_port):\n return self.get_info_from_bond_config(\"Bonding mode: \", \"\\d*\", bond_port)",
"def promisc_mode_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the allmulticast mode of port. | def get_port_allmulticast_mode(self, port_id):
return self.get_detail_from_port_info("Allmulticast mode: ", "\S+", port_id) | [
"def igmp_mode(self):\n return self.data.get('igmp_mode')",
"def _get_port_group(self):\n return self.__port_group",
"def read_all_channels(self):\n data = SPI.command(CMD_ANA_GETALL, returned=2)\n return [\n data[0] << 8 | data[1], data[2] << 8 | data[3], data[4] << 8 |\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get info by executing the command "show bonding config". | def get_info_from_bond_config(self, key_str, regx_str, bond_port):
out = self.dut.send_expect("show bonding config %d" % bond_port, "testpmd> ")
find_value = self.get_value_from_str(key_str, regx_str, out)
return find_value | [
"def view_conf() -> None:\n print(Config.get_conf())",
"def get_config(switchname, username, password):\n\n client = paramiko.SSHClient()\n client.load_system_host_keys()\n client.set_missing_host_key_policy(paramiko.AutoAddPolicy())\n client.connect(hostname=switchname, username=username, password... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the mode of the bonding device which you choose. | def get_bond_mode(self, bond_port):
return self.get_info_from_bond_config("Bonding mode: ", "\d*", bond_port) | [
"def get_mode(self):\n return self.mode",
"def get_mode(self,):\n return self.current_mode",
"def get_bonding_type(bondname):\n mode = -1\n try:\n with open('/sys/class/net/%s/bonding/mode' % bondname, 'r') as f:\n lines = f.readlines()\n if lines:\n c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the balance transmit policy of bonding device. | def get_bond_balance_policy(self, bond_port):
return self.get_info_from_bond_config("Balance Xmit Policy: ", "\S+", bond_port) | [
"def eth_adapter_policy(self):\n return self._eth_adapter_policy",
"def wallet(self):\n\t\tdat = self.conn.call('GET', '/api/wallet/').json()\n\t\tbalance = float(dat['data']['total']['balance'])\n\t\tsendable = float(dat['data']['total']['sendable'])\n\t\treturn (balance, sendable)",
"def set_balance_po... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the active slaves of the bonding device which you choose. | def get_bond_active_slaves(self, bond_port):
try:
return self.get_info_from_bond_config("Active Slaves \(\d\): \[", "\d*( \d*)*", bond_port)
except Exception as e:
return self.get_info_from_bond_config("Acitve Slaves: \[", "\d*( \d*)*", bond_port) | [
"def get_slaves(self, name):\n slaves = self.execute('SENTINEL', 'slaves', name)\n result = []\n for slave in slaves:\n result.append(dict_from_list(slave))\n return result",
"def get_slave_list (bus=\"wisbone\"):\n\tslave_list = []\n\treturn slave_list",
"def get_slaves_m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Launch the testpmd app with the command parameters. | def launch_app(self, pmd_param=" "):
self.pmdout.start_testpmd("all", param=pmd_param) | [
"def run_tests_from_commandline():\n import maya.standalone\n maya.standalone.initialize()\n run_tests()",
"def test_platform_args(self):\n self.app = self.make_app(argv = ['production', 'run', 'J.Doe_00_04', '--debug', '--force', '--amplicon', '--restart', '--sample', SAMPLES[1], '--drmaa'], exte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a bonding device with the parameters you specified. | def create_bonded_device(self, mode=0, socket=0, verify_detail=False):
out = self.dut.send_expect("create bonded device %d %d" % (mode, socket), "testpmd> ")
self.verify("Created new bonded device" in out,
"Create bonded device on mode [%d] socket [%d] failed" % (mode, socket))
... | [
"def create(self, obj: Device):\n raise BanyanError('devices cannot be created via the API')",
"def create_device(device):\n return FoobotDevice(auth_header=self.auth_header,\n user_id=device['userId'],\n uuid=device['uuid... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Start all the ports which the testpmd can see. | def start_all_ports(self):
self.start_port("all") | [
"def start(self):\n self._logger.info(\"Starting TestPMD...\")\n dpdk.init()\n self._testpmd.start()\n self._logger.info(\"TestPMD...Started.\")\n\n self._testpmd.send('set fwd {}'.format(self._fwdmode), 1)\n\n if settings.getValue('VSWITCH_JUMBO_FRAMES_ENABLED'):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Start a port which the testpmd can see. | def start_port(self, port):
self.__send_expect("port start %s" % str(port), "testpmd> ")
time.sleep(3) | [
"def start_server(port: int):\n run(port)",
"def open_port(self, port, protocol=\"TCP\"):\n cmd = ['open-port']\n cmd.append('{}/{}'.format(port, protocol))\n self._environment.command_runner(cmd)",
"def start_for_guest(self):\n self._logger.info(\"Starting TestPMD for one guest..... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add the ports into the bonding device as slaves. | def add_slave_to_bonding_device(self, bond_port, invert_verify=False, *slave_port):
if len(slave_port) <= 0:
utils.RED("No port exist when add slave to bonded device")
for slave_id in slave_port:
self.__send_expect("add bonding slave %d %d" % (slave_id, bond_port), "testpmd> ")
... | [
"def add_slaves(no_of_slaves=''):\n _, master_ip = get_master_dns_ip()\n if master_ip and no_of_slaves:\n # Test and see if we can find existing slaves\n create_slaves(int(no_of_slaves))\n host_list = [slave.public_dns_name for slave in SLAVE_INSTANCES.itervalues()]\n execute(run_s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove the specified slave port from the bonding device. | def remove_slave_from_bonding_device(self, bond_port, invert_verify=False, *slave_port):
if len(slave_port) <= 0:
utils.RED("No port exist when remove slave from bonded device")
for slave_id in slave_port:
self.dut.send_expect("remove bonding slave %d %d" % (int(slave_id), bond_p... | [
"def delete_port(port):\n return IMPL.delete_port(port)",
"def multiroom_remove(self, slave_ip: str) -> str:\n self._logger.info(\"Removing slave '\"+str(slave_ip)+\"' from multiroom group\")\n return self._send(\"multiroom:SlaveKickout:\"+str(slave_ip)).content.decode(\"utf-8\")",
"def delete_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove all slaves of specified bound device. | def remove_all_slaves(self, bond_port):
all_slaves = self.get_bond_slaves(bond_port)
all_slaves = all_slaves.split()
if len(all_slaves) == 0:
pass
else:
self.remove_slave_from_bonding_device(bond_port, False, *all_slaves) | [
"def remove_slave_group_ids(self, persister=None):\n persister.exec_stmt(Group.DELETE_SLAVE_GROUPS,\n {\"params\": (self.__group_id, )})",
"def delete(self):\n for port in self.ports:\n port.delete()\n self.ports = []\n self.subnet.close()",
"def... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the primary slave for the bonding device. | def set_primary_for_bonding_device(self, bond_port, slave_port, invert_verify=False):
self.dut.send_expect("set bonding primary %d %d" % (slave_port, bond_port), "testpmd> ")
out = self.get_info_from_bond_config("Primary: \[", "\d*", bond_port)
if not invert_verify:
self.verify(str(s... | [
"def setMaster(self, led, master):\n self.logger.info(\"setting master for led %d to %d\"%(led,master))\n self._connManager.send(self.protocolArne.setMaster(master, led=led))\n #self._connManager.send(COMMANDS['setMaster'] + struct.pack('B', led) + struct.pack('B', master))",
"def set_master(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the mode for the bonding device. | def set_mode_for_bonding_device(self, bond_port, mode):
self.dut.send_expect("set bonding mode %d %d" % (mode, bond_port), "testpmd> ")
mode_value = self.get_bond_mode(bond_port)
self.verify(str(mode) in mode_value, "Set bonding mode failed") | [
"def _set_mode(self, mode):\n self._parent._write(self, DacBase._COMMAND_SET_SLOT_MODE.format(mode))\n self._mode = mode",
"def set_mode(self, mode):\n self._mode = mode",
"def set_mode(self, mode):\n self._write_byte(BNO055_OPR_MODE_ADDR, mode & 0xFF)\n # Delay for 30 millise... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the MAC for the bonding device. | def set_mac_for_bonding_device(self, bond_port, mac):
self.dut.send_expect("set bonding mac_addr %s %s" % (bond_port, mac), "testpmd> ")
new_mac = self.get_port_mac(bond_port)
self.verify(new_mac == mac, "Set bonding mac failed") | [
"def mac(self, mac):\n self._query_helper(\"system\", \"set_mac_addr\", {\"mac\": mac})",
"def mac(self, mac: str) -> None:\n self._query_helper(\"system\", \"set_mac_addr\", {\"mac\": mac})",
"def vpp_set_interface_mac(node, interface, mac):\n cmd = u\"sw_interface_set_mac_address\"\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the balance transmit policy for the bonding device. | def set_balance_policy_for_bonding_device(self, bond_port, policy):
self.dut.send_expect("set bonding balance_xmit_policy %d %s" % (bond_port, policy), "testpmd> ")
new_policy = self.get_bond_balance_policy(bond_port)
policy = "BALANCE_XMIT_POLICY_LAYER" + policy.lstrip('l')
self.verify(... | [
"def set_balance(self, zone: int, balance: int):\n raise NotImplemented()",
"def SetTrafficShaper(self, name, per_policy, priority, guaranteed_bandwidth, maximum_bandwidth, diffserv='disable',\n diffservcode='000000'):\n payload = {'json':\n {\n 'nam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send packets to the slaves and calculate the slave`s RX packets and unbond port TX packets. | def send_default_packet_to_slave(self, unbound_port, bond_port, pkt_count=100, **slaves):
pkt_orig = {}
pkt_now = {}
temp_count = 0
summary = 0
# send to slave ports
pkt_orig = self.get_all_stats(unbound_port, 'tx', bond_port, **slaves)
for slave in slaves['activ... | [
"def test_broadcast_tx_all_slaves_down(self):\n bond_port = self.create_bonded_device(MODE_BROADCAST, SOCKET_0)\n self.add_slave_to_bonding_device(bond_port, False, self.dut_ports[0], self.dut_ports[1], self.dut_ports[2])\n self.dut.send_expect(\"set portlist %d,%d\" % (self.dut_ports[3], bond_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send packets to the unbound port and calculate unbound port RX packets and the slave`s TX packets. | def send_default_packet_to_unbound_port(self, unbound_port, bond_port, pkt_count=300, **slaves):
pkt_orig = {}
pkt_now = {}
summary = 0
# send to unbonded device
pkt_orig = self.get_all_stats(unbound_port, 'rx', bond_port, **slaves)
summary = self.send_packet(unbound_por... | [
"def send_default_packet_to_slave(self, unbound_port, bond_port, pkt_count=100, **slaves):\n pkt_orig = {}\n pkt_now = {}\n temp_count = 0\n summary = 0\n\n # send to slave ports\n pkt_orig = self.get_all_stats(unbound_port, 'tx', bond_port, **slaves)\n for slave in ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Do some basic operations to bonded devices and slaves, such as adding, removing, setting primary or setting mode. | def verify_bound_basic_opt(self, mode_set):
bond_port_0 = self.create_bonded_device(mode_set, SOCKET_0, True)
self.add_slave_to_bonding_device(bond_port_0, False, self.dut_ports[1])
mode_value = self.get_bond_mode(bond_port_0)
self.verify('%d' % mode_set in mode_value,
... | [
"def setup_bd(client, conn_mgr):\n sess_hdl = conn_mgr.client_init()\n dev_tgt = DevTarget_t(0, hex_to_i16(0xffff))\n ifindices = [1, 2, 65]\n\n for ifindex in ifindices:\n action_spec = dc_set_bd_properties_action_spec_t(\n action_bd=0,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create bonded device, add one slave, verify bonded device MAC action varies with the mode. | def verify_bound_mac_opt(self, mode_set):
mac_address_0_orig = self.get_port_mac(self.dut_ports[0])
mac_address_1_orig = self.get_port_mac(self.dut_ports[1])
mac_address_2_orig = self.get_port_mac(self.dut_ports[2])
mac_address_3_orig = self.get_port_mac(self.dut_ports[3])
bond_... | [
"def create_bonded_device(self, mode=0, socket=0, verify_detail=False):\n out = self.dut.send_expect(\"create bonded device %d %d\" % (mode, socket), \"testpmd> \")\n self.verify(\"Created new bonded device\" in out,\n \"Create bonded device on mode [%d] socket [%d] failed\" % (mode... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set promiscuous mode on bonded device, verify bonded device and all slaves have different actions by the different modes. | def verify_bound_promisc_opt(self, mode_set):
unbound_port = self.dut_ports[3]
bond_port = self.create_bonded_device(mode_set, SOCKET_0)
self.add_slave_to_bonding_device(bond_port,
False,
self.dut_ports[0],
... | [
"def test_promiscuous_pass(self):\n if _debug: TestVLAN._debug(\"test_promiscuous_pass\")\n\n # three element network\n tnet = TNetwork(3)\n tnode1, tnode2, tnode3 = tnet.state_machines\n\n # reach into the network and enable promiscuous mode\n tnet.vlan.nodes[2].promiscuou... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify the transmitting packet are all correct in the round robin mode. | def verify_round_robin_tx(self, unbound_port, bond_port, **slaves):
pkt_count = 300
pkt_now = {}
pkt_now, summary = self.send_default_packet_to_unbound_port(unbound_port, bond_port, pkt_count=pkt_count, **slaves)
if slaves['active'].__len__() == 0:
self.verify(pkt_now[bond_p... | [
"def mustRetransmit(self):\n if self.syn or self.fin or self.dlen:\n return True\n return False",
"def check_for_packets_to_send(self):\n socket_id, network_packet_json_str = self.next_scheduled_network_packet(time.time())\n while socket_id:\n #_debug_print(\"Send... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify that receiving and transmitting the packets correctly in the round robin mode, when bringing any one slave of the bonding device link down. | def test_round_robin_one_slave_down(self):
bond_port = self.create_bonded_device(MODE_ROUND_ROBIN, SOCKET_0)
self.add_slave_to_bonding_device(bond_port, False, self.dut_ports[0], self.dut_ports[1], self.dut_ports[2])
self.dut.send_expect("set portlist %d,%d" % (self.dut_ports[3], bond_port), "te... | [
"def test_round_robin_all_slaves_down(self):\n bond_port = self.create_bonded_device(MODE_ROUND_ROBIN, SOCKET_0)\n self.add_slave_to_bonding_device(bond_port, False, self.dut_ports[0], self.dut_ports[1], self.dut_ports[2])\n self.dut.send_expect(\"set portlist %d,%d\" % (self.dut_ports[3], bond... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify that receiving and transmitting the packets correctly in the round robin mode, when bringing all slaves of the bonding device link down. | def test_round_robin_all_slaves_down(self):
bond_port = self.create_bonded_device(MODE_ROUND_ROBIN, SOCKET_0)
self.add_slave_to_bonding_device(bond_port, False, self.dut_ports[0], self.dut_ports[1], self.dut_ports[2])
self.dut.send_expect("set portlist %d,%d" % (self.dut_ports[3], bond_port), "t... | [
"def test_round_robin_one_slave_down(self):\n bond_port = self.create_bonded_device(MODE_ROUND_ROBIN, SOCKET_0)\n self.add_slave_to_bonding_device(bond_port, False, self.dut_ports[0], self.dut_ports[1], self.dut_ports[2])\n self.dut.send_expect(\"set portlist %d,%d\" % (self.dut_ports[3], bond_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify the RX packets are all correct in the activebackup mode. | def verify_active_backup_rx(self, unbound_port, bond_port, **slaves):
pkt_count = 100
pkt_now = {}
slave_num = slaves['active'].__len__()
if slave_num != 0:
active_flag = 1
else:
active_flag = 0
pkt_now, summary = self.send_default_packet_to_slav... | [
"def test_active_backup_rx_tx(self):\n bond_port = self.create_bonded_device(MODE_ACTIVE_BACKUP, SOCKET_0)\n self.add_slave_to_bonding_device(bond_port, False, self.dut_ports[0], self.dut_ports[1], self.dut_ports[2])\n self.dut.send_expect(\"set portlist %d,%d\" % (self.dut_ports[3], bond_port)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify the TX packets are all correct in the activebackup mode. | def verify_active_backup_tx(self, unbound_port, bond_port, **slaves):
pkt_count = 0
pkt_now = {}
if slaves['active'].__len__() != 0:
primary_port = slaves['active'][0]
active_flag = 1
else:
active_flag = 0
pkt_now, summary = self.send_default... | [
"def test_active_backup_rx_tx(self):\n bond_port = self.create_bonded_device(MODE_ACTIVE_BACKUP, SOCKET_0)\n self.add_slave_to_bonding_device(bond_port, False, self.dut_ports[0], self.dut_ports[1], self.dut_ports[2])\n self.dut.send_expect(\"set portlist %d,%d\" % (self.dut_ports[3], bond_port)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify receiving and transmitting the packets correctly in the activebackup mode. | def test_active_backup_rx_tx(self):
bond_port = self.create_bonded_device(MODE_ACTIVE_BACKUP, SOCKET_0)
self.add_slave_to_bonding_device(bond_port, False, self.dut_ports[0], self.dut_ports[1], self.dut_ports[2])
self.dut.send_expect("set portlist %d,%d" % (self.dut_ports[3], bond_port), "testpmd... | [
"def verify_active_backup_tx(self, unbound_port, bond_port, **slaves):\n pkt_count = 0\n pkt_now = {}\n\n if slaves['active'].__len__() != 0:\n primary_port = slaves['active'][0]\n active_flag = 1\n else:\n active_flag = 0\n\n pkt_now, summary = se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify that receiving and transmitting that packets correctly in the activebackup mode, when bringing all slaves of the bonding device link down. | def test_active_backup_all_slaves_down(self):
bond_port = self.create_bonded_device(MODE_ACTIVE_BACKUP, SOCKET_0)
self.add_slave_to_bonding_device(bond_port, False, self.dut_ports[0], self.dut_ports[1], self.dut_ports[2])
self.dut.send_expect("set portlist %d,%d" % (self.dut_ports[3], bond_port)... | [
"def test_active_backup_rx_tx(self):\n bond_port = self.create_bonded_device(MODE_ACTIVE_BACKUP, SOCKET_0)\n self.add_slave_to_bonding_device(bond_port, False, self.dut_ports[0], self.dut_ports[1], self.dut_ports[2])\n self.dut.send_expect(\"set portlist %d,%d\" % (self.dut_ports[3], bond_port)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Translate the MAC type from the string into the int. | def translate_mac_str_into_int(self, mac_str):
mac_hex = '0x'
for mac_part in mac_str.split(':'):
mac_hex += mac_part
return int(mac_hex, 16) | [
"def _convert_char_to_type(type_char):\n # type: (Any) -> TypeCode\n typecode = type_char\n if not isinstance(type_char, int):\n typecode = ord(type_char)\n\n try:\n return TypeCode(typecode)\n except ValueError:\n raise RuntimeError(\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate the hash value with the source and destination MAC. | def mac_hash(self, dest_mac, src_mac):
dest_port_mac = self.translate_mac_str_into_int(dest_mac)
src_port_mac = self.translate_mac_str_into_int(src_mac)
src_xor_dest = dest_port_mac ^ src_port_mac
xor_value_1 = src_xor_dest >> 32
xor_value_2 = (src_xor_dest >> 16) ^ (xor_value_1 ... | [
"def udp_hash(self, dest_port, src_port):\n return htons(dest_port ^ src_port)",
"def ipv4_hash(self, dest_ip, src_ip):\n dest_ip_int = self.translate_ip_str_into_int(dest_ip)\n src_ip_int = self.translate_ip_str_into_int(src_ip)\n return htonl(dest_ip_int ^ src_ip_int)",
"def genera... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Translate the IP type from the string into the int. | def translate_ip_str_into_int(self, ip_str):
ip_part_list = ip_str.split('.')
ip_part_list.reverse()
num = 0
ip_int = 0
for ip_part in ip_part_list:
ip_part_int = int(ip_part) << (num * 8)
ip_int += ip_part_int
num += 1
return ip_int | [
"def TypeCheck(ipType, number):\r\n transported_type = ipType # tcp, upd, icmp, icmpv6 or numbers\r\n target_dict = {22: \"SSH\", 25: \"SMTP\", 53: \"DNS\", 80: \"HTTP\", 110: \"POP3\", 143: \"IMAP\", 389: \"LDAP\",\r\n 443: \"HTTPS\", 445: \"SMB\", 465: \"SMTPS\", 993: \"IMAPS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate the hash value with the source and destination IP. | def ipv4_hash(self, dest_ip, src_ip):
dest_ip_int = self.translate_ip_str_into_int(dest_ip)
src_ip_int = self.translate_ip_str_into_int(src_ip)
return htonl(dest_ip_int ^ src_ip_int) | [
"def udp_hash(self, dest_port, src_port):\n return htons(dest_port ^ src_port)",
"def mac_hash(self, dest_mac, src_mac):\n dest_port_mac = self.translate_mac_str_into_int(dest_mac)\n src_port_mac = self.translate_mac_str_into_int(src_mac)\n src_xor_dest = dest_port_mac ^ src_port_mac\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate the hash value with the source and destination port. | def udp_hash(self, dest_port, src_port):
return htons(dest_port ^ src_port) | [
"def hash(cls, host, port):\n return str(cls.compile(host, port))",
"def mac_hash(self, dest_mac, src_mac):\n dest_port_mac = self.translate_mac_str_into_int(dest_mac)\n src_port_mac = self.translate_mac_str_into_int(src_mac)\n src_xor_dest = dest_port_mac ^ src_port_mac\n xor_v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate the hash value by the policy and active slave number. | def policy_and_slave_hash(self, policy, **slaves):
global S_MAC_IP_PORT
source = S_MAC_IP_PORT
global D_MAC_IP_PORT
dest_mac = D_MAC_IP_PORT[0]
dest_ip = D_MAC_IP_PORT[1]
dest_port = D_MAC_IP_PORT[2]
hash_values = []
if len(slaves['active']) != 0:
... | [
"def _genhash( self, fileref ):\n\t\treturn toolbox.md5( fileref )",
"def get_hash(self, descriptor):",
"def _get_hash_partial(self):\n hash_value = 0\n \n # available\n hash_value ^= self.available\n \n # description\n description = self.description\n if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find the hash value by the given slave port id. | def slave_map_hash(self, port, order_ports):
if len(order_ports) == 0:
return None
else:
order_ports = order_ports.split()
return order_ports.index(str(port)) | [
"def _node_hash(self, node, port):\n\n return hash(frozenset([node['mgmt_ip'], port]))",
"def get_hash(self,job_id):\n time.sleep(3)\n endpoint = '/hash'\n response = requests.get(baseUrl + endpoint + '/' + job_id)\n return response",
"def udp_hash(self, dest_port, src_port):\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify that transmitting the packets correctly in the XOR mode. | def verify_xor_tx(self, unbound_port, bond_port, policy, vlan_tag=False, **slaves):
pkt_count = 100
pkt_now = {}
pkt_now, summary = self.send_customized_packet_to_unbound_port(unbound_port, bond_port, policy, vlan_tag=False, pkt_count=pkt_count, **slaves)
hash_values = []
hash_... | [
"def test_xor_tx(self):\n bond_port = self.create_bonded_device(MODE_XOR_BALANCE, SOCKET_0)\n self.add_slave_to_bonding_device(bond_port, False, self.dut_ports[0], self.dut_ports[1], self.dut_ports[2])\n self.dut.send_expect(\"set portlist %d,%d\" % (self.dut_ports[3], bond_port), \"testpmd> \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify that transmitting packets correctly in the XOR mode. | def test_xor_tx(self):
bond_port = self.create_bonded_device(MODE_XOR_BALANCE, SOCKET_0)
self.add_slave_to_bonding_device(bond_port, False, self.dut_ports[0], self.dut_ports[1], self.dut_ports[2])
self.dut.send_expect("set portlist %d,%d" % (self.dut_ports[3], bond_port), "testpmd> ")
se... | [
"def verify_xor_tx(self, unbound_port, bond_port, policy, vlan_tag=False, **slaves):\n pkt_count = 100\n pkt_now = {}\n\n pkt_now, summary = self.send_customized_packet_to_unbound_port(unbound_port, bond_port, policy, vlan_tag=False, pkt_count=pkt_count, **slaves)\n\n hash_values = []\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify that transmitting packets correctly in the XOR mode, when bringing any one slave of the bonding device link down. | def test_xor_tx_one_slave_down(self):
bond_port = self.create_bonded_device(MODE_XOR_BALANCE, SOCKET_0)
self.add_slave_to_bonding_device(bond_port, False, self.dut_ports[0], self.dut_ports[2], self.dut_ports[1])
self.dut.send_expect("set portlist %d,%d" % (self.dut_ports[3], bond_port), "testpmd... | [
"def test_xor_tx_all_slaves_down(self):\n bond_port = self.create_bonded_device(MODE_XOR_BALANCE, SOCKET_0)\n self.add_slave_to_bonding_device(bond_port, False, self.dut_ports[0], self.dut_ports[1], self.dut_ports[2])\n self.dut.send_expect(\"set portlist %d,%d\" % (self.dut_ports[3], bond_port... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify that transmitting packets correctly in the XOR mode, when bringing all slaves of the bonding device link down. | def test_xor_tx_all_slaves_down(self):
bond_port = self.create_bonded_device(MODE_XOR_BALANCE, SOCKET_0)
self.add_slave_to_bonding_device(bond_port, False, self.dut_ports[0], self.dut_ports[1], self.dut_ports[2])
self.dut.send_expect("set portlist %d,%d" % (self.dut_ports[3], bond_port), "testpm... | [
"def test_xor_tx_one_slave_down(self):\n bond_port = self.create_bonded_device(MODE_XOR_BALANCE, SOCKET_0)\n self.add_slave_to_bonding_device(bond_port, False, self.dut_ports[0], self.dut_ports[2], self.dut_ports[1])\n self.dut.send_expect(\"set portlist %d,%d\" % (self.dut_ports[3], bond_port)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Open or shutdown the vlan strip and filter option of specified port. | def vlan_strip_and_filter(self, action='off', *ports):
for port_id in ports:
self.dut.send_expect("vlan set strip %s %d" % (action, port_id), "testpmd> ")
self.dut.send_expect("vlan set filter %s %d" % (action, port_id), "testpmd> ") | [
"def update_switch_port_vlans_on_device(self, interface, port):",
"def _clear_port_vlan_cfg(self, port):\n rid = self.xmlproxy.nb.Ports.find(port)\n prow = self.xmlproxy.nb.Ports.getRow(rid)\n if prow['pvid'] != 1:\n # Set default pvid and try to remove VLAN\n self.xmlpr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify that transmitting packets correctly in the XOR mode, when choosing the l34 as the load balance policy. | def test_xor_l34_forward(self):
bond_port = self.create_bonded_device(MODE_XOR_BALANCE, SOCKET_0)
self.add_slave_to_bonding_device(bond_port, False, self.dut_ports[0], self.dut_ports[1], self.dut_ports[2])
self.dut.send_expect("set portlist %d,%d" % (self.dut_ports[3], bond_port), "testpmd> ")
... | [
"def verify_xor_tx(self, unbound_port, bond_port, policy, vlan_tag=False, **slaves):\n pkt_count = 100\n pkt_now = {}\n\n pkt_now, summary = self.send_customized_packet_to_unbound_port(unbound_port, bond_port, policy, vlan_tag=False, pkt_count=pkt_count, **slaves)\n\n hash_values = []\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify that transmitting packets correctly in the broadcast mode. | def verify_broadcast_tx(self, unbound_port, bond_port, **slaves):
pkt_count = 100
pkt_now = {}
pkt_now, summary = self.send_default_packet_to_unbound_port(unbound_port, bond_port, pkt_count=pkt_count, **slaves)
for slave in slaves['active']:
self.verify(pkt_now[slave][0] ==... | [
"def test_broadcast(self):\n if _debug: TestVLAN._debug(\"test_broadcast\")\n\n # three element network\n tnet = TNetwork(3)\n tnode1, tnode2, tnode3 = tnet.state_machines\n\n # make a broadcast PDU\n pdu = PDU(b'data', source=1, destination=0)\n if _debug: TestVLAN.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify that transmitting packets correctly in the broadcast mode, when bringing any one slave of the bonding device link down. | def test_broadcast_tx_one_slave_down(self):
bond_port = self.create_bonded_device(MODE_BROADCAST, SOCKET_0)
self.add_slave_to_bonding_device(bond_port, False, self.dut_ports[0], self.dut_ports[1], self.dut_ports[2])
self.dut.send_expect("set portlist %d,%d" % (self.dut_ports[3], bond_port), "tes... | [
"def test_broadcast_tx_all_slaves_down(self):\n bond_port = self.create_bonded_device(MODE_BROADCAST, SOCKET_0)\n self.add_slave_to_bonding_device(bond_port, False, self.dut_ports[0], self.dut_ports[1], self.dut_ports[2])\n self.dut.send_expect(\"set portlist %d,%d\" % (self.dut_ports[3], bond_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify that transmitting packets correctly in the broadcast mode, when bringing all slaves of the bonding device link down. | def test_broadcast_tx_all_slaves_down(self):
bond_port = self.create_bonded_device(MODE_BROADCAST, SOCKET_0)
self.add_slave_to_bonding_device(bond_port, False, self.dut_ports[0], self.dut_ports[1], self.dut_ports[2])
self.dut.send_expect("set portlist %d,%d" % (self.dut_ports[3], bond_port), "te... | [
"def test_broadcast_tx_one_slave_down(self):\n bond_port = self.create_bonded_device(MODE_BROADCAST, SOCKET_0)\n self.add_slave_to_bonding_device(bond_port, False, self.dut_ports[0], self.dut_ports[1], self.dut_ports[2])\n self.dut.send_expect(\"set portlist %d,%d\" % (self.dut_ports[3], bond_p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert Python PODs to XML Takes in a Python POD (dictionary, list or scalar) and returns its XML representation as a string. The return value always needs to be wrapped in an enclosing element. | def to_xmls (foo, indent = 1):
if type(foo) == type({}):
return __print_dict(foo, indent)
elif type(foo) == type([]) or type(foo) == type(()):
return __print_list(foo, indent)
else:
return __print_scalar(foo, indent) | [
"def generateXml(obj):\r\n if isinstance(obj, dict) or isinstance(obj,DictMixin):\r\n return getXML_dict(obj, \"item\")\r\n elif isinstance(obj,collections.Iterable):\r\n return \"<list>%s</list>\" % getXML(obj, \"item\")\r\n else:\r\n raise RuntimeError(\"Unable to convert to XML: %s\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a noisy subgraph matching problem. | def smp_noisy():
adj0 = csr_matrix([[0, 0, 0],
[1, 0, 0],
[0, 0, 0]])
adj1 = csr_matrix([[0, 0, 0],
[0, 0, 0],
[0, 1, 0]])
nodelist = pd.DataFrame(['a', 'b', 'c'], columns=[Graph.node_col])
edgelist = pd.DataFram... | [
"def test_subgraph(self):\n self.list_motif = []\n n1 = Nucleotid(0, 1, [4], [\"tHS\"])\n n2 = Nucleotid(1, 2, [3], [\"cWW\"])\n n3 = Nucleotid(1, 3, [4], [])\n self.list_motif.append(n1)\n self.list_motif.append(n2)\n self.list_motif.append(n3)\n # self.searc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test Circuit with some example instructions | def test_circuit():
instructions = """\
123 -> x
456 -> y
x AND y -> d
x OR y -> e
x LSHIFT 2 -> f
y RSHIFT 2 -> g
NOT x -> h
NOT y -> i
"""
expected = dict(
[
("d", 72),
("e", 507),
("f", 492),
("g", 114),
("h", 65412),
("i", 65079... | [
"def test_control_bit_of_cnot(self):\n\n qr = QuantumRegister(2, \"qr\")\n circuit = QuantumCircuit(qr)\n circuit.cx(qr[0], qr[1])\n circuit.x(qr[0])\n circuit.cx(qr[0], qr[1])\n\n new_pm = PassManager(CommutativeCancellation())\n new_circuit = new_pm.run(circuit)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get map figure coordinates for a position. | def _figure_coordinates(self, position):
position = np.array(position)
scaled = np.atleast_2d((position - self._origin) / self._resolution)
# flip array in left-right direction
return np.fliplr(scaled).astype(np.uint16).reshape(position.shape) | [
"def _get_plot_coordinates(self) -> Tuple[int, int]:\n return self._x0 + AXIS_SPACE_PX, self._y0 # y does not need to be added AXIS_SPACE_PX, since it is at bottom",
"def obj_coords(self, soma_id, soma_map, soma_config):\n query = { \"map\": soma_map,\n \"config\": soma_config,\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check whether a position is free in the map. | def _is_free(self, position):
index = self._figure_coordinates(position)
return self._map[tuple(index)] == FREE | [
"def _is_free(self, pos: int) -> bool:\n row_idx, col_idx = self._index(pos)\n return self._board[row_idx][col_idx] is None",
"def is_costmap_free(self, x, y):\n x_idx = int((x - self.map_orig_x)/self.map_resolution)\n y_idx = int((y - self.map_orig_y)/self.map_resolution)\n\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inflate the obstacles in map by a given radius. | def _inflate_map(self, og, radius):
new_map = copy(og)
shape = og.shape
new_radius = radius / self._resolution
obstacles = np.nonzero(og == OCCUPIED)
for i in range(np.size(obstacles[0])):
x = obstacles[0][i]
y = obstacles[1][i]
rr,cc ... | [
"def inflate_map(self, grid_map):\n\n\n \"\"\"\n Fill in your solution here\n \"\"\"\n\n width = grid_map.get_width()\n height = grid_map.get_height()\n radius = self.radius\n #fill in the C space cells whose distance to occupied cells <= robot radius\n for x_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw a random sample from the configuration space | def _draw_sample(self):
sample = np.random.random_sample(2)*10
return sample | [
"def draw_sample(self):\n m = self.data[1].shape[0]\n select = np.random.choice(m,self.mtrain,replace=False)\n return tuple([d[select,:] for d in self.data])",
"def draw_sample(self):\n return self.sample_fn(self.output_components)",
"def generate_sample(self):\n\n rand_angles... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Trains one logistic classifier per review group. Saves the trained classifiers within self.models. | def train(self, x_train, y_train):
# check if vectorizer has been created before, if so load from file
if check_persisted(f"{self.env['store_misc']}/tfidf", f'{self.vectorizer_hash}_X', self.load_fresh):
vec = load(f"{self.env['store_misc']}/tfidf", f'{self.vectorizer_hash}_vec')
... | [
"def exec_classifiers(self, dataset):\n f = Features()\n pt = param_tuning.ParamTuning()\n\n start_time = time.time()\n Xtrain, Xtest, ytrain, ytest = self._load_and_split_data(dataset)\n print(\"Loaded train/test datasets in {} sec.\".format(time.time() - start_time))\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute a class saliency map using the model for images X and labels y. | def compute_saliency_maps(X, y, model):
# Make input tensor require gradient
X.requires_grad_()
saliency = None
##############################################################################
# TODO: Implement this function. Perform a forward and backward pass through #
# the model to compute the gradient... | [
"def classifier_saliency_maps(X, y, model):\n # Make sure the model is in \"test\" mode\n model.eval()\n\n # Make input tensor require gradient\n X.requires_grad_()\n\n scores = model(X)\n correct_class_scores = scores.gather(1, y.view(-1,1)).squeeze()\n dummy_loss = torch.sum(correct_class_sco... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate an adversarial attack that is close to X, but that the model classifies as target_y. | def make_adversarial_attack(X, target_y, model, max_iter=100, verbose=True):
# Initialize our adversarial attack to the input image, and make it require gradient
X_adv = X.clone()
X_adv = X_adv.requires_grad_()
learning_rate = 1
##############################################################################... | [
"def make_adversarial_attack(x, y_target, model, max_iter=100, verbose=True):\n # Initialize our adversarial attack to the input image, and make it require gradient\n \n \n ##############################################################################\n # TODO: Generate an adversarial attack X_adv that the mode... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Performs gradient step update to generate an image that maximizes the score of target_y under a pretrained model. | def class_visualization_step(img, target_y, model, **kwargs):
l2_reg = kwargs.pop('l2_reg', 1e-3)
learning_rate = kwargs.pop('learning_rate', 25)
########################################################################
# TODO: Use the model to compute the gradient of the score for the #
# class... | [
"def make_adversarial_attack(X, target_y, model, max_iter=100, verbose=True):\n # Initialize our adversarial attack to the input image, and make it require gradient\n X_adv = X.clone()\n X_adv = X_adv.requires_grad_()\n \n learning_rate = 1\n ###################################################################... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get an instance of a reviewer based on MODE. | def get_instance(*args):
if MODE == 'list':
return ListReviewer(*args)
if MODE == 'quorum':
return QuorumReviewer(*args)
raise Exception('Invalid MODE') | [
"def get_instance(self, name, id):\n cls = self.get_class(name)\n if cls:\n if hasattr(cls, 'objects') and id:\n try:\n return cls.objects.get(id=id)\n except (cls.DoesNotExist, ValueError):\n return None\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update Github commit status as success. | def set_success_commit_status(self, desc):
info = self.get_pull_request()
sha = info['head']['sha']
repo = info['head']['repo']['full_name']
return self.set_commit_status('success', desc, repo, sha) | [
"def _update_github_status(report, url, key, threshold, details_link):\n title = key.capitalize()\n\n if report:\n value = int(re.sub(r\"\\D\", \"\", report[key]))\n if value >= threshold:\n pr_state = \"success\"\n description = f\"{title} diff is good!\"\n else:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update Github commit status as pending. | def set_pending_commit_status(self, desc):
info = self.get_pull_request()
sha = info['head']['sha']
repo = info['head']['repo']['full_name']
return self.set_commit_status('pending', desc, repo, sha) | [
"def pending(self):\n for status in self.get_statuses():\n if status.context == 'review/gitmate/manual':\n return\n\n status = CommitStatus(Status.PENDING, 'This commit needs review.',\n 'review/gitmate/manual', 'http://gitmate.io')\n self.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extract a list of usernames from a reviewer list. | def get_reviewers(self):
match = reviewer_regex.match(self.body)
if not match:
return []
return [x.strip('@ ') for x in match.group(1).split(',')] | [
"def get_all_usernames():\n return list(map(lambda u: u.username, get_all_users()))",
"def extract_username_lists(files, outfile):\n\n authors = []\n for filepath in files:\n with open(filepath, \"r\") as f:\n for line in f:\n try:\n comm = json.loads(l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extract the reviewers from pull request body and call the Github API to check who is still pending reviews. | def pending_reviewers(self):
pending = self.get_reviewers()
comments = self.get_comments()
for comment in comments:
username = comment['user']['login']
if username in pending and approve_regex.search(comment['body']):
pending.remove(username)
retur... | [
"def pass_pull_requests(data):\n\tmissing_params = missing_parameters(params=data, required=['pull_requests'])\n\tif missing_params:\n\t\treturn {\"data\": f\"Missing required parameters: {missing_params}\", \"status\": False}\n\n\tcode_cloud = CodeCloud()\n\tresponse = {'status': True, 'data': []}\n\n\tfor pull_re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get number of pending reviews from comments. | def pending_reviews(self):
pending = QUORUM
comments = self.get_comments()
for comment in comments:
username = comment['user']['login']
if (approve_regex.search(comment['body'])
and (username in QUORUM_USERS or len(QUORUM_USERS) == 0)):
... | [
"def disapproved_comments_count(self, post):\r\n count = self.disapproved_comments(post).count()\r\n return count",
"def get_reviews_count(self):\n\n return len(self.pull_requests)",
"def get_num_reviews(self, submission_pk, submission_id):\n return len(list(self.execute(\"SELECT * F... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get account balance for the given currency Calls `GET /accounts/{account_id}/balances` endpoint and only return balance of the given currency. Returns 0 if given currency does not exist in the returned balances. | async def balance(self, currency: str) -> int:
return (await self.balances()).get(currency, 0) | [
"def getAccountBalance(self, currency={}):\n data = self.getInfo()\n\n if currency.__contains__(\"BTC\"):\n return Decimal(data['return']['funds']['btc'])\n elif currency.__contains__(\"USD\"):\n return Decimal(data['return']['funds']['usd'])\n else:\n re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send amount of currency to payee Calls `POST /accounts/{account_id}/payments` endpoint and returns payment details. | async def send_payment(self, currency: str, amount: int, payee: str) -> Payment:
p = await self.client.create(self._resources("payment"), payee=payee, currency=currency, amount=amount)
return Payment(id=p["id"], account_id=self.id, payee=payee, currency=currency, amount=amount) | [
"def send_fee(self, address, amount, currency):\n req = {\n 'address': address,\n 'amount': amount,\n 'currency': currency,\n }\n return self.do('GET', '/api/1/send_fee', req=req, auth=True)",
"def pay_money(self, amount, receiver=None):\n currency = se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate an account identifier Calls `POST /accounts/{account_id}/account_identifiers` to generate account identifier. | async def generate_account_identifier(self) -> str:
ret = await self.client.create(self._resources("account_identifier"))
return ret["account_identifier"] | [
"def _get_account_id(self) -> str:\n return self._post(\n DEXCOM_AUTHENTICATE_ENDPOINT,\n json={\n \"accountName\": self._username,\n \"password\": self._password,\n \"applicationId\": DEXCOM_APPLICATION_ID,\n },\n )",
"de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |