query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
state_transl(state) > int Translates state names into numbers.
def state_transl(state): nonlocal state_cnt nonlocal state_transl_dict if state not in state_transl_dict.keys(): state_transl_dict[state] = state_cnt state_cnt += 1 return str(state_transl_dict[state])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_state_code(self, data) -> int:\n return int(self.state)", "def get_new_state():\n state = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in xrange(32))\n return state", "def get_lookup_state(self, state):\n return \"\".join(map(str, state))", "def lookup_stat...
[ "0.60437626", "0.590167", "0.58867633", "0.5879405", "0.58519715", "0.5814022", "0.57338357", "0.5721833", "0.564492", "0.56102365", "0.5605891", "0.5580897", "0.5508165", "0.5494175", "0.54446507", "0.54058284", "0.53943527", "0.5359987", "0.5331887", "0.5330565", "0.5310229...
0.78725755
1
symb_transl(symb) > int Translates symbol names into numbers.
def symb_transl(symb): nonlocal symb_cnt nonlocal symb_transl_dict if symb not in symb_transl_dict.keys(): symb_transl_dict[symb] = symb_cnt symb_cnt += 1 return str(symb_transl_dict[symb])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def symb_to_num(symbolic):\n\n if len(symbolic) == 9:\n group = (symbolic[:-6], symbolic[3:-3], symbolic[6:])\n try:\n numeric = notation[group[0]] + notation[group[1]] + notation[group[2]]\n except:\n numeric = \"Invalid Symbolic Representation!\"\n else:\n ...
[ "0.5577643", "0.5450003", "0.5389088", "0.5294732", "0.51255476", "0.50892496", "0.5078452", "0.49963906", "0.4970441", "0.49569905", "0.49000248", "0.48983368", "0.4879762", "0.48773867", "0.48554212", "0.47946328", "0.47715932", "0.47610152", "0.47499046", "0.47405514", "0....
0.7598046
0
aut2GFF(aut) > string Serializes an automaton as the GOAL file format.
def aut2GFF(aut): state_cnt = 0 state_transl_dict = dict() ########################################### def state_transl(state): """state_transl(state) -> int Translates state names into numbers. """ nonlocal state_cnt nonlocal state_transl_dict if state not in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aut2BA(aut):\n res = \"\"\n for st in aut[\"initial\"]:\n res += st + \"\\n\"\n for trans in aut[\"transitions\"]:\n src, symb, tgt = trans\n res += \"{},{}->{}\".format(symb, src, tgt) + \"\\n\"\n for st in aut[\"final\"]:\n res += st + \"\\n\"\n\n return res", "de...
[ "0.5754445", "0.54976296", "0.54789925", "0.5461304", "0.5443864", "0.54335296", "0.53065205", "0.52437365", "0.5173404", "0.5142212", "0.5129688", "0.51291436", "0.51273733", "0.5098814", "0.5092949", "0.50890404", "0.50819266", "0.5079442", "0.5072792", "0.5064227", "0.5050...
0.7273705
0
state_transl(state) > int Translates state names into numbers.
def state_transl(state): nonlocal state_cnt nonlocal state_transl_dict if state not in state_transl_dict.keys(): state_transl_dict[state] = state_cnt state_cnt += 1 return str(state_transl_dict[state])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_state_code(self, data) -> int:\n return int(self.state)", "def get_new_state():\n state = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in xrange(32))\n return state", "def get_lookup_state(self, state):\n return \"\".join(map(str, state))", "def lookup_stat...
[ "0.60437626", "0.590167", "0.58867633", "0.5879405", "0.58519715", "0.5814022", "0.57338357", "0.5721833", "0.564492", "0.56102365", "0.5605891", "0.5580897", "0.5508165", "0.5494175", "0.54446507", "0.54058284", "0.53943527", "0.5359987", "0.5331887", "0.5330565", "0.5310229...
0.78725755
0
Initialises a new ordered linked list object, with a given list of elements lst.
def __init__(self, lst=[]): self.__length = 0 # current length of the linked list self.__head = None # pointer to the first node in the list for e in lst: # initialize the list, self.add(e) # by adding elements one by one
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, lst=[]):\r\n self.__length = 0 # current length of the linked list\r\n self.__head = None # pointer to the first node in the list\r\n self.__last = None # pointer to the last node in the list\r\n lst.reverse() # reverse to ensure elements will appear in same order...
[ "0.7740163", "0.7060453", "0.6915438", "0.682955", "0.6793986", "0.6741357", "0.6705007", "0.66472715", "0.655822", "0.64578074", "0.64578074", "0.64578074", "0.64578074", "0.64578074", "0.6447554", "0.643696", "0.6430444", "0.6427214", "0.642692", "0.6379833", "0.6360155", ...
0.76552415
1
Removes the node at the start of the list. Leaves the ordered list intact if already empty.
def __remove_first(self): if self.__head is not None: self.__length -= 1 self.__head = self.__head.next() if self.__length == 0: # when there are no more elements in the list, self.__last = None # remove the pointer to the last element
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_node_at_start(self):\n if not self.head:\n print('List already empty.')\n return\n self.head = self.head.next", "def delete_node_at_beginning(self):\n\t\tif self.root is None:\n\t\t\traise EmptyRootException(\"ERROR: No node available in list. Please insert node in ...
[ "0.8351589", "0.7582796", "0.73799616", "0.7289658", "0.7140646", "0.71081614", "0.7106494", "0.7027544", "0.68831503", "0.6852153", "0.6819653", "0.669881", "0.6663422", "0.6578224", "0.6563162", "0.6558882", "0.65287566", "0.6518836", "0.648081", "0.6434819", "0.6407462", ...
0.77263117
1
Adds a node with value s at the right position in an already sorted ordered linked list.
def add(self, s): current = self.first() # case 1 : list is empty, add new node as first node if self.size() == 0: self.__add_first(s) return # case 2 : list is not empty, element to be added is smaller than all existing ones elif s < current.value(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(s, v):\n if empty(s):\n return Link(v)\n if s.first > v:\n s.first, s.rest = v, Link(s.first, s.rest)\n elif s.first < v and empty(s.rest):\n s.rest = Link(v, s.rest)\n elif s.first < v:\n add(s.rest, v)\n return s", "def add(self, s, value):\n\t\thead, tail = s...
[ "0.69526494", "0.6913095", "0.66902816", "0.615452", "0.6098683", "0.6022445", "0.6022445", "0.60025346", "0.5976091", "0.5931356", "0.5927383", "0.589682", "0.589132", "0.5852468", "0.58322865", "0.5830779", "0.58050364", "0.58000183", "0.57888347", "0.5756908", "0.57483876"...
0.7564802
0
Removes the first node with the given value from the ordered linked list. Leaves the list intact if already empty.
def remove(self, value): node = self.first() # case 1 : in case of empty list, do nothing and return None if node is None: return None # case 2 : list has at least one element and node to be removed is the first element if node.value() == value: self.__hea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_value(self, value):\n if self.head is None: \n raise ValueError('Deleting from empty list.')\n node = self.head \n if node.value == value: \n self.head = self.head.next_node \n return node \n while node.next_node is not None:\n curr...
[ "0.84336585", "0.82318616", "0.82197016", "0.79544455", "0.7914709", "0.78713995", "0.78583854", "0.7776217", "0.7672654", "0.76066184", "0.7589861", "0.7580605", "0.7466483", "0.7233176", "0.71712923", "0.7104648", "0.70787865", "0.70723754", "0.6865433", "0.6846761", "0.678...
0.82805014
1
Returns the value of the cargo contained in this node.
def value(self): return self.__cargo
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value(self):\r\n return self.__cargo", "def value(self):\n return self.node_value", "def value(self):\n return self.get_attribute(\"value\", str(self.children))", "def getValue(self):\n return _libsbml.ASTNode_getValue(self)", "def getValue(self):\n \n retu...
[ "0.8142979", "0.73237133", "0.7138349", "0.69184244", "0.6778445", "0.6735514", "0.6679945", "0.6646512", "0.6615436", "0.6615436", "0.6615436", "0.66109717", "0.66104925", "0.6604634", "0.6604634", "0.6604634", "0.6604634", "0.6604634", "0.6604634", "0.6604634", "0.6604634",...
0.8199494
0
L is a list of locations ordered by their id, L[i] is the name of the ith location E is an adjacency matrix whose entries are weights, where E[i][j] denotes an edge from i to j E[i][j] == 'x' if and only if such an edge does not exist H is a list of homes identified by id s is the starting location fileName is name of ...
def print_input(L, E, H, s, fileName): f = open(fileName, 'w') f.write(str(len(L))+'\n') #The first line of the input should contain a single integer, which equals the number of locations f.write(str(len(H))+'\n') #The second line should also be an integer, which equals the number of homes for location in L: f.wr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(list_of_locations, list_of_homes, starting_car_location, adjacency_matrix, params=[]):\n\n\n\n\n path = [starting_car_location]\n dict = {}\n index = 0\n for i in range(len(list_of_locations)):\n if list_of_locations[i] == starting_car_location:\n index = i\n\n path = [in...
[ "0.55288064", "0.52756536", "0.5219858", "0.5188992", "0.5051993", "0.5038808", "0.5035424", "0.5009456", "0.50076455", "0.4981707", "0.4980944", "0.49535435", "0.49374443", "0.4930359", "0.48791504", "0.48749682", "0.48330376", "0.48256785", "0.48253503", "0.480284", "0.4799...
0.565996
0
Generate a random input of n locations and write to fileName Each vertex is a home with probability p
def generate_random_input(n, p, fileName): max_x = 1000 L = [] H = [] E = [] x = [] #non negative x-coordinate of vertices for i in range(n): L.append('location' + str(i)) rand = round(random.random() * max_x) + 1 while rand in x: rand = round(random.random() * max_x) + 1 x.append(rand) for i in rang...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateRandomInput(filename, num_people, travel_db):\n import random\n routes = []\n for i in range(num_people):\n route = travel_db.randomRoute()\n route.insert(0,\"Person \" + str(i)) # Add a name for each route.\n routes.append(route)\n if FileH...
[ "0.67131954", "0.62345254", "0.6159704", "0.61301774", "0.6034666", "0.5965056", "0.58956575", "0.5811915", "0.5804421", "0.5698664", "0.5690434", "0.5683697", "0.56731087", "0.56668985", "0.5614566", "0.55891496", "0.5583429", "0.5572517", "0.55605453", "0.5547967", "0.55264...
0.77192765
0
Gets the feature of this PaymentConnectorFeature.
def feature(self): return self._feature
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, feature_name):\n return getattr(self, feature_name)", "def get(cls, feature_name):\n try:\n return cls.feature_registry[feature_name]\n except KeyError:\n raise FeatureNotFound(feature_name)", "def config(self, feature):\n return self._config.get(...
[ "0.63052654", "0.58349454", "0.58330095", "0.5801297", "0.57597953", "0.574794", "0.56846553", "0.5595365", "0.5569588", "0.55606323", "0.5526605", "0.550877", "0.5505963", "0.55038595", "0.548417", "0.5483593", "0.54776543", "0.54644096", "0.53197587", "0.53013575", "0.52925...
0.7268537
0
Sets the feature of this PaymentConnectorFeature.
def feature(self, feature): self._feature = feature
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_cur_feature(self, feature):\n self.cur_feature = feature", "def setFeature(self, name, value=1):\n self.features[self.featureSet.getId(self.tag+name)] = value", "async def async_set_features(self, features):\n self._features = features", "def attach_feature(self, feature):\r\n\r\...
[ "0.61582905", "0.5667619", "0.5464145", "0.5331207", "0.52944213", "0.5291586", "0.52516097", "0.52505726", "0.52294904", "0.521491", "0.51534677", "0.51327854", "0.51170415", "0.5108358", "0.50498706", "0.50097615", "0.4988337", "0.4987762", "0.49632746", "0.49425036", "0.49...
0.7179533
0
repo_url is formatted as AUTHOR/REPO user and passwd required to have 5000 request limit
def get_pullReq(repo_url, user, passwd): #auth for 5000 request/h limitprint("\nINPUT GITHUB AUTH TO GET BETTER REQUEST LIMIT") if user=='' or passwd=='': user = input('username : ') passwd = input('passwd : ') #repo url github_pullReq_url = "https://api.github.com/repos/{}/pulls...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pullReq_commits(pullreq_url, user, passwd):\n \n #auth for 5000 request/h limitprint(\"\\nINPUT GITHUB AUTH TO GET BETTER REQUEST LIMIT\")\n if user=='' or passwd=='':\n user = input('username : ')\n passwd = input('passwd : ')\n\n #fetch 250 max commits\n pullReq_commits = g...
[ "0.7222348", "0.6270832", "0.61279446", "0.61235946", "0.60410225", "0.60330355", "0.59770346", "0.5941654", "0.5870572", "0.5806155", "0.575964", "0.5754485", "0.5734286", "0.56632453", "0.56577796", "0.56416154", "0.5631557", "0.56242985", "0.5606981", "0.56014514", "0.5584...
0.72966975
0
pullreq_url is from the dictionnary outputted by get_pullreq dict['_links']['commits']['href'] user and passwd required to have 5000 request limit
def get_pullReq_commits(pullreq_url, user, passwd): #auth for 5000 request/h limitprint("\nINPUT GITHUB AUTH TO GET BETTER REQUEST LIMIT") if user=='' or passwd=='': user = input('username : ') passwd = input('passwd : ') #fetch 250 max commits pullReq_commits = get_requests(pull...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pullReq(repo_url, user, passwd):\n \n #auth for 5000 request/h limitprint(\"\\nINPUT GITHUB AUTH TO GET BETTER REQUEST LIMIT\")\n if user=='' or passwd=='':\n user = input('username : ')\n passwd = input('passwd : ')\n\n #repo url\n github_pullReq_url = \"https://api.github.c...
[ "0.79000103", "0.61164", "0.6008621", "0.5987483", "0.59653175", "0.592727", "0.57375395", "0.56855536", "0.5679855", "0.5627813", "0.5618178", "0.5520393", "0.54909617", "0.5481987", "0.5375036", "0.53679514", "0.5272469", "0.52530247", "0.52414536", "0.5240988", "0.5225295"...
0.81588095
0
Builds the instance based on the spec, loading images from image_dir. Return the instance, for example with self.load(name)
def create(self, spec, force_cache=False, image_dir="~/.hyperkit"):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(cls, path):\n assert os.path.exists(path), \"No such file: %r\" % path\n\n (folder, filename) = os.path.split(path)\n (name, extension) = os.path.splitext(filename)\n\n image = Image(None)\n image._path = path\n image._format = Image.image_format(extension)\n\n ...
[ "0.61524683", "0.6037816", "0.60318625", "0.59158003", "0.5908878", "0.5878213", "0.58532834", "0.582987", "0.5799404", "0.57779765", "0.5770414", "0.5768476", "0.5713612", "0.56738454", "0.5671704", "0.5643247", "0.5602958", "0.55821663", "0.55706567", "0.5565781", "0.554887...
0.6255592
0
Test admin successful registration
def test_admin_register(self): admin = dict( name='Jonnie Pemba', username='jonnie', password='Andela8', role='admin' ) resp = self.client.post( '/api/v1/register', content_type='application/json', data=json.dum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_register_only_one_admin(self):\n reply = self.admin_register()\n\n admin = dict(\n name='Codjoe Ronnie',\n username='ronnie',\n password='Andela8',\n role='admin'\n )\n\n resp = self.client.post(\n '/api/v1/register',\n ...
[ "0.7809236", "0.7805565", "0.7801625", "0.76964223", "0.7696397", "0.7694462", "0.76621336", "0.75906897", "0.7580382", "0.7477269", "0.7457051", "0.7443463", "0.7440877", "0.74344105", "0.74344105", "0.74344105", "0.74344105", "0.74272805", "0.7426961", "0.74158543", "0.7403...
0.82520497
0
Test admin can not register with empty name field
def test_admin_register_no_name(self): admin = dict( name='', username='jonnie', password='Andela8', role='admin' ) resp = self.client.post( '/api/v1/register', content_type='application/json', data=json.dumps(a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_empty_user_name_field(self):\r\n result=self.user.get_user_register(\"Stephen\",\" Ochieng\",\"stephenochieng955@mail.com\",\"stephenochieng\",\"eat\")\r\n self.assertEqual(2,result,\"Fill in the username field please\")", "def test_admin_register_no_username(self):\n admin ...
[ "0.7362851", "0.73370975", "0.7315861", "0.7309367", "0.72637767", "0.7149645", "0.7137991", "0.7085262", "0.7083449", "0.69957393", "0.6902289", "0.6869284", "0.68501955", "0.68169886", "0.6810906", "0.68084204", "0.67463064", "0.67453456", "0.6722818", "0.66770905", "0.6634...
0.75739056
0
Test admin can not register with empty password field
def test_admin_register_no_password(self): admin = dict( name='Jonnie Pemba', username='jonnie', password='', role='admin' ) resp = self.client.post( '/api/v1/register', content_type='application/json', data=jso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_empty_password_field(self):\r\n result=self.user.get_user_register(\"Stephen\",\" Ochieng\",\"stephenochieng955@mail.com\",\"stephenochieng\",\"eat\"\")\r\n self.assertEqual(2,result,\"Fill in the password field please\")", "def test_invalid_password(self):\n pass", "def t...
[ "0.84288025", "0.7932215", "0.78030753", "0.7799765", "0.77714837", "0.7749584", "0.7745351", "0.7689125", "0.76422065", "0.76118517", "0.7564709", "0.7561372", "0.7557103", "0.75487673", "0.75414103", "0.7503708", "0.75003606", "0.7489784", "0.74815494", "0.74763495", "0.746...
0.80885565
1
Test admin can not register with invalid password field
def test_admin_register_wrong_password(self): admin = dict( name='Jonnie Pemba', username='jonnie', password='Andela', role='admin' ) resp = self.client.post( '/api/v1/register', content_type='application/json', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_password(self):\n pass", "def test_admin_register_no_password(self):\n admin = dict(\n name='Jonnie Pemba',\n username='jonnie',\n password='',\n role='admin'\n )\n\n resp = self.client.post(\n '/api/v1/register',...
[ "0.8574067", "0.80264175", "0.8024861", "0.79407185", "0.789616", "0.7894492", "0.78743935", "0.781172", "0.778892", "0.7776758", "0.77584887", "0.7728596", "0.77148277", "0.7702502", "0.7690832", "0.76812327", "0.76725155", "0.7661382", "0.76580256", "0.7653059", "0.7646939"...
0.81949
1
Test admin can not register with invalid role field
def test_admin_register_wrong_role(self): admin = dict( name='Jonnie Pemba', username='jonnie', password='Andela8', role='keeper' ) resp = self.client.post( '/api/v1/register', content_type='application/json', d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_role(self):\n pass", "def test_add_role_simple_post(self):\n pass", "def test_admin_cannot_create_user_with_different_roles(self):\n resp = self.admin_register()\n reply = self.admin_login()\n token = reply['token']\n user = dict(\n name='Summer...
[ "0.7693056", "0.7495057", "0.74605167", "0.7379491", "0.6992951", "0.6956861", "0.6911706", "0.69024867", "0.68894583", "0.6844062", "0.68185097", "0.6816657", "0.67910755", "0.67658985", "0.6691237", "0.6685197", "0.6672649", "0.6657749", "0.66458726", "0.66364074", "0.66341...
0.7838657
0
Test can not register more than one admin
def test_register_only_one_admin(self): reply = self.admin_register() admin = dict( name='Codjoe Ronnie', username='ronnie', password='Andela8', role='admin' ) resp = self.client.post( '/api/v1/register', content_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_admin(self):\n assert(admin)", "def test_02_second_user_is_not_admin(self):\r\n self.register()\r\n self.signout()\r\n self.register(name=\"tester2\", email=\"tester2@tester.com\",\r\n password=\"tester\")\r\n self.signout()\r\n user = db.se...
[ "0.7309909", "0.7267381", "0.7182782", "0.71491766", "0.7015131", "0.70101553", "0.700269", "0.6975732", "0.69714284", "0.6962041", "0.6954554", "0.69518054", "0.6945564", "0.6876291", "0.6874265", "0.68027735", "0.6774794", "0.6731248", "0.6718102", "0.669607", "0.668596", ...
0.801755
0
Test admin can view all user accounts
def admin_can_view_all_user_accounts(self): resp = self.admin_create_user() reply = self.admin_create_user2() resp = self.admin_login() token = resp['token'] resp = self.client.get( '/api/v1/users', headers={'Authorization': 'Bearer {}'.format(token)} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_all_user(self):\n response = self.client().get(AuthTestCase.admin)\n # assert the response code\n self.assertEqual(response.status_code, 200)", "def test_admin_get_all(self):\n response = self.app.get('/api/v3/users', headers=self.admin_header)\n self.assertEqual(r...
[ "0.8039933", "0.78656775", "0.7778051", "0.77131677", "0.7622776", "0.75739825", "0.74982417", "0.74839985", "0.7449284", "0.7436807", "0.7436807", "0.7382937", "0.73566735", "0.7339939", "0.73188037", "0.7282121", "0.7279309", "0.7223879", "0.7220174", "0.71927464", "0.71734...
0.8417845
0
Test store attendants cannot view user accounts
def attendants_cannot_view_user_accounts(self): reply = self.admin_create_user() resp = self.attendant_login() token = resp['token'] resp = self.client.get( '/api/v1/users', headers={'Authorization': 'Bearer {}'.format(token)} ) reply = json.loads(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_non_owner(self):\n another_user = CustomUser(id=101, email='another_user@mail.com', is_active=True)\n another_user.set_password('testpassword')\n another_user.save()\n self.client.login(email='another_user@mail.com', password='testpassword')\n\n url = reverse('route'...
[ "0.68920714", "0.6664434", "0.66508675", "0.65989894", "0.65780735", "0.65544313", "0.6523385", "0.6505487", "0.63439023", "0.63439023", "0.63439023", "0.63439023", "0.6324461", "0.6319198", "0.63036656", "0.62793696", "0.6270352", "0.62537885", "0.6243347", "0.62364614", "0....
0.7187359
0
Tests that admin cannot view all users in the Inventory\ with blacklisted token
def test_cannot_view_all_users_with_blacklisted_token(self): resp = self.admin_create_user() reply = self.admin_create_user2() resp = self.admin_login() token = resp['token'] resp = self.client.delete( '/api/v1/logout', headers={'Authorization': 'Bearer {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_10_admin_user_not_listed(self):\r\n self.register()\r\n res = self.app.get('/admin/users', follow_redirects=True)\r\n assert \"Manage Admin Users\" in res.data, res.data\r\n assert \"Current Users with Admin privileges\" not in res.data, res.data\r\n assert \"John\" not ...
[ "0.73880625", "0.73672503", "0.7269525", "0.7072302", "0.7024909", "0.70035934", "0.6964477", "0.6964477", "0.6938775", "0.6838921", "0.6826864", "0.678693", "0.6745519", "0.6745451", "0.67423964", "0.6729407", "0.6705149", "0.6697523", "0.6688124", "0.66815144", "0.66791004"...
0.77643275
0
Test admin cannot update a store attendant\ with blacklisted token
def test_cannot_update_user_with_blacklisted_token(self): resp = self.admin_create_user() reply = self.admin_login() token = reply['token'] resp = self.client.delete( '/api/v1/logout', headers={'Authorization': 'Bearer {}'.format(token)} ) reply =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_attendant_cannot_make_a_sale_with_blacklisted_token(self):\n reply = self.admin_add_product()\n\n resp = self.admin_create_user()\n reply = self.attendant_login()\n token = reply['token']\n\n resp = self.client.delete(\n '/api/v1/logout',\n headers=...
[ "0.6632362", "0.6503029", "0.6456621", "0.64475024", "0.6429417", "0.64270395", "0.63401264", "0.631916", "0.63083947", "0.62978315", "0.62547594", "0.6140264", "0.61387783", "0.6122147", "0.6098927", "0.609861", "0.6074144", "0.6073103", "0.60713977", "0.60544616", "0.605314...
0.6702801
0
Test admin cannot update a store attendant with different roles\ other than 'admin' or 'attendant'
def test_admin_cannot_update_user_with_different_roles(self): resp = self.admin_create_user() reply = self.admin_login() token = reply['token'] user = dict( name='Summer Lover', username='lover', password='Andela8', role='supervisor' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_attendant_can_only_view_own_sale(self):\n reply = self.admin_add_product()\n\n resp = self.admin_create_user()\n reply = self.attendant_login()\n token = reply['token']\n sale = dict(products = [\n {\n \"prod_name\":\"NY_denims\", \n ...
[ "0.6734772", "0.67023313", "0.6685747", "0.6653768", "0.65826803", "0.6570354", "0.6543829", "0.6476152", "0.64435196", "0.6425734", "0.6390715", "0.63797116", "0.6317682", "0.6251953", "0.6250159", "0.6206891", "0.62026596", "0.61997855", "0.6192626", "0.6176961", "0.6169824...
0.7228282
0
Test admin cannot update a store attendant with invalid username
def test_admin_cannot_update_user_with_invalid_username(self): resp = self.admin_create_user() reply = self.admin_login() token = reply['token'] user = dict( name='Summer Love', username='love summer', password='Andela8', role='attendant' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_admin_cannot_update_user_with_invalid_name(self):\n resp = self.admin_create_user()\n reply = self.admin_login()\n token = reply['token']\n user = dict(\n name='Summer Lover3',\n username='lover',\n password='Andela8',\n role='attenda...
[ "0.6882498", "0.6805685", "0.67120755", "0.6652845", "0.6626257", "0.66236037", "0.66232955", "0.6510223", "0.6469667", "0.64549625", "0.6385028", "0.63423777", "0.6299679", "0.6264924", "0.6254841", "0.62495565", "0.6238614", "0.6227551", "0.62265486", "0.6219083", "0.620443...
0.6969854
0
Test admin cannot update a store attendant with invalid password
def test_admin_cannot_update_user_with_invalid_password(self): resp = self.admin_create_user() reply = self.admin_login() token = reply['token'] user = dict( name='Summer Love', username='love', password='Andela', role='attendant' )...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_password(self):\n pass", "def test_invalid_update_user_old_password(self):\n\n data = {\n 'password': 'password-invalido',\n 'new_password': 'pedro123456789',\n 'confirm_password': 'pedro123456789'\n }\n response = self.client.put(self...
[ "0.7587666", "0.7190806", "0.7065232", "0.70605147", "0.69997144", "0.6972896", "0.69573975", "0.693463", "0.6927393", "0.6889472", "0.6862712", "0.6851641", "0.6851611", "0.68099064", "0.6807714", "0.6806558", "0.6805681", "0.67896575", "0.6773845", "0.67709357", "0.67707455...
0.7285022
1
Test admin cannot update a store attendant with vague user id
def test_admin_cannot_update_user_with_vague_user_id(self): resp = self.admin_create_user() reply = self.admin_login() token = reply['token'] user = dict( name='Summer Love', username='love', password='Andela8', role='attendant' ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_edition_of_other_users_aid(client, contributor):\n\n aid = AidFactory()\n form_url = reverse('aid_edit_view', args=[aid.slug])\n client.force_login(contributor)\n res = client.get(form_url)\n assert res.status_code == 404", "def test_update_user(self):\n pass", "def test_update_b...
[ "0.6781378", "0.65461284", "0.64795804", "0.6436433", "0.6332345", "0.6313285", "0.6267433", "0.622346", "0.62083393", "0.61932874", "0.61855006", "0.61781687", "0.6140063", "0.6139956", "0.6132134", "0.609968", "0.60942966", "0.6083457", "0.6070109", "0.6059979", "0.6030719"...
0.6831623
0
Test admin cannot updates a user that doesnt exist
def test_admin_cannot_update_non_existant_user(self): resp = self.admin_create_user() reply = self.admin_login() token = reply['token'] user = dict( name='Summer Lover', username='lover', password='Andela8', role='attendant' ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_user(self):\n pass", "def test_user_update_request(self):\n pass", "def test_update_self_fail(self):\n new_user = self.create_user('1')\n url = '/0/chefs/' + str(new_user.pk)\n\n headers = self.login()\n resp = self.client.put(url, **headers)\n s...
[ "0.81179094", "0.76583564", "0.76581556", "0.76460975", "0.75170904", "0.74860865", "0.74507725", "0.7441613", "0.7438987", "0.74172455", "0.73982227", "0.7366298", "0.73619944", "0.7332433", "0.7329521", "0.7268531", "0.7250227", "0.7234456", "0.7233554", "0.72302", "0.72285...
0.8409781
0
Test admin cannot delete a user that doesnt exist
def test_admin_cannot_delete_non_existant_user(self): resp = self.admin_create_user() reply = self.admin_login() token = reply['token'] resp = self.client.delete( '/api/v1/users/5', content_type='application/json', headers={'Authorization': 'B...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_user(self):\n pass", "def test_delete_user(self):\n pass", "def test_delete_fail(self):\n self.user_api()\n self.base.metadata.create_all(self.engine)\n people = self.provision_users()\n p = {'id': people[2].id}\n self.delete('user', 403, params=...
[ "0.8464141", "0.8464141", "0.8194369", "0.80601615", "0.80286217", "0.79667133", "0.7949473", "0.79252636", "0.791296", "0.7894087", "0.78859013", "0.7866681", "0.78086597", "0.7806129", "0.7803511", "0.7781318", "0.7777231", "0.77508134", "0.7748713", "0.774801", "0.7744327"...
0.8555734
0
Test user cannot logout with a blacklisted token
def test_cannot_logout_with_blacklisted_token(self): reply = self.admin_register() user = dict( username='jonnie', password='Andela8' ) resp = self.client.post( '/api/v1/login', content_type='application/json', data=json.dumps(u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_logout_without_token(self):\n self.create_user()\n\n url = reverse_lazy('authenticate:logout')\n response = self.client.get(url)\n\n detail = str(response.data['detail'])\n status_code = int(response.data['status_code'])\n\n self.assertEqual(len(response.data), 2)...
[ "0.76390165", "0.7464493", "0.7407765", "0.7369426", "0.72350377", "0.7150207", "0.7141968", "0.71375614", "0.71186984", "0.71078527", "0.71049744", "0.70918167", "0.7071774", "0.703527", "0.69626963", "0.6960639", "0.691597", "0.69064254", "0.6890695", "0.6852276", "0.685189...
0.84015685
0
Creates a pipeline that reads tweets from Cloud Datastore from the last N days. The pipeline finds the top mostused words, the top mosttweeted URLs, ranks word cooccurrences by an 'interestingness' metric (similar to on tf idf).
def process_datastore_tweets(project, dataset, pipeline_options): ts = str(datetime.datetime.utcnow()) p = beam.Pipeline(options=pipeline_options) # Create a query to read entities from datastore. query = make_query('Tweet') # Read entities from Cloud Datastore into a PCollection. lines = (p | 'read ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTopNTweets(retrievedTweets, numberOfTweets):\n if sortBy=='newest':\n retrievedTweets = sorted(retrievedTweets, key=lambda k: k['id'], reverse=True)\n elif sortBy=='oldest':\n retrievedTweets = sorted(retrievedTweets, key=lambda k: k['id'],reverse=False)\n elif sor...
[ "0.55078226", "0.54873246", "0.53973114", "0.5381288", "0.53680915", "0.534437", "0.5264347", "0.52361506", "0.52216566", "0.5216795", "0.52121794", "0.52082795", "0.5202691", "0.51886666", "0.5179647", "0.5176253", "0.5159707", "0.51566535", "0.51549745", "0.51432204", "0.51...
0.66543806
0
BigQuery schema for the word cooccurrence table.
def generate_cooccur_schema(): json_str = json.dumps({'fields': [ {'name': 'w1', 'type': 'STRING', 'mode': 'NULLABLE'}, {'name': 'w2', 'type': 'STRING', 'mode': 'NULLABLE'}, {'name': 'count', 'type': 'INTEGER', 'mode': 'NULLABLE'}, {'name': 'log_weight', 'type': 'FLOAT', 'mod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_wc_schema():\n json_str = json.dumps({'fields': [\n {'name': 'word', 'type': 'STRING', 'mode': 'NULLABLE'},\n {'name': 'percent', 'type': 'FLOAT', 'mode': 'NULLABLE'},\n {'name': 'ts', 'type': 'TIMESTAMP', 'mode': 'NULLABLE'}]})\n return parse_table_schema_from_json(js...
[ "0.6825363", "0.5536852", "0.542956", "0.5351534", "0.5351479", "0.5240092", "0.52194554", "0.52166784", "0.5211417", "0.5208293", "0.5185048", "0.51837534", "0.5175961", "0.51413655", "0.511861", "0.5096498", "0.50657487", "0.50420344", "0.5041939", "0.5027259", "0.5024432",...
0.6641016
1
BigQuery schema for the urls count table.
def generate_url_schema(): json_str = json.dumps({'fields': [ {'name': 'url', 'type': 'STRING', 'mode': 'NULLABLE'}, {'name': 'count', 'type': 'INTEGER', 'mode': 'NULLABLE'}, {'name': 'ts', 'type': 'TIMESTAMP', 'mode': 'NULLABLE'}]}) return parse_table_schema_from_json(json_str)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tables():\n with db.connect() as conn:\n conn.execute(\n \"CREATE TABLE IF NOT EXISTS url_list \"\n \"(url_id VARCHAR(20) NOT NULL UNIQUE, url_data VARCHAR(2083) NOT NULL);\"\n )", "def get_table_count(t...
[ "0.56397116", "0.55176735", "0.54308933", "0.53076", "0.50500786", "0.5012381", "0.5005372", "0.49362692", "0.4921254", "0.49172506", "0.49127892", "0.49102753", "0.49071926", "0.48962775", "0.48466182", "0.48446733", "0.48303398", "0.48188177", "0.48101094", "0.48087117", "0...
0.6956805
0
BigQuery schema for the word count table.
def generate_wc_schema(): json_str = json.dumps({'fields': [ {'name': 'word', 'type': 'STRING', 'mode': 'NULLABLE'}, {'name': 'percent', 'type': 'FLOAT', 'mode': 'NULLABLE'}, {'name': 'ts', 'type': 'TIMESTAMP', 'mode': 'NULLABLE'}]}) return parse_table_schema_from_json(json_str)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_cooccur_schema():\n json_str = json.dumps({'fields': [\n {'name': 'w1', 'type': 'STRING', 'mode': 'NULLABLE'},\n {'name': 'w2', 'type': 'STRING', 'mode': 'NULLABLE'},\n {'name': 'count', 'type': 'INTEGER', 'mode': 'NULLABLE'},\n {'name': 'log_weight', 'type': 'FL...
[ "0.6019789", "0.5929392", "0.5895341", "0.56691307", "0.56456923", "0.56099075", "0.5580256", "0.5541957", "0.55183524", "0.546304", "0.5438903", "0.5436714", "0.54277676", "0.5387588", "0.5350829", "0.53483534", "0.53423476", "0.53415966", "0.5339946", "0.53039205", "0.52996...
0.71177036
0
Gets the error_details of this WorkRequest.
def error_details(self): return self._error_details
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_details(self) -> Sequence['outputs.JobErrorDetailsResponse']:\n return pulumi.get(self, \"error_details\")", "def error_details(self) -> Sequence['outputs.JobErrorDetailsResponse']:\n return pulumi.get(self, \"error_details\")", "def error_details(self) -> Sequence['outputs.JobErrorDeta...
[ "0.7687312", "0.7687312", "0.7687312", "0.7687312", "0.75932133", "0.71988595", "0.7126288", "0.70466316", "0.67343795", "0.672883", "0.6612877", "0.659201", "0.65748554", "0.6505508", "0.6468211", "0.6435177", "0.64291966", "0.63854223", "0.6382505", "0.6382505", "0.6382505"...
0.8006274
0
Sets the error_details of this WorkRequest.
def error_details(self, error_details): self._error_details = error_details
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_detail(self, error_detail):\n\n self._error_detail = error_detail", "def set_error(self, error):\n self._set_sub_text('error', text=str(error))\n return self", "def set_error_details(code, desc):\n MDC.put('errorCode', code)\n MDC.put('errorDescription', desc)", "def erro...
[ "0.7288278", "0.62475634", "0.6221895", "0.6116249", "0.6079993", "0.6001644", "0.6001644", "0.6001644", "0.5962383", "0.5880566", "0.5878469", "0.58783144", "0.57903564", "0.5766922", "0.5754919", "0.574586", "0.57366425", "0.5700703", "0.5700703", "0.5700703", "0.5700703", ...
0.81081605
0
Gets the load_balancer_id of this WorkRequest. The `OCID`__ of the load balancer with which the work request is associated.
def load_balancer_id(self): return self._load_balancer_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_balancer_id(self) -> str:\n return pulumi.get(self, \"load_balancer_id\")", "def load_balancer_id(self) -> str:\n return pulumi.get(self, \"load_balancer_id\")", "def load_balancer_id(self) -> str:\n return pulumi.get(self, \"load_balancer_id\")", "def load_balancer_id(self) -> ...
[ "0.7890315", "0.7890315", "0.7890315", "0.78116715", "0.7780647", "0.7739434", "0.7739434", "0.656374", "0.6504513", "0.6472288", "0.63884926", "0.63022023", "0.6237915", "0.60421634", "0.58649844", "0.55915666", "0.55746996", "0.5552787", "0.5515452", "0.5499319", "0.5448212...
0.79292524
0
Sets the load_balancer_id of this WorkRequest. The `OCID`__ of the load balancer with which the work request is associated.
def load_balancer_id(self, load_balancer_id): self._load_balancer_id = load_balancer_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(self, request, loadbalancer_id):\n kwargs = {'loadbalancer_id': loadbalancer_id}\n update_loadbalancer(request, **kwargs)", "def load_balancer_id(self):\n return self._load_balancer_id", "def load_balancer_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"load_balan...
[ "0.66619974", "0.65204686", "0.6427702", "0.6352528", "0.6352528", "0.6352528", "0.6221372", "0.6221372", "0.6017137", "0.59453", "0.5768332", "0.57498705", "0.57174456", "0.5444608", "0.5366137", "0.5321263", "0.5312888", "0.5203628", "0.51420414", "0.51369774", "0.5123431",...
0.8018049
0
Sets the message of this WorkRequest. A collection of data, related to the load balancer provisioning process, that helps with debugging in the event of failure.
def message(self, message): self._message = message
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message(self, value: str):\n self._properties[\"message\"] = value", "def _set_message(self, value):\n self.__message = value", "def message(self, message: str):\n\n self._message = message", "def message(self, message):\n\n self._message = message", "def message(self, messa...
[ "0.6355234", "0.63029337", "0.62257034", "0.6203849", "0.6203849", "0.6203849", "0.6203849", "0.6203849", "0.6203849", "0.6203849", "0.6203849", "0.61765045", "0.61677366", "0.60702616", "0.60020745", "0.6000318", "0.5923937", "0.58947843", "0.57720613", "0.57564867", "0.5730...
0.6311244
1
Gets the time_accepted of this WorkRequest. The date and time the work request was created, in the format defined by RFC3339.
def time_accepted(self): return self._time_accepted
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pending_time(self):\n now = datetime.datetime.utcnow().replace(tzinfo=utc)\n timediff = now - self.time_requested\n return timediff", "def submit_time(self) -> datetime:\n return self._submit_time", "def accepted_time(self, accepted_time):\n\n self._accepted_time = accept...
[ "0.66144276", "0.646957", "0.63799495", "0.6186461", "0.61386454", "0.6039994", "0.6039994", "0.6039994", "0.5985838", "0.5985838", "0.5985838", "0.5985838", "0.5956583", "0.5956583", "0.58897996", "0.5854773", "0.5841652", "0.5841652", "0.5841652", "0.5810735", "0.58032846",...
0.78294075
0
Sets the time_accepted of this WorkRequest. The date and time the work request was created, in the format defined by RFC3339.
def time_accepted(self, time_accepted): self._time_accepted = time_accepted
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accepted_time(self, accepted_time):\n\n self._accepted_time = accepted_time", "def time_accepted(self):\n return self._time_accepted", "def accept_transfer(self):\n self.is_accepted = True\n self.date_time_accepted = models.DateTimeField(auto_now=True)", "def rejected_time(sel...
[ "0.84088874", "0.71794397", "0.6400894", "0.61765873", "0.6028219", "0.58656025", "0.55198085", "0.55198085", "0.55198085", "0.55198085", "0.5302736", "0.52900857", "0.526864", "0.52670693", "0.5256942", "0.5244525", "0.5244525", "0.5244525", "0.5244525", "0.5244525", "0.5244...
0.8216104
1
Gets the time_finished of this WorkRequest. The date and time the work request was completed, in the format defined by RFC3339.
def time_finished(self): return self._time_finished
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_datetime_finish(self):\n return self.get_t_sect()['datetime_finish']", "def date_finished(self):\n return self._date_finished", "def completion_time(self) -> datetime:\n return self._completion_time", "def getEndTime(self):\n assert self.isFinished(), \"Too early to tell: %s...
[ "0.7161936", "0.71145535", "0.66829485", "0.6392356", "0.63675296", "0.6357172", "0.62655723", "0.62655723", "0.6258675", "0.62255806", "0.62255806", "0.62255806", "0.62255806", "0.62255806", "0.62255806", "0.6190014", "0.61434066", "0.6117809", "0.6112199", "0.60793656", "0....
0.7401861
0
Sets the time_finished of this WorkRequest. The date and time the work request was completed, in the format defined by RFC3339.
def time_finished(self, time_finished): self._time_finished = time_finished
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finish_time(self, finish_time):\n\n self._finish_time = finish_time", "def finish_time(self, finish_time):\n\n self._finish_time = finish_time", "def finish_time(self, finish_time):\n\n self._finish_time = finish_time", "def date_finished(self, date_finished):\n self._date_fin...
[ "0.7065115", "0.7065115", "0.7065115", "0.685432", "0.66010696", "0.6252097", "0.6162726", "0.6158714", "0.6031602", "0.5875143", "0.58484834", "0.57532066", "0.54509366", "0.5416478", "0.5416478", "0.5416478", "0.5403264", "0.5403264", "0.5389085", "0.531435", "0.5231423", ...
0.7655443
0
Extracts features for the cue classifier from the sentence dictionaries. Returns (modified) sentence dictionaries, a list of feature dictionaries, and if called in training mode, a list of labels.
def extract_features_cue(sentence_dicts, cue_lexicon, affixal_cue_lexicon, mode='training'): instances = [] for sent in sentence_dicts: # print(sent) for key, value in sent.items(): features = {} if isinstance(key, int): if not_known_cue_word(value[3].lowe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_features_scope(sentence_dicts, mode='training'):\n instances = []\n sentence_splits = []\n for sent in sentence_dicts:\n if not sent['neg']:\n continue\n print(sent)\n graph = make_dir_graph_for_sentence(sent)\n bidir_graph = make_bidir_graph_for_sentence...
[ "0.66892666", "0.64949316", "0.64540094", "0.6393714", "0.6249462", "0.6235507", "0.62350196", "0.6123919", "0.6111465", "0.6105283", "0.6068304", "0.6055675", "0.6046535", "0.60203534", "0.5974322", "0.59696513", "0.58575445", "0.5842558", "0.58295137", "0.582673", "0.579152...
0.77999353
0
Extracts labels for training the cue classifier. Skips the words that are not known cue words. For known cue words, label 1 means cue and label 1 means non cue. Returns a list of integer labels.
def extract_labels_cue(sentence_dicts, cue_lexicon, affixal_cue_lexicon): labels = [] for sent in sentence_dicts: for key, value in sent.items(): if isinstance(key, int): if not_known_cue_word(value[3].lower(), cue_lexicon, affixal_cue_lexicon): continue ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_labels():\n return {\"contradiction\": 0, \"neutral\": 1, \"entailment\": 2}", "def _labels_of_sentence(self, sentence, esplit):\n\n labels = torch.zeros(len(sentence))\n for token_index, token_attribute_list in enumerate(sentence):\n label_string = token_attribute_list[self.task_label_...
[ "0.6373983", "0.636646", "0.63285345", "0.63244736", "0.6292417", "0.62817603", "0.6245523", "0.6224025", "0.6190308", "0.6177026", "0.6169095", "0.6158527", "0.6142776", "0.61409414", "0.6128977", "0.61261064", "0.61201036", "0.6105373", "0.60926604", "0.60921204", "0.607337...
0.7232671
0
Extracts features for the scope classifier from the sentence dictionaries. Returns (modified) sentence dictionaries, a list of feature dictionaries, a list of the sentence lengths, and if called in training mode, a list of labels.
def extract_features_scope(sentence_dicts, mode='training'): instances = [] sentence_splits = [] for sent in sentence_dicts: if not sent['neg']: continue print(sent) graph = make_dir_graph_for_sentence(sent) bidir_graph = make_bidir_graph_for_sentence(sent) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sentence_to_features(self,sentence):\n\n configured_features = self.configFeatures\n sentence_features = []\n\n for word_idx in range(len(sentence)):\n # word before(-1), current word(0), next word(+1)\n feature_span = len(configured_features)\n half_span ...
[ "0.6499947", "0.63480926", "0.62033504", "0.6139011", "0.6135315", "0.608286", "0.6075097", "0.60615474", "0.6008933", "0.5990459", "0.5952437", "0.59342676", "0.59133846", "0.5895635", "0.5889323", "0.5888182", "0.58752054", "0.58739567", "0.5872163", "0.5853179", "0.5812754...
0.75720364
0
Creates a campaign with propositions, users, and 4 categories in which the students are distributed with the probabilities 0.8, 0.1, 0.06, 0.04
def generate_batch_wishes(self, n_propositions=10, n_students=168): np.random.seed(0) campaign = Campaign(name="Batch campaign", manager_id="17bocquet") campaign.save() propositions = [] for i in range(n_propositions): proposition = Proposition( cam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_citizens_campaign_game(self, number_to_create, demographic_data=None):\n provinces = demographic_data[\"provinces\"]\n country_population = sum([province['population'] for province in provinces])\n for province in provinces:\n province['population'] = round(number_to_crea...
[ "0.60540473", "0.54775965", "0.5420016", "0.53115493", "0.527698", "0.5219173", "0.5213245", "0.52056885", "0.5204419", "0.5188002", "0.5140095", "0.51223373", "0.50955987", "0.50922906", "0.50904256", "0.5060676", "0.5026107", "0.49677777", "0.49602473", "0.4956977", "0.4945...
0.67905664
0
Computes the number of correct predictions.
def num_correct_fun(preds, labels): assert preds.size(0) == labels.size( 0 ), "Batch dim of predictions and labels must match" # Find number of correct predictions num_correct = (preds == labels).float().sum() return num_correct
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, test_data):\n count = 0.0\n for testcase in test_data:\n answer = np.argmax(testcase[1])\n prediction = np.argmax(self.feed_forward(testcase[0]))\n count = count + 1 if (answer - prediction) == 0 else count\n return count", "def accuracy_sco...
[ "0.7441072", "0.72760016", "0.72760016", "0.7261768", "0.7162763", "0.71161926", "0.7093444", "0.7023508", "0.69957274", "0.69852626", "0.69605917", "0.69590217", "0.69373053", "0.6929616", "0.69030887", "0.68987405", "0.6885546", "0.6881008", "0.68792915", "0.6875002", "0.68...
0.78854287
0
Computes the label error.
def label_errors(preds, labels): num_correct = num_correct_fun(preds, labels) return (1.0 - num_correct / preds.size(0)) * 100.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_error(self):\n self.prediction = self.predict()\n pred = self.prediction.reshape(-1)\n self.error = np.sum(pred != self.label) / self.train_data.shape[0]\n return(self.error)", "def _computeError(self, inputs, targets):\n return .5*np.sum((targets-self._pcnfwd(inputs)...
[ "0.72471374", "0.6982414", "0.6836361", "0.6726223", "0.66949826", "0.66395104", "0.6596141", "0.6493463", "0.64885974", "0.64688194", "0.6429107", "0.63847214", "0.6296689", "0.6245625", "0.6220233", "0.6192241", "0.6189202", "0.6174556", "0.6165178", "0.6155069", "0.6149445...
0.729121
0
Computes the GPU memory usage for the current device (MB).
def gpu_mem_usage(): mem_usage_bytes = torch.cuda.max_memory_allocated() return mem_usage_bytes / _B_IN_MB
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_gpu_mem_usage(self):\n assert self.network_generator is not None, \\\n \"Unable to measure network memory utilization without generator function\"\n\n dispatcher = MulticoreDispatcher(1)\n dispatcher.run(get_model_gpu_allocation, self.network_generator)\n mem_usage = dispatcher.join()[0]\...
[ "0.8307335", "0.7811169", "0.72445303", "0.7240968", "0.7172051", "0.7077602", "0.7038147", "0.70290995", "0.70069295", "0.69895846", "0.6949969", "0.6910933", "0.6902093", "0.68718094", "0.6866974", "0.6856295", "0.68228793", "0.6775267", "0.67143226", "0.66814", "0.66562223...
0.8433346
1
Get run id. If active run is not found, tries to find last experiment. Raise `DataSetError` exception if run id can't be found.
def run_id(self): if self._run_id is not None: return self._run_id run = mlflow.active_run() if run: return run.info.run_id raise DataSetError("Cannot find run id.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_run_id(self):\n\t\tif self.have_metadata is False:\n\t\t\tself._get_metadata()\n\t\t\tself.have_metadata = True\n\n\t\ttry:\n\t\t\treturn self.keyinfo['tracking_id'].attrs['run_id']\n\t\texcept:\n\t\t\treturn None", "def getRunId(self):\n return self.runid", "def get_current_run_id(self):\n ...
[ "0.7135845", "0.6851856", "0.65218407", "0.64400977", "0.63702995", "0.63424414", "0.62259513", "0.62118405", "0.61478734", "0.6060078", "0.5936504", "0.5921628", "0.5848821", "0.5746301", "0.57423246", "0.5689302", "0.5672927", "0.5640232", "0.5566331", "0.5538917", "0.55199...
0.7998408
0
Save given MLflow metrics dataset and log it in MLflow as metrics.
def _save(self, data: MetricsDict) -> None: client = MlflowClient() try: run_id = self.run_id except DataSetError: # If run_id can't be found log_metric would create new run. run_id = None log_metric = ( partial(client.log_metric, run_id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metrics(logger, model, X_train, y_train, X_test, y_test):\n\n results = dict()\n y_preds = model.predict(X_test)\n results['Train Accuracy'] = model.score(X_train, y_train)\n results['Test Accuracy'] = accuracy_score(y_test, y_preds)\n results['Precision'] = precision_score(y_test, y_preds)\n ...
[ "0.667636", "0.6626673", "0.63638973", "0.6311859", "0.6228164", "0.61837775", "0.6092719", "0.6020087", "0.59919375", "0.59843105", "0.59331805", "0.58579373", "0.58464634", "0.58147526", "0.580968", "0.57692844", "0.57684577", "0.5746049", "0.5712529", "0.56523967", "0.5635...
0.72578466
0
Check if MLflow metrics dataset exists.
def _exists(self) -> bool: client = MlflowClient() all_metrics = client._tracking_client.store.get_all_metrics( run_uuid=self.run_id ) return any(self._is_dataset_metric(x) for x in all_metrics)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_metrics(charm):\n metricsyaml = \"{}/{}/metrics.yaml\".format(\n get_layer_path(),\n charm,\n )\n if os.path.exists(metricsyaml):\n return True\n return False", "def __check_default_metrics_exist(self):\n return_var = False\n if Metric.objects.count() == len...
[ "0.7121421", "0.6643055", "0.6265092", "0.6205776", "0.61936194", "0.6130659", "0.60995066", "0.60854906", "0.5931938", "0.5857567", "0.5838012", "0.5831367", "0.5810273", "0.57931703", "0.5787611", "0.57371074", "0.56733835", "0.56578803", "0.56324285", "0.5589755", "0.55682...
0.78530204
0
Check if given metric belongs to dataset.
def _is_dataset_metric(self, metric: mlflow.entities.Metric) -> bool: return self._prefix is None or ( self._prefix and metric.key.startswith(self._prefix) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_datapoint_with_metric_name(fake_ingest, metric_name):\n for datapoint in fake_ingest.datapoints:\n if datapoint.metric == metric_name:\n return True\n return False", "def exists_dataset(self, dataset):\n assert dataset, \"Must input a valid dataset name.\"\n return a...
[ "0.7180669", "0.685971", "0.6771512", "0.6482194", "0.6318453", "0.6209338", "0.6122321", "0.6078198", "0.6062199", "0.60171694", "0.6016336", "0.59766287", "0.5968776", "0.5964305", "0.5955861", "0.5951552", "0.59065855", "0.5861811", "0.5808055", "0.57722306", "0.5740384", ...
0.79114664
0
Update metric in given dataset.
def _update_metric( metrics: List[mlflow.entities.Metric], dataset: MetricsDict = {} ) -> MetricsDict: for metric in metrics: metric_dict = {"step": metric.step, "value": metric.value} if metric.key in dataset: if isinstance(dataset[metric.key], list): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, data: Mapping[str, np.ndarray]) -> Self:\n\n for metric in self.metrics:\n metric.update(data)\n\n return self", "def update_metrics(self, metrics, predictions, labels):\n return", "def update_metric(self, metric, value):\n if self.is_number(value):\n ...
[ "0.71797806", "0.63577366", "0.62742144", "0.62739", "0.6228634", "0.6181807", "0.6058167", "0.603701", "0.6003216", "0.60031444", "0.59537387", "0.59425193", "0.58586115", "0.5792442", "0.5785038", "0.57844263", "0.5765737", "0.57546055", "0.57347775", "0.57347775", "0.57347...
0.6611735
1
Build list of tuples with metrics. First element of a tuple is key, second metric value, third step. If MLflow metrics dataset has prefix, it will be attached to key.
def _build_args_list_from_metric_item( self, key: str, value: MetricItem ) -> Generator[MetricTuple, None, None]: if self._prefix: key = f"{self._prefix}.{key}" if isinstance(value, dict): return (i for i in [(key, value["value"], value["step"])]) if isinstanc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init_metrics(self):\n\n batch = {}\n # split data into batches of size batch_size or less\n for metric_name, metric_pattern in self.metrics.items():\n # get the batch list for that metric\n batch_list = []\n for s in range(1, self.schema + 1):\n ...
[ "0.6118578", "0.6038798", "0.6013908", "0.5998873", "0.5981428", "0.5951664", "0.58464813", "0.5808635", "0.57962924", "0.57889605", "0.5692853", "0.56794715", "0.5677968", "0.5665272", "0.56633407", "0.55949426", "0.55933595", "0.5555804", "0.5555385", "0.55325973", "0.55102...
0.6626808
0
Train CRF CEM recognizer.
def train_crf(ctx, input, output, clusters): click.echo('chemdataextractor.crf.train') sentences = [] for line in input: sentence = [] for t in line.split(): token, tag, iob = t.rsplit('/', 2) sentence.append(((token, tag), iob)) if sentence: sente...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self):\n # self.recognizer.train()\n self.detector.train()\n self.shared_conv.train()", "def train(self, training_data, model_name):\n dataset = []\n for example in training_data:\n entity_offsets = self._convert_example(example)\n dataset.append...
[ "0.6329142", "0.63131255", "0.62282646", "0.6179476", "0.61736995", "0.6069067", "0.60654396", "0.60244024", "0.60244024", "0.60244024", "0.60244024", "0.60244024", "0.60149896", "0.59746766", "0.5974304", "0.58804363", "0.5876749", "0.58578265", "0.58444804", "0.58298576", "...
0.7064023
0
Creqte source datafram(data, columns) (can not be changed), cast columns to column.type, create datafram for view (may be changed)
def __init__(self, data, columns): super().__init__() self._filters = {} self._columns = [Column(column) for column in columns] self._source = pd.DataFrame(data, columns=[column.name for column in self._columns], dtype=str) # Change columns datatypes for name, type in [(c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform(self, data: pd.DataFrame, columns: list, verbose: int=1) -> pd.DataFrame:", "def set_data(self):\n # take care of samples\n patients = self.samples.iloc[:,1].tolist()\n samples = self.samples.iloc[:,0].tolist()\n self.samples = pd.DataFrame(patients,index = samples,columns = ['patient...
[ "0.64389884", "0.5948591", "0.5881242", "0.58062464", "0.57837504", "0.57338804", "0.56620854", "0.5654127", "0.5632112", "0.5579484", "0.557895", "0.5526446", "0.5522663", "0.55082947", "0.5498815", "0.5490089", "0.54709536", "0.5469522", "0.5448788", "0.54474294", "0.544637...
0.60024875
1
Get row index in source dataframe
def get_source_row(self, row): return self._dataframe.index[row]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_source_index(self, index: QModelIndex) -> QModelIndex:\n if 0 <= index.row() < len(self._dataframe.values):\n if 0 <= index.column() < len(self._dataframe.columns):\n row = self.get_source_row(index.row())\n column = self.get_source_column(index.column())\n ...
[ "0.7043844", "0.69685376", "0.67891747", "0.6734552", "0.66790116", "0.6637733", "0.65600115", "0.63639086", "0.63481534", "0.62835675", "0.6162552", "0.6137102", "0.6129762", "0.6109574", "0.6097899", "0.6087226", "0.6052882", "0.6049967", "0.60444957", "0.6033079", "0.60288...
0.7654912
0
Check is column filtered
def hasFilter(self, column) -> bool: column_name = self._dataframe.columns[column] return column_name in self._filters.keys()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_column(col, row):\n return col == column", "def check_cols_methane(name):\n return True if name in ['SampleDay', 'SampleHour', 'Decimal Year',\n 'Peak Area 1', 'Peak Area 2', 'Run median', 'Daily Median'] else False", "def filter_row(col, rw):\n return rw ...
[ "0.714587", "0.6344972", "0.62104183", "0.6077036", "0.6077036", "0.60573", "0.6053506", "0.60512096", "0.60433084", "0.5973961", "0.59735787", "0.5946853", "0.59380823", "0.5930365", "0.5920199", "0.59102327", "0.5894116", "0.58357984", "0.58133674", "0.57480985", "0.5739575...
0.6831352
1
Set filter value to column
def setFilter(self, column, value) -> None: if not self.hasFilter(column): column_name = self._dataframe.columns[column] self._filters[column_name] = value self._applyFilters()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_or_update_filter(column, value, filter_type='eq', _filter=None):\n if _filter is None:\n _filter = {}\n\n _filter[column] = {filter_type: value}\n\n return _filter", "def setFilter(self, type: int, filter: int) -> None:\n ...", "def filter(self, filter):\n self._filter ...
[ "0.6479343", "0.6327096", "0.6258252", "0.62564", "0.60858995", "0.6042315", "0.60086817", "0.59755254", "0.5903751", "0.58324903", "0.5778453", "0.57581186", "0.5745971", "0.57118183", "0.5702547", "0.5678945", "0.5658681", "0.5639756", "0.5639756", "0.56249976", "0.5568201"...
0.7826371
0
Reset filter value to column
def resetFilter(self, column): if self.hasFilter(column): column_name = self._dataframe.columns[column] del self._filters[column_name] self._applyFilters()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_filters():\n logger.info(\"reset filters\")\n global filter_item\n filter_item = -1\n filter_topics_table.view.filters = [IndexFilter()]\n filter_custom_table.view.filters = [IndexFilter()]\n filter_label.text = \"\"", "def reset_filter(self):\n arlen = len(self.variant_list)\n...
[ "0.7546535", "0.65499115", "0.62967247", "0.6168715", "0.6093071", "0.59730977", "0.58553", "0.576923", "0.57680595", "0.56759405", "0.5591549", "0.5562137", "0.55558145", "0.55424154", "0.55133826", "0.55060047", "0.5501112", "0.54963195", "0.54875726", "0.54688084", "0.5457...
0.71770364
1
Make visible dataframe appling all filters on source
def _applyFilters(self) -> None: self._dataframe = self._source.loc[:, self._visable_columns] for column, value in self._filters.items(): if value is not None: self._dataframe = self._dataframe[self._source[column] == value] else: self._dataframe =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_filters(self):\n\n # Update household filter\n household_filter = [True if agent == 'household' else False for agent \\\n in self.source.data['agent_type']]\n self.household_view.filters[0] = BooleanFilter(household_filter)\n\n # Update neighbourhood filter\n ...
[ "0.64257777", "0.64170974", "0.60299", "0.590793", "0.5862535", "0.5817036", "0.5791453", "0.57656854", "0.5761146", "0.57199377", "0.566996", "0.5668453", "0.56454384", "0.55735713", "0.5497803", "0.547759", "0.54444075", "0.5442627", "0.54268384", "0.54174805", "0.541208", ...
0.7271048
0
Get cell style from hiden styeles column
def _get_cell_style(self, row: int, column: int): style = None if 'STYLE' in self._source.columns: style = self._source.loc[self.get_source_row(row), 'STYLE'] column_name = self._dataframe.columns[column] if f'STYLE_{column_name}' in self._source.columns: style = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_highlighted_style(feature):\r\n\r\n return {\"weight\": 3, \"color\": \"black\"}", "def design_cells(val):\n # ugly way to get if it is emoji or prob-val\n if \".\" not in str(val[0]):\n # emoji\n return ['font-size:20pt'] * TOP_E\n else:\n # prob\n return ['color:...
[ "0.6037128", "0.602545", "0.5960017", "0.59558016", "0.5942395", "0.5839042", "0.58133143", "0.57690036", "0.56537867", "0.5642963", "0.56286687", "0.5584785", "0.55833846", "0.5573612", "0.5543419", "0.55313474", "0.5503975", "0.55015445", "0.547513", "0.5468061", "0.5450509...
0.72440755
0
Filter model for selected cell value
def _filter_model(self) -> None: indexes = self.tableView.selectedIndexes() if len(indexes) > 0: cell = self.tableView.model().itemData(indexes[0]) if self.tableView.model().hasFilter(indexes[0].column()): self.tableView.model().resetFilter(indexes[0].column()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _filter(self, col: str, val: Any) -> pd.DataFrame:\n return self._df[self._df[col] == val]", "def filter_table(self):\n\n filter_text = self.dlg.uTextFilter.text()\n self.proxy_model.setFilterCaseSensitivity(Qt.CaseInsensitive)\n self.proxy_model.setFilterKeyColumn(2)\n sel...
[ "0.61465836", "0.60357475", "0.5836791", "0.58231956", "0.5813032", "0.5806916", "0.5806267", "0.57512933", "0.570322", "0.5613734", "0.55834484", "0.5580254", "0.5567273", "0.5547823", "0.5541002", "0.5514371", "0.5469984", "0.54644424", "0.5443306", "0.540509", "0.53569776"...
0.72029215
0
extract temperature and pressure from thermofile
def extract_TP(thermofile, column_number, TP, addtxt): with open(thermofile, 'r') as f: [f.readline() for i in range(3)] #extract data while True: line = f.readline() if not line: break else: entry=line.split('\n')[0].split('\t') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_temperature():\n content = _read_raw_temperature()\n\n # get last three characters of first line\n is_valid = content[0][-4:].strip()\n\n # convert to boolean\n is_valid = _validity_to_bool(is_valid)\n\n reading = content[1]\n reading = float(reading.split('=')[-1].strip()) / 1e3\n...
[ "0.6801142", "0.6627863", "0.65125084", "0.6498045", "0.6469067", "0.6388448", "0.6369974", "0.6369449", "0.63679165", "0.6332436", "0.6262144", "0.6257998", "0.6150737", "0.6128258", "0.61186016", "0.61119604", "0.6102738", "0.60951656", "0.609493", "0.60928375", "0.6082937"...
0.7111684
0
registers a new cache or replaces the existing one. if `replace=True` is provided. otherwise, it raises an error on adding a cache which is already registered.
def register_cache(instance, **options): get_component(CachingPackage.COMPONENT_NAME).register_cache(instance, **options)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace(self, other_cache):\n # This is used in avant-idle to replace the content of the cache\n # in a process (where no storage normally takes place) by\n # that of another where the actual caching of the source is done.\n self.cache.clear()\n for key in other_cache:\n ...
[ "0.57119435", "0.55816114", "0.5510161", "0.53981495", "0.53348285", "0.5221639", "0.5185721", "0.51807415", "0.5178592", "0.516138", "0.5150727", "0.5098093", "0.50709575", "0.50582135", "0.5053526", "0.5041543", "0.5037809", "0.5036832", "0.5036832", "0.5020652", "0.5019957...
0.5955155
0
gets the registered cache with given name. it raises an error if no cache found for given name.
def get_cache(name): return get_component(CachingPackage.COMPONENT_NAME).get_cache(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cache(name, region, namespace):\n try:\n cache = getattr(_CACHES, name)\n except AttributeError:\n manager = CacheManager(**cache_regions[region])\n cache = manager.get_cache(namespace)\n setattr(_CACHES, name, cache)\n return cache", "def getHostByName(self, name, *a...
[ "0.7070603", "0.70663273", "0.6774853", "0.65753937", "0.65753937", "0.6561623", "0.6553643", "0.65430456", "0.6463009", "0.64330125", "0.6423352", "0.6407644", "0.63443184", "0.63150007", "0.63098884", "0.62563205", "0.6237036", "0.6201351", "0.6185012", "0.6158534", "0.6157...
0.8160379
0
clears a cache with given name.
def clear(name): get_component(CachingPackage.COMPONENT_NAME).clear(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_cache(name, region, namespace):\n cache = get_cache(name, region, namespace)\n cache.clear()", "def clear(self, name=None):\n if name is None: # Delete whole cache\n try:\n os.unlink(self.filepath)\n except OSError:\n pass\n r...
[ "0.7740158", "0.7638491", "0.7009554", "0.67994934", "0.67422235", "0.67090124", "0.6701614", "0.6690846", "0.6683314", "0.6680682", "0.66635156", "0.66617554", "0.664632", "0.6569245", "0.65159833", "0.64994127", "0.6455329", "0.6447904", "0.6433137", "0.64108324", "0.640818...
0.7696294
1
gets all available cache names.
def get_cache_names(): return get_component(CachingPackage.COMPONENT_NAME).get_cache_names()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_cache_names(self) -> list:\n conn = await self.random_node()\n return await cache_get_names_async(conn)", "def get_init_all_names(self) -> list[str]:\n names = {self.client.name, self.client.alias_name}\n if self.service_resource:\n names.add(self.service_reso...
[ "0.8306477", "0.63981295", "0.63402134", "0.61634046", "0.61542654", "0.61251444", "0.5971529", "0.59659857", "0.5958396", "0.58481795", "0.5840008", "0.58350694", "0.5829402", "0.57440615", "0.573535", "0.57182413", "0.5714329", "0.5707662", "0.567821", "0.5675578", "0.56313...
0.8020084
1
gets statistic info of all caches.
def get_all_stats(): return get_component(CachingPackage.COMPONENT_NAME).get_all_stats()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all(self):\r\n ret = []\r\n for cache_name, stat in self.stats_per_cache.items():\r\n ret.append({\r\n 'cache_name': cache_name,\r\n 'num_hits': len(stat.hit_targets),\r\n 'num_misses': len(stat.miss_targets),\r\n 'hits': stat.hit_targets,\r\n 'misses': stat.mi...
[ "0.7667571", "0.72230273", "0.71913105", "0.7065014", "0.6986488", "0.69252217", "0.68825775", "0.6842123", "0.6785798", "0.67494714", "0.66936606", "0.660042", "0.6566474", "0.6457031", "0.6440768", "0.63751704", "0.6336934", "0.62978095", "0.629635", "0.62528795", "0.625023...
0.76419413
1
saves cached items of all persistent caches into database.
def persist_all(**options): return get_component(CachingPackage.COMPONENT_NAME).persist_all(**options)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_all(self):\r\n for index in range(self.count()):\r\n self.save(index)", "def save_servers(self):\n\n\t\tfor serv in self.servers:\n\t\t\ta = serv.cache.hash_map\n\t\t\twith open('cache.pickle', 'wb') as handle:\n\t\t\t\tpickle.dump(a, handle, protocol=pickle.HIGHEST_PROTOCOL)", "def ...
[ "0.6491182", "0.6305364", "0.623572", "0.61513877", "0.61201674", "0.6106031", "0.604628", "0.6033563", "0.60323066", "0.5989577", "0.59685063", "0.5851815", "0.5850472", "0.5846848", "0.5825873", "0.5825709", "0.5813846", "0.5808218", "0.57953066", "0.57812065", "0.5776191",...
0.664058
0
clears all caches that are required. normally, you should never call this method manually. but it is implemented to be used for clearing extended and complex caches after application has been fully loaded. to enforce that valid results are cached based on loaded packages.
def clear_required_caches(): return get_component(CachingPackage.COMPONENT_NAME).clear_required_caches()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_cache():\n # TODO\n pass", "def clear_cache(self):\n pass", "def clear_cache():\n cache = Cache()\n cache.reset()", "def cache_clear(self):\n\t\tself.__cache = {}", "def clear_all(self) -> None:\n with self._caches_lock:\n self._function_caches = {}", ...
[ "0.7994559", "0.7888056", "0.7651978", "0.7617424", "0.76009864", "0.75158864", "0.7514429", "0.7508485", "0.7451582", "0.7418931", "0.7418292", "0.73935676", "0.7345077", "0.733354", "0.7332456", "0.73254156", "0.73245597", "0.730606", "0.72230273", "0.7210806", "0.7198348",...
0.8194667
0
Exchange ghosts values in periodic local array
def _exchange_ghosts_local_d(self, d): s_gh = self.gh_out[d] sl = [slice(None) for _ in xrange(self._dim)] sl_gh = [slice(None) for _ in xrange(self._dim)] sl[d] = slice(1 * s_gh, 2 * s_gh) sl_gh[d] = slice(-1 * s_gh, None) for v_out in self.field_out: v_out.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _exchange_ghosts_local(self):\n for d in xrange(self._dim):\n self._exchange_ghosts_local_d(d)", "def indices_and_currents_TSC_2D( charge_electron, positions_x, positions_y, velocity_x, velocity_y,\\\n x_grid, y_grid, ghost_cells, length_domain_x, length_domain_y,...
[ "0.6893269", "0.54866093", "0.5398292", "0.5353562", "0.5318594", "0.5316869", "0.5310509", "0.53035486", "0.5277521", "0.520041", "0.5179516", "0.5174113", "0.5162675", "0.5162337", "0.5161567", "0.51536834", "0.51487446", "0.51144516", "0.50992984", "0.5064667", "0.5062222"...
0.6425586
1
Performs ghosts exchange locally in each direction
def _exchange_ghosts_local(self): for d in xrange(self._dim): self._exchange_ghosts_local_d(d)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _exchange_ghosts_mpi(self):\n for d in xrange(self._dim):\n if d in self._cutdir_list:\n self._exchange_ghosts_mpi_d(d)\n else:\n self._exchange_ghosts_local_d(d)", "def move_ghosts(self):\n temp_ghosts = []\n for ghost in self.ghosts:\...
[ "0.69767755", "0.65840703", "0.6523343", "0.6032678", "0.5722102", "0.56207675", "0.5510207", "0.54849404", "0.5424678", "0.5414342", "0.5414342", "0.5345978", "0.5329319", "0.532052", "0.5301776", "0.5295316", "0.52799314", "0.5223032", "0.5206781", "0.5198322", "0.5179556",...
0.7840964
0
Performs ghosts exchange either locally or with mpi communications in each direction
def _exchange_ghosts_mpi(self): for d in xrange(self._dim): if d in self._cutdir_list: self._exchange_ghosts_mpi_d(d) else: self._exchange_ghosts_local_d(d)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _exchange_ghosts_mpi_d(self, d):\n s_gh = self.gh_out[d]\n sl_l = [slice(None) for _ in xrange(self._dim)]\n sl_gh_l = [slice(None) for _ in xrange(self._dim)]\n sl_r = [slice(None) for _ in xrange(self._dim)]\n sl_gh_r = [slice(None) for _ in xrange(self._dim)]\n sl_l...
[ "0.69065416", "0.6561432", "0.57953256", "0.5653083", "0.55906194", "0.55473036", "0.5502584", "0.5496955", "0.5474431", "0.54014534", "0.53840894", "0.5377938", "0.53468025", "0.5310125", "0.5282678", "0.52745557", "0.5266758", "0.5263322", "0.52578515", "0.52422863", "0.523...
0.76470697
0
Return axample of configured AnimationManager instance
def get_animManager(): NUM_LINES = 50 NUM_STEPS = 1000 STEP_MAX = 0.1 fig = plt.figure('3D Random walk example') ax = fig.gca(projection='3d') ax.set_axis_off() # Setting the axes properties d = 1 ax.set_xlim3d([0.0 - d, 1.0 + d]) ax.set_ylim3d([0.0 - d, 1.0 + d]) a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSampler(self, *args):\n return _osgAnimation.Channel_getSampler(self, *args)", "def get_animator(self):\n \n return graphical.Animator(self)", "def __call__(self, *args):\n return _osgAnimation.AnimationManagerBase___call__(self, *args)", "def get_sampler(self):\n re...
[ "0.5929234", "0.58319426", "0.5712612", "0.5358319", "0.5345582", "0.5287932", "0.51266444", "0.50897235", "0.50664383", "0.50573474", "0.49518934", "0.49007067", "0.48587754", "0.48277414", "0.48074946", "0.4796288", "0.47952378", "0.47919708", "0.47805485", "0.4770601", "0....
0.5915016
1
Creates instance of abstract memorybased persistence component.
def __init__(self): super(MemoryPersistence, self).__init__(descriptor)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __new__(cls, *args, **kwargs):\n obj = super(Memory, cls).__new__(cls, *args, **kwargs)\n obj.__dict__ = cls.data\n\n return obj", "def get_instance():\n if PersistenceManager._instance is None:\n PersistenceManager._instance = PersistenceManager()\n return Persi...
[ "0.6396316", "0.612985", "0.6109966", "0.60697746", "0.5990019", "0.5682012", "0.5597681", "0.55813473", "0.5535128", "0.5517559", "0.54749537", "0.54711515", "0.5453528", "0.543589", "0.54355305", "0.5423502", "0.5406449", "0.54031616", "0.5364649", "0.5349354", "0.53341067"...
0.7326523
0
En el constructor tenemos self.beneficios_maquinas que es un diccionario que nos indicara cuanto ganaremos con cada maquina
def __init__(self): self.beneficios_maquinas = {"tragaperras":500 , "b_jack" : 900 , "poker" : 1000 , "baccarat": 600 , "dados":500 , "ruleta":900 , "bingo" :750 ,"carreras":700} self.catalogo = {"tragaperras":50000 , "b_jack" : 90000 , "poker" : 100000 , "baccarat": 60000 , "dados": 50000 , "ruleta":...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, sistema, nombre, espacios_de_atencion, niveles=None, capacity=float('inf'), init=0):\r\n\r\n super(MedioDeAlmacenamiento, self).__init__(sistema, capacity, init)\r\n self.nombre = nombre\r\n self.espacios_de_atencion = espacios_de_atencion\r\n self.espacios_en_uso = 0...
[ "0.59883666", "0.57581353", "0.56326735", "0.56068796", "0.53704154", "0.533318", "0.53174007", "0.52919334", "0.5273505", "0.52577746", "0.5244493", "0.52358776", "0.5231335", "0.5222198", "0.5213215", "0.51973087", "0.5174603", "0.5153929", "0.5133798", "0.5123422", "0.5096...
0.6868715
0
Este metodo nos creara el mapa Kasino por defecto se creara de 40x40 y aunque en este prog no es necesario, dejo la opcion de introducir ancho y largo distintos para poder crear diferentes mapas segun avances o segun dificultad... TENER EN CUENTA QUE LOS ESPACIOS DE LA LISTA DE EL MAPA SON 3 CARACTERES ESPACIO
def crear_mapa (self, ancho = 40 , largo = 40): for i in range (largo): a = " " b = [] for z in range (ancho): b.append(a) kasino.mapa.append(b) for i in range (1,ancho -1): kasino.mapa[0][i]="═══" kasino.mapa[l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pintarIMAGENENMAPA(self, pos):\n # Agrego al vector que controla las images\n k = (pos[0], pos[1], \"img\"+str(self.idIMG))\n # Si deseo pintar una silla\n if self.queIMGAgregar == 1:\n self.telaMAPA.create_image(k[0], k[1], image=self.imgSilla, tag=k[2])\n # C...
[ "0.65309775", "0.63648427", "0.63088846", "0.62954193", "0.6213833", "0.6092138", "0.60337055", "0.60142654", "0.59787285", "0.5911133", "0.5909889", "0.5894976", "0.58894086", "0.58749473", "0.5871359", "0.5868573", "0.58479834", "0.58409506", "0.58083653", "0.57830596", "0....
0.7384126
0
Este metodo nos dara mediante una formula la variable fama , que dependera de la decoracion del casino e influira en las visitas. Utilizamos el diccionario kasino.decoracion, variable propia de esta clase para hacer con este una lista, luego dividimos en 3 partes la lista segun corresponde. Luego las recorremos para pu...
def fama (self , diccionario): decoracion_list = [] for key , value in diccionario.items(): a=[] a.append(key) a.append(value) decoracion_list.append (a) paredes_list = decoracion_list [0:3] suelo_list = decoracion_list [3:6] ref...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calcular_tres_marcas_menor_produccion(lista):\r\n lista_ordenada_menor_a_mayor = ordenar_lista_menor_a_mayor_produccion(lista)\r\n lista_marcas_menor_produccion = []\r\n for i in range(3):\r\n lista_marcas_menor_produccion.append(lista_ordenada_menor_a_mayor[i][0])\r\n \r\n return lista_m...
[ "0.5861771", "0.5792501", "0.5622451", "0.56105626", "0.5542907", "0.5492034", "0.547894", "0.54629517", "0.54576236", "0.54318184", "0.54252744", "0.539618", "0.53948766", "0.5382875", "0.53711325", "0.5367106", "0.5332052", "0.53252435", "0.53132993", "0.5304049", "0.530344...
0.78076255
0
Este metodo lo usaremos para printear el mapa, pondremos un titulo y luego mediante join printearemos la listamapa
def game (self,mapa): self.titulo() for fila in mapa: print("".join(fila))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_map():\r\n for row in range(0, len(map1)): #for all rows\r\n for column in range(0, len(map1[0])): #for all columns\r\n print(map1[row][column], end=' ')\r\n print()", "def display_map(map):\n for row in map:\n line = \"\"\n for point in row:\n ...
[ "0.6373207", "0.63231426", "0.6191893", "0.6182269", "0.6169301", "0.6159255", "0.6086893", "0.60857475", "0.60446316", "0.5992802", "0.59581316", "0.5861561", "0.5839619", "0.5816608", "0.5770234", "0.57276624", "0.56045544", "0.5600139", "0.55909145", "0.55598956", "0.54838...
0.6927792
0
Usamos este metodo para igualar la variable mapa kasino a lo escrito en el metodo casino.guardar en 1 documento y asi rcuperar datos . separamos el str con un split usando las X escritas , recorremos el str y usamos las comas para recuperar los elementos de la lineas de mapa, [][] es decir de la lista de listas.La S no...
def cargar_mapa (self): stream_cargar = open ('yo_mapa.txt', 'rt',encoding="utf-8") mapa=stream_cargar.readlines() a = mapa[0].split("X") mapa__I=[] mapa__D=[] toca = "izda" for lista in a: pasar="X" linea1=[] trozo=""...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mapa(self, msg, match):\n\n for linha in self.mapa_inteiros:\n yield \" \".join(map(str, linha))", "def _process_strings(line,\n lang_nlp,\n get_lemmas,\n get_pos,\n remove_stopwords,\n repla...
[ "0.6102629", "0.5565367", "0.5481452", "0.53654796", "0.5168428", "0.5052943", "0.5018136", "0.4998325", "0.49851122", "0.4938655", "0.49217921", "0.4897635", "0.4893655", "0.48854673", "0.48832467", "0.48750573", "0.48663384", "0.4831402", "0.48311475", "0.47943395", "0.4793...
0.71529096
0
Este metodo guardara en 1 documento los dicc kasino maquina y kasino decoracion y los ints dia y dinero ,en esta ocasion se escribiran todos juntos ya que es facil recuperarlos
def guardar_otras (self,maquinas,decoracion,dia,dinero):#dicc,dicc,int,int stream_guardar = open("yo_otros.txt","wt",encoding="utf-8") for i in maquinas: stream_guardar.write(str(maquinas[i])) for i in decoracion: stream_guardar.write(str(decoracion[i])) st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cargar_otras(self):\n\n stream_cargar = open ('yo_otros.txt', 'rt',encoding=\"utf-8\")\n datos=stream_cargar.readlines()\n \n # print(datos)\n # print (len(kasino.maquinas))\n\n lista_maquinas=[]\n lista_deco =[]\n day=\"\"\n money=\"\"\n\n ...
[ "0.65296155", "0.59569544", "0.5910678", "0.5854344", "0.5832947", "0.58255154", "0.5819173", "0.57754415", "0.57597715", "0.571407", "0.570511", "0.570511", "0.570511", "0.570511", "0.570511", "0.5703714", "0.5645902", "0.56388974", "0.55998516", "0.55933887", "0.55918986", ...
0.649683
1
Este metodo recuperara los dicc kasino maquinas y kasino decoracion y los ints dia y dinero, para ello usamos un contador y recorremos los dicc igualando el dicc a su parte de la cadena escrita en el documento mediante el contador
def cargar_otras(self): stream_cargar = open ('yo_otros.txt', 'rt',encoding="utf-8") datos=stream_cargar.readlines() # print(datos) # print (len(kasino.maquinas)) lista_maquinas=[] lista_deco =[] day="" money="" contador=0 dia_o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _obtener_autos_cercanos(self, x, y):\n\n\t\t\"\"\"Convierte a metros\"\"\"\n\n\t\tx = vincenty((0,x), origen).meters\n\t\ty = vincenty((y,0), origen).meters\n\t\t\n\t\tconductores = mongo.db.conductores\n\t\tquery = \"if(this.posicion){if((Math.pow(this.posicion.lng-\"+str(x)+\",2)+Math.pow(this.posicion.lat-\...
[ "0.6076252", "0.58189213", "0.58189213", "0.58189213", "0.58189213", "0.58189213", "0.5760438", "0.572302", "0.569719", "0.5684234", "0.5659719", "0.562336", "0.55975646", "0.55528826", "0.5529479", "0.5520378", "0.5477187", "0.54736406", "0.54670554", "0.54157156", "0.539547...
0.6132804
0
Constructor method. The `pos` parameter expects the genomic position as a 0based index. Setting the `refr` or `alt` parameters to `.` will designate this variant as a "no call".
def __init__(self, seqid, pos, refr, alt, **kwargs): self._seqid = seqid self._pos = pos self._refr = refr self._alt = alt self.info = dict() for key, value in kwargs.items(): self.info[key] = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, pos):\r\n self.pos = pos", "def __init__(self, pos, score=0):\n self.__pos = pos\n self.__score = score", "def __init__(self, pos, vel=None, frame=None):\n\n if isinstance(pos, coord.Galactocentric):\n pos = pos.data\n\n if not isinstance(pos, co...
[ "0.66734743", "0.6133717", "0.60993713", "0.60905766", "0.60079235", "0.60035133", "0.5972953", "0.59705895", "0.59635913", "0.59585696", "0.5953488", "0.59305876", "0.5828635", "0.5826504", "0.5818104", "0.57789505", "0.57692695", "0.5743065", "0.57181144", "0.57134575", "0....
0.65443873
1
Getter method for the variant window. The "variant window" (abbreviated `VW` in VCF output) is the sequence interval in the proband contig that encompasses all kmers overlapping the variant. GCCTAGTTAGCTAACGTCCCGATCACTGTGTCACTGC .....A ....A. ...A.. ..A... .A.... A..... | < position of variant [] < variant window, inte...
def window(self): return self.attribute('VW')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CuN17vol(n,h,w,V):\n Vshell = 2*ZCE_GaAs(n,V)*(h-ZCE_GaAs(n,V)) + w*ZCE_GaAs(n,V)\n Vcore = (w-2*ZCE_GaAs(n,V))*(h-ZCE_GaAs(n,V))\n return Vshell*1e14,Vcore*1e14", "def get_asymwindow(self):\n asymwindow = sum(\n [\n np.concatenate(\n [\n ...
[ "0.5497812", "0.5490596", "0.54333067", "0.53656536", "0.53286386", "0.518327", "0.5145856", "0.51408875", "0.51281923", "0.51159835", "0.5093824", "0.50667363", "0.50662166", "0.5062015", "0.5056756", "0.5056118", "0.50559324", "0.5042922", "0.5027012", "0.5025038", "0.50142...
0.67229086
0
Wrap the `kevlar call` procedure as a generator function. Input is the following. an iterable containing one or more target sequences from the reference genome, stored as khmer or screed sequence records an iterable containing one or more contigs assembled by kevlar, stored as khmer or screed sequence records alignment...
def call(targetlist, querylist, match=1, mismatch=2, gapopen=5, gapextend=0, ksize=31): for query in sorted(querylist, reverse=True, key=len): bestcigar = None bestscore = None besttarget = None bestorientation = None for target in sorted(targetlist, key=lambda recor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_call_cli(targetfile, queryfile, cigar, capsys):\n target = data_file(targetfile)\n query = data_file(queryfile)\n args = kevlar.cli.parser().parse_args(['call', query, target])\n kevlar.call.main(args)\n\n out, err = capsys.readouterr()\n print(out)\n cigars = list()\n for line in ...
[ "0.55534565", "0.49242163", "0.48804748", "0.48293254", "0.4763826", "0.47369397", "0.46600562", "0.4650148", "0.45753592", "0.4518727", "0.45137888", "0.4498816", "0.44679454", "0.44503778", "0.44378328", "0.4428958", "0.44179434", "0.440283", "0.4389591", "0.43709272", "0.4...
0.61551183
0
Return a new instance of the Network class.
def new_network(): new_names = Names() new_devices = Devices(new_names) return Network(new_names, new_devices)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_network(self):\n\n print ('Creating network, changing data will have no effect beyond this point.')\n n = IMNN.IMNN(parameters=self.parameters)\n\n if self.load_network:\n n.restore_network()\n else:\n n.setup(network = self.network, load_data = self.dat...
[ "0.76890683", "0.7565279", "0.72739667", "0.72504044", "0.72160345", "0.70732576", "0.69950795", "0.6969925", "0.690757", "0.68565255", "0.67459494", "0.6560776", "0.65384907", "0.6508981", "0.6470703", "0.6434769", "0.64018965", "0.63492566", "0.63455343", "0.6334854", "0.63...
0.82193184
0
Return a Network class instance with three devices in the network.
def network_with_devices(): new_names = Names() new_devices = Devices(new_names) new_network = Network(new_names, new_devices) [SW1_ID, SW2_ID, OR1_ID] = new_names.lookup(["Sw1", "Sw2", "Or1"]) # Add devices new_devices.make_device(SW1_ID, new_devices.SWITCH, 0) new_devices.make_device(SW2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_network():\n new_names = Names()\n new_devices = Devices(new_names)\n return Network(new_names, new_devices)", "def get_network(self):\n\n # Find which nodes are input and which are output. We may want to store\n # this info somewhere else (like in the genome)\n\n inputs = [...
[ "0.62895656", "0.5824083", "0.5780455", "0.5759089", "0.5730831", "0.5706215", "0.57014054", "0.5680786", "0.56487197", "0.56329834", "0.55932325", "0.5591472", "0.55858415", "0.55215573", "0.5447525", "0.5435627", "0.5412156", "0.5403432", "0.5399039", "0.537979", "0.5357020...
0.7487247
0
Test if execute_network returns the correct output for XOR gates.
def test_execute_xor(new_network): network = new_network devices = network.devices names = devices.names [SW1_ID, SW2_ID, XOR1_ID, I1, I2] = names.lookup( ["Sw1", "Sw2", "Xor1", "I1", "I2"]) # Make devices devices.make_device(XOR1_ID, devices.XOR) devices.make_device(SW1_ID, device...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_execute_non_xor_gates(new_network, gate_id, switch_outputs,\n gate_output, gate_kind):\n network = new_network\n devices = network.devices\n names = devices.names\n\n [AND1_ID, OR1_ID, NAND1_ID, NOR1_ID, SW1_ID, SW2_ID, SW3_ID, I1, I2,\n I3] = names.lookup([\"...
[ "0.7108362", "0.64456266", "0.62483436", "0.6179121", "0.5954281", "0.5924266", "0.579673", "0.5786133", "0.5775739", "0.5742536", "0.57371473", "0.57168096", "0.56857705", "0.5650925", "0.56489795", "0.55563605", "0.54900867", "0.5481334", "0.5473376", "0.5467943", "0.546222...
0.75833476
0
Test if execute_network returns the correct output for nonXOR gates.
def test_execute_non_xor_gates(new_network, gate_id, switch_outputs, gate_output, gate_kind): network = new_network devices = network.devices names = devices.names [AND1_ID, OR1_ID, NAND1_ID, NOR1_ID, SW1_ID, SW2_ID, SW3_ID, I1, I2, I3] = names.lookup(["And1", "Or1",...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_execute_xor(new_network):\n network = new_network\n devices = network.devices\n names = devices.names\n\n [SW1_ID, SW2_ID, XOR1_ID, I1, I2] = names.lookup(\n [\"Sw1\", \"Sw2\", \"Xor1\", \"I1\", \"I2\"])\n\n # Make devices\n devices.make_device(XOR1_ID, devices.XOR)\n devices.m...
[ "0.7244407", "0.6555086", "0.60672414", "0.5958014", "0.5866374", "0.58132195", "0.57049644", "0.5648179", "0.5560035", "0.55518097", "0.55496335", "0.5549202", "0.5501493", "0.55004686", "0.5457115", "0.5452267", "0.5450071", "0.5425552", "0.5411698", "0.5404994", "0.5403933...
0.723775
1
Test if execute_network returns the correct output for nongate devices. Tests switches, Dtypes and clocks.
def test_execute_non_gates(new_network): network = new_network devices = network.devices names = devices.names LOW = devices.LOW HIGH = devices.HIGH # Make different devices [SW1_ID, SW2_ID, SW3_ID, CL_ID, D_ID] = names.lookup(["Sw1", "Sw2", "Sw3", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_execute_non_xor_gates(new_network, gate_id, switch_outputs,\n gate_output, gate_kind):\n network = new_network\n devices = network.devices\n names = devices.names\n\n [AND1_ID, OR1_ID, NAND1_ID, NOR1_ID, SW1_ID, SW2_ID, SW3_ID, I1, I2,\n I3] = names.lookup([\"...
[ "0.64358634", "0.6286758", "0.6224356", "0.6207054", "0.6135582", "0.6115254", "0.6070223", "0.6026147", "0.6020904", "0.591166", "0.58820087", "0.58704305", "0.58060014", "0.57573897", "0.57547915", "0.5727722", "0.56890357", "0.56707734", "0.56616163", "0.561187", "0.561031...
0.7138289
0
Renders a Markdownformatted string as HTML.
def markdown_to_html(s): return markdown(s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_markdown(text):\n return clean_markdown_html(markdown(force_str(text), **MARKDOWN_KWARGS))", "def render_markdown(text):\n return markdown(text, **MARKDOWN_KWARGS)", "def mdhtml_to_html(data_str):\n mdrenderer = mistune.Renderer()\n markdown = mistune.Markdown(renderer=mdrenderer)\n r...
[ "0.7279775", "0.7157913", "0.69744706", "0.6868016", "0.6853341", "0.6828946", "0.67198783", "0.6678728", "0.65148413", "0.6497659", "0.64447343", "0.6409846", "0.63674206", "0.62986237", "0.6293463", "0.6277161", "0.6252812", "0.62270266", "0.62042814", "0.61876", "0.6187383...
0.7307166
0
Splits a commadelimited string.
def split_by_comma(s): return s.strip().split(",")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def separate_comma(s):\n return s.split(',')", "def split_by_comma_and_whitespace(s):\r\n return re.split(r'[\\s,]+', s)", "def split_by_comma_and_whitespace(a_str):\r\n return re.split(r'[\\s,]', a_str)", "def split_value(string):\n split = string.split(',')\n result = []\n\n level = 0\n buf = ...
[ "0.8214036", "0.7340147", "0.7091655", "0.7032393", "0.70248574", "0.69270283", "0.6926893", "0.6860048", "0.6846079", "0.6821014", "0.6803655", "0.67259437", "0.66994894", "0.66705036", "0.6661326", "0.66231436", "0.66043615", "0.65586185", "0.6540317", "0.65376675", "0.6520...
0.84413457
0
Handles Clair's `fixed_in_version`, which _may_ be URLencoded. The API guarantee is only that the field is a string, so encoding it's slightly weaselly, but only slightly.
def maybe_urlencoded(fixed_in: str) -> str: try: d = urllib.parse.parse_qs(fixed_in) # There may be additional known-good keys in the future. return d["fixed"][0] except (ValueError, KeyError): return fixed_in
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_new_style_with_version(self):\n self.assertIsNotNone(parse_arxiv_id('1202.1234v1'))\n self.assertIsNotNone(parse_arxiv_id('1203.12345v1'))\n self.assertIsNotNone(parse_arxiv_id('1203.12345v12'))", "def check_version_str(version):\n if not version.startswith('v') and version != 'c...
[ "0.52483535", "0.5137429", "0.51280016", "0.49726486", "0.49645323", "0.49600667", "0.4959355", "0.49344546", "0.49142966", "0.49102196", "0.48660696", "0.48568073", "0.48517373", "0.48187718", "0.47451013", "0.4744391", "0.47432333", "0.47277656", "0.47126156", "0.4712107", ...
0.55728
0
Check whether this manifest was preempted by another worker. That would be the case if the manifest references a manifestsecuritystatus, or if the reindex threshold is no longer valid.
def should_skip_indexing(manifest_candidate): if getattr(manifest_candidate, "manifestsecuritystatus", None): return manifest_candidate.manifestsecuritystatus.last_indexed >= reindex_threshold return len(manifest_candidate.manifestsecuritystatus_set) > 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def x_overrun(self):\n return (self.status & 0x10) != 0", "def has_receiver(self):\n return self.balance < 0", "def z_overrun(self):\n return (self.status & 0x40) != 0", "def _allow_reset(self):\r\n return (self.child_state == self.DONE and self.child_attempts < self.max_attempts)...
[ "0.5434844", "0.541006", "0.5406191", "0.53775686", "0.53569597", "0.52894694", "0.5256828", "0.52423096", "0.52342397", "0.5217433", "0.5182849", "0.51582813", "0.51306504", "0.5123424", "0.51226157", "0.5121449", "0.511326", "0.50790226", "0.5077256", "0.50669265", "0.50635...
0.6024165
0