query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
>>> from qrl.crypto.doctest_data import ; hashchain_reveal(hstr2bin('32eee808dc7c5dfe26fd4859b415e5a713bd764036bbeefd7a541da9a1cc7b9fcaf17da039a62756b63835de1769e05e')) == hashchain_reveal_expected1 True
def hashchain_reveal(seed_private, epoch=0, blocks_per_epoch=config.dev.blocks_per_epoch): return hashchain(seed_private, epoch, blocks_per_epoch).hc_terminator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_basic(self):\n self.assertEqual(hash_str(\"world!\", salt=\"hello, \").hex()[:6], \"68e656\")", "def test_hash_string(self):\n self.assertEqual(hexlify(self._hashdigest(pubkey_sha)), sample_ripe)", "def test_hash(self):\r\n self.assertEqual(processor_hash('test'), 'GqNJWF7X7L07nEh...
[ "0.679759", "0.6713177", "0.66735476", "0.6555535", "0.65270245", "0.63835394", "0.634795", "0.6294269", "0.6280061", "0.62610084", "0.62473416", "0.62116927", "0.614765", "0.6113428", "0.60587496", "0.6050654", "0.60447747", "0.6025219", "0.60249877", "0.6022704", "0.6010632...
0.0
-1
return a classname if compare_to is same as current_order
def simple_sort(current_order, compare_to): sort = 'asc' if '-' not in current_order else 'desc' current_order = current_order.replace('-', '') if compare_to == current_order: return 'sort_%s' %sort return ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checked_classified(self, order):\n assert (order.get_status() is OrderStatus.Created)\n assert (order.direction is not Direction.Cancel)\n if order.exec_type not in [Exectype.Market, Exectype.Stop]:\n assert (order.price is not None)\n check_left = np.round(order.pric...
[ "0.51907116", "0.5182846", "0.51150525", "0.50446", "0.5003113", "0.49566683", "0.49448878", "0.4912039", "0.4878263", "0.48774582", "0.487666", "0.4870765", "0.48602548", "0.48531458", "0.4831841", "0.4820289", "0.4819008", "0.48080614", "0.47922298", "0.4788945", "0.4781898...
0.53609127
0
Given the specific term, retreives the XML describing all of the courses for a given semester.
def read_data(term): course_url = '/admweb/!SWKSECX.main?term='+ term + '&title=&course=&crn=&coll=&dept=&subj=' connection = httplib.HTTPSConnection('courses.rice.edu', 443) connection.connect() connection.request( 'GET', course_url ) courses_xml = connection.getresponse() return courses_xml
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_courses(self,terms):\n\n return self.course_search.search_for(terms)", "def get_course(dept, num):\n \n # semester: 10 = Fall, 20 = Spring, 30 = Summer\n host = \"https://selfservice.mypurdue.purdue.edu/prod/bwckctlg.p_disp_course_detail\"\n query = \"?cat_term_in={term}&subj_code_i...
[ "0.5970237", "0.59381807", "0.58946824", "0.5720252", "0.5719336", "0.57049215", "0.56781137", "0.56664187", "0.5561834", "0.5425173", "0.5420679", "0.54122835", "0.5410656", "0.53915286", "0.5389977", "0.5292437", "0.5243592", "0.52412623", "0.51622677", "0.51473016", "0.510...
0.6914351
0
Uses the information in the XML to create a Course object to send to Parse
def parse_create_course(xml_course): attrs = [ "term-code", "term-description", 'subject', "course-number", "school", "department", "title", "description", "credit-hours", "distribution-group" ] course = pull_attributes_from_xml(xml_course, attrs) course["sections"] = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_course(xml_course):\n\n parse_course = parse_get_course(xml_course)\n if not parse_course: # Does not already exist, create\n parse_course = parse_create_course(xml_course)\n else:\n # TODO: Update existing attributes of the course here and upload the changes\n None\n parse_course_id = up...
[ "0.7376115", "0.6733328", "0.6598599", "0.6522951", "0.63766646", "0.62547004", "0.60987", "0.60921395", "0.60627925", "0.6030125", "0.6019453", "0.6005106", "0.5900326", "0.58816576", "0.5865308", "0.5858704", "0.5853114", "0.5842916", "0.5832726", "0.5832424", "0.5831467", ...
0.79287744
0
Uses the information in the XML to find an existing course in the parse database by doing a look up using subject and coursenumber
def parse_get_course(xml_course): parse_course = parse_create_course(xml_course) query_constraints = { "termCode": parse_course["termCode"], "subject": parse_course["subject"], "courseNumber": parse_course["courseNumber"] } params = urllib.urlencode({"where": json.dumps(query_constraints)}) connec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_course(xml_course):\n\n parse_course = parse_get_course(xml_course)\n if not parse_course: # Does not already exist, create\n parse_course = parse_create_course(xml_course)\n else:\n # TODO: Update existing attributes of the course here and upload the changes\n None\n parse_course_id = up...
[ "0.6541497", "0.6240518", "0.60879576", "0.6023193", "0.59681183", "0.5899737", "0.58327365", "0.5699141", "0.56010294", "0.5572856", "0.5572046", "0.55431306", "0.5459641", "0.5446461", "0.54302126", "0.5379499", "0.53209007", "0.52978843", "0.5285469", "0.5283759", "0.52683...
0.7112868
0
Given Course data, creates or updates the Parse Course for it. Returns the id of the object uploaded.
def upload_course(parse_course): # If parse_course["id"] is not specified, use POST method otherwise use PUT and return the upload results # If upload fails, throw an exception because the user of this function relies on this function succeeding url = COURSES_ENDPOINT if not parse_course.get("objectId"): me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_course(self, course: Course) -> None:\n self.collection.insert_one(course.dict())", "def save_course(self):\r\n self.course.save()\r\n self.store.update_item(self.course, self.user.id)", "def process_course(xml_course):\n\n parse_course = parse_get_course(xml_course)\n if not pa...
[ "0.6991563", "0.6642847", "0.6434144", "0.6322279", "0.6304579", "0.62080973", "0.6107005", "0.59469926", "0.58848274", "0.5841465", "0.58388895", "0.5776982", "0.56982106", "0.5692232", "0.56591153", "0.5643993", "0.5639945", "0.56230175", "0.5609774", "0.5583628", "0.555205...
0.71907526
0
Uses the information in the XML to create a Section object to send to Parse
def parse_create_section(xml_course): attrs = [ "section", 'crn', "start-time", "end-time", "meeting-days", "location", "section-number", "instructor" ] section = pull_attributes_from_xml(xml_course, attrs) section["places"] = [] # Create Place attribute pointer based on lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_sections(self):\n\t\t# NOTE: cell=self is required to tell NEURON of this object.\n\t\tself.node = [h.Section(name='node',cell=self) for x in range(self._axonNodes)]\n\t\tself.mysa = [h.Section(name='mysa',cell=self) for x in range(self._paraNodes1)]\n\t\tself.flut = [h.Section(name='flut',cell=self) f...
[ "0.6425162", "0.6219104", "0.6158753", "0.61021316", "0.6033711", "0.60276043", "0.5972726", "0.59163094", "0.57888544", "0.57497406", "0.56417423", "0.56381196", "0.5629374", "0.56092596", "0.5584174", "0.556007", "0.55357677", "0.5519701", "0.55190384", "0.55119073", "0.551...
0.71325403
0
Uses the information in the XML to find an existing Section in the parse database by doing a look up using crn
def parse_get_section(xml_course): parse_section = parse_create_section(xml_course) query_constraints = { "crn": parse_section["crn"] } params = urllib.urlencode({"where": json.dumps(query_constraints)}) connection = httplib.HTTPSConnection(PARSE_API_URL, PARSE_API_PORT) connection.connect() connectio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_create_section(xml_course):\n\n attrs = [\n \"section\",\n 'crn',\n \"start-time\",\n \"end-time\",\n \"meeting-days\",\n \"location\",\n \"section-number\",\n \"instructor\"\n ]\n\n section = pull_attributes_from_xml(xml_course, attrs)\n\n section[\"places\"] = []\n\n # Crea...
[ "0.61502224", "0.57553375", "0.5448547", "0.5343673", "0.5308534", "0.5230989", "0.5230989", "0.52115005", "0.5138592", "0.51289445", "0.5105253", "0.50976074", "0.5016464", "0.5014626", "0.4979332", "0.49579075", "0.4931446", "0.4898956", "0.48874933", "0.48787415", "0.48348...
0.6337521
0
Given Section data, creates or updates the Parse Section for it. Returns the id of the object uploaded.
def upload_section(parse_section): # If parse_section["id"] is not specified, use POST method otherwise use PUT and return the upload results url = SECTIONS_ENDPOINT if not parse_section.get("objectId"): method = "POST" else: method = "PUT" url += '/' + parse_section["objectId"] connection = http...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, request, *args, **kwargs):\r\n\r\n try:\r\n ser = SectionsSerializer(Sections.objects.get(id=request.data['section']))\r\n except Sections.DoesNotExist as error:\r\n log.error(error)\r\n return Response('Section does not exist',\r\n ...
[ "0.6169723", "0.60097486", "0.59602237", "0.59314704", "0.5868095", "0.5751703", "0.56381774", "0.5405678", "0.5388949", "0.53622067", "0.52659726", "0.5245509", "0.52186877", "0.5200988", "0.5189022", "0.518119", "0.51709217", "0.5164825", "0.51472646", "0.51449126", "0.5144...
0.7223142
0
Uses an HTTP GET to retrieve the Places data from Parse if not already retrieved
def get_places(): global app_id, rest_api_key, places if not places: connection = httplib.HTTPSConnection(PARSE_API_URL, PARSE_API_PORT) connection.connect() connection.request( method='GET', url=PLACES_ENDPOINT, headers={"X-Parse-Application-Id": app_id, "X-Parse-REST-API-Key": re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def places_get_all():\n if request.method == 'GET':\n data = get_all_places()\n if len(data['places']) == 0:\n return jsonify({'response': 'Not have places.'}), 404\n return jsonify(data), 200", "def places_get_one(place):\n place = place.replace('-', ' ')\n if request.me...
[ "0.7140999", "0.68109626", "0.67426455", "0.63092905", "0.6287065", "0.61778533", "0.6161749", "0.6113257", "0.6058726", "0.6033323", "0.6032079", "0.60246813", "0.600293", "0.59983027", "0.59662473", "0.59623533", "0.58876234", "0.5885913", "0.5870607", "0.5812627", "0.57860...
0.76609266
0
Given a Parse Course ID and Parse Section ID, adds the proper association (if it doesn't already exist) to make the Parse Section one of the children of the Parse Course.
def put_child(course_id, section_id): section_url = SECTIONS_ENDPOINT + "/" + section_id course_url = COURSES_ENDPOINT + "/" + course_id # Get course from Parse course_connection = httplib.HTTPSConnection(PARSE_API_URL, PARSE_API_PORT) course_connection.connect() course_connection.request( method='GET...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_course(xml_course):\n\n parse_course = parse_get_course(xml_course)\n if not parse_course: # Does not already exist, create\n parse_course = parse_create_course(xml_course)\n else:\n # TODO: Update existing attributes of the course here and upload the changes\n None\n parse_course_id = up...
[ "0.55693036", "0.55527", "0.5542507", "0.5442161", "0.5404261", "0.53314143", "0.52971184", "0.5200115", "0.5191614", "0.51330805", "0.51152116", "0.5099494", "0.5036683", "0.5000588", "0.49935493", "0.49853474", "0.49577346", "0.49370083", "0.49121204", "0.49021304", "0.4899...
0.7125181
0
Entirely processes a Course given it's XML data. Creates / Updates the corresponding Parse Course and Parse Section.
def process_course(xml_course): parse_course = parse_get_course(xml_course) if not parse_course: # Does not already exist, create parse_course = parse_create_course(xml_course) else: # TODO: Update existing attributes of the course here and upload the changes None parse_course_id = upload_course(p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_create_course(xml_course):\n attrs = [\n \"term-code\",\n \"term-description\",\n 'subject',\n \"course-number\",\n \"school\",\n \"department\",\n \"title\",\n \"description\",\n \"credit-hours\",\n \"distribution-group\"\n ]\n course = pull_attributes_from_xml(xml_cours...
[ "0.6962763", "0.64638436", "0.641806", "0.62422866", "0.6193113", "0.61114055", "0.608011", "0.6013513", "0.6002378", "0.56043005", "0.5571442", "0.5534993", "0.5486418", "0.5453523", "0.5442029", "0.54323494", "0.5428582", "0.5420072", "0.5415792", "0.5405431", "0.5392446", ...
0.8557731
0
Compute the mismatch mixing matrix for A(k) up to m mismatches
def get_mismatch_matrix(k,m): words = get_words(k) N = len(words) mismatch_matrix = np.zeros((N, N)) for i in range(N): for j in range(i, N): if Levenshtein.hamming(words[i], words[j]) <= m: mismatch_matrix[i,j] = 1/2 mismatch_matrix[j,i] = 1/2 r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kmer_mismatches(kmer, d):\n mismatches = [kmer] # Initialize mismatches with the k-mer itself (i.e. d=0).\n alt_bases = {'A':'CGT', 'C':'AGT', 'G':'ACT', 'T':'ACG'}\n for dist in xrange(1, d+1):\n for change_indices in combinations(xrange(len(kmer)), dist):\n for substitutions in pr...
[ "0.61256033", "0.5492321", "0.54824024", "0.54747415", "0.5421776", "0.53394526", "0.525798", "0.52476174", "0.5239157", "0.5195318", "0.51432306", "0.5101812", "0.5101346", "0.5072509", "0.50719184", "0.50710094", "0.50672525", "0.50546324", "0.5017481", "0.50011516", "0.498...
0.6413842
0
Compute the mismatch mixing matrix for A(k) with an _lambdaexponentially decaying mixing coefficient in the Hamming distance (number of character mismatches).
def get_exp_mismatch_matrix(k, _lambda): words = get_words(k) N = len(words) exp_mismatch_matrix = np.zeros((N, N)) for i in range(N): exp_mismatch_matrix[i,i] = 1 for j in range(i+1, N): exp_mismatch_matrix[i,j] = _lambda**Levenshtein.hamming(words[i], words[j]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mismatch_matrix(k,m):\n words = get_words(k)\n N = len(words)\n\n mismatch_matrix = np.zeros((N, N))\n for i in range(N):\n for j in range(i, N):\n if Levenshtein.hamming(words[i], words[j]) <= m:\n mismatch_matrix[i,j] = 1/2\n mismatch_matrix[j,i...
[ "0.60043955", "0.584836", "0.5295001", "0.5183668", "0.5108589", "0.5089423", "0.5051361", "0.5040407", "0.5032514", "0.50196207", "0.5013043", "0.4982249", "0.4963083", "0.4911103", "0.4889793", "0.48831633", "0.48796803", "0.48700666", "0.48386526", "0.48216584", "0.4814628...
0.7275287
0
Convenience constructor for making a BB fitting a circle at position p with radius r.
def newForCircle(p: Tuple[float, float], r: float) -> "BB": bb_ = lib.cpBBNewForCircle(p, r) return BB(bb_.l, bb_.b, bb_.r, bb_.t)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_circle(x, y, r):\n\tnew_circle = Circle()\n\tnew_circle.x = x\n\tnew_circle.y = y\n\tnew_circle.r = r\n\treturn new_circle", "def create_circle(self, x, y, r, **kwargs):\n return self.create_oval(*self.circ_to_oval(x, y, r), **kwargs)", "def __init__(self,r):\n self.radius = r\n s...
[ "0.6797189", "0.6702777", "0.6667772", "0.6466669", "0.6431503", "0.6397208", "0.63960946", "0.63899255", "0.6344427", "0.63260734", "0.63089645", "0.628068", "0.62040615", "0.61392826", "0.6138638", "0.61225516", "0.6100172", "0.60856056", "0.6085377", "0.5999422", "0.598271...
0.8697982
0
Returns true if the bounding boxes intersect
def intersects(self, other: "BB") -> bool: return bool(lib.cpBBIntersects(self, other))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doBoundingBoxesIntersect(self, other):\n if(self.upperLeft.x <= other.lowerRight.x and\n self.lowerRight.x >= other.upperLeft.x and\n self.upperLeft.y >= other.lowerRight.y and\n self.lowerRight.y <= other.upperLeft.y):\n return True\n return False"...
[ "0.7917236", "0.7433382", "0.73676354", "0.7323342", "0.7283105", "0.72586185", "0.7230588", "0.72287357", "0.7222845", "0.72152424", "0.71825683", "0.7179442", "0.71124595", "0.70957017", "0.70947075", "0.70937395", "0.7029807", "0.70073956", "0.6959474", "0.6942189", "0.693...
0.6963489
18
Returns true if the segment defined by endpoints a and b intersect this bb.
def intersects_segment( self, a: Tuple[float, float], b: Tuple[float, float] ) -> bool: assert len(a) == 2 assert len(b) == 2 return bool(lib.cpBBIntersectsSegment(self, a, b))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bbox_segment_intersects(bbox, a, b):\n # check whether the line is completely left/right/above/below the bbox\n if ((a[0] < bbox[0] and b[0] < bbox[0]) or\n (a[0] > bbox[2] and b[0] > bbox[2]) or\n (a[1] < bbox[1] and b[1] < bbox[1]) or\n (a[1] > bbox[3] and b[1] > bbox[2])):\n ...
[ "0.7417177", "0.7300638", "0.723171", "0.71940637", "0.70631444", "0.702027", "0.6949147", "0.68978626", "0.6845215", "0.6803748", "0.679673", "0.67637116", "0.6740446", "0.67376935", "0.6726528", "0.67107207", "0.67035824", "0.66985804", "0.6663408", "0.6662316", "0.6642424"...
0.8736708
0
Returns true if bb completley contains the other bb
def contains(self, other: "BB") -> bool: return bool(lib.cpBBContainsBB(self, other))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersects(self, other: \"BB\") -> bool:\n return bool(lib.cpBBIntersects(self, other))", "def isFullyContained(self,b):\n if b.chr != self.chr: return False\n if(b.start>=self.start and b.end<=self.end):return True\n else:\n return False", "def contains(self, other):...
[ "0.71655524", "0.6751795", "0.6408625", "0.63212824", "0.62912047", "0.6269242", "0.62372667", "0.6073795", "0.6011292", "0.6004978", "0.59933054", "0.5990504", "0.5896537", "0.5873203", "0.5848521", "0.5822856", "0.58123267", "0.57848597", "0.5763034", "0.5756717", "0.573985...
0.7855869
0
Returns true if this bb contains the vector v
def contains_vect(self, v: Tuple[float, float]) -> bool: assert len(v) == 2 return bool(lib.cpBBContainsVect(self, v))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __contains__(self, vector: Vector) -> bool:\n for vec in self.__elements:\n if vec == vector:\n return True\n return False", "def __contains__(self, v):\n for i in self:\n if v in i:\n return True\n False", "def __contains__(se...
[ "0.7753515", "0.75045705", "0.7134097", "0.67284584", "0.66507435", "0.6634624", "0.6634624", "0.6548283", "0.6511672", "0.63941616", "0.63868654", "0.636395", "0.636395", "0.63505995", "0.634826", "0.6313001", "0.62741154", "0.6256784", "0.6193182", "0.6173938", "0.6173084",...
0.84576803
0
Return the minimal bounding box that contains both this bb and the other bb
def merge(self, other: "BB") -> "BB": cp_bb = lib.cpBBMerge(self, other) return BB(cp_bb.l, cp_bb.b, cp_bb.r, cp_bb.t)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minDistBoundingBox(box1, box2):\n\n x1, y1, bw1, bh1 = box1[0], box1[1], box1[2], box1[3]\n x1b, y1b = x1 + bw1, y1 + bh1\n x2, y2, bw2, bh2 = box2[0], box2[1], box2[2], box2[3]\n x2b, y2b = x2 + bw2, y2 + bh2\n left = x2b < x1\n right = x1b < x2\n bottom = y2b < y1\n top = y1b < y2\n ...
[ "0.7417275", "0.73058367", "0.7186486", "0.7129518", "0.7075564", "0.7031528", "0.6983231", "0.6939014", "0.69309556", "0.6930756", "0.6909553", "0.6848703", "0.68110675", "0.68043196", "0.66724664", "0.6671054", "0.66672003", "0.6622425", "0.6621673", "0.6621345", "0.6538790...
0.0
-1
Return the minimal bounding box that contans both this bounding box and the vector v
def expand(self, v: Tuple[float, float]) -> "BB": cp_bb = lib.cpBBExpand(self, tuple(v)) return BB(cp_bb.l, cp_bb.b, cp_bb.r, cp_bb.t)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Vmin(V):\n return np.min(V)", "def get_bounding_box(self):\n if len(self.polygons) == 0:\n return None\n return numpy.array(((min(pts[:, 0].min() for pts in self.polygons),\n min(pts[:, 1].min() for pts in self.polygons)),\n (...
[ "0.66466093", "0.6520689", "0.6483818", "0.64321315", "0.64321315", "0.64093477", "0.6361213", "0.63357437", "0.6283989", "0.62723213", "0.62641245", "0.6255189", "0.6154182", "0.61055714", "0.6085589", "0.6080898", "0.6077978", "0.6076983", "0.6064426", "0.60208815", "0.6015...
0.0
-1
Merges this and other then returns the area of the merged bounding box.
def merged_area(self, other: "BB") -> float: return lib.cpBBMergedArea(self, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersect_over_union(self, other: 'BoundingBox2D') -> float:\n intersection = self.intersection(other)\n if intersection is None:\n return 0.0\n return intersection.area / (self.area + other.area - intersection.area)", "def merge_boxes(b_a, b_b):\n x1 = min(b_a[0], b_b[...
[ "0.7157065", "0.71257174", "0.6863361", "0.6718412", "0.6672673", "0.65338534", "0.64984745", "0.6486933", "0.6463623", "0.6392254", "0.6305657", "0.6289434", "0.6286845", "0.62425774", "0.623435", "0.6214841", "0.6189725", "0.6187245", "0.61332756", "0.61302435", "0.61198205...
0.8213908
0
Returns the fraction along the segment query the BB is hit. Returns infinity if it doesnt hit
def segment_query(self, a: Tuple[float, float], b: Tuple[float, float]) -> float: assert len(a) == 2 assert len(b) == 2 return lib.cpBBSegmentQuery(self, a, b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fractionPassing(self):\n return self.cut.entries / self.entries", "def denominator(self):\n return 1", "def denominator(self, ???):", "def getB(self):\n return ((self.bPlusbStar() / self.nPos) + (self.bMinusbStar / self.nNeg)) / 2", "def segment_to_fraction(distance):\r\n if np....
[ "0.6630583", "0.6425761", "0.6225191", "0.6154683", "0.6074927", "0.5970434", "0.5944755", "0.5914879", "0.5909964", "0.58984774", "0.5868031", "0.58616555", "0.5840804", "0.58013916", "0.5793779", "0.5786189", "0.5754431", "0.57225853", "0.5708478", "0.56926256", "0.56920666...
0.53765804
68
Returns a copy of the vector v clamped to the bounding box
def clamp_vect(self, v: Tuple[float, float]) -> Vec2d: assert len(v) == 2 v2 = lib.cpBBClampVect(self, v) return Vec2d(v2.x, v2.y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _call_clipVector(vecObj, low, high):\n res = vecObj.clipVector(low, high)\n return res", "def clamp(self, value, minv, maxv):\n if value > maxv:\n return maxv\n if value < minv:\n return minv\n return value", "def vc_clamp(x, lb, ub):\n\n y = min(x, ub)\n...
[ "0.6807381", "0.6428448", "0.63725543", "0.6356594", "0.6352561", "0.63401467", "0.62526983", "0.62392527", "0.62268704", "0.62158364", "0.6202087", "0.62009895", "0.6138032", "0.61025995", "0.6064156", "0.6042305", "0.6008709", "0.59086823", "0.5906434", "0.5868656", "0.5867...
0.78596365
0
Wenn Windows, verhalten von binaeren Dateien verbessern.
def setWinBinMode(self): try: # Windows needs stdio set for binary mode. import msvcrt msvcrt.setmode (0, os.O_BINARY) # stdin = 0 msvcrt.setmode (1, os.O_BINARY) # stdout = 1 self.logger.debug("Windows found, set binary mode") except ImportError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def win():\n if platform.system() in WINDOWS:\n return True\n return False", "def is_windows():\n return os.name == \"nt\"", "def is_win():\n return sys.platform[:3] == \"win\"", "def is_windows():\r\n return sys.platform == \"win32\"", "def is_windows():\n return sys.p...
[ "0.65731186", "0.652225", "0.6470413", "0.6435043", "0.6404046", "0.63480294", "0.6341871", "0.6300086", "0.62505215", "0.61096054", "0.61033535", "0.6053399", "0.60161406", "0.60030526", "0.5946356", "0.5660631", "0.5611057", "0.5574567", "0.55204207", "0.5510968", "0.550965...
0.5272913
26
Erzeugen notwendige Verzeichnisse in Datastore wenn nicht vorhanden.
def createDirectories(self): # -- LOG thepath = os.path.dirname(self.settings.logfile) distutils.dir_util.mkpath(thepath) # -- SESSION thepath = self.settings.sessionpath distutils.dir_util.mkpath(thepath) # -- DATABASE thepath = self.settings.dbpath distuti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_version_data_existed(self):\n # if exists, skip\n # return \n\n return True", "def test_backend_name_distinction(self):\n self._test_backend_name_distinction(self.volume_id_list_without_prefix)", "def volumes(self):", "def __len__(self):\n return len(self.db)", "def __NNNameCh...
[ "0.52055395", "0.51279175", "0.49413115", "0.47858343", "0.47708228", "0.4761658", "0.47440276", "0.47155702", "0.47035265", "0.46811026", "0.46754476", "0.46532047", "0.46413302", "0.46383125", "0.46321526", "0.4602954", "0.4575675", "0.45742193", "0.4568179", "0.45680857", ...
0.0
-1
Schreibt einen Fehlermeldung auf stderr
def writelog(self,*args): import sys print(' '.join([str(a) for a in args]),file=sys.stderr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_err(self, *lst):\n self.print2file(self.stderr, False, True, *lst)", "def print_err(err):\n return stdout.write(err.args[0])", "def error(message):\n print(message, file=sys.stderr)", "def printerr(msg):\n print(msg, file=sys.stderr)", "def result_stderr(result):\n return result[...
[ "0.72328687", "0.6940028", "0.6930398", "0.68906885", "0.68363875", "0.6835012", "0.6834855", "0.682285", "0.6821791", "0.67793924", "0.6752441", "0.6745539", "0.6729952", "0.672143", "0.6719605", "0.6718775", "0.66960204", "0.668392", "0.6678071", "0.666586", "0.6640537", ...
0.0
-1
Verbinden mit Datenbank Wenn dbfilename angegeben
def connectDb(self): self.db = Database('sqlite',self.settings.sqlitefilename) self.db.user = self.session.getAttribute(self.settings.authenvar) self.db.settings = self.settings self.db.logger = self.logger self.db.cgiparam = self.cgiparam self.db.writelog = self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadDB(self,dbfilename):\n \n db=[]\n with open(dbfilename,'r',encoding='ISO-8859-1') as dbfilename:\n dbreader= csv.reader(dbfilename,delimiter=self.sDelimiter )\n for lFields in dbreader:\n db.append(lFields)\n\n return db", "def db_file():\n...
[ "0.71046317", "0.6916016", "0.6736287", "0.6682424", "0.667132", "0.6536231", "0.64644116", "0.6447481", "0.6443855", "0.63989985", "0.63823104", "0.63783497", "0.63288426", "0.6328334", "0.63079494", "0.62568176", "0.6248388", "0.6201025", "0.6177725", "0.61691105", "0.61612...
0.0
-1
Behandelt Anmeldeverfahren Es wird geprueft, ob schon ein Benutzer eingeloggt ist. Des erfogt durch das versuchte Lesen einer Sessionvariabel (gewoehnlich "user") ist diese Vorhanden bzw. nicht Leer, gilt der Benutzer als angemeldet.
def handleLogin(self): aVar = self.session.getAttribute(self.settings.authenvar) self.loggedin = False if not aVar: self.currenttemplate = self.settings.logintemplate self.logger.debug("Not logged in, Login-Mask activated.") return self.loggedin = True self.log...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_logged_in_user():\n user_id = session.get(\"user_id\")\n if user_id is None:\n g.user = None\n else:\n g.user = {\n \"user_id\": user_id,\n \"user_name\": session.get(\"user_name\")\n }", "def _load_user():\n user = session.get('user')\n\n if use...
[ "0.6632528", "0.6623475", "0.6597947", "0.64342046", "0.64179903", "0.64179903", "0.64135504", "0.6351458", "0.6349099", "0.6331735", "0.624122", "0.62315804", "0.6229254", "0.62206924", "0.61837983", "0.6175565", "0.61481726", "0.6147068", "0.6137512", "0.61315745", "0.60983...
0.56766754
86
Setzen der Flashvariable Der Text in flash wird dem Template uebergeben ${FLASH} und kann wird dort angezeigt. txt Flash Text
def setFlash(self,txt): self.flash = txt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flash(text, type=INFO):\n flash_message['text'] = text\n flash_message['type'] = type", "def set_flash(data):\n local.flash_message = b64encode(pickle.dumps(data))", "def flash_display_text(self):\r\n if self.flashMillisecs in self.flashTimes:\r\n self.countdownString.setStyleSheet...
[ "0.7407915", "0.6243453", "0.59574306", "0.56630206", "0.56456476", "0.56057084", "0.5602982", "0.5602982", "0.5484917", "0.54733086", "0.5426906", "0.54131734", "0.54042053", "0.5398598", "0.5392821", "0.5345576", "0.5328521", "0.53128743", "0.5296913", "0.52903944", "0.5276...
0.7894787
0
Liefert einen Eintrag im Routingverzeihnis basierend auf Pfad path Pfad auf eintrag, wird keiener angegeben,so wird der aktuelle Pfad verwendet strict Vorgabewert gesetzt wird False uebergeben, so wird kein Fehler erzeugt, wenn nicht gefunden. secure Ueberprueft, ob beim Eitrag die Rechte ueberprueft werden soll.
def getEntry(self,path=None,strict=True,secure=True): path = path or self.path inxEntry = self.routing.findEntry(path) entry = self.routing.entries[inxEntry] if strict and entry is None: sEntries = "Path-tree\n"+"\n".join([x.get('path','') for x in self.routing.entries]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_path(self, s):\n return True", "def resolve_path(self, path):\n if path:\n if path[0] == '/':\n #zope objects case\n try: return self.unrestrictedTraverse(path)\n except: pass\n else:\n #aliss (python) objec...
[ "0.5677675", "0.54581755", "0.54337823", "0.54013294", "0.53485847", "0.533537", "0.53188103", "0.50786537", "0.5069197", "0.50642717", "0.49895015", "0.49731568", "0.49500102", "0.49488223", "0.49339435", "0.4925092", "0.49197397", "0.49162027", "0.48928607", "0.48888433", "...
0.5466822
1
Vorbereiten des Controller. Abstrakte Methode, diese kann in options/mframe.py ueberschrieben weden Setzen von Methoden und Vorgabewert
def prepareController(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_controller(self):", "def Update(self, controller):\n pass", "def __init__(self, controller):\n self._controller = controller", "def __init__(self, view, model):\n self.view = view\n self.view.set_controller(self)\n self.model = model", "def action(self):\n ...
[ "0.70822626", "0.6441546", "0.6388756", "0.6302702", "0.61122227", "0.61122227", "0.5937033", "0.5870635", "0.581604", "0.5807554", "0.57872707", "0.57705015", "0.5763379", "0.5732413", "0.5629399", "0.5627821", "0.5627821", "0.5625543", "0.5600184", "0.55868185", "0.55685526...
0.6048279
6
Prueft ob der Benutzer eines der uebergebene Rechte besitzt
def checkRights(self,entry): if not self.session.isLoggedin(): self.logger.debug('Not logged in, we leave checkRights') return False # Ist Eintrag Public (z.B. Authen) if entry.get('public'): return True rights = entry.get('rights') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user(self):", "def user():", "def user(self):\n pass", "def getResponsibleUsers():", "def get_one_user():", "def user(self, uid):", "def wahlrecht(self, irc, msg, args):\n if self._is_voting_enabled(irc, msg, reply=True):\n user_list = []\n for join_id in self.re...
[ "0.7015204", "0.66788423", "0.66660386", "0.6376852", "0.6369947", "0.6274839", "0.61995834", "0.59317493", "0.592075", "0.59052855", "0.5847772", "0.5836721", "0.58131725", "0.58024895", "0.5797404", "0.57444686", "0.57444686", "0.57310027", "0.5699502", "0.5691705", "0.5672...
0.0
-1
Erzeugen des Controller, entry Routing Eintrags Object
def releaseController(self,entry): controllerName = entry.get('controller') if controllerName is None: self.logger.debug('Path: "{}" controller not decleared, we leave'.format(entry.get('path'))) self.controller = Controller(self) return self.logger...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def route(self):\n pass", "def mvcObj(self, router):\n pass", "def route( request, c ):", "def routes(self, body):\n pass", "def mvcRouter(self, router):\n pass", "def index_route(self, request, *args, **kwargs):\n raise Http404()", "def route(self, env):\n ...
[ "0.711534", "0.6924134", "0.6728508", "0.6227307", "0.60982", "0.60037285", "0.58711183", "0.5868464", "0.5808522", "0.5785226", "0.5734909", "0.57303315", "0.568503", "0.5655221", "0.56326646", "0.5625207", "0.56240773", "0.5579798", "0.5549135", "0.5529758", "0.5516693", ...
0.528223
54
In der CGI Variable path wir der gewuenschte Pfad auf den Controller uebergeben. Diese wird ausgwertet und in der Routingtabelle nachgeschlagen. In der Routingtabelle wird der Controllername vermerkt und ausgefuehrt.
def work(self): redirectDeep=self.settings.maxredirects # Redirect Loop while FOREVER: entry = self.getEntry() for redirectcnt in range(0,redirectDeep-1): if entry.get('redirect') is None: break self.path = entry.get('redirect') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pathfor( request, *args, **kwargs ):", "def releaseController(self,entry):\n \n controllerName = entry.get('controller')\n \n if controllerName is None:\n self.logger.debug('Path: \"{}\" controller not decleared, we leave'.format(entry.get('path')))\n self.controller = ...
[ "0.58181685", "0.5507331", "0.5368903", "0.5306434", "0.5282481", "0.5241728", "0.52358586", "0.52031386", "0.5198254", "0.5163362", "0.50515395", "0.5016045", "0.5009271", "0.49856222", "0.49850282", "0.49715376", "0.49714506", "0.49709913", "0.49620748", "0.49510586", "0.49...
0.0
-1
fuegt text dem Contentnbuffer hinzu text String mit inhalt
def render(self,value): self.content += value if self._rendernl: self.content += self._rendernl
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addContent(text):", "def getText():", "def getText():", "def getText():", "def getText():", "def getText():", "def text(self):\n return self.content", "def plain_text_(self):\n return self.content.decode(self.encoding)", "def postprocess(self, text):\r\n return text", "de...
[ "0.6941335", "0.69232386", "0.69232386", "0.69232386", "0.69232386", "0.69232386", "0.6780827", "0.67055005", "0.657867", "0.65636176", "0.6522846", "0.63513684", "0.6298835", "0.62473255", "0.6232585", "0.6215911", "0.618917", "0.6158541", "0.61101365", "0.6097772", "0.60808...
0.0
-1
Liefert den Inhalt eines CGI Parmeters basierend auf den QUERY_STRINGS param Name des CGI Parameters nvl NullValue wird zurueckgeliefert, wenn der Parameter nicht vorhanden ist. Vorgabewert ''
def getCgiParameter(param,nvl=''): query_string = os.environ['QUERY_STRING'] parsed = parse_qs(query_string) retval = parsed.get(param) if retval is None: return None else: return retval[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cgiparam(self,name=None,nvl='',noneifnotused=False): \n if self.form is None:\n self.logger.debug('Form not defined, nvl returnd')\n return nvl\n \n # Wurde Spezielle CGI Verarbeitung gewuenscht\n if isinstance(self.form,dict):\n return self.form.get(name,nvl)\n...
[ "0.68676573", "0.6290201", "0.62290454", "0.6090092", "0.60684675", "0.5958999", "0.5851652", "0.5787709", "0.5784721", "0.5666418", "0.565603", "0.56227976", "0.56054574", "0.5600178", "0.55845547", "0.55600107", "0.54914063", "0.5483884", "0.5482327", "0.544595", "0.5407495...
0.61354756
3
Laed den Inhalt des CGI in Abhaengigkeit des Flags usecgi. usecgi
def loadCgiParameter(self): if self.usecgi: self.form=FieldStorage(keep_blank_values=1) self.path = self.cgiparam(name='path',nvl='/') else: # Form inhalte holen qs = self.query_string parsed = parse_qs(qs) self.form = dict() for key in parsed...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Main():\n wsgiref.handlers.CGIHandler().run(application)", "def handler(request):\n\tglobal req\n\treq = request\n\n\t\"\"\"Handles a single request from the client, checking the form data for what to do.\n\tCalls functions to get data frm the DB and renders it as XHTML\"\"\"\n\n\tnow = time.time()\n\n\tf...
[ "0.6065659", "0.5665476", "0.55807704", "0.5559359", "0.5547418", "0.5341351", "0.5336655", "0.5252254", "0.52506816", "0.5198742", "0.5170052", "0.5152763", "0.51221436", "0.5080511", "0.5069608", "0.5062145", "0.5022987", "0.49356276", "0.49331462", "0.49176794", "0.4896962...
0.5510162
5
Liefert den geparsten Query String
def getParsedQueryString(self): return cgi.parse_qs(self.query_string)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_query_string(self):\r\n pass", "def _get_query_part(params: dict) -> str:\n params_cleaned = {k: v for k, v in params.items() if v is not None}\n return ('?' + urlencode(params_cleaned, quote_via=quote, safe=\"/,\")) if params_cleaned else \"\"", "def encoded_query_str(request):\n ...
[ "0.81491977", "0.7360224", "0.7241088", "0.6829905", "0.6829262", "0.67888916", "0.6748177", "0.67181957", "0.6705086", "0.6649373", "0.6631138", "0.6631138", "0.66182524", "0.6563053", "0.64593166", "0.6454432", "0.64478385", "0.64211726", "0.6419503", "0.63587254", "0.63558...
0.6809732
5
Liefert aus dem CGI einen benannten Parameter name Name des Cgiparmeters nvl NullValue wird geliefert, wenn der Parameter nicht uebergeben wurde
def cgiparam(self,name=None,nvl='',noneifnotused=False): if self.form is None: self.logger.debug('Form not defined, nvl returnd') return nvl # Wurde Spezielle CGI Verarbeitung gewuenscht if isinstance(self.form,dict): return self.form.get(name,nvl) # wenn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getParameter(self, name):", "def _get_param_from_request(self, nombreParametro):\n\t\treturn request.args.get(nombreParametro)", "def getCgiParameter(param,nvl=''):\n query_string = os.environ['QUERY_STRING']\n parsed = parse_qs(query_string)\n retval = parsed.get(param)\n if retval is ...
[ "0.6984488", "0.6518252", "0.6509895", "0.63873404", "0.6297295", "0.6131174", "0.61152864", "0.60404736", "0.5814613", "0.5788756", "0.5753376", "0.5746549", "0.57352185", "0.5730151", "0.57107925", "0.57065684", "0.5703177", "0.5638922", "0.5634816", "0.56301075", "0.562937...
0.8072438
0
Setzen der Parameter fuer Templates
def defaultTemplateParameter(self): self.tplparam['BODY'] = self.content self.tplparam['FLASH'] = (self.flash or '').replace('"', r'\"') self.tplparam['PYMFRAMEVERSION'] = self.pymframeversion self.tplparam['USER'] = self.session.getAttribu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setTemplateParameter(self,name,value):\n self.tplparam[name] = value", "def setParameter(self, name, value):", "def _config(self):\n tmpl = self._template_interface\n for p in tmpl._params:\n setattr(self, p._name, p.get_value())", "def define_parameters(self):", "def set...
[ "0.81341386", "0.7047122", "0.651418", "0.64651376", "0.62941664", "0.62544084", "0.62332976", "0.61994874", "0.61864775", "0.6185183", "0.6179255", "0.61744213", "0.6174358", "0.61188614", "0.6110847", "0.6094941", "0.6093879", "0.6079203", "0.6076053", "0.6037855", "0.60232...
0.6587532
2
Fuegt der Standard Parmeterliste einen Eintrag hinzug oder aendert diesen. name Name des Parameters value Inhalt
def setTemplateParameter(self,name,value): self.tplparam[name] = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getParameter(self, name):", "def setParameter(self, name, value):", "def parameters(self):", "def define_parameters(self):", "def __setitem__(self, name: str, value):\n super(Parameter, self).__setitem__(name, value)", "def parameters(self):\n pass", "def params():\n raise NotI...
[ "0.7019348", "0.67843944", "0.66614234", "0.650577", "0.6377055", "0.6351305", "0.63127047", "0.62319314", "0.6182715", "0.61809283", "0.6159626", "0.614466", "0.61189115", "0.60633993", "0.60572857", "0.60572857", "0.6057096", "0.6046293", "0.60161483", "0.60020393", "0.5993...
0.0
-1
Initialisieren Abstrakte Methode, diese kann in options/mframe.py ueberschrieben werden
def setup(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, frame):\n self.frame = frame\n self._configure()", "def __init__(self, frame):\n self.frame = frame", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pas...
[ "0.70448387", "0.69133914", "0.6861105", "0.6861105", "0.6861105", "0.6861105", "0.6861105", "0.6861105", "0.6861105", "0.6861105", "0.6732359", "0.66935533", "0.66732675", "0.6617154", "0.66102046", "0.66046375", "0.65614206", "0.65614206", "0.6559159", "0.6559159", "0.65420...
0.0
-1
Abstrakte Mehtode wird in options/mframe.py aufgerufen
def onInit(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hook_frame_selected(self):", "def frame(self):", "def change_frame(self, frame):\r\n pass", "def main_frame(self):\n debug.virtual('wxMediator.main_frame')", "def __init__(self, frame):\n self.frame = frame", "def dispatch_frame(self, frame):", "def setupOptionsFrame(self):\n\n...
[ "0.6515632", "0.647678", "0.6115767", "0.60367817", "0.603532", "0.60195166", "0.5954144", "0.5866861", "0.586646", "0.58569634", "0.57945967", "0.5787335", "0.5743865", "0.5701996", "0.56993943", "0.56606734", "0.56544495", "0.56304306", "0.5613108", "0.5591648", "0.5572113"...
0.0
-1
Abstrakte Mehtode wird in options/mframe.py aufgerufen
def afterWork(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hook_frame_selected(self):", "def frame(self):", "def change_frame(self, frame):\r\n pass", "def main_frame(self):\n debug.virtual('wxMediator.main_frame')", "def __init__(self, frame):\n self.frame = frame", "def dispatch_frame(self, frame):", "def setupOptionsFrame(self):\n\n...
[ "0.65151006", "0.64778674", "0.6117484", "0.60386825", "0.6037334", "0.6021119", "0.5954234", "0.58682036", "0.58678764", "0.5857496", "0.5796308", "0.5789542", "0.5746315", "0.5701898", "0.56975824", "0.56620985", "0.5655906", "0.5630794", "0.5614502", "0.5593059", "0.557245...
0.0
-1
Abstrakte Mehtode wird in options/mframe.py aufgerufen
def onDone(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hook_frame_selected(self):", "def frame(self):", "def change_frame(self, frame):\r\n pass", "def main_frame(self):\n debug.virtual('wxMediator.main_frame')", "def __init__(self, frame):\n self.frame = frame", "def dispatch_frame(self, frame):", "def setupOptionsFrame(self):\n\n...
[ "0.6515799", "0.64780504", "0.61175776", "0.60390854", "0.6037653", "0.60214657", "0.5952773", "0.58687997", "0.5867961", "0.5858251", "0.5794759", "0.5789679", "0.5746275", "0.57022476", "0.56970835", "0.56622493", "0.5654481", "0.56311244", "0.5615157", "0.5592653", "0.5572...
0.0
-1
Startet die Verarbeitung. onInit Hook bevor die Bearbeitung beginnt onClose Nachbearbeitung
def build(self): self.logger.debug("run") self.onInit() self.work() self.afterWork() template = Templateengine(self.currenttemplate) template.readTemplateFile() contenttype = self.settings.contenttype self.defaultTemplateParameter() try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onInit(self):\n pass", "def on_start(self):\n self.init()", "def onInit(*args):", "def onInit(*args):", "def onInit(*args):", "def onInit(*args):", "def on_startup(self) -> None:\n ...", "def on_start(self):\n pass", "def on_start(self):\n pass", "def on_start...
[ "0.79394215", "0.7911022", "0.7446895", "0.7446895", "0.7446895", "0.7446895", "0.7352791", "0.7175605", "0.7175605", "0.7175605", "0.7175605", "0.7175605", "0.7175605", "0.7175605", "0.7175605", "0.7002526", "0.6971559", "0.6957478", "0.6957478", "0.69376475", "0.69061404", ...
0.0
-1
Gibt den gesamten Response auf stdout aus
def write(self): self.session.cookies['with_max_age'] = 'expires in {} minutes'.format(self.settings.sessionlifetime) sys.stdout.flush() sys.stdout.write(self.session.cookies.output(self.session.cookies)) sys.stdout.write('\n') sys.stdout.write(self.settings.contenttype) sys.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output(self, response: str):\n\n # Try to output through the prefered medium, but revert to\n # backup if need to and log any errors found, for example:\n # logging.error(\"Problem!\")\n\n IO.stdout(response)", "def response(self, data, response_type = \"terminal\"):\n if (...
[ "0.7399306", "0.7035156", "0.67503905", "0.67340016", "0.67140317", "0.6595793", "0.653666", "0.65136904", "0.6447274", "0.6439549", "0.64278734", "0.64268064", "0.64227223", "0.63991123", "0.6324795", "0.62977356", "0.6227124", "0.6226691", "0.6109555", "0.61010414", "0.6096...
0.0
-1
Build an application into a docker image. The build will be.
def build(parser): parser.add_argument( '-i', '--identity-file', help=( 'A SSH private key file which may be used to pull down ' 'repositories when building.' ), ) parser.add_argument( '-e', '--env', action='append', default=[], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_docker(c):\n tag = c.run('git describe', hide=True)\n docker_img = f'{docker_repo}:{tag.stdout.strip()}'\n c.run(f'docker build -t {docker_img} .')", "def build(config, version_tag):\n config_dict = get_config(config)\n image_name = config_dict['IMAGE'].split(':')[0]\n image = '{}:{}'...
[ "0.728759", "0.7125728", "0.7063539", "0.70521617", "0.7014252", "0.7007478", "0.69872326", "0.6935246", "0.6930503", "0.69300056", "0.69241107", "0.6907585", "0.6824419", "0.6819319", "0.6816419", "0.67739934", "0.67064244", "0.669797", "0.66670424", "0.663121", "0.6611756",...
0.7510288
0
Respond with dummy content via HTTP.
def respond(self): req = self.req req_uri = bton(req.uri) if req_uri == '/': req.status = b'200 OK' req.ensure_headers_sent() req.write(b'Hello world!') return if req_uri == '/env': req.status = b'200 OK' req.ensure_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def emptyresponse():\n return get_response(\"\")", "def test_sample(self):\n response = self.tester.get('/sample-household/',\n content_type='html/text')\n self.assertEqual(response.status_code, 200)", "def response_handling(self) -> global___Snippet.SimpleRes...
[ "0.6685774", "0.653254", "0.6492824", "0.6492824", "0.6484595", "0.6475465", "0.642968", "0.64224654", "0.64184016", "0.63898206", "0.6374144", "0.6295283", "0.6292539", "0.6273358", "0.6255722", "0.62487423", "0.62462354", "0.62414706", "0.6200457", "0.6179395", "0.6177956",...
0.0
-1
Create and start an HTTP server bound to ``bind_addr``.
def make_tls_http_server(bind_addr, ssl_adapter, request): httpserver = HTTPServer( bind_addr=bind_addr, gateway=HelloWorldGateway, ) # httpserver.gateway = HelloWorldGateway httpserver.ssl_adapter = ssl_adapter threading.Thread(target=httpserver.safe_start).start() while not h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listen(self):\n\n msg = _(u'Serving on host %(bind)s:%(port)s')\n msg %= {'bind': self._wsgi_conf.bind, 'port': self._wsgi_conf.port}\n LOG.info(msg)\n\n httpd = simple_server.make_server(self._wsgi_conf.bind,\n self._wsgi_conf.port,\n ...
[ "0.7009316", "0.68428564", "0.6720143", "0.6662201", "0.6658321", "0.65545225", "0.6548313", "0.653597", "0.65009654", "0.64817756", "0.6477882", "0.64442277", "0.6442424", "0.64423376", "0.64010143", "0.63692665", "0.63614887", "0.63138366", "0.62734425", "0.62704706", "0.62...
0.7076777
0
Provision a server creator as a fixture.
def tls_http_server(request): return functools.partial(make_tls_http_server, request=request)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_nova_create(tiny_cirros_server):\n\n assert ping_from_mnaio(tiny_cirros_server.accessIPv4)\n\n @pytest.mark.testinfra('ansible://' + tiny_cirros_server.accessIPv4)\n @pytest.mark.test_id('57f87c9e-3adb-11e9-b2ca-6a00035510c0')\n @pytest.mark.jira('ASC-31')\n def test_nova_create_connect(hos...
[ "0.6389046", "0.6211826", "0.60900635", "0.6058039", "0.60431457", "0.5989971", "0.59649867", "0.596473", "0.5951707", "0.5888222", "0.58145905", "0.575608", "0.56847775", "0.5684153", "0.56765664", "0.56556773", "0.5648855", "0.56459504", "0.5604653", "0.55835444", "0.555056...
0.0
-1
Provide a certificate authority via fixture.
def ca(): return trustme.CA()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_use_certificate(self, ctx_or_conn):\n # TODO\n # Hard to assert anything. But we could set a privatekey then ask\n # OpenSSL if the cert and key agree using check_privatekey. Then as\n # long as check_privatekey works right we're good...\n ctx_or_conn.use_certificate(\...
[ "0.6478829", "0.6210673", "0.588348", "0.58145547", "0.57692796", "0.5756476", "0.5745719", "0.57149416", "0.5711973", "0.5676903", "0.5664968", "0.5628662", "0.5617317", "0.5582491", "0.5564817", "0.5559471", "0.55492854", "0.5547014", "0.55356705", "0.5494599", "0.54880655"...
0.6169851
2
Provide a certificate authority certificate file via fixture.
def tls_ca_certificate_pem_path(ca): with ca.cert_pem.tempfile() as ca_cert_pem: yield ca_cert_pem
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_load_client_ca(self, context, ca_file):\n context.load_client_ca(ca_file)", "def test_use_certificate(self, ctx_or_conn):\n # TODO\n # Hard to assert anything. But we could set a privatekey then ask\n # OpenSSL if the cert and key agree using check_privatekey. Then as\n ...
[ "0.6675616", "0.6659725", "0.66458046", "0.65266156", "0.6517194", "0.62550855", "0.6234092", "0.617175", "0.61563927", "0.61135054", "0.6095193", "0.60206944", "0.5993298", "0.59436864", "0.591276", "0.58697903", "0.58674884", "0.5856625", "0.58131033", "0.58096194", "0.5807...
0.6276557
5
Provide a leaf certificate via fixture.
def tls_certificate(ca): interface, _host, _port = _get_conn_data(ANY_INTERFACE_IPV4) return ca.issue_cert(ntou(interface))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_use_certificate(self, ctx_or_conn):\n # TODO\n # Hard to assert anything. But we could set a privatekey then ask\n # OpenSSL if the cert and key agree using check_privatekey. Then as\n # long as check_privatekey works right we're good...\n ctx_or_conn.use_certificate(\...
[ "0.64099133", "0.5815417", "0.5815417", "0.5645898", "0.5644121", "0.55344754", "0.5510401", "0.54696214", "0.54393286", "0.5389256", "0.5381491", "0.53703773", "0.53650725", "0.535862", "0.5345015", "0.5323259", "0.5321473", "0.53142846", "0.5283148", "0.5282517", "0.5259944...
0.48076737
87
Provide a certificate chain PEM file path via fixture.
def tls_certificate_chain_pem_path(tls_certificate): with tls_certificate.private_key_and_cert_chain_pem.tempfile() as cert_pem: yield cert_pem
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _use_certificate_chain_file_test(self, certdir):\n chain = _create_certificate_chain()\n [(cakey, cacert), (ikey, icert), (skey, scert)] = chain\n\n makedirs(certdir)\n\n chainFile = join_bytes_or_unicode(certdir, \"chain.pem\")\n caFile = join_bytes_or_unicode(certdir, \"ca....
[ "0.65376246", "0.6510968", "0.64322776", "0.6361593", "0.60838246", "0.60578936", "0.59323585", "0.5911285", "0.5909131", "0.586066", "0.5757245", "0.5733029", "0.57099134", "0.5704165", "0.5615864", "0.55440724", "0.55197316", "0.54616076", "0.5460418", "0.5451866", "0.54236...
0.7069549
0
Provide a certificate private key PEM file path via fixture.
def tls_certificate_private_key_pem_path(tls_certificate): with tls_certificate.private_key_pem.tempfile() as cert_key_pem: yield cert_key_pem
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PRIVATE_RSA_KEYFILE_PATH() :\n return os.path.join( config.CONFIG_PATH(), \"%s-private.pem\" % RSA_KEYPAIR_PREFIX() )", "def test_use_privatekey_file_bytes(self, tmpfile):\n self._use_privatekey_file_test(\n tmpfile + NON_ASCII.encode(getfilesystemencoding()),\n FILETYPE_PEM,\...
[ "0.69608307", "0.687093", "0.6712036", "0.6702118", "0.6690106", "0.66636044", "0.6662529", "0.6596007", "0.65030545", "0.64921826", "0.6414813", "0.64131594", "0.6375513", "0.63217956", "0.63216823", "0.63068557", "0.6184653", "0.6176945", "0.6149253", "0.6133763", "0.610941...
0.7651465
0
Append uncaught exception ``args`` in threads to ``exceptions``.
def _thread_except_hook(exceptions, args): if issubclass(args.exc_type, SystemExit): return # cannot store the exception, it references the thread's stack exceptions.append(( args.exc_type, str(args.exc_value), ''.join( traceback.format_exception( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiprocess_except_hook(exctype, value, traceback):\n log.critical(\n 'Uncaught exception',\n exc_info=(exctype, value, traceback)\n )", "def thread_exceptions():\n exceptions = []\n # Python 3.8+\n orig_hook = getattr(threading, 'excepthook', None)\n if orig_hook is not None...
[ "0.6442792", "0.6314771", "0.6114252", "0.6108315", "0.6078531", "0.6070044", "0.5971772", "0.59131795", "0.58630633", "0.58242786", "0.5804844", "0.5800842", "0.5789167", "0.57715845", "0.57265514", "0.56889033", "0.56334716", "0.5630397", "0.562727", "0.5553139", "0.5514725...
0.8276504
0
Provide a list of uncaught exceptions from threads via a fixture. Only catches exceptions on Python 3.8+.
def thread_exceptions(): exceptions = [] # Python 3.8+ orig_hook = getattr(threading, 'excepthook', None) if orig_hook is not None: threading.excepthook = functools.partial( _thread_except_hook, exceptions, ) try: yield exceptions finally: if orig_hook...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _thread_except_hook(exceptions, args):\n if issubclass(args.exc_type, SystemExit):\n return\n # cannot store the exception, it references the thread's stack\n exceptions.append((\n args.exc_type,\n str(args.exc_value),\n ''.join(\n traceback.format_exception(\n ...
[ "0.66760486", "0.6598078", "0.6356232", "0.62687737", "0.6181395", "0.6165635", "0.61543995", "0.5914752", "0.5768126", "0.57457703", "0.5707351", "0.5681946", "0.5677206", "0.5652876", "0.5609814", "0.55952704", "0.5578221", "0.55618787", "0.5545394", "0.54994076", "0.548082...
0.7226413
0
Test ability to connect to server via HTTPS using adapters.
def test_ssl_adapters( http_request_timeout, tls_http_server, adapter_type, tls_certificate, tls_certificate_chain_pem_path, tls_certificate_private_key_pem_path, tls_ca_certificate_pem_path, ): interface, _host, port = _get_conn_data(ANY_INTERFACE_IPV4) tls_adapter_cls = get_ssl_adapter...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_http_over_https_error(\n http_request_timeout,\n tls_http_server, adapter_type,\n ca, ip_addr,\n tls_certificate,\n tls_certificate_chain_pem_path,\n tls_certificate_private_key_pem_path,\n):\n # disable some flaky tests\n # https://github.com/cherrypy/cheroot/issues/225\n issue...
[ "0.69955426", "0.68153185", "0.6773603", "0.6768768", "0.6602018", "0.6554022", "0.65539634", "0.6547804", "0.6482891", "0.6361325", "0.62152225", "0.62116075", "0.6187968", "0.60914856", "0.60686594", "0.6054359", "0.6045301", "0.6039718", "0.60362446", "0.59973997", "0.5973...
0.7578603
0
Verify that client TLS certificate auth works correctly.
def test_tls_client_auth( # noqa: C901, WPS213 # FIXME # FIXME: remove twisted logic, separate tests http_request_timeout, mocker, tls_http_server, adapter_type, ca, tls_certificate, tls_certificate_chain_pem_path, tls_certificate_private_key_pem_path, tls_ca_certificate_pem_path, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cert(self):\n\n try:\n client = SSLClient(host=FQDN, ip=APPLIANCE, usercert=CERT, sslverifyhost=True, cabundle=CABUNDLE)\n self.assertTrue(1==1, \"SSLClient connects with cabundle\")\n except Exception as exception:\n print(exception)\n self.fail(\...
[ "0.7287053", "0.7028661", "0.6923222", "0.6836822", "0.6744789", "0.673261", "0.6715781", "0.66538733", "0.65806013", "0.64398456", "0.6386415", "0.6303621", "0.62990195", "0.6282365", "0.6271865", "0.6262839", "0.6243923", "0.62418854", "0.61895025", "0.6189468", "0.6184999"...
0.7006178
2
Test the SSL environment generated by the SSL adapters.
def test_ssl_env( # noqa: C901 # FIXME thread_exceptions, recwarn, mocker, http_request_timeout, tls_http_server, adapter_type, ca, tls_verify_mode, tls_certificate, tls_certificate_chain_pem_path, tls_certificate_private_key_pem_path, tls_ca_cer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ssl_default(self):\n assert security.security_settings.ssl_verify()", "def test_ssl_default(self):\n e = ErrataConnector()\n assert e.ssl_verify", "def test_ssl_object_attributes(self) -> None:\n self.start_dummy_server()\n\n sock = socket.create_connection((self.hos...
[ "0.770599", "0.73672163", "0.7322214", "0.6758989", "0.6576103", "0.656199", "0.6549003", "0.65401477", "0.64486176", "0.6444399", "0.6433896", "0.64335483", "0.6433273", "0.635133", "0.6345513", "0.6299908", "0.6269125", "0.62344015", "0.61389065", "0.61210895", "0.611912", ...
0.77942646
0
Ensure that connecting over HTTPS to HTTP port is handled.
def test_https_over_http_error(http_server, ip_addr): httpserver = http_server.send((ip_addr, EPHEMERAL_PORT)) interface, _host, port = _get_conn_data(httpserver.bind_addr) with pytest.raises(ssl.SSLError) as ssl_err: http.client.HTTPSConnection( '{interface}:{port}'.format( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def require_ssl(self) -> bool:\n return pulumi.get(self, \"require_ssl\")", "def test_http_over_https_error(\n http_request_timeout,\n tls_http_server, adapter_type,\n ca, ip_addr,\n tls_certificate,\n tls_certificate_chain_pem_path,\n tls_certificate_private_key_pem_path,\n):\n # dis...
[ "0.6614945", "0.66055554", "0.6604858", "0.65914345", "0.6571247", "0.6559934", "0.65185666", "0.6508329", "0.6505015", "0.64640206", "0.6414904", "0.6401335", "0.639926", "0.63944304", "0.6385157", "0.6371877", "0.6370279", "0.6341131", "0.6311642", "0.62804675", "0.6276595"...
0.62939143
19
Ensure that connecting over HTTP to HTTPS port is handled.
def test_http_over_https_error( http_request_timeout, tls_http_server, adapter_type, ca, ip_addr, tls_certificate, tls_certificate_chain_pem_path, tls_certificate_private_key_pem_path, ): # disable some flaky tests # https://github.com/cherrypy/cheroot/issues/225 issue_225 = ( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use_https(url, timeout=60):\n \n try:\n response = requests.get(url, timeout=timeout, verify=True)\n if 'https://' in response.url: return True\n\n return False\n except:\n # Defaulting to 'False', probably the web server don't know what to do\n print('Warning: The H...
[ "0.6710321", "0.66494393", "0.6643778", "0.66217566", "0.6581355", "0.65778327", "0.6564057", "0.6526524", "0.6462561", "0.64555955", "0.6455363", "0.6426444", "0.6423672", "0.6423008", "0.6417971", "0.6401551", "0.6397704", "0.6355188", "0.634817", "0.63455546", "0.6333298",...
0.66934764
1
'super' is called cause this class is part of the SpotifyClient mixin and all the constructors of mixin base classes should be called
def __init__(self, **config): super().__init__(**config) for required in [ "CLIENT_ID", "CLIENT_SECRET", "USER_ID"]: if not required in config: raise RuntimeError( "Required key is missing from the config: {}".format( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, client):\n super().__init__(client)", "def __init__(self, **kwargs):\n # Call superclass\n super().__init__(**kwargs)", "def __init__(self, *args, **kwargs):\n self._initialize_protocols()\n super().__init__(*args, **kwargs)", "def __init__(self, **kwargs...
[ "0.76301706", "0.7138623", "0.7082449", "0.7049371", "0.69989604", "0.69989604", "0.69989604", "0.69989604", "0.69989604", "0.6977749", "0.69485176", "0.69485176", "0.69299436", "0.69299436", "0.69299436", "0.6924915", "0.6923379", "0.6895334", "0.6895072", "0.6895072", "0.68...
0.0
-1
Returns the URL used to authorize Spotify to access the playlist
def start_login(self, controller=None, scope=('user-modify-playback-state', 'playlist-modify-private', 'user-read-playback-state')): authentication_params = {} authentication_params['grant_type'] = 'authorization_code' au...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getauthenticationurl():\n\n # read application keys from env variables\n appid, appsecret, redirecturi = readappkeys()\n\n # generate random state string for request (for security)\n state = ''.join(random.choice(string.ascii_lowercase + string.digits \n + string.ascii_uppercase) for...
[ "0.7664534", "0.7005464", "0.69552195", "0.64460176", "0.6185538", "0.6177314", "0.61346537", "0.6055279", "0.5944853", "0.59444726", "0.593703", "0.5909125", "0.5888972", "0.5854268", "0.58344334", "0.5831299", "0.5813125", "0.58006614", "0.5737664", "0.57366407", "0.5734806...
0.0
-1
Gets the parameters back from Spotify after a successful login
def complete_login(self, **kwargs): if "code" not in kwargs: raise RuntimeError( "Refresh token is missing. I cannot connect to Spotify") # Store the code to perform token refreshing in the future and # ask an access token for the first time self._refresh_to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getauthenticationurl():\n\n # read application keys from env variables\n appid, appsecret, redirecturi = readappkeys()\n\n # generate random state string for request (for security)\n state = ''.join(random.choice(string.ascii_lowercase + string.digits \n + string.ascii_uppercase) for...
[ "0.6241658", "0.6234331", "0.62220687", "0.61849093", "0.61352277", "0.60973555", "0.60933167", "0.60242903", "0.5982811", "0.5948543", "0.59349114", "0.5931842", "0.5837423", "0.5837423", "0.58237237", "0.57739174", "0.5740481", "0.5693118", "0.5686621", "0.5674879", "0.5665...
0.0
-1
Get a new access token
def refresh_token(self, first_time=False): with REFRESH_CONDITION: request_data = {} if first_time: request_data['grant_type'] = 'authorization_code' request_data['code'] = self._refresh_token request_data['redirect_uri'] = CALLBACK_ENDPOI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_access_token(self):\n\n token_work = time.time() < self.expires\n\n if token_work:\n # No need update token\n return self.access_token\n\n data = {\n 'client_id': self.client_id,\n 'grant_type': 'implicit'\n }\n\n response = req...
[ "0.7904706", "0.77317834", "0.7720392", "0.7677382", "0.7676716", "0.7627653", "0.76195437", "0.76005834", "0.7535613", "0.7358604", "0.7354608", "0.7345471", "0.7321995", "0.72929406", "0.726715", "0.72556674", "0.7252414", "0.7184126", "0.71475697", "0.71299934", "0.7109634...
0.0
-1
Sleep int(_expires_in 15) seconds and try to refresh the token on thread wake up
def _refresh_worker(self): while True: REFRESH_CONDITION.acquire() was_notified = REFRESH_CONDITION.wait(float(self._expires_in - 15)) if was_notified or not self._refresh_thread_running: # Time to leave # logger.info('Spotify token-refresh th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh_token(self):\n now = timezone.now()\n limit = now - timedelta(days=20)\n # TODO: use expires_in from response data?\n print(self.token_refresh_date)\n print(limit)\n if self.token_refresh_date < limit:\n url = '{}refresh_access_token'.format(conf.INS...
[ "0.69340503", "0.6666325", "0.6595538", "0.6558248", "0.64956605", "0.63839006", "0.63831645", "0.63681054", "0.6343139", "0.632429", "0.62926483", "0.6261342", "0.6221045", "0.6215796", "0.62150896", "0.61794406", "0.61485153", "0.6130231", "0.60743874", "0.6059254", "0.6041...
0.71048456
0
List all code snippets, or create a new snippet.
def get(self, request): posts = post.objects.filter(unlisted=False,visibility="PUBLIC") page = self.request.GET.get('page', 1) page_num = self.request.GET.get('size', 1000) paginator = custom() results = paginator.paginate_queryset(posts,request) seriali...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def snippet_list(request):\n if request.method == 'GET':\n snippets = Snippet.objects.all()\n serializer = SnippetSerializer(snippets, many=True)\n return Response(serializer.data)\n\n elif request.method == 'POST':\n serializer = SnippetSerializer(data=request.data)\n if s...
[ "0.6875088", "0.6875088", "0.67247355", "0.63738513", "0.6289875", "0.58442754", "0.5827876", "0.5823223", "0.5671299", "0.561267", "0.55535626", "0.54807174", "0.54807174", "0.5408165", "0.53261644", "0.5297931", "0.5284797", "0.5218211", "0.51798266", "0.5141808", "0.512396...
0.0
-1
Test creating a user with valid payload is successful
def test_create_valid_user_success(self): payload = { 'email': 'test@maksim.net', 'password': 'testpass1234', 'name': 'Tester' } res = self.client.post(CREATE_USER_URL, payload) self.assertEqual(res.status_code, status.HTTP_201_CREATED) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_createuser():\n url = baseUrl + userurl\n payload = user_payload\n logging.info(\"Create a user: %s\" % payload)\n r = requests.post(url, data=json.dumps(payload), headers=header)\n assert r.status_code == 201\n resp = r.text\n assert resp == 'Success'", "def test_create_user_exists...
[ "0.8677998", "0.86215556", "0.8612816", "0.85703385", "0.8554486", "0.8543167", "0.8540295", "0.8534767", "0.85117793", "0.8481868", "0.84368175", "0.84231776", "0.84189546", "0.83947426", "0.83425725", "0.83350927", "0.829134", "0.8291029", "0.82614017", "0.8176014", "0.8163...
0.84719783
10
Test if user alrady exists
def test_user_exists(self): payload = { 'email': 'test@net.net', 'password': 'testpass', 'name': 'Maks' } create_user(**payload) res = self.client.post(CREATE_USER_URL, payload) self.assertEqual(res.status_code, status.HTTP_400_BAD_RE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_existence(self):\n self.assertTrue(User.objects.filter(username='rcm').exists())", "def _checkUserExists(username,self):\r\n \r\n exists = False\r\n \r\n if _findUser(username) is not None:\r\n exists = True\r\n \r\n return exists", "def is_existing_user(email):\n ...
[ "0.7377935", "0.73207504", "0.72591484", "0.72267944", "0.7196486", "0.7180633", "0.7178468", "0.71751124", "0.7123562", "0.71040285", "0.7077532", "0.7068242", "0.70588106", "0.7022351", "0.6978213", "0.69628733", "0.69585633", "0.6941906", "0.69233483", "0.69218326", "0.691...
0.63283235
95
test that password is > 5 characters
def test_password_too_short(self): payload = { 'email': 'test@max.net', 'password': 'pw', 'name': 'Maks' } res = self.client.post(CREATE_USER_URL, payload) self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST) user_exists =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_length(string):\n if 6 < len(string) < 12:\n return True\n\n print(\"Your password is not between 6 and 12 characters\")\n return False", "def test_long_password():\n expect_error(register, InputError,\n \"abcdef\", \"a\" * (MIN_PASSWORD - 1), \"a\", \"A\", \"a\")", ...
[ "0.7938407", "0.76082075", "0.75802946", "0.74498004", "0.7405349", "0.7378838", "0.7364058", "0.72912395", "0.7279095", "0.72163117", "0.7152712", "0.71506137", "0.715002", "0.71177787", "0.7090262", "0.7085485", "0.7082143", "0.7056657", "0.7034339", "0.7015536", "0.7003966...
0.62037945
97
Test that a token is created for the user
def test_create_token_for_user(self): payload = { 'email': 'test@max.net', 'password': 'Testpass123', 'name': 'Maks' } create_user(**payload) res = self.client.post(TOKEN_URL, payload) self.assertIn('token', res.data) self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_token_valid(self):\n create_mock_user(**self.mock_user)\n res = self.client.post(TOKEN_URL, self.mock_user)\n\n self.assertEqual(res.status_code, status.HTTP_200_OK)\n self.assertIn('token', res.data)", "def test_create_token_for_user(self):\n payload = {'email'...
[ "0.8524954", "0.8461728", "0.8460548", "0.8412818", "0.8412537", "0.8401617", "0.825214", "0.8243027", "0.82033753", "0.8139369", "0.7937181", "0.79370046", "0.79301524", "0.78969824", "0.7844167", "0.78259856", "0.7804769", "0.7752505", "0.77294105", "0.7720604", "0.7707844"...
0.84151304
3
Token is not created if invalid credentials are given
def test_create_token_invalid_credentials(self): create_user(email='test@max.net', password='testpass') payload = { 'email': 'test@max.net', 'password': 'Wrongpass', 'name': 'Maks' } res = self.client.post(TOKEN_URL, payload) self.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_token_invalid_credentials(self):\n create_user(email='test@test.com', password='testpass')\n payload = {'email': 'test@test.com', 'password': 'wrong'}\n\n res = self.client.post(TOKEN_URL, payload)\n\n self.assertNotIn('token', res.data)\n self.assertEqual(res.status_c...
[ "0.7632745", "0.7474523", "0.74665654", "0.74624467", "0.7388547", "0.73693335", "0.73460495", "0.7296583", "0.7261183", "0.72582823", "0.7188742", "0.7100818", "0.70256793", "0.70245194", "0.7008473", "0.6943011", "0.6933354", "0.6931034", "0.6928811", "0.6920352", "0.689603...
0.7450179
4
Test that token is not created if user doesn't exists
def test_create_token_no_user(self): payload = { 'email': 'test@max.net', 'password': 'testpass', 'name': 'Maks' } res = self.client.post(TOKEN_URL, payload) self.assertNotIn('token', res.data) self.assertEqual(res.status_code, status...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_token_no_user(self):\n res = self.client.post(TOKEN_URL, self.mock_user)\n\n self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)\n self.assertNotIn('token', res.data)", "def test_create_token_no_user(self):\n payload = {\n 'email': 'test@gmail.com...
[ "0.804403", "0.79388356", "0.78894347", "0.7885779", "0.7755042", "0.7703482", "0.76045763", "0.75595903", "0.7531418", "0.7526247", "0.749789", "0.7478718", "0.7438763", "0.7421789", "0.7401069", "0.7393741", "0.7387908", "0.73829055", "0.7354504", "0.73526466", "0.7351663",...
0.7817135
4
Test that email and password are required
def test_create_token_missing_field(self): res = self.client.post(TOKEN_URL, {'email': 'one', 'password': ''}) self.assertNotIn('token', res.data) self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_validate_credentials(self):\n pass", "def test_user1_method2():\n assert u.email == USER_CREDENTIALS[\"email\"], \"Email was not assigned correctly\"\n assert u.password is not None, \"Password was not assigned correctly\"", "def test_empty_email_field(self):\r\n result=self.us...
[ "0.7667619", "0.7537894", "0.7486675", "0.74528986", "0.74425703", "0.74402696", "0.74267894", "0.74228615", "0.7419903", "0.7400364", "0.7398148", "0.73889226", "0.7376929", "0.73726565", "0.7367708", "0.73451835", "0.7318413", "0.7303919", "0.7301908", "0.7273048", "0.72705...
0.0
-1
Test if authentication is required for endpoint
def test_retrieve_user_unauthorized(self): res = self.client.get(ME_URL) self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AuthenticationRequired(self, req):\n return self._reqauth or bool(self._GetRequestContext(req).handler_access)", "def requires_auth(self):\n return True", "def test_authentication_required(self):\n self.auth.validate_token_request(self.request)\n self.mock_validator.client_authentic...
[ "0.73845714", "0.72459024", "0.71155125", "0.7104278", "0.7074309", "0.69732046", "0.6961559", "0.6961559", "0.6958326", "0.6925321", "0.691463", "0.68520665", "0.68306756", "0.6830215", "0.68296325", "0.68278533", "0.680668", "0.6777026", "0.6766343", "0.6756573", "0.6730236...
0.0
-1
Test retrieving profile for logged in user
def test_retrieve_profile_success(self): res = self.client.get(ME_URL) self.assertEqual(res.status_code, status.HTTP_200_OK) self.assertEqual(res.data, { 'name': self.user.name, 'email': self.user.email, })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_retrieve_profile(self):\n\n response = self.client.get(URL_ME)\n\n self.assertEqual(response.status_code, status.HTTP_200_OK)\n\n # Check that the user object returns as expected. There is no need\n # (and it is not secure) to return a password to client side.\n self.ass...
[ "0.8208589", "0.807811", "0.8027141", "0.80075693", "0.7999291", "0.7981915", "0.79818964", "0.7970111", "0.795909", "0.7951995", "0.79075676", "0.79026365", "0.78413916", "0.7817132", "0.7801892", "0.77627635", "0.77301943", "0.77071506", "0.76768214", "0.7648913", "0.758592...
0.8024252
3
Test that post is not allowed on ME URL
def test_post_me_not_allowed(self): res = self.client.post(ME_URL, {}) self.assertEqual(res.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post_me_not_allowed(self):\n\n res = self.client.post(URL_ME)\n self.assertEqual(res.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)", "def test_post_not_allowed(self):\n res = self.client.post(ME_URL, {})\n\n self.assertEquals(res.status_code, status.HTTP_405_METHOD_NOT_ALL...
[ "0.8461097", "0.84138185", "0.83183134", "0.83183134", "0.82397634", "0.7598235", "0.737263", "0.73357296", "0.7310725", "0.71874416", "0.7147814", "0.7056462", "0.696132", "0.6954524", "0.6949271", "0.69422376", "0.6938751", "0.6937013", "0.68605566", "0.68541366", "0.683602...
0.8356106
2
Test updating the user profile for authenticated user
def test_update_user_profile(self): payload = { 'name': 'new_name', 'password': 'password123' } res = self.client.patch(ME_URL, payload) self.user.refresh_from_db() self.assertEqual(self.user.name, payload['name']) self.assertTrue(sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_can_update_user_profile(self):\n self.update_user()\n self.assertEqual(self.user.first_name, self.updated_data['first_name'])\n self.assertEqual(self.user.last_name, self.updated_data['last_name'])\n self.assertEqual(self.user.email, self.updated_data['email'])", "def test_up...
[ "0.8541788", "0.8345881", "0.83412725", "0.8336656", "0.8336178", "0.83121", "0.82863855", "0.82676023", "0.81461143", "0.8111659", "0.8109977", "0.80113643", "0.8009354", "0.7964934", "0.7915162", "0.7874697", "0.7871452", "0.7786894", "0.7776982", "0.77649665", "0.7760117",...
0.83560354
1
Initializes the Shi MCC to be used for our program. For more information about the commands used refer to "Marathon Cryopump Controller Programmer's Reference Guide" in the Documentation.
def initialize_shi_mcc(mcc): pi = ProfileInstance.getInstance() hw = HardwareStatusInstance.getInstance() try: # I don't know what this is talking about # TODO: Log better events Logging.logEvent("Debug", "Status Update", {"message": "Power on the Shi Mcc",...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n super(StarCCM_wrapper, self).__init__()\n self.command = ['qsub', 'runStarCCM.pbs']\n self.starccmLic = os.environ['STAR_POWER_ON_DEMAND_LIC']\n self.CDLMD_LicFile = os.environ['LM_LICENSE_FILE']", "def initialise(self):\n # Can take quite a lot of time du...
[ "0.6237261", "0.58044004", "0.5760452", "0.5703008", "0.56428814", "0.5637261", "0.5615268", "0.5581539", "0.5542994", "0.55005854", "0.5494935", "0.54786813", "0.54465544", "0.54165804", "0.5411882", "0.54005915", "0.53868127", "0.5372716", "0.53573555", "0.53217703", "0.529...
0.69191116
0
Return iterable with strip_value items removed from beginning.
def v0_lstrip(iterable, strip_value): stripped = [] is_beginning = True for item in iterable: if is_beginning: if item != strip_value: is_beginning = False else: continue stripped.append(item) return stripped
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def v4_lstrip(iterable, strip_value):\n stripped = []\n def is_strip_value(value): return value == strip_value\n for item in dropwhile(is_strip_value, iterable):\n stripped.append(item)\n return stripped", "def v1_lstrip(iterable, strip_value):\n stripped = []\n is_beginning = True\n ...
[ "0.77129996", "0.7655893", "0.75878036", "0.7578346", "0.73598844", "0.73241323", "0.7268078", "0.7177186", "0.71711046", "0.6862552", "0.68594253", "0.66307306", "0.6221924", "0.61717254", "0.6156851", "0.60763013", "0.6043025", "0.59987134", "0.59019655", "0.5735523", "0.57...
0.77285135
0
Return iterable with strip_value items removed from beginning.
def v1_lstrip(iterable, strip_value): stripped = [] is_beginning = True for item in iterable: if is_beginning and item == strip_value: continue is_beginning = False stripped.append(item) return stripped
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def v0_lstrip(iterable, strip_value):\n stripped = []\n is_beginning = True\n for item in iterable:\n if is_beginning:\n if item != strip_value:\n is_beginning = False\n else:\n continue\n stripped.append(item)\n return stripped", "def...
[ "0.77279246", "0.77117336", "0.7585977", "0.7576826", "0.7358597", "0.73228806", "0.72670853", "0.717575", "0.71704465", "0.6864692", "0.6858694", "0.6629628", "0.62193835", "0.61715555", "0.6153395", "0.60745984", "0.6041615", "0.5996829", "0.59021205", "0.57330346", "0.5705...
0.7655379
2
Return iterable with strip_value items removed from beginning.
def v2_lstrip(iterable, strip_value): stripped = [] iterator = iter(iterable) try: item = next(iterator) while item == strip_value: item = next(iterator) stripped.append(item) except StopIteration: pass else: for item in iterator: strip...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def v0_lstrip(iterable, strip_value):\n stripped = []\n is_beginning = True\n for item in iterable:\n if is_beginning:\n if item != strip_value:\n is_beginning = False\n else:\n continue\n stripped.append(item)\n return stripped", "def...
[ "0.77285135", "0.77129996", "0.7655893", "0.7578346", "0.73598844", "0.73241323", "0.7268078", "0.7177186", "0.71711046", "0.6862552", "0.68594253", "0.66307306", "0.6221924", "0.61717254", "0.6156851", "0.60763013", "0.6043025", "0.59987134", "0.59019655", "0.5735523", "0.57...
0.75878036
3
Return iterable with strip_value items removed from beginning.
def v3_lstrip(iterable, strip_value): stripped = [] iterator = iter(iterable) for item in iterator: if not item == strip_value: stripped.append(item) break for item in iterator: stripped.append(item) return stripped
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def v0_lstrip(iterable, strip_value):\n stripped = []\n is_beginning = True\n for item in iterable:\n if is_beginning:\n if item != strip_value:\n is_beginning = False\n else:\n continue\n stripped.append(item)\n return stripped", "def...
[ "0.77285135", "0.77129996", "0.7655893", "0.75878036", "0.73598844", "0.73241323", "0.7268078", "0.7177186", "0.71711046", "0.6862552", "0.68594253", "0.66307306", "0.6221924", "0.61717254", "0.6156851", "0.60763013", "0.6043025", "0.59987134", "0.59019655", "0.5735523", "0.5...
0.7578346
4
Return iterable with strip_value items removed from beginning.
def v4_lstrip(iterable, strip_value): stripped = [] def is_strip_value(value): return value == strip_value for item in dropwhile(is_strip_value, iterable): stripped.append(item) return stripped
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def v0_lstrip(iterable, strip_value):\n stripped = []\n is_beginning = True\n for item in iterable:\n if is_beginning:\n if item != strip_value:\n is_beginning = False\n else:\n continue\n stripped.append(item)\n return stripped", "def...
[ "0.77285135", "0.7655893", "0.75878036", "0.7578346", "0.73598844", "0.73241323", "0.7268078", "0.7177186", "0.71711046", "0.6862552", "0.68594253", "0.66307306", "0.6221924", "0.61717254", "0.6156851", "0.60763013", "0.6043025", "0.59987134", "0.59019655", "0.5735523", "0.57...
0.77129996
1
Return iterable with strip_value items removed from beginning.
def v5_lstrip(iterable, strip_value): def is_strip_value(value): return value == strip_value return dropwhile(is_strip_value, iterable)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def v0_lstrip(iterable, strip_value):\n stripped = []\n is_beginning = True\n for item in iterable:\n if is_beginning:\n if item != strip_value:\n is_beginning = False\n else:\n continue\n stripped.append(item)\n return stripped", "def...
[ "0.77279246", "0.77117336", "0.7655379", "0.7585977", "0.7576826", "0.7358597", "0.73228806", "0.717575", "0.71704465", "0.6864692", "0.6858694", "0.6629628", "0.62193835", "0.61715555", "0.6153395", "0.60745984", "0.6041615", "0.5996829", "0.59021205", "0.57330346", "0.57058...
0.72670853
7
Return iterable with strip_value items removed from beginning.
def v6_lstrip(iterable, strip_value): iterator = iter(iterable) for item in iterator: if item != strip_value: yield item break for item in iterator: yield item
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def v0_lstrip(iterable, strip_value):\n stripped = []\n is_beginning = True\n for item in iterable:\n if is_beginning:\n if item != strip_value:\n is_beginning = False\n else:\n continue\n stripped.append(item)\n return stripped", "def...
[ "0.77285135", "0.77129996", "0.7655893", "0.75878036", "0.7578346", "0.73241323", "0.7268078", "0.7177186", "0.71711046", "0.6862552", "0.68594253", "0.66307306", "0.6221924", "0.61717254", "0.6156851", "0.60763013", "0.6043025", "0.59987134", "0.59019655", "0.5735523", "0.57...
0.73598844
5
Return iterable with strip_value items removed from beginning.
def v6_lstrip(iterable, strip_value): iterator = iter(iterable) for item in iterator: if item != strip_value: yield item break yield from iterator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def v0_lstrip(iterable, strip_value):\n stripped = []\n is_beginning = True\n for item in iterable:\n if is_beginning:\n if item != strip_value:\n is_beginning = False\n else:\n continue\n stripped.append(item)\n return stripped", "def...
[ "0.77285135", "0.77129996", "0.7655893", "0.75878036", "0.7578346", "0.73598844", "0.7268078", "0.7177186", "0.71711046", "0.6862552", "0.68594253", "0.66307306", "0.6221924", "0.61717254", "0.6156851", "0.60763013", "0.6043025", "0.59987134", "0.59019655", "0.5735523", "0.57...
0.73241323
6
Return iterable with strip_value items removed from beginning.
def v7_lstrip(iterable, strip_value): iterator = iter(iterable) for item in iterator: if (callable(strip_value) and not strip_value(item) or not callable(strip_value) and item != strip_value): yield item break yield from iterator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def v0_lstrip(iterable, strip_value):\n stripped = []\n is_beginning = True\n for item in iterable:\n if is_beginning:\n if item != strip_value:\n is_beginning = False\n else:\n continue\n stripped.append(item)\n return stripped", "def...
[ "0.77285135", "0.77129996", "0.7655893", "0.75878036", "0.7578346", "0.73598844", "0.73241323", "0.7268078", "0.71711046", "0.6862552", "0.68594253", "0.66307306", "0.6221924", "0.61717254", "0.6156851", "0.60763013", "0.6043025", "0.59987134", "0.59019655", "0.5735523", "0.5...
0.7177186
8
Return iterable with strip_value items removed from beginning.
def v8_lstrip(iterable, strip_value): iterator = iter(iterable) if callable(strip_value): predicate = strip_value else: def predicate(value): return value == strip_value for item in iterator: if not predicate(item): yield item break yield from iterator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def v0_lstrip(iterable, strip_value):\n stripped = []\n is_beginning = True\n for item in iterable:\n if is_beginning:\n if item != strip_value:\n is_beginning = False\n else:\n continue\n stripped.append(item)\n return stripped", "def...
[ "0.77279246", "0.77117336", "0.7655379", "0.7585977", "0.7576826", "0.7358597", "0.73228806", "0.72670853", "0.717575", "0.6864692", "0.6858694", "0.6629628", "0.62193835", "0.61715555", "0.6153395", "0.60745984", "0.6041615", "0.5996829", "0.59021205", "0.57330346", "0.57058...
0.71704465
9
Return iterable with strip_value items removed from beginning.
def v9_lstrip(iterable, strip_value): if callable(strip_value): predicate = strip_value else: def predicate(value): return value == strip_value return dropwhile(predicate, iterable)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def v0_lstrip(iterable, strip_value):\n stripped = []\n is_beginning = True\n for item in iterable:\n if is_beginning:\n if item != strip_value:\n is_beginning = False\n else:\n continue\n stripped.append(item)\n return stripped", "def...
[ "0.77285135", "0.77129996", "0.7655893", "0.75878036", "0.7578346", "0.73598844", "0.73241323", "0.7268078", "0.7177186", "0.71711046", "0.6862552", "0.66307306", "0.6221924", "0.61717254", "0.6156851", "0.60763013", "0.6043025", "0.59987134", "0.59019655", "0.5735523", "0.57...
0.68594253
11
Helper that splits states list into separate lists per source mds and adds them to report accordingly.
def fill_episodic_report_body(report, states): lookup = _separate_states_by_source_mds(states) for source_mds_handle, states in lookup.items(): report_part = report.add_report_part() report_part.SourceMds = source_mds_handle report_part.values_list.extend(states)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _state_sources(state_code):\n url = f\"{USNPL_URL}/search/state?state={state_code}\"\n state_page = get_page(url)\n\n result_table = state_page.find(\"table\", class_=\"table table-sm\")\n result_rows = result_table.find_all(\"tr\")\n results = list()\n for row in result_rows:\n if not...
[ "0.5698368", "0.5454509", "0.526879", "0.5225116", "0.5076698", "0.50746095", "0.5033952", "0.49979", "0.49269316", "0.49249452", "0.49195585", "0.4919531", "0.49125117", "0.4910174", "0.49056783", "0.49053705", "0.48991954", "0.48968974", "0.48653445", "0.48653445", "0.48445...
0.5466304
1
Extracts the last layer from a docker image from an image tarball
def extract_last_layer(tar_path, layer_path, diffid_path): tar = tarfile.open(tar_path, mode="r") decoder = JSONDecoder() try: # Extracts it as a file object (not to the disk) manifest = tar.extractfile("manifest.json").read().decode("utf-8") except Exception as e: print(( "Unable to extrac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_docker_image(image):\n # add defaults\n if '/' not in image:\n image = 'library/' + image\n if ':' not in image:\n image = image + ':latest'\n\n # parse\n tokens1 = image.split('/')\n namespace = tokens1[0]\n\n tokens2 = tokens1[1].split(':')\n name = tokens2[0]\n ...
[ "0.60316336", "0.5940161", "0.5587789", "0.55839086", "0.54569244", "0.5387674", "0.5323076", "0.5313751", "0.52941746", "0.5292577", "0.525259", "0.5203206", "0.514233", "0.51331997", "0.51178265", "0.5069433", "0.50575453", "0.50401694", "0.5020187", "0.50168437", "0.500633...
0.76204437
0
Should take a numpy array and return a reference to the same array. All operations should be inplace
def __call__(self, x): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reference_to_array(self):\n arr = numpy.arange(0.0, 10.0, 0.1)\n arr = numpy.reshape(arr, (25, 4))\n vtk_arr = array_handler.array2vtk(arr)\n arr1 = array_handler.vtk2array(vtk_arr)\n # Now make sure these are using the same memory.\n arr[0][0] = 100.0\n s...
[ "0.7033308", "0.67810196", "0.65600705", "0.63790286", "0.63512224", "0.63190967", "0.62840974", "0.6056528", "0.5981485", "0.5903696", "0.5849404", "0.58491117", "0.5833835", "0.5827772", "0.57921165", "0.5790692", "0.57435983", "0.57395685", "0.57289165", "0.571282", "0.569...
0.0
-1
y = slope x + bias
def __init__(self, slope=1.0, bias=0.0, **kwargs): super().__init__(**kwargs) self.slope = slope self.bias = bias
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def square_trick(bias, slope, predictor, current_value, learning_rate):\n predicted_value = bias + slope*predictor\n slope += learning_rate*predictor*(current_value-predicted_value)\n bias += learning_rate*(current_value-predicted_value)\n return slope, bias", "def __call__(self, x):\n\n np.mu...
[ "0.71951133", "0.70433915", "0.7006244", "0.69780636", "0.6928714", "0.6775172", "0.664858", "0.6644134", "0.6606537", "0.6554321", "0.65479314", "0.65419704", "0.6535835", "0.65200883", "0.65050614", "0.65032125", "0.6477004", "0.647279", "0.6458895", "0.6443563", "0.6436256...
0.60427344
47
Applies inplace linear activation
def __call__(self, x): np.multiply(x, self.slope, out=x) np.add(x, self.bias, out=x) return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linear_activation_forward(A_prev, W, b, activation):\n pass", "def linear_activation_forward(A_prev, W, b, activation):\n Z, linear_cache = linear_forward(A_prev, W, b)\n if activation == 'sigmoid':\n activation_fun = sigmoid\n else:\n activation_fun = relu\n A, cache = activatio...
[ "0.78238016", "0.7253499", "0.7113381", "0.71122736", "0.70810336", "0.7012244", "0.69595957", "0.6942727", "0.69128925", "0.68755966", "0.6852831", "0.6824166", "0.6789728", "0.67681146", "0.67663103", "0.6718598", "0.66713166", "0.6643897", "0.65571713", "0.6546967", "0.654...
0.0
-1
Applies inverted sigmoid inplace
def __call__(self, x): np.subtract(x, self.d, out=x) np.divide(self.a, x, out=x) np.subtract(x, self.b, out=x) np.log(x, out=x) np.divide(x, -self.e, out=x) np.add(x, self.c, out=x) return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inverse_sigmoid(x):\n y = -1 * np.log((1-x)/x)\n return y", "def sigmoid(z):\r\n \r\n return vSigmoid(z);", "def swish(x):\n return x * k.activations.sigmoid(x)", "def swish(x):\n return x * tf.sigmoid(x)", "def activation_sigmoid(self):\n self.value = 1 / (1 + np.e ** (-self....
[ "0.75106734", "0.75092953", "0.73808044", "0.73472565", "0.73404986", "0.7290867", "0.7290837", "0.7245116", "0.72361183", "0.7213144", "0.7213144", "0.7199016", "0.7183686", "0.7171895", "0.7162724", "0.71618813", "0.7150425", "0.7141738", "0.7136035", "0.7135243", "0.712966...
0.0
-1
If below threshold, clamps to 0. If above, clamps to newval
def __init__(self, shape, threshold=0.0, newval=1.0): self.bool_array = np.full(shape, True, dtype=bool) self.threshold = threshold self.newval = newval
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def threshold(self,thresholdValue):\n # TO DO\n pass", "def threshold(self, value):\r\n threshold = 0.5\r\n if value >= threshold:\r\n return 1\r\n else:\r\n return 0", "def __init__(self, threshold: float = 0.3, initial_val: float = 0.0) -> None:\n self.threshold = ...
[ "0.67773557", "0.67196333", "0.64979124", "0.6460965", "0.644781", "0.644781", "0.63301975", "0.6301552", "0.6152789", "0.61035085", "0.609007", "0.60886663", "0.60886663", "0.60886663", "0.60886663", "0.60886663", "0.6052183", "0.60106796", "0.5966216", "0.5962973", "0.59455...
0.0
-1