query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
return the statistical information query across feedback and prediction model | def get(self):
from models.prediction import Prediction
from models.feedback import Feedback
prediction_collection = Prediction._get_collection()
feedback_collection = Feedback._get_collection()
statistical_data = copy.deepcopy(CONSTANTS['STATISTICAL_DATA'])
# initial s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_statistics(self):",
"def prediction():\n # retweets_only = request.args.get('retweets_only')\n # api.set_retweet_checking(strtobool(retweets_only.lower()))\n # with_sentiment = request.args.get('with_sentiment')\n # api.set_with_sentiment(strtobool(with_sentiment.lower()))\n # query = ... | [
"0.63750684",
"0.6304389",
"0.624345",
"0.62196577",
"0.6172109",
"0.6098883",
"0.6085545",
"0.6072154",
"0.6068451",
"0.60035133",
"0.59794176",
"0.5978775",
"0.5976125",
"0.5952715",
"0.5937861",
"0.591812",
"0.59040034",
"0.5885989",
"0.5883272",
"0.58799636",
"0.5878831",... | 0.64818 | 0 |
Trains the classifier with the given filenames | def train(self, trainFilenames):
startIndex = len(self.documents)
endIndex = startIndex + len(trainFilenames)
self.documents += trainFilenames
X = [[i] for i in range(startIndex, endIndex)]
Y = [isAroused(f) for f in trainFilenames]
self.knn.fit(np.array(X), np.array(Y)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train(self, trainfile):",
"def train_for(labels, filenames):\n stt = stt_google\n csvfiles = []\n writers = []\n for index, filename in enumerate(filenames):\n currfile = open(filename, 'ab')\n csvfiles.append(currfile)\n writers.append(csv.writer(currfile))\n # record ins... | [
"0.71127045",
"0.6847688",
"0.67817926",
"0.67200977",
"0.6696759",
"0.6646218",
"0.6621507",
"0.6604409",
"0.65844727",
"0.6558893",
"0.64029044",
"0.63676393",
"0.6323149",
"0.62984276",
"0.62698185",
"0.62642264",
"0.6254352",
"0.6238679",
"0.6231274",
"0.6210927",
"0.6206... | 0.69635355 | 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 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 |
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 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 |
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 |
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 |
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 |
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 |
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 |
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 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 |
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 |
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 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 |
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 |
Calculate the networks response given an input_array view Writes inplace onto the output_buffer, which should be the output attribute. | def response(self, input_array, output_buffer):
self.full_state[:self._num_neurons] = self.state
self.full_state[self._num_neurons:] = input_array
# Ox(N+K) * (N+k)x1 = Ox1
np.dot(self.output_weight_matrix_t, self.full_state, out=output_buffer)
self.output_function(output_buffer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output(self):\n # print \"Neuron output\"\n\n if self.output_cache is not None:\n # print self, \"returning from cache\"\n return self.output_cache\n\n self.inputs_cache = []\n\n sum = 0\n for input_edge in self.inputs:\n input = input_edge.fr... | [
"0.55928963",
"0.5376753",
"0.53665227",
"0.5296144",
"0.527639",
"0.5235963",
"0.52188903",
"0.5217325",
"0.5138259",
"0.51363903",
"0.51081425",
"0.50779176",
"0.5035379",
"0.50321174",
"0.50214463",
"0.5021284",
"0.50130475",
"0.5010053",
"0.4997446",
"0.4995831",
"0.49893... | 0.760667 | 0 |
Takes the weights determined by the regression and assigned them to the output weight matrix. It also stores the transpose for evaluating the network response. | def set_output_weights(self, weight_matrix):
self.output_weight_matrix = weight_matrix
# NOTE: transpose returns a view, which is undesirable since it
# doesn't change underlying memory position of elements, harming
# performance. Using copy() defaults the resulting array to C-order
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_output_weights(self, weight_matrix):\n pass",
"def get_output(weight, data, regression= \"logistic\"):\n dot_product = np.matmul(data,weight)\n if regression == \"logistic\":\n output = get_sigmoid(dot_product)\n elif regression == \"probit\":\n output = norm.cdf(dot_product... | [
"0.62622184",
"0.6099907",
"0.59809464",
"0.59226084",
"0.588757",
"0.58769035",
"0.5807121",
"0.5786652",
"0.56827784",
"0.5597509",
"0.55609065",
"0.5537566",
"0.5535183",
"0.5484286",
"0.54790425",
"0.5468608",
"0.54455024",
"0.5440672",
"0.5432752",
"0.54239595",
"0.54108... | 0.6113737 | 1 |
Get the base directory for the HOOMD source include path. | def _get_hoomd_include_path():
current_module_path = pathlib.Path(hoomd.__file__).parent.resolve()
build_module_path = (pathlib.Path(hoomd.version.build_dir)
/ 'hoomd').resolve()
# use the source directory if this module is in the build directory
if current_module_path == build... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_base_dir(self):\n dir_of_this_file = os.path.dirname(os.path.abspath(__file__))\n return os.path.dirname(dir_of_this_file)",
"def base_path(self):\n return self.setup.base_path",
"def get_basedir():\n pydir = os.path.dirname(os.path.realpath(__file__))\n return os.path.abspat... | [
"0.7442867",
"0.7395388",
"0.7299446",
"0.72828186",
"0.7278307",
"0.72629154",
"0.72075653",
"0.7153355",
"0.7074621",
"0.7011946",
"0.6945648",
"0.68774784",
"0.68459976",
"0.6814923",
"0.67840946",
"0.67808783",
"0.67687577",
"0.67571956",
"0.673957",
"0.6711352",
"0.67090... | 0.75955003 | 0 |
Get the arguments to pass to the compiler. These arguments must include the include patch for HOOMD's include files. | def get_cpu_compiler_arguments():
return ['-I', str(_get_hoomd_include_path()), '-O3'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cmd_args():\n\n\n\t#Creates the Argument Parser\n\tparser = ArgumentParser(description = \"ID Lab qPCR Analysis v\" + VERSION + \" \" + QUALITY)\n\n\t#Adds the input file argument\n\tparser.add_argument('-f', '--file',\n\t\t\t\tnargs = '+',\n\t\t\t\ttype = FileType('r'),\n\t\t\t\trequired = True)\n\n\t#Add... | [
"0.62126195",
"0.6209011",
"0.6146279",
"0.60574615",
"0.6017521",
"0.6017049",
"0.5986454",
"0.5982572",
"0.59781384",
"0.59694815",
"0.59504384",
"0.5947426",
"0.5947385",
"0.5942806",
"0.5933377",
"0.5913432",
"0.5913432",
"0.5913432",
"0.5911532",
"0.5909301",
"0.59056324... | 0.7048054 | 0 |
Converts a collection of bitstrings into a probability distribution. | def bits_to_probabilities(
all_qubits: Sequence[Tuple[int, int]],
subsys_qubits: Sequence[Tuple[int, int]],
bits: np.ndarray,
) -> np.ndarray:
num_qubits = len(subsys_qubits)
indices = [all_qubits.index(q) for q in subsys_qubits]
bits_red = np.asarray(bits[:, indices], dtype=int)
for i in ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _subset_probability(self, strings, distribution):\n return sum([distribution.get(value, 0) for value in strings])",
"def get_probability(some_dict, some_string):\n lowercase_review = some_string.lower()\n split_review = lowercase_review.split()\n product = 1 \n for word in split_review:\n ... | [
"0.6407181",
"0.60309595",
"0.60273093",
"0.5953324",
"0.59460145",
"0.59174967",
"0.58379996",
"0.57809484",
"0.5766862",
"0.574746",
"0.56745225",
"0.56645024",
"0.56295586",
"0.56137174",
"0.5611615",
"0.56004035",
"0.55773675",
"0.5561261",
"0.54970413",
"0.5494817",
"0.5... | 0.62023234 | 1 |
Generates a composite CZ gate with sqrtiSWAP and singlequbit gates. | def cz_to_sqrt_iswap(
qubit_0: cirq.GridQubit,
qubit_1: cirq.GridQubit,
) -> cirq.Circuit:
op_list = [
cirq.Z(qubit_0) ** 0.5,
cirq.Z(qubit_1) ** 0.5,
cirq.X(qubit_0) ** 0.5,
cirq.X(qubit_1) ** -0.5,
cirq.ISWAP(qubit_0, qubit_1) ** -0.5,
cirq.X(qubit_0) ** -1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gate2zx(box):\n if isinstance(box, (Bra, Ket)):\n dom, cod = (1, 0) if isinstance(box, Bra) else (0, 1)\n return Id(0).tensor(*[\n X(dom, cod, phase=.5 * bit) for bit in box.bitstring])\n if isinstance(box, (Rz, Rx)):\n return (Z if isinstance(box, Rz) else X)(1, 1, box.ph... | [
"0.6479775",
"0.606908",
"0.6067696",
"0.600097",
"0.6000181",
"0.59230465",
"0.58839595",
"0.58092767",
"0.5749159",
"0.5699589",
"0.56759256",
"0.5625869",
"0.56059206",
"0.5575785",
"0.55034477",
"0.5484602",
"0.54683816",
"0.54502505",
"0.54478735",
"0.5435558",
"0.542716... | 0.60810953 | 1 |
Constructor for the SubjectAttribute class. This initializes the fields specific to the class, and inherits from the Base class. | def __init__(self, *args, **kwargs):
self.logger = logging.getLogger(self.__module__ + '.' + self.__class__.__name__)
self.logger.addHandler(logging.NullHandler())
# These are common to all objects
self._id = None
self._version = None
self._links = {}
self._tags... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, subject: any) -> None:\n self.subject = subject",
"def __init__(self, subject, subject_public_key):\n\n self.subject = subject\n self.subject_public_key = subject_public_key\n self.ca = False\n\n self._hash_algo = 'sha256'\n self._other_extensions = {}... | [
"0.68805003",
"0.6658577",
"0.6645255",
"0.6537347",
"0.6537347",
"0.62047374",
"0.6186341",
"0.60285175",
"0.6025166",
"0.59983367",
"0.5989758",
"0.59819853",
"0.5921729",
"0.5894229",
"0.58762026",
"0.5858054",
"0.58576274",
"0.58576274",
"0.5812425",
"0.5812425",
"0.58124... | 0.7949523 | 0 |
The setter for the subject attribute's alcohol consumption data. | def alcohol(self, alcohol):
self.logger.debug("In 'alcohol' setter.")
self._alcohol = alcohol | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject(self, value):\n self.set_property(\"subject\", value)",
"def setamplitude(self, value):\n self.instrument.write('AMPL {0}'.format(value))",
"def setSubject(self,value): \n self.PDFreactorConfiguration.in1[\"subject\"] = value",
"def subject_a(self, subject_a):\n\n self... | [
"0.53642905",
"0.52938616",
"0.5175113",
"0.5063071",
"0.50269246",
"0.50269246",
"0.50269246",
"0.5021125",
"0.4956185",
"0.49286798",
"0.49017158",
"0.4900791",
"0.48965985",
"0.48779207",
"0.4875368",
"0.4875368",
"0.48706746",
"0.48359177",
"0.4833197",
"0.48326105",
"0.4... | 0.67048883 | 0 |
The setter for the coronary artery disease data. | def cad(self, cad):
self.logger.debug("In 'cad' setter.")
self._cad = cad | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cidade(self, cidade):\n self._cidade = cidade",
"def ecology_of_disease(self, ecology_of_disease):\n\n self._ecology_of_disease = ecology_of_disease",
"def AddCorrelation(self, ds):\n self.IsCorrelation = True\n self.Correlation = ds",
"def treatDisease(self, disease = None):\... | [
"0.54452705",
"0.53908396",
"0.5332612",
"0.52496827",
"0.52358633",
"0.51721865",
"0.51308006",
"0.50270617",
"0.5023041",
"0.5005956",
"0.49866706",
"0.49836308",
"0.49604467",
"0.49583635",
"0.49549976",
"0.4948579",
"0.49432927",
"0.49384874",
"0.49271527",
"0.49110594",
... | 0.55410296 | 0 |
The setter for the comment field. The comment must be a string. | def comment(self, comment):
self.logger.debug("In 'comment' setter.")
self._comment = comment | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_comment(self, comment):\n self.comment_text = str(comment)",
"def set_comment(self, comment):\n\t\tself.comment_ = comment",
"def comment(self, comment):\n self.logger.debug(\"In 'comment' setter.\")\n\n if len(comment) > 512:\n raise Exception(\"Comment is too long, mus... | [
"0.86464536",
"0.858516",
"0.84981894",
"0.8361004",
"0.8356122",
"0.8356122",
"0.8137892",
"0.81237066",
"0.81237066",
"0.81237066",
"0.81237066",
"0.81237066",
"0.81237066",
"0.81237066",
"0.81237066",
"0.81237066",
"0.81237066",
"0.80302024",
"0.7223892",
"0.70307696",
"0.... | 0.8592925 | 1 |
The setter for the contact field indicating whether the subject wishes to be contacted in the future or not. | def contact(self, contact):
self.logger.debug("In 'contact' setter.")
self._contact = contact | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contact(self, contact):\n\n self._contact = contact",
"def contact(self, contact):\n\n self._contact = contact",
"def set_raw_contact(self, value: Atoms):\n self._raw_contact = value",
"def sequencing_contact(self, sequencing_contact):\n self.logger.debug(\"In 'sequencing_cont... | [
"0.6295653",
"0.6295653",
"0.60215765",
"0.6010511",
"0.57705194",
"0.5734996",
"0.56862885",
"0.5654685",
"0.55741537",
"0.55741537",
"0.5554601",
"0.5554601",
"0.5468744",
"0.5468744",
"0.5419921",
"0.5416634",
"0.5405509",
"0.53448963",
"0.53448963",
"0.53360754",
"0.53111... | 0.68161464 | 0 |
The setter for the subject's education. | def education(self, education):
self.logger.debug("In 'education' setter.")
self._education = education | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject(self, value):\n self.set_property(\"subject\", value)",
"def study(self, study):\n self.logger.debug(\"In 'study' setter.\")\n\n self._study = study",
"def set_subject(self, subject):\n self._subject = subject",
"def change_subject(self, new_subject):\n raise No... | [
"0.5795873",
"0.55750304",
"0.5570268",
"0.5530429",
"0.5493474",
"0.5493474",
"0.5493474",
"0.54005027",
"0.5381545",
"0.5318309",
"0.5318309",
"0.5307106",
"0.52891785",
"0.5287006",
"0.52413213",
"0.523876",
"0.52178764",
"0.51306283",
"0.51233983",
"0.5068059",
"0.5049448... | 0.84062594 | 0 |
The setter for the subject attribute's family history. | def family_history(self, family_history):
self.logger.debug("In 'family_history' setter.")
self._family_history = family_history | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def history(self, history):\n self._history = history",
"def history(self, history):\n\n self._history = history",
"def family(self):",
"def father(self, father):\n\n self.logger.debug(\"In 'father' setter.\")\n\n self._father = father",
"def setModelHistory(self, *args):\n ... | [
"0.59344965",
"0.5847449",
"0.55912066",
"0.5489957",
"0.5443313",
"0.5224106",
"0.5147542",
"0.5112606",
"0.50875604",
"0.5077268",
"0.50474036",
"0.5041362",
"0.5035428",
"0.50337815",
"0.50030565",
"0.49780738",
"0.49273506",
"0.4916864",
"0.48970786",
"0.4852568",
"0.4844... | 0.7772218 | 0 |
The setter for the subject's father. | def father(self, father):
self.logger.debug("In 'father' setter.")
self._father = father | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setParent(self, father):\n\n # This should be ideally called only once\n # by the father when creating the child :-)\n # though it is possible to change parenthood\n # when a new child is adopted in the place\n # of an existing one - in that case the existing\n # child... | [
"0.7558183",
"0.6385268",
"0.63541925",
"0.62541175",
"0.5972186",
"0.5898839",
"0.57044",
"0.56877744",
"0.5662545",
"0.56145734",
"0.56136143",
"0.55698144",
"0.55341566",
"0.55177635",
"0.5500039",
"0.5491826",
"0.5457412",
"0.54562056",
"0.5422276",
"0.5422276",
"0.53844"... | 0.83543134 | 0 |
The setter for the gallbladder disease data. | def gallbladder(self, gallbladder):
self.logger.debug("In 'gallbladder' setter.")
self._gallbladder = gallbladder | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_data(self, d):\n self._data = d\n self.is_data_set = True",
"def setData(self,newData):\r\n pass",
"def dnb(self, dnb):\n\n self._dnb = dnb",
"def set_dcmgnd(self, gnd):\n self.dcmgnd = gnd",
"def set_ddg_flag(self, is_new_hunk):\n Gumtree.gumtree.setDDGFla... | [
"0.5783567",
"0.57404447",
"0.56364006",
"0.5479423",
"0.5477732",
"0.5465287",
"0.5447467",
"0.5447467",
"0.54369414",
"0.53982717",
"0.53661007",
"0.53497696",
"0.5344861",
"0.53273064",
"0.53273064",
"0.5312296",
"0.53118473",
"0.52982324",
"0.5294734",
"0.5291972",
"0.528... | 0.6785721 | 0 |
The setter for the subject attribute's hypertension data. | def hypertension(self, hypertension):
self.logger.debug("In 'hypertension' setter.")
self._hypertension = hypertension | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject(self, value):\n self.set_property(\"subject\", value)",
"def setSubject(self,value): \n self.PDFreactorConfiguration.in1[\"subject\"] = value",
"def subject(self, subject: \"str\"):\n self._attrs[\"subject\"] = subject",
"def subject(self, subject: \"str\"):\n self._at... | [
"0.5970333",
"0.5816906",
"0.56116444",
"0.56116444",
"0.54425675",
"0.5421129",
"0.5368664",
"0.53539914",
"0.5346087",
"0.53391975",
"0.53391975",
"0.53391975",
"0.52859944",
"0.5181244",
"0.5181244",
"0.5181244",
"0.5181244",
"0.5181244",
"0.5162451",
"0.5105633",
"0.50443... | 0.6880703 | 0 |
The setter for the subject attribute's illicit drug history data. | def illicit_drug(self, illicit_drug):
self.logger.debug("In 'illicit_drug' setter.")
self._illicit_drug = illicit_drug | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __setitem__(self):\n raise ValueError(\"Dataset objects are immutable\")",
"def set_field( self, data ):\n super( UnsteadyField1D, self ).set_field( data )\n self.history[:] = self.val[:]\n return",
"def subject_uuid(self, subject_uuid):\r\n\r\n self._subject_uuid = subje... | [
"0.53864956",
"0.53475034",
"0.52075934",
"0.5040177",
"0.502803",
"0.5027246",
"0.50090796",
"0.50090796",
"0.50090796",
"0.4977144",
"0.49580055",
"0.48284277",
"0.48150432",
"0.48130378",
"0.48080885",
"0.47837257",
"0.4740099",
"0.4740099",
"0.47126606",
"0.47096834",
"0.... | 0.6039002 | 0 |
The setter for the subject attribute's kidney disease data. | def kidney(self, kidney):
self.logger.debug("In 'kidney' setter.")
self._kidney = kidney | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject_id(self, subject_id):\n\n self._subject_id = subject_id",
"def deidentify(self, subject_id=None):\n # Changing subject id\n if subject_id:\n self.subject = subject_id\n else:\n self.subject = ''\n\n self.metadata = {\n 'PATIENTINFO' ... | [
"0.6164212",
"0.6071912",
"0.6058911",
"0.5866199",
"0.58180076",
"0.560134",
"0.558731",
"0.55842304",
"0.55842304",
"0.55529183",
"0.55529183",
"0.55529183",
"0.5542547",
"0.5474031",
"0.54299515",
"0.53850234",
"0.53850234",
"0.53827834",
"0.527691",
"0.51949143",
"0.51505... | 0.7384534 | 0 |
The setter for the subject's mother. | def mother(self, mother):
self.logger.debug("In 'mother' setter.")
self._mother = mother | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject(self, value):\n self.set_property(\"subject\", value)",
"def mother_id(self):\n return self._mother",
"def possessed_by(self, other):\r\n self.owner = other",
"def subject(self, subject):\n\n self._subject = subject",
"def subject(self, subject):\n\n self._sub... | [
"0.6592376",
"0.6417233",
"0.62410694",
"0.6048784",
"0.6048784",
"0.6048784",
"0.5874268",
"0.5828045",
"0.5784376",
"0.5755819",
"0.56805325",
"0.56648695",
"0.5597864",
"0.5590452",
"0.55859816",
"0.54407835",
"0.5409681",
"0.54057693",
"0.529991",
"0.52964944",
"0.5279828... | 0.83289975 | 0 |
The setter for the subject attribute's occupation. | def occupation(self, occupation):
self.logger.debug("In 'occupation' setter.")
self._occupation = occupation | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def occupation(self, occupation):\n\n self._occupation = occupation",
"def set_occupant(self):\n\t\tself.occupant = 1",
"def occupancy(self, occupancy):\n\n self._occupancy = occupancy",
"def set_occupant(self, obj):\n\t\tpass",
"def subject(self, value):\n self.set_property(\"subject\... | [
"0.7053533",
"0.68027806",
"0.66343707",
"0.64560807",
"0.5774",
"0.56687814",
"0.5632423",
"0.5632423",
"0.53159213",
"0.53159213",
"0.52375567",
"0.52261674",
"0.52215457",
"0.51968753",
"0.5182352",
"0.513832",
"0.5123571",
"0.5122215",
"0.5119199",
"0.5117822",
"0.5110349... | 0.75977945 | 0 |
The setter for the subject attribute's pvd (peripheral vascular disease) data. | def pvd(self, pvd):
self.logger.debug("In 'pvd' setter.")
self._pvd = pvd | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vpd_id(self, vpd_id):\n\n self._vpd_id = vpd_id",
"def set_voltage(self, v, ch): \n self.write(\"VSET\" + str(ch) + \":\" + str(v) + \"\\n\")",
"def v(self, v):\n self._v = v",
"def v(self, v):\n\n self._v = v",
"def v(self, v):\n\n self._v = v",
"def set_vol... | [
"0.5837103",
"0.5526243",
"0.54655874",
"0.53762007",
"0.53762007",
"0.5366413",
"0.53607076",
"0.5357537",
"0.52633405",
"0.5219998",
"0.5216777",
"0.5204844",
"0.51895255",
"0.51381326",
"0.508224",
"0.5081992",
"0.50561976",
"0.50049466",
"0.49902153",
"0.4962001",
"0.4941... | 0.78896886 | 0 |
The setter for the subject attribute's siblings. | def siblings(self, siblings):
self.logger.debug("In 'siblings' setter.")
self._siblings = siblings | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject(self, value):\n self.set_property(\"subject\", value)",
"def change_subject(self, new_subject):\n raise NotImplementedError",
"def subject(self, subject):\n\n self._subject = subject",
"def subject(self, subject):\n\n self._subject = subject",
"def subject(self, subj... | [
"0.6429605",
"0.57400227",
"0.5691364",
"0.5691364",
"0.5691364",
"0.56346184",
"0.5630802",
"0.55770516",
"0.5508243",
"0.5407607",
"0.53761977",
"0.53761977",
"0.5310728",
"0.5300314",
"0.52240336",
"0.52158016",
"0.519634",
"0.5072914",
"0.5072221",
"0.5058918",
"0.5052136... | 0.69191176 | 0 |
The setter for the optional subproject the subject belongs to, currently limited to VCU but controlled vocabulary could be expanded to incude more projects. | def subproject(self, subproject):
self.logger.debug("In 'subproject' setter.")
self._subproject = subproject | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testSubproject(self):\n attr = self.session.create_visit_attr()\n\n self.util.stringTypeTest(self, attr, \"subproject\")\n\n self.util.stringPropertyTest(self, attr, \"subproject\")",
"def SetSubSpaceProjector(self, proj):\n return _hypre.HypreLOBPCG_SetSubSpaceProjector(self, pro... | [
"0.6812608",
"0.6662138",
"0.58673406",
"0.57978135",
"0.5670406",
"0.55939984",
"0.54418045",
"0.53359234",
"0.52879244",
"0.5231679",
"0.5231679",
"0.51887167",
"0.51805437",
"0.51462317",
"0.5124727",
"0.5056825",
"0.5053475",
"0.50437045",
"0.5041038",
"0.5012335",
"0.498... | 0.78754413 | 0 |
The setter for center specific survey identifier. | def survey_id(self, survey_id):
self.logger.debug("In 'survey_id' setter.")
self._survey_id = survey_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def survey_id(self, survey_id):\n\n self._survey_id = survey_id",
"def set_ident(self, new_ident: int):\n if not isinstance(new_ident, int):\n raise TypeError(\"Spectrum set identifiers may ONLY be positive integers\")\n self._set_ident = new_ident",
"def survey_response_id(self... | [
"0.68363386",
"0.6073385",
"0.6002878",
"0.57867825",
"0.57867825",
"0.57867825",
"0.5744583",
"0.57225215",
"0.56880254",
"0.5651209",
"0.55950034",
"0.55378723",
"0.55103487",
"0.55103487",
"0.5474164",
"0.54545075",
"0.540694",
"0.540694",
"0.5403246",
"0.5392221",
"0.5390... | 0.7165307 | 0 |
Deletes the current object (self) from OSDF. If the object has not been previously saved (node ID is not set), then an error message will be logged stating the object was not deleted. If the ID is set, and exists in the OSDF instance, then the object will be deleted from the OSDF instance, and this object must be resav... | def delete(self):
self.logger.debug("In delete.")
if self._id is None:
self.logger.warn("Attempt to delete a %s with no ID.", __name__)
raise Exception("{} does not have an ID.".format(__name__))
id = self._id
session = iHMPSession.get_session()
self.lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self, obj=None):\n if not obj:\n return\n key = \"{}.{}\".format(type(obj).__name__, obj.id)\n if key in self.__objects:\n del self.__objects[key]\n self.save()",
"def delete(self):\n self.id = uuid4()\n DataStore.remove_instance(self... | [
"0.6932225",
"0.6836191",
"0.6761663",
"0.6756009",
"0.67374784",
"0.67361516",
"0.67361516",
"0.67361516",
"0.67361516",
"0.6723348",
"0.6723348",
"0.6723348",
"0.67100346",
"0.6577172",
"0.6520184",
"0.6508795",
"0.64875054",
"0.641628",
"0.64133525",
"0.63939804",
"0.63892... | 0.73344004 | 0 |
Searches OSDF for SubjectAttribute nodes. Any criteria the user wishes to add is provided by the user in the query language specifications provided in the OSDF documentation. A general format is | def search(query="\"subject_attr\"[node_type]"):
module_logger.debug("In search.")
session = iHMPSession.get_session()
module_logger.info("Got iHMP session.")
if query != '"subject_attr"[node_type]':
query = '({}) && "subject_attr"[node_type]'.format(query)
module_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_subjects(self):\n return self.filter_nodes('//Subjects/Subject')",
"def subject_list():\n items = []\n\n soup = abcradionational.get_soup(URL + \"/podcasts/subjects\")\n \n subject_heading = abcradionational.get_podcast_heading(soup)\n \n for subject in subject_heading:\n ... | [
"0.6321968",
"0.5868989",
"0.5797068",
"0.5797068",
"0.5792069",
"0.57776743",
"0.5761896",
"0.57172513",
"0.5666394",
"0.53860444",
"0.53860444",
"0.53587943",
"0.53587943",
"0.53587943",
"0.53587943",
"0.53587943",
"0.53022003",
"0.524047",
"0.5169435",
"0.5145889",
"0.5113... | 0.73507226 | 0 |
Saves the data in OSDF. The JSON form of the current data for the instance is validated in the save function. If the data is not valid, then the data will not be saved. If the instance was saved previously, then the node ID is assigned the alpha numeric found in the OSDF instance. If not saved previously, then the node... | def save(self):
self.logger.debug("In save.")
# If node previously saved, use edit_node instead since ID
# is given (an update in a way)
# can also use get_node to check if the node already exists
if not self.is_valid():
self.logger.error("Cannot save, data is invali... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self):\n self.logger.debug(\"In save.\")\n\n if not self.is_valid():\n self.logger.error(\"Cannot save, data is invalid\")\n return False\n\n session = iHMPSession.get_session()\n self.logger.info(\"Got iHMP session.\")\n\n success = False\n\n ... | [
"0.7139773",
"0.6385708",
"0.6246444",
"0.5928301",
"0.58878785",
"0.5868495",
"0.58186436",
"0.5813409",
"0.57692957",
"0.57653695",
"0.57553834",
"0.5749684",
"0.57480514",
"0.5716162",
"0.5714232",
"0.5713952",
"0.56692517",
"0.5650842",
"0.5636613",
"0.56266105",
"0.55924... | 0.8063669 | 0 |
Returns the games that the current user has moderator access | def get_current_user_games_moderating():
return Game.get_user_games_moderating(users.GetCurrentUser()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_games_moderating(user):\n if not user: return []\n moderating = db.Query(GameModerator).filter('user =', user)\n return [m.game for m in moderating]",
"def user_moderating(self, user):\n if not user: return False\n query = db.Query(GameModerator)\n query.filter('game ='... | [
"0.812755",
"0.7338971",
"0.7006234",
"0.68757516",
"0.6267719",
"0.6133413",
"0.6118051",
"0.60893816",
"0.6021789",
"0.6008156",
"0.59875387",
"0.59740645",
"0.59282196",
"0.59213614",
"0.5802367",
"0.577083",
"0.57459813",
"0.574014",
"0.5720754",
"0.56914926",
"0.5688182"... | 0.799862 | 1 |
Returns the games that the given user has moderator access | def get_user_games_moderating(user):
if not user: return []
moderating = db.Query(GameModerator).filter('user =', user)
return [m.game for m in moderating] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_moderating(self, user):\n if not user: return False\n query = db.Query(GameModerator)\n query.filter('game =', self)\n query.filter('user =', user)\n return query.get()",
"def get_current_user_games_moderating():\n return Game.get_user_games_moderating(users.GetCurrentUser(... | [
"0.77718145",
"0.7593678",
"0.693608",
"0.66256106",
"0.6421562",
"0.6419097",
"0.63924074",
"0.63783497",
"0.6341371",
"0.63391614",
"0.6326846",
"0.62342393",
"0.6186595",
"0.6106071",
"0.6048413",
"0.5946077",
"0.5878598",
"0.5866314",
"0.5842646",
"0.58251846",
"0.5795843... | 0.854335 | 0 |
Returns true if the given user has moderator acces to this game. | def user_moderating(self, user):
if not user: return False
query = db.Query(GameModerator)
query.filter('game =', self)
query.filter('user =', user)
return query.get() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkIfAllowed(self, user):\n\n # Default case if mod access is not needed everyone has access\n if not self.modOnlyAccess:\n return True\n\n # Otherwise check the user's access level\n if user.modAccess == self.modOnlyAccess:\n return True\n else:\n ... | [
"0.7828556",
"0.77501905",
"0.7736339",
"0.7736339",
"0.76756227",
"0.75299066",
"0.73816484",
"0.73230696",
"0.73103917",
"0.729185",
"0.72802365",
"0.72083044",
"0.71758336",
"0.7058588",
"0.7058509",
"0.7045077",
"0.70308125",
"0.70189774",
"0.70164526",
"0.70089716",
"0.7... | 0.786476 | 0 |
Retrieves a set of TaggedDocuments from the database | def retrieve_tagged_documents_from_database(session, document_ids: Set[int], document_collection: str) \
-> List[TaggedDocument]:
doc_results = {}
document_ids = sorted(list(document_ids))
# first query document titles and abstract
doc_query = session.query(Document).filter(and_(Document.id.in_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_documents(self) -> Iterable[dict]:\n\n return self._db[\"documents\"]",
"def get_documents(self):\n documents = self.tree.execute(\"$.documents\")\n for doc in documents:\n sentences = {s['@id']: s['text'] for s in doc.get('sentences', [])}\n self.document_dict... | [
"0.73104936",
"0.655779",
"0.6516003",
"0.6449883",
"0.6446499",
"0.6396306",
"0.6396306",
"0.6355805",
"0.6333367",
"0.6319859",
"0.62557304",
"0.623653",
"0.6147569",
"0.61305124",
"0.61125934",
"0.6096729",
"0.6084542",
"0.5975077",
"0.5961116",
"0.5907853",
"0.59019995",
... | 0.7045775 | 1 |
Sets the update_param of this SmartContractsExternalEvent. | def update_param(self, update_param):
self._update_param = update_param | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_on_update(cls, on_update_callback):\n cls._on_update = on_update_callback",
"def update_date(self, update_date):\n\n self._update_date = update_date",
"def update_date(self, update_date):\n\n self._update_date = update_date",
"def set_update_received_callback(self, callback):... | [
"0.59627855",
"0.5543473",
"0.5543473",
"0.5518267",
"0.55124503",
"0.5423533",
"0.54043597",
"0.53955996",
"0.5364033",
"0.53036",
"0.5252726",
"0.52114725",
"0.52114725",
"0.52114725",
"0.52114725",
"0.520907",
"0.5166328",
"0.5160308",
"0.51379406",
"0.5137891",
"0.5092448... | 0.7297 | 0 |
Sets the posting_instruction_batch of this SmartContractsExternalEvent. | def posting_instruction_batch(self, posting_instruction_batch):
self._posting_instruction_batch = posting_instruction_batch | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch(self, batch):\n\n self._batch = batch",
"def postings(self, postings):\n if postings:\n self._postings = postings",
"def handle_batch(self, batch: Mapping[str, Any]) -> None:\n self.batch = {**batch, **self.forward(batch)}",
"def batch_id(self, batch_id):\n\n ... | [
"0.53729135",
"0.4839542",
"0.4687863",
"0.46870282",
"0.46480635",
"0.45746222",
"0.4540861",
"0.4540861",
"0.4462273",
"0.4403963",
"0.44033626",
"0.43905142",
"0.43627852",
"0.43363622",
"0.43031356",
"0.42991257",
"0.4292917",
"0.4282893",
"0.42753202",
"0.42618978",
"0.4... | 0.8160995 | 0 |
Sets the set_flag of this SmartContractsExternalEvent. | def set_flag(self, set_flag):
self._set_flag = set_flag | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_flag(self, new):\n self.flag = new",
"def set_mark(self, perception: Perception) -> None:\n if self.mark.set_mark_using_condition(self.condition, perception):\n self.ee = False",
"def setFlag(self, flag, value) -> None:\n ...",
"def eflags_set(self, bit: int, value: bo... | [
"0.5919165",
"0.58560085",
"0.5854866",
"0.58365464",
"0.57126683",
"0.5702005",
"0.5682941",
"0.5682941",
"0.55357",
"0.54927593",
"0.5410388",
"0.5371538",
"0.5341425",
"0.5327782",
"0.53235805",
"0.53189474",
"0.5291089",
"0.5272593",
"0.5252654",
"0.5218112",
"0.52065414"... | 0.73909456 | 0 |
Sets the get_derived_parameters of this SmartContractsExternalEvent. | def get_derived_parameters(self, get_derived_parameters):
self._get_derived_parameters = get_derived_parameters | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_derived_parameters(self) -> DerivedParameterCollection:\n return DerivedParameterCollection([])",
"def _get_derived_parameters(self) -> DerivedParameterCollection:\n return DerivedParameterCollection([])",
"def set_ext_params(self, ext_params):\n num_param = core.xc_func_info_get_... | [
"0.567191",
"0.567191",
"0.5428137",
"0.53064084",
"0.52684146",
"0.5215091",
"0.5188942",
"0.5188912",
"0.51474154",
"0.5135808",
"0.5132381",
"0.5115146",
"0.49988118",
"0.4979826",
"0.49458262",
"0.4884202",
"0.4871893",
"0.48503995",
"0.48305923",
"0.48068097",
"0.4793973... | 0.7784515 | 0 |
Take a set of feature activities and represent them in inputs. | def defeaturize(self, feature_activities):
input_activities = feature_activities[:self.max_num_inputs]
# Project each ziptie down to inputs.
bundle_activities = feature_activities[self.max_num_inputs:]
# TODO: iterate over multiple zipties
ziptie_input_activities = self.ziptie.pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def featurize(self, new_inputs):\n # Start by normalizing all the inputs.\n self.input_activities = self.update_inputs(new_inputs)\n\n # Run the inputs through the ziptie to find bundle activities\n # and to learn how to bundle them.\n bundle_activities = self.ziptie.featurize(se... | [
"0.6215956",
"0.61140203",
"0.58670443",
"0.5805919",
"0.56044936",
"0.55787945",
"0.55729645",
"0.55585843",
"0.55393785",
"0.5494204",
"0.54847795",
"0.54795194",
"0.5450705",
"0.54096943",
"0.53977007",
"0.5394272",
"0.53692985",
"0.53616226",
"0.5357934",
"0.5325238",
"0.... | 0.73373103 | 0 |
Normalize and update inputs. Normalize activities so that they are predictably distrbuted. Use a running estimate of the maximum of each cable activity. Scale it so that the max would fall at 1. Normalization has several benefits. 1. It makes for fewer constraints on worlds and sensors. It allows any sensor can return ... | def update_inputs(self, inputs):
# TODO: numpy-ify this
if inputs.size > self.max_num_inputs:
print("Featurizer.update_inputs:")
print(" Attempting to update out of range input activities.")
# This is written to be easily compilable by numba, however,
# it ha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def featurize(self, new_inputs):\n # Start by normalizing all the inputs.\n self.input_activities = self.update_inputs(new_inputs)\n\n # Run the inputs through the ziptie to find bundle activities\n # and to learn how to bundle them.\n bundle_activities = self.ziptie.featurize(se... | [
"0.5670106",
"0.56258184",
"0.55450493",
"0.54929584",
"0.5432683",
"0.5393879",
"0.53888273",
"0.5325755",
"0.5312501",
"0.52890813",
"0.5263034",
"0.5148294",
"0.5144454",
"0.5135208",
"0.5122069",
"0.51190495",
"0.5117909",
"0.5102565",
"0.50878215",
"0.5065914",
"0.505135... | 0.67921335 | 0 |
!Returns the name of a vector map not in the current mapset. Mapname is of the form temp_xxxxxx where xxxxxx is a random number. | def tempmap():
rand_number = [random.randint(0, 9) for i in range(6)]
rand_number_str = ''.join(map(str, rand_number))
mapname = 'temp_' + rand_number_str
maplist = grass.read_command('g.list', type='vector', mapset='.').split()
while mapname in maplist:
rand_number = [random.randint(0, 9) f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mapping_name(self) -> Optional[str]:\n return self.get(\"/TM\")",
"def i_get_specified_map_name(cls, field, value, name):\n ret_val, name.value = gxapi_cy.WrapEMAPTEMPLATE._i_get_specified_map_name(GXContext._get_tls_geo(), field.encode(), value.encode(), name.value.encode())\n return re... | [
"0.5682107",
"0.564879",
"0.5627548",
"0.5520334",
"0.5474383",
"0.5460252",
"0.5433927",
"0.53500676",
"0.5322008",
"0.528899",
"0.5254873",
"0.5241105",
"0.5222035",
"0.52160156",
"0.51757026",
"0.51566136",
"0.5155313",
"0.51499426",
"0.51480395",
"0.51412773",
"0.51398396... | 0.7676091 | 0 |
!Load vector lines into python list. | def loadVector(vector):
expVecCmmd = 'v.out.ascii format=standard input=' + vector
# JL p = Popen(expVecCmmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
p = Popen(expVecCmmd, shell=True, stdin=PIPE, stdout=PIPE,
stderr=STDOUT, close_fds=False)
vectorAscii = p.stdout... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readVector(text):\n items = text.split()\n if int(items[0])+1 != len(items):\n raise ValueError(\"Invalid number of items\")\n return [float(v) for v in items[1:]]",
"def fread_vector(stream):\n\n return (numpy.array(\n [float(d) for d in re.split(r\"\\s+\", stream.readline()) if len(d)... | [
"0.6735636",
"0.66572475",
"0.65267396",
"0.64631766",
"0.62894356",
"0.6212257",
"0.60744894",
"0.6050167",
"0.5971917",
"0.5936406",
"0.5927659",
"0.59243774",
"0.5906393",
"0.5888187",
"0.5879284",
"0.5851395",
"0.580826",
"0.58042836",
"0.57976484",
"0.5788558",
"0.57716"... | 0.72660893 | 0 |
!Get transects locations along input vector lines. | def get_transects_locs(vector, transect_spacing, dist_function, last_point):
# holds locations where transects should intersect input vector lines
transect_locs = []
vectors = []
for line in vector:
transect_locs.append([line[0]])
vectors.append([[line[0], line[1]]])
# i starts a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_transect_ends(transect_locs, vectors, trend, dleft, dright):\n transect_ends = []\n if not trend:\n for k, transect in enumerate(transect_locs):\n # if a line in input vec was shorter than transect_spacing\n if len(transect) < 2:\n continue # then don't pu... | [
"0.63135153",
"0.59478843",
"0.5900003",
"0.57753754",
"0.572772",
"0.5653143",
"0.562377",
"0.55997103",
"0.55771756",
"0.55584687",
"0.55505735",
"0.5534073",
"0.549853",
"0.54831463",
"0.54450405",
"0.5424618",
"0.5399742",
"0.539676",
"0.5395751",
"0.5379726",
"0.5361239"... | 0.8311026 | 0 |
!From transects locations along input vector lines, get transect ends. | def get_transect_ends(transect_locs, vectors, trend, dleft, dright):
transect_ends = []
if not trend:
for k, transect in enumerate(transect_locs):
# if a line in input vec was shorter than transect_spacing
if len(transect) < 2:
continue # then don't put a transec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_transects_locs(vector, transect_spacing, dist_function, last_point):\n # holds locations where transects should intersect input vector lines\n transect_locs = []\n vectors = []\n for line in vector:\n transect_locs.append([line[0]])\n vectors.append([[line[0], line[1]]])\n ... | [
"0.7829282",
"0.5986902",
"0.58439416",
"0.5737113",
"0.56587785",
"0.54360026",
"0.5381559",
"0.5353021",
"0.5303393",
"0.5286405",
"0.5271834",
"0.52648467",
"0.52199537",
"0.51981175",
"0.5193811",
"0.5183831",
"0.5180789",
"0.517281",
"0.51669097",
"0.5162157",
"0.5157939... | 0.7529391 | 1 |
Adds multiple elements of the same type to structure.elements. | def add_elements(self, elements, type, thermal=False, axes={}):
return [self.add_element(nodes=nodes, type=type, thermal=thermal, axes=axes) for nodes in elements] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addElements( self, elements, plane = 0):\n for e in elements:\n self.addElement( e, plane )",
"def __add__(self, element):\r\n self.elements += element",
"def add_list(self, elements):\n if not isinstance(elements, (list, tuple)):\n warn(\"Input must be a list or ... | [
"0.6932413",
"0.6647059",
"0.6410584",
"0.62046254",
"0.61571664",
"0.60924846",
"0.6082265",
"0.6054165",
"0.60392433",
"0.60392433",
"0.6007566",
"0.59567493",
"0.5934673",
"0.5911498",
"0.5884601",
"0.587952",
"0.58746034",
"0.5872647",
"0.5837587",
"0.5834314",
"0.5812739... | 0.67169875 | 1 |
Check if an element already exists based on nodes or centroid. | def check_element_exists(self, nodes=None, xyz=None, virtual=False):
if not xyz:
xyz = centroid_points([self.node_xyz(node) for node in nodes])
gkey = geometric_key(xyz, '{0}f'.format(self.tol))
if virtual:
return self.virtual_element_index.get(gkey, None)
else... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains(self, element):\n pass",
"def contains(self, element) -> bool:\n\n return self.__find_node(element) is not None",
"def __contains__(self, point):\n for component, dim in zip(point, self.dimensions):\n if component not in dim:\n return False\n r... | [
"0.60550416",
"0.5977769",
"0.592818",
"0.5824264",
"0.5823655",
"0.5782504",
"0.57631004",
"0.57197577",
"0.57041025",
"0.5618146",
"0.56131375",
"0.5596627",
"0.55922264",
"0.55544585",
"0.5548297",
"0.55086267",
"0.5484296",
"0.5472488",
"0.54446507",
"0.5439354",
"0.54372... | 0.61814296 | 0 |
Return the centroid of an element. | def element_centroid(self, element):
return centroid_points(self.nodes_xyz(nodes=self.elements[element].nodes)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def centroid(self) -> PointValue:\n return ops.GeoCentroid(self).to_expr()",
"def get_element_centroids(self):\n if self.centroids is None:\n self.centroids = np.vstack((\n np.mean(self.grid['x'], axis=1),\n np.mean(self.grid['z'], axis=1)\n )).T\... | [
"0.7748887",
"0.76868415",
"0.7632962",
"0.75434023",
"0.7536017",
"0.75336224",
"0.7488187",
"0.73457927",
"0.73423916",
"0.73017126",
"0.72235227",
"0.71224225",
"0.7083174",
"0.70831215",
"0.7082723",
"0.698191",
"0.68854874",
"0.68596756",
"0.6837567",
"0.6779904",
"0.677... | 0.89669955 | 0 |
Adds a nodal element to structure.elements with the possibility of adding a coincident virtual node. Virtual nodes are added to a node set called 'virtual_nodes'. | def add_nodal_element(self, node, type, virtual_node=False):
if virtual_node:
xyz = self.node_xyz(node)
key = self.virtual_nodes.setdefault(node, self.node_count())
self.nodes[key] = {'x': xyz[0], 'y': xyz[1], 'z': xyz[2],
'ex': [1, 0, 0], 'ey':... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_virtual_element(self, nodes, type, thermal=False, axes={}):\n ekey = self.check_element_exists(nodes, virtual=True)\n\n if ekey is None:\n\n ekey = self.element_count()\n element = func_dict[type]()\n element.axes = axes\n element.nodes = nodes\n ... | [
"0.6634317",
"0.61566204",
"0.5652742",
"0.56208146",
"0.5584139",
"0.55827653",
"0.5531385",
"0.55188775",
"0.55154985",
"0.5491441",
"0.5474709",
"0.547417",
"0.54539937",
"0.54539937",
"0.54503345",
"0.5447374",
"0.5445971",
"0.54049236",
"0.537154",
"0.53474987",
"0.53453... | 0.7079097 | 0 |
Assign the ElementProperties object name to associated Elements. | def assign_element_property(self, element_property):
if element_property.elset:
elements = self.sets[element_property.elset].selection
else:
elements = element_property.elements
for element in elements:
self.elements[element].element_property = element_proper... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fromElement(self, element):\n from comoonics.ComProperties import Properties\n props=element.getElementsByTagName(Properties.TAGNAME)\n #log.debug(\"fromElement: %s, %u\" %(element, len(props)))\n if len(props)>=1:\n self.properties=Properties(props[0])\n for p... | [
"0.6765604",
"0.5937132",
"0.593495",
"0.5834883",
"0.56832635",
"0.5542729",
"0.55254275",
"0.54816675",
"0.5402877",
"0.535998",
"0.5290429",
"0.5289492",
"0.52726215",
"0.52641964",
"0.52641964",
"0.5244588",
"0.5224988",
"0.5219556",
"0.520917",
"0.51843125",
"0.51752377"... | 0.7392299 | 0 |
take `num` elements from sample `smp` similar to random.sample but even if `num` > len(`smp`). | def grow_sample(smp, num):
smp = np.asarray(smp)
smp_len = len(smp)
if smp_len > num:
return np.array(random.sample(list(smp), num))
div = int(np.floor(num / smp_len))
rem = num - div * smp_len
rem_el = np.array(random.sample(list(smp), rem))
base_el = np.tile(smp, div)
return np.concatenate((base_el, rem_el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_sampling(elements, n):\r\n import random\r\n return [random.choice(elements) for i in range(n)]",
"def take_samples(self, num_samples: int) -> List:\n if num_samples > len(self.samples):\n return random.sample(self.samples, len(self.samples))\n return random.sample(self.... | [
"0.68522865",
"0.648896",
"0.6459786",
"0.6449171",
"0.64182615",
"0.6378369",
"0.6269525",
"0.6269366",
"0.6265996",
"0.6110838",
"0.6074783",
"0.6069164",
"0.60457987",
"0.6039458",
"0.6031454",
"0.60261863",
"0.60166687",
"0.6005243",
"0.6001939",
"0.5999907",
"0.59767216"... | 0.8121735 | 0 |
Show user's created listings | def user_listings(username):
user = User.query.get_or_404(username)
created_listings = user.created_listings
serialized = [
listing.serialize(isDetailed=False)
for listing in created_listings
]
return (jsonify(listings=serialized), 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, request):\n listings = self.get_queryset().all().order_by(\"start_date\")\n username = None\n auth = request.user.is_authenticated\n if auth:\n username = request.user.username\n return render(request, 'listings/list.html', {'listings': listings,\n ... | [
"0.7004472",
"0.6673305",
"0.6630085",
"0.6528049",
"0.6506623",
"0.6486702",
"0.64642733",
"0.64642733",
"0.64642733",
"0.64642733",
"0.64642733",
"0.64642733",
"0.6457943",
"0.64462024",
"0.6429502",
"0.6318806",
"0.62973744",
"0.62960905",
"0.62940705",
"0.6247468",
"0.622... | 0.76791966 | 0 |
Show a listing. Returns => { | def listing_show(listing_id):
listing = Listing.query.get_or_404(listing_id)
return (jsonify(listing=listing.serialize(isDetailed=True)), 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listing(request):\n lakes = Lake.objects.all().order_by(\"title\")\n\n return render(request, \"lakes/listing.html\", {\n \"lakes\": lakes,\n })",
"def show_listings(offset):\n items = Item.query.filter(Item.status == \"listed\").order_by(desc(Item.date_listed)).offset(offset).limit(LIMIT)... | [
"0.69484735",
"0.6776792",
"0.6761225",
"0.6761225",
"0.6761225",
"0.67378205",
"0.65945524",
"0.65146893",
"0.64641935",
"0.6459318",
"0.6453462",
"0.645169",
"0.6412892",
"0.63761",
"0.637451",
"0.63693076",
"0.6330857",
"0.62925524",
"0.6270236",
"0.62691593",
"0.6267482",... | 0.7389735 | 0 |
Create a new listing. | def listing_create():
listing_data = request.json.get("listing")
form = ListingCreateForm(data=listing_data)
if form.validate():
listing = Listing.create(form)
db.session.commit()
# TODO: reevaluate error with a try and except later
return (jsonify(listing=listing.serialize(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def newListing():\n try:\n # Create newListing, initialize with user input from form\n newListing = {\n \"numBedrooms\": request.form.get(\"numBedrooms\"),\n \"sqFootage\": request.form.get(\"sqFootage\"),\n \"numBathrooms\": request.form.get(\"numBathrooms\"),\n ... | [
"0.7329421",
"0.7028599",
"0.6506419",
"0.6243624",
"0.6172223",
"0.60724956",
"0.6068415",
"0.605586",
"0.6049541",
"0.5983175",
"0.5927461",
"0.5834615",
"0.5830206",
"0.5818242",
"0.5696018",
"0.56799376",
"0.5675575",
"0.56571704",
"0.5647056",
"0.5627651",
"0.562004",
... | 0.79246366 | 0 |
def a for class A | def a(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def a1(self):\n print(\"Hello from an instance of A\")",
"def __init__(self,a): \n self.a = a",
"def b_class_a(self):\n return self._b_class_a",
"def fA(self):\n pass",
"def a(self):\r\n return self.__a",
"def getA(self):\n\t\treturn self.a",
"def fun_a(self):\n ... | [
"0.6785395",
"0.67790973",
"0.67719483",
"0.66484004",
"0.65515727",
"0.6428552",
"0.6374703",
"0.62903553",
"0.62113595",
"0.61528116",
"0.6152233",
"0.60726637",
"0.59858364",
"0.5968785",
"0.5968785",
"0.5896728",
"0.5852677",
"0.5852677",
"0.5852677",
"0.58128977",
"0.580... | 0.73799604 | 1 |
get a list of all class members, ordered by class | def getmembers(klass, members=None):
if members is None:
members = []
for k in klass.__bases__:
print(k)
getmembers(k, members)
for m in dir(klass):
print(m)
if m not in members:
members.append(m)
return members | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all(cls):\n return [(k, v) for k, v in cls.__members__.items()]",
"def get_members():",
"def all_names(cls) -> List[str]:\n return list(member_name for member_name in cls.__members__.keys())",
"def list(cls):\n return [cls.__dict__.get(name) for name in dir(cls) if (\n not... | [
"0.7196665",
"0.70308536",
"0.6879248",
"0.67503995",
"0.6459501",
"0.6431725",
"0.6319217",
"0.6284791",
"0.62736416",
"0.6240478",
"0.6227316",
"0.6226022",
"0.6189405",
"0.6184931",
"0.6156415",
"0.6146528",
"0.61306727",
"0.60859036",
"0.6068512",
"0.60406107",
"0.6035632... | 0.76963896 | 0 |
Set bot status to online, idle or dnd | async def set_status(self, ctx, *, status: str = "online"):
try:
status = discord.Status[status.lower()]
except KeyError:
await ctx.error("Invalid Status", "Only `online`, `idle` or `dnd` statuses are available.")
else:
await self.bot.change_presence(status=s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def status(self, ctx, *, status=None):\n # [p]set status <status>\n\n statuses = {\n \"online\": discord.Status.online,\n \"idle\": discord.Status.idle,\n \"dnd\": discord.Status.dnd,\n \"invisible\": discord.Status.inv... | [
"0.7229784",
"0.7148614",
"0.69359046",
"0.6784688",
"0.6700738",
"0.65831655",
"0.6553433",
"0.6454904",
"0.62434053",
"0.62246996",
"0.6186946",
"0.61738676",
"0.6167214",
"0.6167214",
"0.6167214",
"0.6127212",
"0.6101693",
"0.6087031",
"0.6058194",
"0.60546035",
"0.6040849... | 0.7328083 | 0 |
Delete a number of messages from the channel. Default is 10. Max 100. | async def purge(self, ctx, msg_number: int = 10):
if ctx.guild.id == 202724765218242560:
return
if msg_number > 100:
await ctx.error("No more than 100 messages can be purged at a time.")
return
deleted = await ctx.channel.purge(limit=msg_number)
s =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def channel_(self, ctx, number=10):\n number = number if number <= 100 else 100\n question = await ctx.send(f\"this will delete the last {number} messages from ALL users. Continue?\")\n await question.add_reaction(self.reactions[0])\n await question.add_reaction(self.reactions[1])... | [
"0.7288479",
"0.72206223",
"0.7182962",
"0.7022472",
"0.6961094",
"0.69093484",
"0.6867969",
"0.6842305",
"0.6701014",
"0.6677718",
"0.6663868",
"0.666008",
"0.6650558",
"0.6520946",
"0.65097123",
"0.6386746",
"0.6380716",
"0.6371731",
"0.6360819",
"0.6308435",
"0.62655646",
... | 0.7220789 | 1 |
Whitelist a role to allow server/channel access to the bot. Use '!whitelist server/channel/remove role_name' | async def whitelist(self, ctx, scope: str, role: discord.Role):
scopes = {
'server': ctx.guild,
'channel': ctx.channel,
'remove': False
}
try:
scope = scopes[scope.lower()]
except KeyError:
await ctx.error(
'In... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def oauth_whitelist(self, ctx, target: Union[Role, utils.User]):\n whitelisted = self.bot.config[\"oauth_whitelist\"]\n\n # target.id is not int??\n if target.id in whitelisted:\n whitelisted.remove(target.id)\n removed = True\n else:\n whitelisted... | [
"0.6592266",
"0.6458174",
"0.5970901",
"0.59082526",
"0.5907761",
"0.590355",
"0.58978397",
"0.5852671",
"0.5787354",
"0.576652",
"0.573009",
"0.57242316",
"0.5718454",
"0.5717965",
"0.5704382",
"0.5697546",
"0.56893694",
"0.5687715",
"0.56833106",
"0.5663093",
"0.5621843",
... | 0.78769565 | 0 |
Prints that the user has gained a certain number of points. | def gain_point(self, points):
self.points += points
print(f"Yay! You have gained {points} point(s)! That means you now have {self.points} points!") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def points(self, event, user):\n if not self.checkPerms(event, \"mod\"):\n return\n event.msg.delete()\n if not str(user) in self.participants.keys():\n message = \"This user has not participated in the event yet.\"\n else:\n message = \"Points so far fo... | [
"0.6295395",
"0.6198117",
"0.6163108",
"0.61107635",
"0.60114384",
"0.59564227",
"0.59373504",
"0.57842314",
"0.5758313",
"0.572314",
"0.5715337",
"0.568637",
"0.5660312",
"0.5635703",
"0.56299436",
"0.5620789",
"0.5615362",
"0.5604543",
"0.5599886",
"0.5595842",
"0.55945617"... | 0.66765255 | 0 |
Prints that the user has lost a certain number of points. | def lose_point(self, points):
self.points -= points
print(f"Oh no! You have lost {points} point(s)! That means you now have {self.points} points!") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def showNbLevelLose(self) :\n nbLevelLose = 0\n for level in self.level_history :\n if level.result == 0:\n nbLevelLose += 1\n Scenario.messageGetNbLevelLose(nbLevelLose)",
"def player_lose(self):\r\n\r\n self.summary = (\" \" * 83) + \"YOU LOSE\"\r\n ... | [
"0.6341795",
"0.6303589",
"0.6055089",
"0.6032912",
"0.5981581",
"0.576775",
"0.5738321",
"0.5728738",
"0.5715829",
"0.5710318",
"0.56970185",
"0.5694103",
"0.5685966",
"0.5660271",
"0.5614931",
"0.5583165",
"0.55793786",
"0.55679923",
"0.5566543",
"0.55512065",
"0.55066997",... | 0.7405634 | 0 |
Check if program is paused | def is_paused(self):
return self.pause | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paused(self) -> bool:",
"def is_paused(self):\n return self._is_paused",
"def is_paused(self):\n self.get_state()\n return self._is_paused()",
"def _is_paused(self):\n self.paused = self.state == 0\n return self.paused",
"def is_paused(self):\n return not self.... | [
"0.8045834",
"0.743452",
"0.74097407",
"0.73986506",
"0.7395203",
"0.7352385",
"0.7223583",
"0.71946",
"0.70427316",
"0.6981936",
"0.6897812",
"0.68908",
"0.6877727",
"0.6867015",
"0.68560666",
"0.6597903",
"0.6584473",
"0.65398806",
"0.6531661",
"0.6517159",
"0.64821386",
... | 0.7790882 | 1 |
Return the address depending on the offset of the parameter {1, 2, 3} and mode of the instruction {0, 1, 2} | def get_address(self, mode, offset):
address = None
if mode == 0:
address = self.data[ self.pos + offset ]
elif mode == 1:
address = self.pos + offset
elif mode == 2:
address = self.rel_pos + self.data[ self.pos + offset ]
else:
print("FAIL - wrong mode parameter")
return address | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_address(self, index, mode):\n if mode == IMMEDIATE_MODE:\n return index\n elif mode == POSITION_MODE:\n return self.program[index]\n elif mode == RELATIVE_MODE:\n return self.program[index] + self.relative_base\n raise Exception(f\"unknown mode: ... | [
"0.6668745",
"0.6327547",
"0.5890035",
"0.57063246",
"0.5650212",
"0.55881464",
"0.5513472",
"0.5477615",
"0.545401",
"0.5398909",
"0.5370811",
"0.5368167",
"0.53471595",
"0.5330211",
"0.5236021",
"0.5231211",
"0.5202355",
"0.5170001",
"0.51551473",
"0.51044565",
"0.5052717",... | 0.73673 | 0 |
Set the addr of data or registers to the value passed | def set_data(self, addr, value):
if addr < 0:
print("FAIL - negative address")
if addr >= len(self.data):
self.regs[ addr ] = value
else:
self.data[ addr ] = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_address_value(cls, addr, val):\n\t\tprint \" Called set_address_value({}, {})\".format(addr, val)\n\t\ttype = abs(addr) // 1000 # integer division\n\t\trelative_address = abs(addr) - (type * 1000)\n\t\tprint \"> Rel = {} - {}\".format(abs(addr), (type * 1000))\n\t\tprint \"> Set mem value: type = {}, addr... | [
"0.73658466",
"0.7286056",
"0.6579337",
"0.65497005",
"0.652987",
"0.6482303",
"0.6474041",
"0.6472174",
"0.6444143",
"0.6431403",
"0.6389778",
"0.63475466",
"0.6292115",
"0.6291647",
"0.62172794",
"0.61805683",
"0.6144672",
"0.61247176",
"0.6120023",
"0.6089628",
"0.60878253... | 0.8273164 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.