query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Process a PayPal or Google Checkout based anonymous contribution.
def anon_contribute_by_payment_mode(request, campaign_id, payment_mode, template='campaign/campaign_contribution_form_%s_anon.html'): campaign = get_object_or_404(Campaign.objects.active(), pk=campaign_id) payment_option = campaign.artist.get_merchant_account(payment_mode) if not payment_option: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paypal_notification(request, payment_mode='paypal'):\r\n try:\r\n data = request.POST\r\n _log.debug(\"PayPal IPN data: %s\", repr(data))\r\n\r\n if not paypal.verify_ipn_request(request):\r\n return HttpResponse()\r\n\r\n if data.get('payment_status', None) != \"Compl...
[ "0.6373298", "0.5703084", "0.5503658", "0.5475027", "0.5220315", "0.5134288", "0.51226735", "0.505278", "0.4990776", "0.493464", "0.49269527", "0.48673046", "0.4841768", "0.4832216", "0.48186994", "0.48010457", "0.47885463", "0.4726758", "0.47251117", "0.47234315", "0.4698482...
0.596364
1
Redeem a campaign ticket.
def redeem_ticket(request, template='campaign/redeem_ticket.html'): ticket_code = request.session.get('open_ticket_code', None) try: del request.session['open_ticket_code'] except KeyError: pass if request.POST or ticket_code: data = request.POST.copy() if ticket_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transfer_ticket(self, ticket_id):\n ticket = self.zendesk.get_ticket(ticket_id)\n subject = ticket[\"ticket\"][\"subject\"]\n status = ticket[\"ticket\"][\"status\"]\n description = ticket[\"ticket\"][\"description\"]\n if ticket[\"ticket\"][\"assignee_id\"] is not None:\n ...
[ "0.56641316", "0.5631388", "0.5553566", "0.5517005", "0.54539233", "0.5423735", "0.53499913", "0.534691", "0.52912635", "0.528025", "0.5250913", "0.52281886", "0.5220547", "0.5217796", "0.5214232", "0.5193973", "0.5187849", "0.51704186", "0.5169197", "0.51427704", "0.5139206"...
0.68725705
0
Process a return from PayPal's or Google's payment screen and redirect to the campaign's detail view. ``inv_id`` is the id of a``PendingContribution``. ``success_code`` is 1 or 0 for successful or cancelled payments respectively.
def payment_return(request, campaign_id, inv_id, success_code, payment_mode): campaign = get_object_or_404(Campaign, pk=campaign_id) if int(success_code) == 1: request.user.message_set.create(message=_('Thank you for your contribution.')) else: # User cancelled payment. request...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_success_request(self) -> HttpResponse: # noqa: C901\n request = self.request\n logger.debug(\n \"Handling Bambora user return request, params: {}.\".format(request.GET)\n )\n\n order_number, _timestamp = request.GET.get(\"ORDER_NUMBER\", \"-\").split(\"-\")\n ...
[ "0.5307607", "0.5205897", "0.5190838", "0.51417315", "0.50907296", "0.499538", "0.4893905", "0.48899612", "0.48739493", "0.48201224", "0.4802943", "0.4783593", "0.4728882", "0.47266012", "0.45329785", "0.45301113", "0.4483462", "0.44707704", "0.44324645", "0.4429951", "0.4421...
0.70670295
0
Receive PayPal IPN (Instant Payment Notification.)
def paypal_notification(request, payment_mode='paypal'): try: data = request.POST _log.debug("PayPal IPN data: %s", repr(data)) if not paypal.verify_ipn_request(request): return HttpResponse() if data.get('payment_status', None) != "Completed": # Do...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_ipn(data):\n data = dict(data)\n data['cmd'] = '_notify-validate'\n resp = requests.post(app.config['PAYPAL']['endpoint'], data=data)\n if resp.text == 'VERIFIED':\n return True\n return False", "def google_notification(request, payment_mode='google'):\r\n # ack_xml = '''<noti...
[ "0.6576129", "0.6399067", "0.57707894", "0.57616985", "0.5696024", "0.55341643", "0.51714045", "0.50293285", "0.5019871", "0.5008682", "0.49326146", "0.48892364", "0.4883548", "0.48674527", "0.4850678", "0.4834348", "0.4818443", "0.47996423", "0.47809997", "0.47706395", "0.47...
0.6606561
0
Receive notification of a campaign payment completed via Google Checkout.
def google_notification(request, payment_mode='google'): # ack_xml = '''<notification-acknowledgment xmlns="http://checkout.google.com/schema/2" serial-number="%s"/>\n\n''' ack_html = '''_type=notification-acknowledgment&serial-number=%s\n\n''' processed_response = None try: data = request....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def awaiting_payment(self):", "def collect_payment():\n\n # 1. Get required arguments\n args = Eg014Controller.get_args()\n try:\n # 2. Call the worker method\n results = Eg014Controller.worker(args)\n except ApiException as err:\n return process_error(err)\n\n # 3. Render suc...
[ "0.63564783", "0.62235355", "0.6013158", "0.57708764", "0.55319244", "0.551384", "0.55091786", "0.54820347", "0.54349434", "0.5395289", "0.5389404", "0.5342692", "0.5317579", "0.53085405", "0.5292847", "0.527213", "0.52671003", "0.52018356", "0.5181457", "0.51404744", "0.5083...
0.66050917
0
Return the lowest cost path, starting from start state,
def lowest_cost_search(start, successors, is_goal, action_cost): explored = set() frontier = [ [start] ] if is_goal(start): return frontier[0] while frontier: path = frontier.pop(0) state1 = final_state(path) if is_goal(state1): return path explored.ad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lowest_cost_search(start, successors, is_goal, action_cost):\r\n # your code here\r\n explored = set()\r\n frontier = [ [start] ]\r\n while frontier:\r\n path = frontier.pop(0)\r\n state1 = final_state(path)\r\n if is_goal(state1):\r\n return path\r\n explored...
[ "0.79001284", "0.7815893", "0.75089973", "0.7477071", "0.73168325", "0.73155445", "0.7228358", "0.70762277", "0.70678824", "0.69976723", "0.69821614", "0.6907217", "0.6877946", "0.6854953", "0.6824021", "0.6787544", "0.67676026", "0.67614686", "0.67411", "0.67290896", "0.6712...
0.7975087
0
Take given data of format from scraper [link] and return the inputs and outputs seperated.
def split_data_into_input_and_output(data): data_in, data_out = list(zip(*[((x["synopsis"]), x["gross"]) for x in data])) return np.array(data_in), np.array(data_out)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_page_data(page_data: List[str]) -> List[Tuple[Any]]:\r\n processed_data: List[Tuple[Any]] = []\r\n for item in page_data:\r\n ram_soup = soup(item, \"html.parser\")\r\n list_wrap = ram_soup.find(\"div\", {\"class\": \"list-wrap\"})\r\n containers = list_wrap.findAll(\"div\", ...
[ "0.6079666", "0.60285807", "0.5801785", "0.58000124", "0.5715568", "0.57005036", "0.5667928", "0.56585526", "0.56310904", "0.56036556", "0.553412", "0.5504417", "0.54888403", "0.5465348", "0.54540986", "0.544446", "0.54395825", "0.5422634", "0.5402472", "0.5396441", "0.538167...
0.55986524
10
If the given data has no signal we cant fit a NN to it. As such, here we append how much the film grossed into the synopsis of each title.
def add_signal(data): for row in data: row["synopsis"] = row["synopsis"] + f' The film grossed ${row["gross"]}'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def augment_train_data(self):\n # do not augment on evaluation dataset\n original_len = len(self.data_train)\n for i in range(len(self.data_train)):\n if i % 100 == 0:\n print(f\"Augmenting train data, progress: {i} / {original_len}\")\n title = self.data_t...
[ "0.6041654", "0.5983893", "0.5946179", "0.5698321", "0.568227", "0.5643324", "0.5570708", "0.5536342", "0.54949754", "0.54921573", "0.5448862", "0.54424274", "0.5428731", "0.5355646", "0.5353451", "0.53421974", "0.5312379", "0.53115404", "0.5311278", "0.53052354", "0.5284356"...
0.548929
10
lab = label pred = prediction
def confusion_plot(lab, pred, name, new_plot=False, save=False): plt.scatter(lab, lab, label="truth", s=2, color="black") plt.scatter(lab, pred, label=name, s=2) handles, labels = plt.gca().get_legend_handles_labels() by_label = dict(zip(labels, handles)) plt.legend(by_label.values(), by_label.keys(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict_label(self, src): # real signature unknown; restored from __doc__\n pass", "def predict_label(img, net_model, label):\n img1 = cv2.resize(img, (80, 80))\n predict = net_model.predict(img1.reshape(1, 80, 80, 3))\n maxi = predict[0][0]\n curs = 0\n test = 0\n for i, pred in enu...
[ "0.7578711", "0.7256652", "0.72129387", "0.709207", "0.709207", "0.7090782", "0.70615506", "0.69712365", "0.6934177", "0.6934177", "0.6934177", "0.68250227", "0.67455095", "0.67181236", "0.6708249", "0.66727287", "0.6672353", "0.66713417", "0.66713417", "0.6652546", "0.664587...
0.0
-1
String representation for a string to value map
def _reprOfStringToValueMap (stringMap : Map) -> String: entrySeparator = u"§" entryTemplate = "%s: %s" keyList = sorted(list(stringMap.keys())) result = "" for key in keyList: value = stringMap[key] result += (iif(result == "", "", entrySeparator) + entryTe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valueToString():", "def str_dict(d):\n return \", \".join(\"%s=%s\" % (k, d[k]) for k in d)", "def __str__(self):\n return '({0},{1})'.format(self.key, self.value)", "def __str__(self):\n return '(' + str(self.key) + ': ' + str(self.value) + ')'", "def __str__(self):\n return '(...
[ "0.6723412", "0.66615885", "0.6657132", "0.66348654", "0.66348654", "0.65340376", "0.65042675", "0.6488888", "0.647782", "0.6375239", "0.63170457", "0.63118005", "0.63005364", "0.62862843", "0.62133026", "0.61995703", "0.6197091", "0.6170143", "0.6162775", "0.6158538", "0.614...
0.7466139
0
Initializes token with start position, token text, token kind and value
def __init__ (self, start : Natural, text : String, kind : String, value : Object): self.start = start self.text = text self.kind = kind self.value = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, token_type, token_value: str):\n super().__init__(token_type)\n self.token_value = token_value", "def __init__(self, tokenType, value = None):\r\n\t\tif not tokenType in VALID_TOKEN_TYPES:\r\n\t\t\traise ValueError(\"Invalid token type '{}' given\".format(tokenType))\r\n\r\n\t\ts...
[ "0.74293166", "0.71529675", "0.7098566", "0.68082476", "0.68082476", "0.68082476", "0.6787119", "0.67069674", "0.6701436", "0.6578326", "0.6462142", "0.6450583", "0.635739", "0.6300707", "0.6180748", "0.6158519", "0.6149903", "0.6079522", "0.59513485", "0.5935185", "0.5913402...
0.6379974
12
String representation for token
def __repr__ (self) -> String: st = ("_Token(%r, '%s', %s, %r)" % (self.start, self.text, self.kind, self.value)) return st
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token(self) -> str:", "def __str__(self):\n return str(self.__token)", "def __str__(self):\n return 'Token({type}, {value})'.format(\n type=self.type,\n value=repr(self.value)\n )", "def __str__(self):\n return 'Token({type}, {value})'.format(\n ...
[ "0.84385175", "0.8271868", "0.8108106", "0.8108106", "0.8108106", "0.8108106", "0.8025444", "0.7961858", "0.7831813", "0.77703315", "0.77629703", "0.7296134", "0.72331005", "0.7230163", "0.7209733", "0.7145438", "0.71215254", "0.709473", "0.7079108", "0.7064358", "0.7064358",...
0.76976573
11
Takes string and constructs either a boolean, a numeric value or a sanitized string.
def _adaptConfigurationValue (cls, value : String) -> Object: Logging.trace(">>: %r", value) uppercasedValue = value.upper() if uppercasedValue in cls._validBooleanValueNames: result = (uppercasedValue in cls._trueBooleanValueNames) elif (cls._integerRegExp.match(value) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _eval(string):\n if not isinstance(string, basestring):\n return string\n if string == \"None\": \n return None\n if string == \"True\":\n return True\n if string == \"False\":\n return False\n if string.isdigit():\n return int(string)\n try:\n return...
[ "0.70763725", "0.7070949", "0.703633", "0.700966", "0.70024306", "0.6884788", "0.68035024", "0.6691395", "0.6654061", "0.66312927", "0.65971744", "0.65764135", "0.6497012", "0.6495254", "0.6387742", "0.63626915", "0.63522667", "0.63450927", "0.6314167", "0.62991416", "0.62868...
0.0
-1
Combines possibly fragmented external representation of a string given by into a sanitized string.
def _combineFragmentedString (cls, st : String) -> String: Logging.trace(">>: %r", st) ParseState_inLimbo = 0 ParseState_inOther = 1 ParseState_inString = 2 ParseState_inLiteral = 3 ParseState_inEscape = 4 parseState = ParseState_inLimbo result = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unquote_safe(s, unsafe_list):\n # note: this build utf8 raw strings ,then does a .decode('utf8') at the end.\n # as a result it's doing .encode('utf8') on each block of the string as it's processed.\n res = _utf8(s).split('%')\n for i in xrange(1, len(res)):\n item = res[i]\n try:\n ...
[ "0.5980609", "0.5755826", "0.57391524", "0.5704989", "0.5646", "0.5615367", "0.5597561", "0.5580975", "0.5558899", "0.55469626", "0.54785067", "0.54588276", "0.5450141", "0.54342884", "0.54277486", "0.5427447", "0.53720134", "0.53665626", "0.5333563", "0.53186095", "0.5312367...
0.0
-1
Expands all variables embedded in .
def _expandVariables (self, st : String) -> String: Logging.trace(">>: %r", st) cls = self.__class__ # collect identifiers embedded in value and replace them by # their value ParseState_inLimbo = 0 ParseState_inString = 1 ParseState_inEscape = 2 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand_vars(self, line, name_dict):\n if '%' not in line:\n return line\n for k, v in name_dict.iteritems():\n line = line.replace('%VAR_' + k + '%', escape(v))\n return line", "def expand_vars(args, diff=()):\n replacer = Placeholders(diff=diff)\n ret...
[ "0.6162648", "0.6160329", "0.58408123", "0.5776226", "0.561078", "0.55938995", "0.5592785", "0.55764043", "0.5556073", "0.5541273", "0.5539711", "0.55256486", "0.5512433", "0.5484812", "0.54581267", "0.5455816", "0.54464215", "0.5433427", "0.5399424", "0.5390867", "0.5338721"...
0.0
-1
Returns string representation of associated identifier value for ; if not found in current key to value map, the identifier itself is returned
def _findIdentifierValue (self, identifier : String) -> String: Logging.trace(">>: %s", identifier) cls = self.__class__ if identifier not in self._keyToValueMap: # leave identifier as is (it might be some value name like # wahr or false Logging.traceError("...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ident(self):\n key_values = [unicode(self.db_key[k]) for k in self.db_key]\n return \"Position (\" + ', '.join(key_values) + \")\"", "def get_identifier_string(self):\n return self.identifier", "def __str__(self):\n return '(' + str(self.key) + ': ' + str(self.value) + ')'", ...
[ "0.5909048", "0.58781356", "0.5796385", "0.5796385", "0.57949334", "0.5659293", "0.5657731", "0.5601299", "0.5601299", "0.5600478", "0.5569756", "0.5562239", "0.55307454", "0.55261767", "0.551171", "0.550825", "0.54956865", "0.5493071", "0.5491545", "0.54761845", "0.54655385"...
0.6844378
0
Returns file name in search paths based on
def _lookupFileName (self, enclosingDirectoryName : String, originalFileName : String) -> String: Logging.trace(">>: directory = %r, file = %r", enclosingDirectoryName, originalFileName) cls = self.__class__ result = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(cls, name, lookup=[]):\r\n if os.path.isfile(name): return name\r\n for spath in lookup:\r\n fname = os.path.join(spath, name)\r\n if os.path.isfile(fname):\r\n return fname\r\n for ext in cls.extensions:\r\n if os.path.isfile(...
[ "0.7638885", "0.73497194", "0.73497194", "0.7327317", "0.72472686", "0.70664126", "0.7015206", "0.70128715", "0.6895865", "0.6734751", "0.6724164", "0.66758233", "0.66646725", "0.66524905", "0.6638574", "0.6630043", "0.662516", "0.65974027", "0.65406924", "0.6537741", "0.6516...
0.70027256
8
Merges continuation lines in into single cumulated line and replaces continuations by empty lines (to preserve line
def _mergeContinuationLines (cls, lineList : StringList): Logging.trace(">>") cumulatedLine = "" markerLength = len(cls._continuationMarker) lineListLength = len(lineList) for i, originalLine in enumerate(lineList): currentLine = originalLine.strip() l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_line_continuations(code):\n # pat = r\"('.*)(\\.\\.\\.)(.*')\"\n # code = re.sub(pat, r\"\\g<1>\\g<3>\", code, flags=re.MULTILINE)\n\n pat = r\"^([^%'\\\"\\n]*)(\\.\\.\\..*\\n)\"\n code = re.sub(pat, r\"\\g<1>\", code, flags=re.MULTILINE)\n return code", "def evaluate_line_continuations...
[ "0.632266", "0.62321156", "0.57464445", "0.53904647", "0.53602", "0.52938676", "0.52780247", "0.52217114", "0.5165691", "0.51586413", "0.51507574", "0.5148912", "0.5105856", "0.50744593", "0.50576735", "0.50505483", "0.50486463", "0.5046026", "0.5037575", "0.50359184", "0.503...
0.71371007
0
Ensures that is of a kind in ; if is not None, token value is also checked
def _mustHave (cls, token : _Token, kindSet : StringSet, valueSet : ObjectSet = None): Logging.trace(">>: token = %r, kindSet = %r, valueSet = %r", token, kindSet, valueSet) errorPosition, errorMessage = -1, "" if token.kind not in k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def issafe(arg):\n return arg.find(';') == -1 and arg.find('|') == -1", "def test_peek_none(self):\n nt = NewickTokenizer(newick='(a,(b,c));')\n nt.tokens()\n self.assertIsNone(nt._peek())", "def _expect_empty(self):\n\n item = self._lexer.get_token()\n if item:\n ...
[ "0.5821828", "0.5813745", "0.55833197", "0.5573724", "0.5496624", "0.5417123", "0.54163474", "0.5394906", "0.53898376", "0.5377175", "0.53525305", "0.5310379", "0.53064024", "0.53017074", "0.52943665", "0.52812845", "0.5275299", "0.52562255", "0.5202314", "0.5170062", "0.5159...
0.48295587
67
Parses configuration file data given by and updates key to value and key to string value map.
def _parseConfiguration (self, lineList : StringList): Logging.trace(">>") cls = self.__class__ cls._mergeContinuationLines(lineList) for i, currentLine in enumerate(lineList): lineNumber = i + 1 # remove leading and trailing white space from line ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_data_config(path):\n cfg = dict()\n cfg['gpus'] = '0,1,2,3'\n cfg['num_workers'] = '10'\n \n with open(path, 'r') as fp:\n lines = fp.readlines()\n for line in lines:\n line = line.strip()\n if line == '' or line.startswith('#'):\n continue\n key, ...
[ "0.6310399", "0.6168418", "0.60951", "0.5952508", "0.594172", "0.58200586", "0.5793364", "0.5778151", "0.57627004", "0.5718471", "0.5715545", "0.57099646", "0.57051796", "0.5693157", "0.56849927", "0.5684658", "0.56639075", "0.5662061", "0.5647733", "0.56444407", "0.5632023",...
0.5831359
5
Appends lines of configuration file with to with leading and trailing whitespace stripped; also handles embedded imports of files (relative to ; tells which files have already been visited
def _readFile (self, directoryName : String, fileName : String, lineList : StringList, visitedFileNameSet : StringSet): Logging.trace(">>: fileName = %r, directory = %r, visitedFiles = %r", fileName, directoryName...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _applyIncludes(self, origfile, _file = file):\n opt = \"include_config\"\n try:\n try:\n includes = self._config.get(\"general\", opt, raw = True).strip()\n except ConfigParser.NoOptionError:\n opt = \"include-config\"\n includes ...
[ "0.59826267", "0.5473369", "0.53376997", "0.521364", "0.5188674", "0.5150931", "0.5146612", "0.5105637", "0.50943565", "0.5074285", "0.50644237", "0.50644237", "0.4991545", "0.49853146", "0.49786365", "0.4973733", "0.49460754", "0.49412823", "0.49387655", "0.493013", "0.49267...
0.0
-1
Sets list of search paths to .
def setSearchPaths (cls, searchPathList : StringList): Logging.trace(">>: %r", searchPathList) cls._searchPathList = ["."] + searchPathList Logging.trace("<<")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_paths(self, paths):\n self.paths = paths", "def set_paths(self, paths):\n self._paths = paths\n self._paths_set = True", "def SetPythonPaths(self):\n _knownPaths = site._init_pathinfo()\n for name, value, junk in self._marchConfig():\n if isinstance(value, ...
[ "0.68462783", "0.6627446", "0.65913725", "0.65353215", "0.6467541", "0.64639115", "0.63712513", "0.63694894", "0.63314074", "0.6320922", "0.631195", "0.6294908", "0.6247503", "0.622521", "0.61129904", "0.59953964", "0.5986615", "0.59491456", "0.5936939", "0.5894814", "0.58811...
0.82994115
0
Parses configuration file given by and sets internal key to value map.
def __init__ (self, fileName : String): Logging.trace(">>: %r", fileName) self._keyToValueMap = {} self._keyToStringValueMap = {} visitedFileNameSet = set() lineList = [] isOkay = self._readFile("", fileName, lineList, visitedFileNameSet) self._parseConfiguratio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config(self):\n\n with open(os.path.expanduser(self.config_filename), 'r') as f:\n lines = f.readlines()\n\n _usable = lambda l: not(l.startswith('#') or l.strip() == '')\n lines = filter(_usable, lines)\n\n def _build_config(key, value, d):\n \"\"\" Calle...
[ "0.65182775", "0.64568365", "0.6327328", "0.63010305", "0.6259645", "0.6236191", "0.6172959", "0.6125023", "0.61192733", "0.61093795", "0.61044985", "0.6075588", "0.6059768", "0.6045328", "0.6028862", "0.60261595", "0.60115445", "0.6010604", "0.5999662", "0.59776324", "0.5975...
0.60789394
11
Returns mapping from all keys in configuration file to their effective values
def asStringMap (self) -> StringMap: Logging.trace(">>") result = dict(self._keyToValueMap) Logging.trace("<<: %r", result) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_config_file() -> typing.MutableMapping[str, typing.Any]:\n return _read_file()", "def restart_map():\n _map = []\n for f, ctxt in CONFIG_FILES.iteritems():\n svcs = []\n for svc in ctxt['services']:\n svcs.append(svc)\n if svcs:\n _map.append((f, svcs)...
[ "0.62769425", "0.60250276", "0.6007226", "0.596452", "0.5918034", "0.5843192", "0.5808663", "0.5807805", "0.5803397", "0.5797582", "0.5762901", "0.57512045", "0.5747105", "0.5734561", "0.5713143", "0.5700877", "0.56251377", "0.56208295", "0.5618294", "0.56151855", "0.56107074...
0.0
-1
Returns mapping from all keys in configuration file to their string values as found in the file
def asDictionary (self) -> Dictionary: Logging.trace(">>") result = dict(self._keyToStringValueMap) Logging.trace("<<: %r", result) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_config_file() -> typing.MutableMapping[str, typing.Any]:\n return _read_file()", "def read_mappings(fname):\n mapping = {}\n for line in open(fname):\n vals = line.strip().split('\\t')\n if len(vals) < 2: continue\n mapping[vals[0]] = vals[1]\n return mapping", "def _r...
[ "0.6537312", "0.60428214", "0.6030933", "0.60305786", "0.60219365", "0.5971801", "0.59504783", "0.5926337", "0.5915486", "0.58640057", "0.5861613", "0.5857182", "0.58519226", "0.5825162", "0.580197", "0.5787843", "0.5786739", "0.5770356", "0.57355756", "0.5712807", "0.5712807...
0.0
-1
Returns set of all keys in configuration file
def keySet (self) -> StringSet: Logging.trace(">>") result = set(self._keyToValueMap.keys()) Logging.trace("<<: %r", result) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keys(self):\n return self.config.keys()", "def keys(self):\n return self.config.keys()", "def get_setting_keys(self):\n return self.do_rpc(\"get_setting_keys\")", "def get_all_keys(self):\n return self.psettings.allKeys()", "def get_config_keys():\n global _allowed_config...
[ "0.7790183", "0.7790183", "0.7384112", "0.7375076", "0.7105019", "0.70563525", "0.70167387", "0.69515896", "0.69376314", "0.69376314", "0.69025695", "0.6888922", "0.6832754", "0.6829535", "0.682636", "0.68065333", "0.6797182", "0.6766179", "0.669738", "0.66707116", "0.6668752...
0.70229256
6
Returns value for in configuration file; if is missing, an error message is logged when there is no associated value, otherwise is returned for a missing entry
def value (self, key : String, defaultValue : Object = missingValue) -> Object: Logging.trace(">>: key = %s, defaultValue = %r", key, defaultValue) isMandatory = (defaultValue == missingValue) result = None if key in self._keyToValue...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_config(config, section, item):\n value = config.get(section, item)\n if value == \"None\":\n return None\n return value", "def config_value(name):\n def get():\n try:\n return config.get('yourls', name)\n except (NoOptionError, NoSectionError):\n re...
[ "0.67917", "0.6635625", "0.6563727", "0.64952976", "0.64884275", "0.64454025", "0.63905793", "0.6375485", "0.629574", "0.62699145", "0.6211306", "0.62047195", "0.61872745", "0.617998", "0.6173474", "0.6172952", "0.6149519", "0.6134496", "0.6125716", "0.6074267", "0.6069744", ...
0.0
-1
Only load the module if apache is installed
def __virtual__(): if _apikey(): return True return ( False, 'The API key was not specified. Please specify it using the "apikey" config.', )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __virtual__():\n cmd = _detect_os()\n if salt.utils.path.which(cmd):\n return \"apache\"\n return (\n False,\n \"The apache execution module cannot be loaded: apache is not installed.\",\n )", "def apache(self):\n self.summarize_operation(\"Installing Apache Web Server...
[ "0.68103963", "0.6424718", "0.6423451", "0.61203414", "0.6101222", "0.6006222", "0.59959805", "0.5972969", "0.59617776", "0.5927091", "0.5924863", "0.57398", "0.5661964", "0.5608795", "0.5575795", "0.5574128", "0.55290484", "0.54831946", "0.5465866", "0.5440239", "0.5419415",...
0.0
-1
Get the API key
def _apikey(): return __opts__.get("bamboohr", {}).get("apikey", None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_api_key(self):\r\n url = '{0}/{1}'.format(self.get_url(), 'api_key')\r\n\r\n return http.Request('GET', url), parsers.parse_json", "def get_api_key(api_key):\n api.get(api_key)", "def api_key(self):\n return self._api_key", "def api_key(self):\n return self.__creds.api_...
[ "0.89945996", "0.8524351", "0.840441", "0.8323821", "0.83030087", "0.83011305", "0.83011305", "0.83011305", "0.83011305", "0.8222898", "0.81584", "0.81584", "0.81180537", "0.8111266", "0.8042683", "0.786292", "0.78575736", "0.78522336", "0.7848158", "0.78442097", "0.78429556"...
0.7700787
33
Show all employees for this company.
def list_employees(order_by="id"): ret = {} status, result = _query(action="employees", command="directory") root = ET.fromstring(result) for cat in root: if cat.tag != "employees": continue for item in cat: emp_id = next(iter(item.values())) emp_ret =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_employees(request, company_id=None):\n current_employee = Employee.objects.get(user__pk=request.user.pk)\n company_super_user = current_employee.isCompanySuperUserOrHigher()\n if company_id:\n company = Company.objects.get(pk=company_id)\n else:\n company = current_employee.compan...
[ "0.7872654", "0.7634882", "0.74686563", "0.73382276", "0.7263343", "0.7216713", "0.71493816", "0.71192384", "0.7012556", "0.6841546", "0.6775984", "0.6766217", "0.675149", "0.6706652", "0.6450483", "0.63677967", "0.6324923", "0.6319123", "0.62385494", "0.6153163", "0.61480546...
0.59792286
22
Show all employees for this company.
def show_employee(emp_id, fields=None): ret = {} if fields is None: fields = ",".join( ( "canUploadPhoto", "department", "displayName", "firstName", "id", "jobTitle", "lastName", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_employees(request, company_id=None):\n current_employee = Employee.objects.get(user__pk=request.user.pk)\n company_super_user = current_employee.isCompanySuperUserOrHigher()\n if company_id:\n company = Company.objects.get(pk=company_id)\n else:\n company = current_employee.compan...
[ "0.7872759", "0.76351726", "0.74689776", "0.7336205", "0.72626585", "0.72163236", "0.71485955", "0.71182954", "0.70109284", "0.6840929", "0.6775324", "0.67646873", "0.6752035", "0.6707513", "0.64506286", "0.6367168", "0.63260454", "0.63192195", "0.6239045", "0.61484945", "0.6...
0.6154354
19
Update one or more items for this employee. Specifying an empty value will clear it for that employee.
def update_employee(emp_id, key=None, value=None, items=None): if items is None: if key is None or value is None: return {"Error": "At least one key/value pair is required"} items = {key: value} elif isinstance(items, str): items = salt.utils.yaml.safe_load(items) xml_it...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, items: Mapping[Any, Any]) -> None:\n self.extend(list(items.values()))\n return", "def update(self, *items):\n for item in items:\n self.add(item)", "def update_item(self, id: str, user: User, **kwargs) -> None:", "def update_items(self, request, *a, **kw):\n ...
[ "0.62127465", "0.61989135", "0.6134278", "0.6095077", "0.60757583", "0.60266775", "0.5949175", "0.5913471", "0.5824841", "0.5775372", "0.5750113", "0.57272786", "0.57065195", "0.56633925", "0.56531554", "0.5622812", "0.56077135", "0.56035596", "0.5586695", "0.55599886", "0.54...
0.6439496
0
Show all users for this company.
def list_users(order_by="id"): ret = {} status, result = _query(action="meta", command="users") root = ET.fromstring(result) for user in root: user_id = None user_ret = {} for item in user.items(): user_ret[item[0]] = item[1] if item[0] == "id": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_users():\n\n users = crud.get_users()\n\n return render_template('all_users.html', users=users)", "def show_users():\n\n user = User(connection=connection, cursor=cursor)\n\n all_users = user.get_all_users()\n\n context = {\n 'all_users': all_users\n }\n\n return render_templa...
[ "0.7302377", "0.72287637", "0.7109827", "0.69417936", "0.6856711", "0.68548924", "0.67848665", "0.6717104", "0.6689702", "0.66741294", "0.666934", "0.6622241", "0.66180104", "0.661377", "0.65867805", "0.6585776", "0.6574805", "0.65646803", "0.65598726", "0.65598726", "0.65598...
0.0
-1
Show all meta data fields for this company.
def list_meta_fields(): ret = {} status, result = _query(action="meta", command="fields") root = ET.fromstring(result) for field in root: field_id = None field_ret = {"name": field.text} for item in field.items(): field_ret[item[0]] = item[1] if item[0] ==...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_fields(self):\n fields = []\n for f in self._meta.fields:\n\n fname = f.name \n # resolve picklists/choices, with get_xyz_display() function\n get_choice = 'get_'+fname+'_display'\n if hasattr( self, get_choice):\n value = ...
[ "0.63180304", "0.6235449", "0.59543186", "0.5739981", "0.5733114", "0.5728143", "0.5680151", "0.5634569", "0.5624671", "0.5574427", "0.55651516", "0.5556688", "0.55432194", "0.55249697", "0.54736274", "0.54564404", "0.54484874", "0.5447442", "0.5430577", "0.5414239", "0.54125...
0.6288093
1
Make a web call to BambooHR The password can be any random text, so we chose Salty text.
def _query(action=None, command=None, args=None, method="GET", data=None): subdomain = __opts__.get("bamboohr", {}).get("subdomain", None) path = "https://api.bamboohr.com/api/gateway.php/{}/v1/".format(subdomain) if action: path += action if command: path += "/{}".format(command) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_password_page(self, error=None):\n # TODO: Make use of \"error\".\n # TODO: add styling\n return \"\"\"\n<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"UTF-8\">\n <title>title</title>\n </head>\n <body>\n <form>\n Email Address:<br>\n <input id=\"email\" t...
[ "0.6120072", "0.5836202", "0.57576877", "0.570071", "0.56842643", "0.5647777", "0.5641218", "0.556389", "0.5555022", "0.5539118", "0.551953", "0.5516611", "0.55077904", "0.54923356", "0.5470385", "0.54577637", "0.545019", "0.5434154", "0.53906393", "0.5384684", "0.537655", ...
0.5092449
78
\brief Stop the write flush timer.
def stopTimer(self): log.debug("SwitchDB: stopping flush timer") self.__flush_timer.stop() self.flushWrites()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stopWrite(self):\n\n self.dowrite = False", "def stop_timer(self):\n self.end_time = datetime.now()", "def stop_timer(self):\n self.log.info(\"{} timer stopped ({} seconds)\".format(self.name, self.interval))\n self.start_event.clear()\n # self.count = self.interval / sel...
[ "0.7037228", "0.6424918", "0.62180656", "0.6174741", "0.60519195", "0.6048231", "0.60435826", "0.60333914", "0.5959563", "0.5948373", "0.59198564", "0.5895208", "0.5839709", "0.580128", "0.5790531", "0.57885194", "0.5749805", "0.5743604", "0.57333773", "0.57209086", "0.570342...
0.8155102
0
\brief Flush any writes to disk.
def flushWrites(self): #log.debug("flushWrites(): Acquiring update lock.") self.__update_lock.acquire() #log.debug("flushWrites() has update lock.") if self.__writes_since_flush > 0: #log.debug("flushWrites(): Acquiring file locks.") for fileLock in self.__node_lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flush(self):\n self.fileobj.flush()", "def flush(self):\n self._write()", "def flush(self):\n for fp in self.files:\n fp.flush()\n if isinstance(fp, int) or hasattr(fp, \"fileno\"):\n try:\n os.fsync(fp)\n except OSErro...
[ "0.7776948", "0.7571886", "0.7562259", "0.7537057", "0.75116175", "0.75019747", "0.75019747", "0.75019747", "0.75019747", "0.74662924", "0.74490076", "0.74389756", "0.7412338", "0.74034125", "0.7378896", "0.7367023", "0.73400176", "0.73231196", "0.73231196", "0.73231196", "0....
0.7245433
25
Decorator for registering a rule with the rule factory.
def register_rule(factory_func=None): def decorator(cls): if factory_func is None: RuleFactory.register_rule(cls) else: RuleFactory.register_rule(lambda: factory_func(cls)) return cls return decorator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_rule(cls, rule_func):\n cls._rules_factories.append(rule_func)", "def register_rule(pattern: matcher.Pattern) -> Callable[..., rules.Rule]:\n\n def register(handler: Callable[..., Any]) -> rules.Rule:\n return rules.make_rule(pattern, handler)\n\n return register", "def add_rule(self, ...
[ "0.8259463", "0.7652915", "0.66059923", "0.65928054", "0.6551904", "0.65204674", "0.64615387", "0.64417386", "0.64297867", "0.64228624", "0.6336922", "0.6239316", "0.6231074", "0.6194358", "0.6129349", "0.6121821", "0.6108161", "0.6086128", "0.59606814", "0.59476435", "0.5836...
0.83662206
0
Returns an instantiated list of each rule that has been registered.
def get_rules(cls) -> list: return [factory() for factory in cls._rules_factories]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rules(self):\n rules = []\n for item in self.rule:\n rules.append(item)\n return rules", "def get_rules(self):\n rules = []\n for item in self.name:\n rules.append(item)\n return rules", "def getListOfRules(self):\n return self.mode...
[ "0.81854767", "0.8028653", "0.7681446", "0.747593", "0.7188627", "0.7024562", "0.6993731", "0.69882214", "0.67589486", "0.6748225", "0.67445904", "0.67356396", "0.6722869", "0.6689858", "0.6678105", "0.6660337", "0.6650291", "0.65893424", "0.6547568", "0.6512674", "0.6477749"...
0.81147885
1
Utility function used by the register_rule decorator to register a lambda/function to instantiate a rule.
def register_rule(cls, rule_func): cls._rules_factories.append(rule_func)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_rule(factory_func=None):\n def decorator(cls):\n if factory_func is None:\n RuleFactory.register_rule(cls)\n else:\n RuleFactory.register_rule(lambda: factory_func(cls))\n\n return cls\n return decorator", "def register_rule(pattern: matcher.Pattern) ...
[ "0.734958", "0.7176785", "0.63173115", "0.57214266", "0.5599516", "0.55994016", "0.55857486", "0.5585293", "0.5575238", "0.5558575", "0.5531269", "0.5498299", "0.5496348", "0.54958177", "0.54734015", "0.54484636", "0.54439145", "0.5400797", "0.5344353", "0.5344353", "0.534435...
0.7451927
0
>>> test_key('bwv66.6.mxl', 'different_key.mxl') False >>> test_key('bwv66.6.mxl', 'different_pitches.mxl') True >>> test_key('bwv66.6.mxl', 'different_ornaments.mxl') True >>> test_key('bwv66.6.mxl', 'different_key2.mxl',1) False >>> test_key('bwv66.6.mxl', 'different_key3.mxl', 5) False >>> test_key('bwv66.6.mxl', 's...
def test_key(score1, score2, measure=0, part=0): diff = ScoreDiff(score1, score2, path) return diff.have_same_key_signature(measure, part)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def func4(key):\n return key in list(my_test_dict.keys())", "def isValidKey(key):\n return True", "def func2(key):\n return key in my_test_dict.keys()", "def check_key(self, key, key_pkl):\r\n start_time = time.time()\r\n # Verify that when we reload the KeyData from the pickled file, th...
[ "0.67308366", "0.6689036", "0.6554257", "0.6496629", "0.63685757", "0.6172832", "0.6085646", "0.6074689", "0.6063078", "0.6014506", "0.6000377", "0.59025127", "0.590022", "0.5894023", "0.5891906", "0.58820397", "0.58645356", "0.58533293", "0.5843953", "0.5829784", "0.5824024"...
0.63992757
4
>>> test_time_signature('bwv66.6.xml', 'different_time.mxl') False >>> test_time_signature('bwv66.6.mxl', 'different_dynamics.mxl') True >>> test_time_signature('bwv66.6.mxl', 'different_key.mxl') True >>> test_time_signature('bwv66.6.mxl', 'different_time2.mxl', 5) False >>> test_time_signature('bwv66.6.mxl', 'differe...
def test_time_signature(score1, score2, measure = 0, part = 0): diff = ScoreDiff(score1, score2, path) return diff.have_same_time_signature(measure, part)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_signature_verification(self):\n curdir = os.path.dirname(os.path.abspath(__file__))\n keydir = os.path.join(curdir, \"data\", \"ima_keys\")\n\n lines = SIGNATURES.split('\\n')\n\n # empty keyring\n keyring = ima_file_signatures.ImaKeyring()\n self.assertTrue(ima.p...
[ "0.6361225", "0.5938662", "0.5742003", "0.56398404", "0.56322205", "0.5614221", "0.5570382", "0.5565186", "0.5562696", "0.5562569", "0.5561084", "0.5537023", "0.5530048", "0.5530048", "0.550574", "0.5453776", "0.5438577", "0.5410554", "0.5371119", "0.5326065", "0.52840763", ...
0.6932904
0
>>> test_clef('bwv66.6.mxl', 'different_clef.mxl') False >>> test_clef('bwv66.6.mxl', 'different_time.mxl') True >>> test_clef('bwv66.6.mxl', 'different_pitches.mxl') True >>> test_clef('bwv66.6.mxl', 'different_clef2.mxl', 1) False >>> test_clef('bwv66.6.mxl', 'different_clef3.mxl', 2) False >>> test_clef('bwv66.6.mxl...
def test_clef(score1, score2, measure = 0, part = 0): diff = ScoreDiff(score1, score2, path) return diff.have_same_clef_markings(measure, part)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tests_truth():\n circ_m = ccxtest(4)\n print(circ_m)\n circ_m = crootnxtest(4)\n print(circ_m)\n circ_m = oracletest(4)\n print(circ_m)\n circ_m = ccx_otest(4)\n print(circ_m)", "def _consonance_test(self, testfunc, param=None):\n n = list(self.notes)\n while len(n) > 1:...
[ "0.5843581", "0.5775546", "0.5584157", "0.5578372", "0.5539811", "0.544524", "0.5414274", "0.5412933", "0.53988796", "0.5382359", "0.53114665", "0.5242615", "0.5241555", "0.5241493", "0.5239952", "0.5205264", "0.5201015", "0.51927865", "0.5182268", "0.5157461", "0.51572466", ...
0.6404271
0
>>> test_pitches('bwv66.6.mxl', 'different_pitches.mxl') False >>> test_pitches('bwv66.6.mxl', 'different_pitches2.mxl', 1) False >>> test_pitches('bwv66.6.mxl', 'different_pitches2.mxl', 2) False >>> test_pitches('bwv66.6.mxl', 'different_dynamics.mxl') True >>> test_pitches('bwv66.6.mxl', 'different_key.mxl') True >>...
def test_pitches(score1, score2, measure = 0, part = 0): diff = ScoreDiff(score1, score2, path) return diff.have_same_pitches(measure, part)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_random_note_pitch(common_scales, all_pitches):\n\n for key, scales in common_scales.items():\n note = random_note_pitch(scales)\n assert note in all_pitches\n assert isinstance(note, (int, str)) is True", "def test_true_false_cases(file_with_true_and_false_value, result, inp):\n ...
[ "0.57925975", "0.5436552", "0.5393471", "0.53561616", "0.53336096", "0.53189737", "0.517428", "0.50872374", "0.5070097", "0.5059205", "0.5006668", "0.4995654", "0.49777004", "0.49690577", "0.4963465", "0.49614137", "0.49481976", "0.49456045", "0.4936992", "0.49341315", "0.492...
0.66385114
0
>>> test_ornaments('bwv66.6.mxl', 'different_ornaments.mxl') False >>> test_ornaments('bwv66.6.mxl', 'different_ornaments2.mxl') False >>> test_ornaments('bwv66.6.mxl', 'different_ornaments3.mxl') False >>> test_ornaments('bwv66.6.mxl', 'different_pitches.mxl') True >>> test_ornaments('bwv66.6.mxl', 'different_key.mxl'...
def test_ornaments(score1, score2, measure = 0, part = 0): diff = ScoreDiff(score1, score2, path) return diff.have_same_ornaments(measure, part)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_match_nones():\r\n runmatch(lcode_nones)", "def ensemble_annoj_exists(ensemble):\n\n\tensemble = str(ensemble)\n\tensemble = ensemble.strip('Ens')\n\tresult = path.isfile('/var/www/html/annoj_private/CEMBA/browser/fetchers/mc_cemba/mc_single_merged_mCG_cluster_mCHmCG_lv_npc50_k30_1_Ens'+str(ensemble)...
[ "0.5523054", "0.5063729", "0.49874783", "0.49115068", "0.48974282", "0.48964244", "0.48904523", "0.48893464", "0.48683524", "0.48556218", "0.48508865", "0.48504823", "0.4835649", "0.48253495", "0.48235333", "0.4821645", "0.48186624", "0.48185313", "0.48053995", "0.4797268", "...
0.6441692
0
>>> test_accidentals('bwv66.6.mxl', 'different_accidentals.mxl') False >>> test_accidentals('bwv66.6.mxl', 'different_ornaments.mxl') True >>> test_accidentals('bwv66.6.mxl', 'bwv66.6.mxl') True >>> test_accidentals('bwv66.6.mxl', 'different_accidentals2.mxl', 1) False >>> test_accidentals('bwv66.6.mxl', 'different_acc...
def test_accidentals(score1, score2, measure = 0, part = 0): diff = ScoreDiff(score1, score2, path) return diff.have_same_accidentals(measure, part)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def given_test_cases(self):\n self.assertTrue(anagram_finder(\"listen\", \"silent\"))\n self.assertTrue(anagram_finder(\"triangle\", \"integral\"))\n self.assertFalse(anagram_finder(\"apple\", \"pabble\"))", "def test_check_validity(resident_names, hospital_names, capacities, seed):\n\n _...
[ "0.59301686", "0.55262876", "0.5454933", "0.5408776", "0.5360736", "0.52889955", "0.5265647", "0.52480555", "0.52306783", "0.51918554", "0.5188172", "0.5188172", "0.5185943", "0.5185736", "0.5171561", "0.5156619", "0.51435447", "0.51403385", "0.5136119", "0.5135964", "0.51198...
0.57314533
1
>>> test_stem_directions('bwv66.6.mxl', 'different_stems.mxl') False >>> test_stem_directions('bwv66.6.mxl', 'different_stems2.mxl', 1) False >>> test_stem_directions('bwv66.6.mxl', 'different_stems3.mxl', 4) False >>> test_stem_directions('bwv66.6.mxl', 'different_ornaments.mxl') True >>> test_stem_directions('bwv66.6...
def test_stem_directions(score1, score2, measure = 0, part = 0): diff = ScoreDiff(score1, score2, path) return diff.have_same_stem_directions(measure, part)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_stemming():\n normalizer = TextNormalizer(stem=True, lemmatize=False)\n assert normalizer.transform([[\"running\"]])[\"corpus\"][0] == [\"run\"]", "def test_1(self):\r\n\r\n max_flexion_len = 3\r\n\r\n result_1 = list(stemmer.gen_simplest_stemmer(\"слово\", max_flexion_len))\r\n ...
[ "0.6692664", "0.624442", "0.60175544", "0.60047394", "0.59410924", "0.5930666", "0.59121484", "0.58245426", "0.560271", "0.5552443", "0.54929966", "0.54354376", "0.5396129", "0.53951675", "0.5383812", "0.5341282", "0.53087145", "0.52382666", "0.52240324", "0.5221061", "0.5160...
0.7251379
0
>>> test_spanners('bwv66.6.mxl', 'different_phrasing.mxl') False >>> test_spanners('bwv66.6.mxl', 'different_ornaments.mxl') False >>> test_spanners('bwv66.6.mxl', 'different_pitches.mxl') True >>> test_spanners('bwv66.6.mxl', 'scriabin_opus_2_no1.mxl') True >>> test_spanners('bwv66.6.mxl', 'scriabin_opus_8_no5.mxl') T...
def test_spanners(score1, score2, measure = 0, part = 0): diff = ScoreDiff(score1, score2, path) return diff.have_same_spanners(measure, part)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_env_rules_cause_matching_span_to_be_sampled():\n with override_global_config(dict(_sampling_rules='[{\"service\":\"test_service\",\"name\":\"test_name\"}]')):\n sampling_rules = get_span_sampling_rules()\n assert sampling_rules[0]._service_matcher.pattern == \"test_service\"\n asse...
[ "0.5340157", "0.51737", "0.507743", "0.50210464", "0.4951721", "0.49203345", "0.48373163", "0.4762639", "0.4744961", "0.47269493", "0.47077292", "0.46728623", "0.466654", "0.4652557", "0.46401304", "0.4631468", "0.4625303", "0.4613554", "0.46055642", "0.46029666", "0.4597388"...
0.6647752
0
>>> test_articulations('bwv66.6.mxl', 'different_articulations.mxl') False >>> test_articulations('bwv66.6.mxl', 'different_ornaments.mxl') True >>> test_articulations('bwv66.6.mxl', 'different_pitches.mxl') True >>> test_articulations('scriabin_opus_2_no1.mxl', 'bwv66.6.mxl') True >>> test_articulations('scriabin_opus...
def test_articulations(score1, score2, measure = 0, part = 0): diff = ScoreDiff(score1, score2, path) return diff.have_same_articulations(measure, part)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_variational():\n # iris\n #pres = \"Test pour le data set Iris (facile, classique)\"\n #test_from_func_variational(pres, 15, 10, 3, True, Iris)\n\n # breast cancer\n pres = \"Test pour le data set Breast Cancer (facile, classique)\"\n test_from_func_variational(pres, 15, 10, 3, True, Bre...
[ "0.551927", "0.55119956", "0.5459723", "0.5439813", "0.5362803", "0.53410804", "0.53354734", "0.5287916", "0.5287916", "0.5285058", "0.5218113", "0.51794463", "0.5179227", "0.51770556", "0.5171885", "0.51688933", "0.51557285", "0.514981", "0.51109475", "0.51107997", "0.509594...
0.66323584
0
Determines whether a piece of software meets 6.031 standards. Software meets 6.031 standards if it is safe from bugs, ready for change, and easy to understand.
def is_code_good(safe_from_bugs, ready_for_change, easy_to_understand): pass # your code here!
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_version_2_6() -> bool:\n v = get_version()\n if v[1] != \"singularity\" and v[1] != \"singularity-ce\":\n return False\n return v[0][0] == 2 and v[0][1] == 6", "def check_supported_features(self):", "def eligible(CGPA:float, Year:int, program:str) -> bool:\n return CGPA >= 2 and Year ...
[ "0.6226087", "0.6051725", "0.5854076", "0.58402455", "0.58168775", "0.5793419", "0.5768285", "0.57435614", "0.57337004", "0.57026315", "0.56996334", "0.5698729", "0.5671816", "0.56634545", "0.5659834", "0.5626873", "0.5620132", "0.55883926", "0.5572107", "0.55642295", "0.5551...
0.6084589
1
A decorator that takes a generator function and makes it threadsafe.
def threadsafe_generator(f): def g(*a, **kw): return ThreadsafeIter(f(*a, **kw)) return g
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def threadsafe_generator(f):\n def g(*a, **kw):\n return ThreadSafe(f(*a, **kw))\n return g", "def threadsafe_generator(f):\n\tdef g(*a, **kw):\n\t\treturn threadsafe_iter(f(*a, **kw))\n\treturn g", "def threadsafe_generator(f):\n def g(*a, **kw):\n return threadsafe_iter(f(*a, **kw))\n ...
[ "0.83985823", "0.8137598", "0.8042877", "0.8042877", "0.8042877", "0.8042877", "0.8042877", "0.8042877", "0.8042877", "0.80164343", "0.7981679", "0.75909317", "0.7472497", "0.7349135", "0.73063093", "0.72516894", "0.70202196", "0.70136774", "0.6973199", "0.69161046", "0.67388...
0.7914833
11
Adds names and bounding boxes to the frame
def redraw_frame(image, names, aligned): i = 0 unicode_font = ImageFont.truetype("DejaVuSansMono.ttf", size=17) img_pil = Image.fromarray(image) draw = ImageDraw.Draw(img_pil) for face in aligned: draw.rectangle((face[0], face[1], face[2], face[3]), outline=(0, 255, 0), width=2) i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _draw(self, frame, boxes, probs, landmarks, name):\n try:\n print('drawing')\n for box, prob, ld, id in zip(boxes, probs, landmarks, name):\n # Draw rectangle on frame\n\n cv2.putText(frame, id, (200, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2, c...
[ "0.67756474", "0.6062011", "0.6045409", "0.60349154", "0.60078406", "0.5994434", "0.5986124", "0.5865525", "0.57960564", "0.5786791", "0.57806087", "0.57626694", "0.57595354", "0.57552874", "0.573282", "0.5705798", "0.56562084", "0.5644989", "0.55984014", "0.55860054", "0.555...
0.52962124
45
Computes the length of the recurring cycle in the decimal representation of the rational number 1/d if any, 0 otherwise
def cycle_length(d): if not isinstance(d, int) or d <= 0: raise ValueError("cycle_length(d): d must be a positive integer") rlist = [] qlist_len = 0 remainder = 1 while remainder: remainder = remainder % d if remainder in rlist: return qlist_len - rlist.index(rema...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lenOfRec(denom):\n d = denom\n n = 1 #numerator\n count = 0\n while n!=0:\n n = n*10 % d\n count += 1\n if n == 1:\n break\n \n return count", "def get_length_repeating_decimals(num, den):\n # When we use longhand divison for the fraction we find that ...
[ "0.7235305", "0.7039432", "0.65656936", "0.64102966", "0.62604904", "0.6176775", "0.6016356", "0.60072213", "0.5950206", "0.5911741", "0.58723277", "0.58633614", "0.57687944", "0.5754934", "0.5731501", "0.5682944", "0.56633145", "0.563831", "0.55833185", "0.55670255", "0.5565...
0.734951
0
Parses restaurant name and ratings from file and adds it to a dictionary.
def process_file(file_name): restaurant_ratings = {} # open file, iterate line by line restaurant_file = open(file_name) # split by colon, returns a list for line in restaurant_file: restaurant_name, restaurant_rating = line.rstrip().split(":") restaurant_ratings[restaurant...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_restaurant_rating_dictionary(filename):\n\n the_file = open(filename)\n\n for line in the_file:\n line = line.rstrip()\n ratings = line.split(\":\")\n\n restaurant_name = ratings[0]\n rating = ratings[1]\n restaurant_ratings[restaurant_name] = rating\n\n retur...
[ "0.8203267", "0.8107739", "0.81040096", "0.80869764", "0.8024982", "0.8008177", "0.77576977", "0.6952371", "0.66929567", "0.6518673", "0.64702773", "0.63175005", "0.6137714", "0.61332256", "0.6118705", "0.6059968", "0.6051205", "0.6029567", "0.598272", "0.59775275", "0.597714...
0.8216074
0
Prompts user for restaurant & rating, adds to dictionary.
def add_restaurant_rating(restaurant_ratings): user_restaurant = raw_input("Enter a restaurant name: ") user_rating = int(raw_input("Enter a restaurant rating between 1-5: ")) # prompt user for new restaurant and rating, add to dictionary restaurant_ratings[user_restaurant] = user_rating return r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adds_user_ratings(restaurant_ratings_dictionary):\n while True:\n add_restaurant = input(\"Would you like to add a restaurant review? Type Y or N\\n> \").lower()\n if add_restaurant == \"n\":\n print(\"n\")\n break\n elif add_restaurant == \"y\":\n print...
[ "0.78467345", "0.744267", "0.71459824", "0.71104604", "0.6941335", "0.69223744", "0.6828657", "0.6637511", "0.64718455", "0.64450294", "0.6160519", "0.60316193", "0.594381", "0.5925114", "0.58915067", "0.5874964", "0.5837635", "0.5719949", "0.5660157", "0.5600644", "0.559366"...
0.8107513
0
User chooses which function to call, based on options available.
def give_user_choice(rest_ratings): print """ Welcome to our program! Here's what's on the menu: 1. Would you like to see all restaurant ratings available? 2. Adding a new restaurant to the list? 3. Quitting our program?""" user_selection = int(raw_input("Please type a number here (1, 2, or 3)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __choose_options(self):\n\t\tswitcher = {\n\t\t\t0: self.__zero,\n\t\t\t1: self.__one,\n\t\t\t2: self.__two,\n\t\t\t3: self.__three,\n\t\t\t4: self.four,\n\t\t\t5: self.four,\n\t\t\t6: self.four,\n\t\t\t7: self.four,\n\t\t}\n\t\tfunc = switcher.get(self.__options(), lambda: \"Invalid option\")\n\t\treturn func...
[ "0.7220321", "0.6326212", "0.61131716", "0.59147114", "0.59010607", "0.5801811", "0.57757354", "0.57502675", "0.5723322", "0.5720491", "0.56927013", "0.5677188", "0.5667494", "0.56666017", "0.56640846", "0.56635255", "0.56632894", "0.5657105", "0.56466323", "0.562625", "0.562...
0.0
-1
Applies the Softmax function to an ndimensional input Tensor rescaling them
def softmax(arr: np.ndarray, axis: int = -1): c = arr.max(axis=axis, keepdims=True) s = arr - c nominator = np.exp(s) denominator = nominator.sum(axis=axis, keepdims=True) probs = nominator / denominator return probs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(input, dim, inplace=False):\n return FunctionLib.apply(\n 'Softmax', input.device, [input],\n outputs=[input if inplace else None], axis=dim)", "def softmax4(x):\n ndim = K.ndim(x)\n if ndim == 2:\n return K.softmax(x)\n elif ndim == 3:\n e = K.exp(x - K.max(x,...
[ "0.7957886", "0.7658958", "0.7509899", "0.7509899", "0.7487856", "0.7486355", "0.744741", "0.7405989", "0.7357403", "0.73492765", "0.7309486", "0.7249288", "0.7239053", "0.7204867", "0.7204867", "0.7201723", "0.7198571", "0.7180414", "0.7176051", "0.7175737", "0.71715707", ...
0.0
-1
A function that fixes a random seed for reproducibility
def set_seeds(seed=42): random.seed(seed) os.environ['PYTHONHASHSEED'] = str(seed) np.random.seed(seed) torch.manual_seed(seed) torch.cuda.manual_seed(seed) torch.cuda.manual_seed_all(seed) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False # for faster trai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Randomize(seed=None):\n random.seed()", "def random():\n np.random.seed(1939)", "def random():\n np.random.seed(0)", "def seed_random():\n random.seed(0)", "def reproducible(seed: int = 0) -> None:\n\n os.environ[\"PYTHONHASHSEED\"] = \"0\"\n\n np.random.seed(seed)\n python_random....
[ "0.8439382", "0.8354831", "0.8337567", "0.8326795", "0.8141794", "0.80265725", "0.79857415", "0.7798418", "0.77400285", "0.7687649", "0.76443243", "0.7551165", "0.7534908", "0.7501219", "0.746654", "0.746654", "0.744722", "0.7379323", "0.7361366", "0.73589087", "0.7341101", ...
0.0
-1
Draw samples from a standard Normal distribution (mean=0, stdev=1).
def standard_normal(random_state, size=None, chunk_size=None, gpu=None, dtype=None): if dtype is None: dtype = np.random.RandomState().standard_normal(size=(0,)).dtype size = random_state._handle_size(size) seed = gen_random_seeds(1, random_state.to_numpy())[0] op = TensorStandardNormal(size=siz...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_normal(self):\n means, scale = self.get_means_and_scales()\n return np.random.normal(means,scale,size=[self.sims,means.shape[0]]).T", "def normal(mean, std):\n\n return random.gauss(mean, std)", "def test_normal(self):\r\n s = np.random.normal(-0.42, 0.55, 5000)\r\n ...
[ "0.75756955", "0.7359071", "0.72345424", "0.7150394", "0.71197146", "0.7093101", "0.69451076", "0.6877788", "0.6869891", "0.6642873", "0.66425455", "0.6602457", "0.6599727", "0.6596702", "0.6525589", "0.64931434", "0.64451784", "0.64451784", "0.64451784", "0.64451784", "0.644...
0.58724236
59
Return a json object containing the file content
def _get_data_file(self, data_path): return json.load(open(data_path))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_json_file_content(file_dir_arg):\n result = None\n\n try:\n with open(file_dir_arg, 'r', encoding='UTF-8-SIG') as f:\n result_tmp = f\n result = load(result_tmp)\n except Exception as e:\n print(e.args)\n\n return result", "...
[ "0.7544937", "0.7363082", "0.73162645", "0.72307235", "0.7181808", "0.71382374", "0.7113364", "0.70853007", "0.70266354", "0.69306314", "0.691841", "0.691532", "0.68940663", "0.6885171", "0.68603086", "0.6775327", "0.67621076", "0.67301583", "0.67107904", "0.67107904", "0.667...
0.67135817
18
Return a dict of movies
def _get_movies(self): return self.data_file['movies']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def movie(response):\n\n response = response.json()\n\n if response.get(\"Error\"):\n raise NotFoundError(response[\"Error\"])\n\n if response[\"Type\"] != \"movie\":\n raise NotFoundError(\"Type is {}, should be movie\".format(response[\"Type\"]))\n\n return [OrderedDict([(\"Title\", res...
[ "0.7980709", "0.7636093", "0.74719363", "0.7403664", "0.72688943", "0.72571814", "0.7191314", "0.71716154", "0.7170183", "0.7166868", "0.7152478", "0.7132814", "0.71075296", "0.7104493", "0.7102627", "0.7031748", "0.7017451", "0.69132686", "0.68304396", "0.68285877", "0.68104...
0.7347992
4
Create DataFrame including rating 5 for all watched movies and split to row each movie_id by user
def _normalize_dataset(self): new_data = [] columns = ['user_id', 'movie_id', 'rating'] for line in self.data_file['users']: movies_by_user = [ {'user_id': line['user_id'], 'movie_id': movie_id, 'rating': 5} for movie_id in line['movies'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def movielens_20m_to_df(ratings_file, movies_file):\n ratings_names = ['user_id', 'movie_id', 'rating', 'unix_timestamp']\n ratings_delim = ','\n\n movies_names = [ 'movie_id', 'movie_title', 'genres']\n movies_delim = ','\n encoding = 'utf-8'\n engine = 'python'\n\n ratings_df = pd.read_csv(r...
[ "0.7226439", "0.6808683", "0.66778433", "0.65288967", "0.6355954", "0.63107824", "0.62635416", "0.62023175", "0.6157416", "0.6135076", "0.6127724", "0.61078817", "0.610165", "0.60978687", "0.60910624", "0.60819", "0.60430026", "0.6031244", "0.6009129", "0.6004356", "0.5994962...
0.71923757
1
Read a normalized dataset and create a sparse matrix containing the ratings
def _get_sparse_data(self): data = self._normalize_dataset() n_users = data.user_id.unique().shape[0] n_movies = data.movie_id.unique().shape[0] ratings = np.zeros((n_users, n_movies)) for row in data.itertuples(): ratings[row[1]-1, row[2]-1] = row[3] retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_data(filename):\n # read in triples of itemID/userID/playcount from the input dataset\n data = pandas.read_table(filename,\n usecols=[0, 1, 2],\n header=0,\n delimiter=',')\n\n # map each userID and itemID to a un...
[ "0.67880994", "0.6689617", "0.6406892", "0.63348025", "0.63336885", "0.6284135", "0.6262106", "0.6207071", "0.61706823", "0.6128356", "0.61157274", "0.6012887", "0.60104775", "0.5936172", "0.58552825", "0.5835682", "0.5825443", "0.5810967", "0.57736486", "0.5751358", "0.57505...
0.7752622
0
Return a list of k recommended movies
def _get_top_k_movies(self, similarity, movie_id, k): return [ self._get_movies()[str(x+1)] for x in np.argsort(similarity[movie_id-1,:])[:-k-1:-1] ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_similar_movies(movie_title, k=500, show_distance=False):\n movie_id = ratings.tconst_gender[ratings.primaryTitle == movie_title].unique()[0]\n\n neighbour_ids = []\n \n movie_ind = movie_mapper[movie_id]\n movie_vec = X[movie_ind]\n k+=1\n \n \n if isinstance(movie_vec, (np.ndar...
[ "0.6969492", "0.6910933", "0.6792513", "0.6524257", "0.64092964", "0.63887626", "0.63844305", "0.6354006", "0.6342225", "0.62963384", "0.61361873", "0.6134131", "0.61273575", "0.6064123", "0.60433394", "0.6024817", "0.6016986", "0.5957066", "0.5895713", "0.58880854", "0.58761...
0.69542474
1
Get a path in obj using dot notation e.g.
def get(obj, path): right = path cur = obj while right: left, right = partition(right) if isinstance(cur, dict): cur = cur.get(left) elif isinstance(cur, (list, tuple)): left = int(left) cur = cur[left] if left < len(cur) else None return cur
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPath(obj):", "def _getattr_path(obj: Any, path: str) -> Any:\n if not path:\n return None\n\n for attr in path.split('.'):\n obj = getattr(obj, attr, None)\n return obj", "def get_obj_path(self, part):\n part_dictionary = self.part_reference.get(part, {})\n return pa...
[ "0.77900285", "0.7466982", "0.6943296", "0.6742843", "0.6567812", "0.65178466", "0.64945525", "0.64223164", "0.6420281", "0.6415424", "0.630857", "0.6302559", "0.627037", "0.62387717", "0.62387717", "0.62183905", "0.6154021", "0.61336106", "0.612455", "0.6106036", "0.61015236...
0.5538838
59
A small utility function that check if the provided string is either None, '', or just a string containing only spaces
def is_empty(val): return val in [None, ''] or val.isspace()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(string):\n return string == None or re.sub(\"\\\\s+\", \"\", string) == \"\"", "def is_null_or_empty(string_val):\n if string_val and string_val.strip():\n return False\n return True", "def is_str_none_or_empty(val):\n if val is None:\n return True\n if isinstance(val,...
[ "0.8237053", "0.8124945", "0.8037569", "0.79108196", "0.7764869", "0.7685698", "0.75816345", "0.7575924", "0.7477997", "0.74721014", "0.7454891", "0.74143285", "0.7358262", "0.7233534", "0.7226879", "0.7201261", "0.71897626", "0.7131125", "0.70505905", "0.69395953", "0.693698...
0.77871525
4
Path helper that allows passing a Falcon resource instance.
def path_helper(self, operations, resource, base_path=None, suffix=None, **kwargs): resource_uri_mapping = self._generate_resource_uri_mapping(self._app, resource, suffix) if not resource_uri_mapping: raise APISpecError("Could not find endpoint for resource {0}".format(resource)) o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ResourcePath(self, name):\n pass", "def url_for(self, resource, **kwargs):\n if self.blueprint:\n return flask.url_for('.' + resource.endpoint, **kwargs)\n return flask.url_for(resource.endpoint, **kwargs)", "def resource_path(self, resource):\n # type: (Text) -> Text\n ...
[ "0.7092943", "0.64470416", "0.6124915", "0.61037254", "0.6059727", "0.60153484", "0.60153484", "0.5925138", "0.5862211", "0.58476615", "0.5824537", "0.5791158", "0.5787645", "0.57799727", "0.57234704", "0.56219244", "0.5615395", "0.5613724", "0.5561888", "0.55315953", "0.5498...
0.50513184
83
This function will download a zip file to disk
def download_zip(url, folder=None): # get this file folder name and save the file name if not folder: folder = os.path.dirname(os.path.abspath(__file__)) file_name = os.path.split(url)[1] # Download the file from "url" and save it locally under "file_name": try: with urllib.request...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download():\n response = requests.get(URL, stream=True)\n\n file = open(FILE_NAME, 'wb')\n file.write(response.content)\n\n with zipfile.ZipFile(FILE_NAME, 'r') as zip_ref:\n zip_ref.extractall()\n\n file.close()\n os.remove(FILE_NAME)", "def download_zip(self, path: Path) -> Path:\n...
[ "0.8009424", "0.77010745", "0.76116294", "0.7511597", "0.7493036", "0.73734725", "0.7276599", "0.7226754", "0.7219494", "0.71844345", "0.7077965", "0.6991962", "0.6977651", "0.6972263", "0.69692117", "0.6968815", "0.69383264", "0.69306594", "0.6927575", "0.68889254", "0.68497...
0.74428934
5
Check the folder contains the three mandatory files with extension .shp, .dbf,.dbf Also check there is only 1 shapefile and this is a polygon type
def check_shapefile(folder): ''' Value | Shape Type 0 | Null Shape 1 | Point 3 | PolyLine 5 | Polygon 8 | MultiPoint 11 | PointZ 13 | PolyLineZ 15 | PolygonZ 18 | MultiPointZ 21 | PointM 23 | PolyLineM 25 | PolygonM 28 | MultiPointM 31 | MultiPatch ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validFiles(self, files):\n for myfile in files:\n if not ( ( myfile.get_uri_scheme() == 'file' ) or \\\n ( myfile.get_uri_scheme() == 'smb' ) ):\n return False\n elif ( not myfile.get_mime_type() in self.oootypes ) and \\\n ( not myfile....
[ "0.61982626", "0.61947924", "0.6175953", "0.6119851", "0.6091015", "0.59931964", "0.59807795", "0.58886826", "0.5863063", "0.5850182", "0.5840579", "0.58361673", "0.5823537", "0.5823537", "0.5823537", "0.5808097", "0.5795179", "0.5784716", "0.5771951", "0.5764534", "0.5762427...
0.839037
0
Check if the table exercise.states is already in the database
def check_table(schemaname=settings.DEFAULT_SCHEMA, tablename=settings.STATES): conn = None cur = None try: conn = utils.pgconnect(**settings.DEFAULT_CONNECTION) cur = conn.cursor() cur.execute("""SELECT to_regclass('%s.%s');""", (AsIs(schemaname), AsIs(tablename))) result...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dont_save(self):\n self.assertFalse(State.objects.exists())", "def check_state_exist(state, qmatrix, numb_actions):\n\n if state not in qmatrix.index:\n # append new state to q table\n qmatrix = qmatrix.append(\n pd.Series(\n [0]*numb_actions,\n ...
[ "0.648905", "0.6143901", "0.5890334", "0.5871307", "0.5857106", "0.58300877", "0.5784326", "0.57831377", "0.5780546", "0.5768868", "0.5703022", "0.56957126", "0.5691821", "0.5673148", "0.56472707", "0.5634992", "0.5631963", "0.55954576", "0.55925184", "0.55847996", "0.5574546...
0.0
-1
Upload file to database
def upload_shape(shapepath): conn = None cur = None try: # first create the sqlstring with inserts # call PGSQL2SHP with some parameters, -s 4326 to set lat/lon srid, -I to create a spatial index on the geometry column params = [settings.SHP2PGSQL, "-s", "4326", "-I", shapepath, se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload(self, filename, file_path):\n return", "def post(self):\n source = 'uploaded by user'\n upload_files = self.get_uploads('file')\n blob_key = upload_files[0].key()\n name = self.request.get('name')\n\n user = users.get_current_user()\n\n username = 'admi...
[ "0.7485169", "0.67197865", "0.6597614", "0.65940464", "0.65767515", "0.65479946", "0.6543065", "0.6538194", "0.6514985", "0.6437462", "0.64294904", "0.64249825", "0.64084154", "0.6353266", "0.6352745", "0.6331172", "0.6331049", "0.6325633", "0.6307132", "0.6279385", "0.626583...
0.0
-1
Check the user input for a point, if inside USA, if OK add it to the database Crop nummber to 4 digits, define the marker size based on the bigger number of digits
def upload_point(x, y, label=""): conn = None cur = None try: # check the point is inside the usa, both point and states must be WGS84 conn = utils.pgconnect(**settings.DEFAULT_CONNECTION) cur = conn.cursor() #if the point is inside this will return (True,) otherwise None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_latitude(self):\n lLatitude = self.cleaned_data['latitude']\n if lLatitude:\n lValue = lLatitude.strip()\n if lValue:\n lRegEx = re.compile(CO_ORD_REGEX)\n if lRegEx.match(lValue) == None:\n raise forms.ValidationError(\...
[ "0.56233335", "0.55526364", "0.5320986", "0.5181115", "0.51509035", "0.51473725", "0.5142715", "0.5123412", "0.50627816", "0.5056026", "0.505146", "0.49788797", "0.49679402", "0.48976582", "0.48737523", "0.4873513", "0.48673427", "0.48661628", "0.48638946", "0.48234263", "0.4...
0.6816568
0
Return the epsg code for a shapefile
def get_epsg(path): dataset = None layer = None srs = None try: driver = ogr.GetDriverByName('ESRI Shapefile') dataset = driver.Open(path, 0) # 0 means read-only layer = dataset.GetLayer() srs = layer.GetSpatialRef() #Set EPSG authority info if possible. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _epsg(self):\n info = self._info['coordinateSystem']['wkt'].rsplit('\"EPSG\",', 1)[-1]\n return int(re.findall(r\"\\d+\", info)[0])", "def s2_epsg_code(self):\n ul, lr = self.ul_lr\n epsg_old = self.epsg\n if epsg_old != 4326:\n lon, lat = ImageIO.transform_point...
[ "0.607808", "0.6057351", "0.5858668", "0.57926476", "0.5748241", "0.56743056", "0.5667732", "0.5608399", "0.5567314", "0.552981", "0.5460044", "0.5319938", "0.53048986", "0.5285746", "0.5281998", "0.52689594", "0.52610826", "0.5208903", "0.5187333", "0.5187333", "0.5178785", ...
0.7115192
0
reproject a vector file (only the first layer!) (it does not save the dataset to disk)
def reproject_vector( path, epsg_from=None, epsg_to=None): if not epsg_to: raise Exception("please, specify the output EPSG codes") inDataSet = None outDataSet = None inFeature = None outFeature = None outLayer = None try: driver = ogr.GetDriverByName('ESRI Shapefile') in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reprojectAndSaveNewRaster(inFilepath,outFilepath,to_EPSG):\r\n from osgeo import gdal\r\n input_raster = gdal.Open(inFilepath)\r\n EPSG_string = \"EPSG:\"+str(to_EPSG)\r\n ras = gdal.Warp(outFilepath,input_raster,dstSRS=EPSG_string)\r\n del ras", "def reprojectAndSaveNewShapefile(inFilepath,ou...
[ "0.62399775", "0.6226501", "0.58857656", "0.58182466", "0.56765485", "0.56583333", "0.5608022", "0.5603202", "0.56001997", "0.5566788", "0.5521875", "0.5514971", "0.5509281", "0.5441147", "0.54357195", "0.54265714", "0.54211587", "0.54107004", "0.54107004", "0.5363864", "0.53...
0.6866187
0
save an ogr dataset to disk, (it will delete preexisting output)
def save_vector(dataset, outpath, driver=None): try: if not driver: driver = dataset.GetDriver() if os.path.exists(outpath): driver.DeleteDataSource(outpath) dst_ds = driver.CopyDataSource(dataset, outpath) else: driver = ogr.GetDriverB...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, output, data):", "def save_dataset(self):\n if self.res_dataset is None:\n return\n if self.write_path is None:\n raise Exception(\"Error: Attempted to save result dataset without ever specifiying a path to write to\")\n\n if self.format == \"arrow\":\n ...
[ "0.67794627", "0.6754343", "0.670547", "0.6607585", "0.6588637", "0.6580151", "0.65534836", "0.6546951", "0.65442836", "0.6486838", "0.64590806", "0.6428214", "0.6412291", "0.6402253", "0.63978577", "0.63953197", "0.63748604", "0.6364255", "0.63512546", "0.6345753", "0.633221...
0.6346837
19
Return html class fragment for the marker size
def get_class_size(size): s = 'fa-lg' if size == 1: s = 'fa-lg' elif size == 2: s = 'fa-2x' elif size == 3: s = 'fa-3x' elif size == 4: s = 'fa-4x' elif size == 5: s = 'fa-5x' return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_marker_size(self, marker_id: int) -> int:\n if marker_id in range(0, 40):\n # WALL_MARKER\n return 250\n else:\n return 100", "def marker_size(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"marker_size\")", "def marker_size(self) ...
[ "0.60135067", "0.58254164", "0.58254164", "0.58254164", "0.5667613", "0.56253487", "0.56235933", "0.561359", "0.556173", "0.55141217", "0.5447288", "0.5412233", "0.5396221", "0.5358953", "0.5335299", "0.52983207", "0.5272478", "0.5263561", "0.5260405", "0.5251097", "0.5245471...
0.66643053
0
Add one point to the map
def add_point(map, x, y, size, label, marker=settings.MARKER, color=settings.MARKER_COLOR): s = get_class_size(size) folium.map.Marker( location=[y, x], popup=label, icon=DivIcon( #icon_size=(150,36), icon_anchor=(0,0), html='<i class="fa '+marker+'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addPoint(self, point):\n self.points.append(point)", "def add(self, point):\n self.points.append(point)", "def add_point(self, pt):\n self.points.append(pt)", "def add_point(self, x: int, y: int):\n self.state[x, y] = 1", "def add_point(self, x: int, y: int):\n self.s...
[ "0.74777544", "0.7411591", "0.7302735", "0.717282", "0.717282", "0.717282", "0.7149496", "0.7075055", "0.7043802", "0.70243937", "0.70046866", "0.70044357", "0.695466", "0.68703127", "0.67992646", "0.67937094", "0.67550814", "0.6747055", "0.67115504", "0.6681633", "0.66295254...
0.62047684
33
Add all the points to the map
def add_all_points(map, marker=settings.MARKER,color=settings.MARKER_COLOR): conn = None curr = None try: conn = utils.pgconnect(**settings.DEFAULT_CONNECTION) cur = conn.cursor() # if the point is inside this will return (True,) otherwise None cur.execute("""select lon, la...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_points(self):\n if not '_list_of_points' in self.__dict__.keys():\n self._list_of_points = [] \n for point in self['point'].items():\n self._list_of_points.append(point[1])", "def add_points(self, points):\n pass", "def addPoints(self, points):\r\n ...
[ "0.75577456", "0.7388146", "0.71856815", "0.70756197", "0.6748661", "0.6737908", "0.6710255", "0.6566786", "0.63640326", "0.625198", "0.6170082", "0.61540735", "0.6121445", "0.6118305", "0.6111104", "0.60829985", "0.6074091", "0.6047287", "0.6039132", "0.6033827", "0.6010885"...
0.6955612
4
Save the html page
def save_map(map, name="index.html", folder=None): if not folder: folder = os.path.dirname(os.path.abspath(__file__)) map.save(folder + "/" + name) return folder + "/" + name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self):\n html_file = '{}/{}.html'.format(self.web_dir, self.title)\n f = open(html_file, 'wt')\n f.write(self.doc.render())\n f.close()", "def save(self, filename):\n outfile = open(filename, \"w\")\n outfile.write(self.html.encode('utf8'))\n outfile.clos...
[ "0.8319438", "0.7728037", "0.7694331", "0.72064406", "0.71366906", "0.709866", "0.7074866", "0.70236087", "0.7007957", "0.69596565", "0.69420594", "0.6893396", "0.6817857", "0.6797137", "0.6697725", "0.6678388", "0.6662395", "0.6651914", "0.662725", "0.66001976", "0.65727824"...
0.0
-1
Download geojson from the database
def get_geojson(): # check the file was already downloaded global GEOJSON if GEOJSON: return GEOJSON conn = None cur = None try: conn = utils.pgconnect(**settings.DEFAULT_CONNECTION) cur = conn.cursor() cur.execute( """SELECT row_to_json(fc) FROM ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_allpoints_geojson():\n\n # check the file was already downloaded\n global GEOJSON\n if GEOJSON: return GEOJSON\n\n conn = None\n cur = None\n try:\n\n conn = utils.pgconnect(**settings.DEFAULT_CONNECTION)\n cur = conn.cursor()\n cur.execute( \"\"\"SELECT row_to_jso...
[ "0.7075735", "0.6992949", "0.6549768", "0.64688873", "0.63209444", "0.62644655", "0.6259451", "0.6221336", "0.61216295", "0.6098716", "0.60747683", "0.6071885", "0.6071885", "0.6039488", "0.59665906", "0.5948892", "0.5944469", "0.58469725", "0.58332884", "0.58315897", "0.5820...
0.7378575
0
Download geojson from the database
def get_allpoints_geojson(): # check the file was already downloaded global GEOJSON if GEOJSON: return GEOJSON conn = None cur = None try: conn = utils.pgconnect(**settings.DEFAULT_CONNECTION) cur = conn.cursor() cur.execute( """SELECT row_to_json(fc) FROM ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_geojson():\n\n # check the file was already downloaded\n global GEOJSON\n if GEOJSON: return GEOJSON\n\n conn = None\n cur = None\n try:\n\n conn = utils.pgconnect(**settings.DEFAULT_CONNECTION)\n cur = conn.cursor()\n cur.execute( \"\"\"SELECT row_to_json(fc) FROM...
[ "0.7378575", "0.6992949", "0.6549768", "0.64688873", "0.63209444", "0.62644655", "0.6259451", "0.6221336", "0.61216295", "0.6098716", "0.60747683", "0.6071885", "0.6071885", "0.6039488", "0.59665906", "0.5948892", "0.5944469", "0.58469725", "0.58332884", "0.58315897", "0.5820...
0.7075735
1
Add a geojson layer to the map
def add_geojson(map, geojson, style_function, name='states' ): folium.GeoJson( geojson, name=name, style_function=style_function ).add_to(map)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geojson(self, feature_id):\n lat, lon = self.lat_lon\n return {\n 'type': 'Feature',\n 'id': feature_id,\n 'geometry': {\n 'type': 'Point',\n 'coordinates': (lon, lat),\n },\n }", "def add_layer(self, layer):\n ...
[ "0.6588062", "0.6515679", "0.63336873", "0.629631", "0.6243965", "0.62241894", "0.621897", "0.6132847", "0.6105182", "0.60940987", "0.60355663", "0.6014956", "0.60060114", "0.59752184", "0.595699", "0.5950891", "0.5879442", "0.5840097", "0.5835999", "0.57998115", "0.57890666"...
0.81856084
0
Open a web page with a browser
def browser(path, driver='chrome'): if driver=='chrome': driver = webdriver.Chrome() elif driver=='firefox': driver = webdriver.Firefox() elif driver=='edge': driver = webdriver.Edge() else: raise Exception("driver "+driver+ " is not supported") driver.get("file:///...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open(url):\r\n webbrowser.open(url)", "def open_browser(url):\n import webbrowser\n webbrowser.open_new(url)", "def open_web_browser(url: str):\n Popen(web_browser + [url], stdout=DEVNULL, stderr=DEVNULL)", "def open_webpage(browser, url, case, version, package):\n browser_obj = Br...
[ "0.8613281", "0.848614", "0.8462892", "0.82772714", "0.82674664", "0.8137916", "0.80658793", "0.7961011", "0.78403914", "0.7771977", "0.76969564", "0.75432944", "0.7518848", "0.7514928", "0.74260086", "0.7413997", "0.740391", "0.73336726", "0.7288364", "0.7193673", "0.713086"...
0.0
-1
Save screenshot at 200dpi in jpeg format
def save_image(driver, outname="states.jpeg", folder=None): # set the output folder if not folder: folder = os.path.dirname(os.path.abspath(__file__)) # get thescreenshot binary = driver.get_screenshot_as_png() stream = io.BytesIO(binary) # save screenshot in jpeg format img = Ima...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_screenshot(x, y, num=''):\n # screenshot takes starting x,y coordinates and then for how far the shot should stretch\n pic = pyautogui.screenshot(region=(0, y * 1.3, x * 0.75, y * 0.6))\n pic.save(\"Screenshot\" + str(num) + \".png\")", "def save_screenshot(self, file_name, width=3840, height=2...
[ "0.66062033", "0.6598681", "0.6575226", "0.65645045", "0.63658035", "0.6315379", "0.6276598", "0.6272334", "0.62493837", "0.62134916", "0.61662805", "0.6145819", "0.6117371", "0.60789603", "0.606364", "0.604557", "0.6026516", "0.60236925", "0.5961424", "0.59462416", "0.594418...
0.6444463
4
This node specifies the matrix predicted based on fixed effect covariates `covs`, and weights the resulting matrix by 1/sigma^2.
def __init__(self, covs, sigma): assert isinstance(sigma, int) assert covs.ndim == 3 assert sigma > 0.0 self.covs = covs self.sigma = sigma self.num_covs = self.covs.shape[0] self.shape = self.covs.shape[1:] self.covs_mat = self.covs.reshape(self.num_covs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_predict(self, z0, z1, f0, f1):\n assert f0.shape[1] == z0.shape[1] and f1.shape[1] == z1.shape[1]\n\n C = self.cpred(z0, z1, f0, f1)\n\n if self.do_w:\n \"\"\"\n Previous formulation: \n \n x1 = -1 (([1 .... N] + 1 - (N+1)/2) / ((N+1)/2)) ** ...
[ "0.546343", "0.532194", "0.5314906", "0.527502", "0.5240777", "0.50803566", "0.50351626", "0.50257665", "0.50079376", "0.50065464", "0.49888334", "0.49851385", "0.49808347", "0.4975273", "0.49522257", "0.49129495", "0.4907197", "0.48811004", "0.48783505", "0.48605442", "0.485...
0.51133114
5
Predicts the matrix using the covariates in self.covs_mat with the updated coefficients stored in self.alpha.
def predict_mat(self): mat = self.covs_mat.dot(self.alpha) return mat.reshape(self.shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_params(self, mat):\n assert mat.shape == self.shape\n vec = mat.reshape(mat.size)\n self.alpha = np.linalg.solve(self.covs_mat.T.dot(self.covs_mat),\n self.covs_mat.T.dot(vec))", "def predict_mat(self):\n return self.u.dot(self.v.T)", "...
[ "0.6490651", "0.60074425", "0.6004628", "0.599036", "0.58364904", "0.57246894", "0.57134897", "0.570626", "0.56881577", "0.5673695", "0.56713176", "0.56486166", "0.5626255", "0.5538134", "0.54957855", "0.5484796", "0.54656494", "0.54615617", "0.5460596", "0.54546833", "0.5441...
0.73345226
0
Estimates the coefficients on the covariates and thereby updates the matrix parameters. Estimation done by least squares.
def update_params(self, mat): assert mat.shape == self.shape vec = mat.reshape(mat.size) self.alpha = np.linalg.solve(self.covs_mat.T.dot(self.covs_mat), self.covs_mat.T.dot(vec))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_coefficients(self):\n self.make_matrix()\n self.coeffs = np.linalg.solve(self.global_matrix,self.global_vector)\n self.coeffs = np.append(self.coeffs, self.D) #Initial condition", "def _set_coefficients(self, user_defined_coefficients=None):\n # Check to ensure that if there...
[ "0.68213785", "0.6568729", "0.650561", "0.63846326", "0.6240839", "0.60767925", "0.60576737", "0.6055638", "0.5992137", "0.5891918", "0.5859752", "0.58514315", "0.58382076", "0.5834185", "0.58303267", "0.5815064", "0.58032453", "0.5801474", "0.5786988", "0.57689154", "0.57507...
0.65043694
3
This node matches the predicted matrix with the observed data, but "masks" predicted matrix so that we are only using entries that were actually observed from the matrix. Weights the resulting matrix by 1/sigma^2.
def __init__(self, mask, data, sigma): assert isinstance(sigma, int) assert sigma > 0.0 assert isinstance(mask, utils.Mask) assert isinstance(data, np.ndarray) assert mask.size == data.size self.mask = mask self.data = data self.sigma = sigma self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, masked_data, masked_binary_data):\n # Use the loaded model to perform missing value prediction.\n # concatenate multiple students' knowledge state into a matrix of shape (num_students, num_concepts)\n predicted_states = []\n for u in range(len(self.model.mrfs)):\n ...
[ "0.56636155", "0.5445435", "0.53317714", "0.5287088", "0.5251721", "0.52371836", "0.52243984", "0.51921326", "0.518488", "0.51842225", "0.51705045", "0.51641315", "0.51526016", "0.50631", "0.5036301", "0.50272423", "0.50238395", "0.5009977", "0.4998374", "0.49955526", "0.4993...
0.47924504
60
This node specifies a lowrank structure with rank `rank` for the predicted matrix. Weights the resulting matrix by 1/sigma^2.
def __init__(self, shape, rank, sigma): assert isinstance(sigma, int) assert sigma > 0.0 assert isinstance(shape, tuple) assert isinstance(rank, int) assert rank > 0 assert rank <= min(*shape) self.shape = shape self.rank = rank self.sigma = sigma ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_optimal_low_rank_matrix( self, orig_similarity_matrix, orig_rank, u, s, v, singular_reduction ):\n '''rank_list = list()\n sum_singular_values = list()\n for rank in range( 0, orig_rank ):\n compute_result = self.compute_low_rank_matrix( u, s, v, rank + 1 )\n ran...
[ "0.59534043", "0.5852097", "0.5795221", "0.56463134", "0.55684614", "0.55317307", "0.5511257", "0.53647435", "0.53025186", "0.52452224", "0.5243477", "0.52426994", "0.520438", "0.51970804", "0.5141929", "0.5132518", "0.51169837", "0.51121306", "0.5107999", "0.50937647", "0.50...
0.5629263
4
Gives the full predicted matrix based on the low rank u and v.
def predict_mat(self): return self.u.dot(self.v.T)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_low_rank_matrix( self, u, s, v, rank ):\n u_approx = u[ :, :rank ]\n s_approx = s[ :rank ]\n sum_taken_percent = np.sum( s_approx ) / float( np.sum( s ) )\n s_approx = np.diag( np.array( s_approx ) )\n v_approx = v[ :rank, : ]\n return [ u_approx.dot( s_approx ...
[ "0.68731123", "0.6112549", "0.60515124", "0.60183614", "0.5982911", "0.5939187", "0.58090305", "0.57974684", "0.578775", "0.574525", "0.5728702", "0.5567461", "0.5479815", "0.54721326", "0.54661137", "0.5449834", "0.54436517", "0.541722", "0.54135686", "0.5375098", "0.5369013...
0.7002625
0
Updates the low rank structure of self.u and self.v based on the `mat` input. Performs singular value decomposition on the matrix and selects the last `self.rank` entries.
def update_params(self, mat): assert mat.shape == self.shape a, s, b = np.linalg.svd(mat, full_matrices=False) self.u = a[:, :self.rank]*s[:self.rank] self.v = b.T[:, :self.rank]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_optimal_low_rank_matrix( self, orig_similarity_matrix, orig_rank, u, s, v, singular_reduction ):\n '''rank_list = list()\n sum_singular_values = list()\n for rank in range( 0, orig_rank ):\n compute_result = self.compute_low_rank_matrix( u, s, v, rank + 1 )\n ran...
[ "0.6372859", "0.55725044", "0.55620676", "0.55460334", "0.5260916", "0.5249304", "0.51922536", "0.5169905", "0.51028615", "0.5082861", "0.5073029", "0.50590885", "0.5045953", "0.49488217", "0.49206302", "0.49198195", "0.49189126", "0.49091235", "0.4873962", "0.4863568", "0.48...
0.7536742
0
This is f's docstring.
def f(x, y, z=3): pass # pragma: nocover
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def func_doc():", "def __doc__(self, ???):", "def __doc__(self):\n return self.fget.__doc__", "def DocString():\n return", "def docstring_hack():\n pass", "def main_docstring():", "def _add_doc(func, doc):\r\n func.__doc__ = doc", "def _add_doc(func, doc):\r\n func.__doc__ = do...
[ "0.79845726", "0.73985684", "0.73007876", "0.7260358", "0.72601354", "0.7231814", "0.7113083", "0.7113083", "0.7113083", "0.7067614", "0.70261246", "0.69841033", "0.6801731", "0.67647177", "0.66249096", "0.6610375", "0.66060334", "0.6599858", "0.6567463", "0.6557377", "0.6538...
0.0
-1
Test getting an analysis when it exists in the database.
def test_get_analysis_with_id(analysis_store: MockStore): # GIVEN a store with an analysis existing_analysis: Analysis = analysis_store.get_query(table=Analysis).first() # WHEN accessing it by ID analysis: Analysis = analysis_store.get_analysis_with_id(analysis_id=existing_analysis.id) # THEN it s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_analysis_with_id_when_missing(analysis_store: MockStore):\n # GIVEN an id that doesn't exist\n missing_analysis_id = 12312423534\n\n # WHEN accessing the analysis\n analysis: Analysis = analysis_store.get_analysis_with_id(analysis_id=missing_analysis_id)\n\n # THEN it should return None...
[ "0.67521673", "0.64993656", "0.6392804", "0.6276373", "0.62410223", "0.62198424", "0.61320305", "0.6044973", "0.60429484", "0.6037851", "0.60214347", "0.600699", "0.59700125", "0.5969135", "0.593259", "0.5906568", "0.5866727", "0.5863172", "0.5861047", "0.5857293", "0.584378"...
0.6659734
1
Test getting an analysis when it does not exist in the database.
def test_get_analysis_with_id_when_missing(analysis_store: MockStore): # GIVEN an id that doesn't exist missing_analysis_id = 12312423534 # WHEN accessing the analysis analysis: Analysis = analysis_store.get_analysis_with_id(analysis_id=missing_analysis_id) # THEN it should return None assert ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_one_in_db(self):\n q = self.generate_query('view_manager_report', ())\n res = self.execute_query(q)\n expected = []\n assert len(res) == 0, f'There is suppose to be an empty summary {res}'\n assert res == expected, f'The result is suppose to be empty {res}'", "def t...
[ "0.6867313", "0.6787145", "0.64357316", "0.6329981", "0.62323785", "0.6220911", "0.6134222", "0.6128569", "0.6122037", "0.60938495", "0.60938495", "0.6075478", "0.60506773", "0.6032781", "0.6021422", "0.6012929", "0.60125285", "0.60118175", "0.60108805", "0.6007062", "0.59906...
0.7349075
0
Test getting the number of failed jobs per category since a supplied date from the database.
def test_get_nr_jobs_with_status_per_category(job_store: MockStore, timestamp_yesterday: datetime): # GIVEN a database with jobs # WHEN querying for failed users failed_jobs: List[Dict[str, Union[str, int]]] = job_store.get_nr_jobs_with_status_per_category( since_when=timestamp_yesterday, status=Tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_error_category(self):\n\n error = error_test_utils.create_error(category='DATA')\n job = job_test_utils.create_job(error=error)\n\n url = '/%s/jobs/?error_category=%s' % (self.api, error.category)\n response = self.client.generic('GET', url)\n self.assertEqual(response.s...
[ "0.5813953", "0.5470477", "0.5436561", "0.5431106", "0.5430519", "0.5358405", "0.5351436", "0.5340761", "0.5265007", "0.52533865", "0.52142894", "0.51785016", "0.512772", "0.50592387", "0.50564986", "0.5048593", "0.50406694", "0.5030915", "0.5024704", "0.5023085", "0.50163347...
0.7530706
0
Test getting a user from the database.
def test_get_user(user_store: MockStore, user_email: str): # GIVEN a database with a user # WHEN querying for a user user: User = user_store.get_user(email=user_email) # THEN it should be returned assert user.email == user_email
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testGetUser(self):\n UserAPI().create([(u'user', u'secret', u'User', u'user@example.com')])\n user = getUser(u'user')\n self.store.commit()\n with login(u'fluiddb', self.admin.objectID, self.transact) as session:\n result = yield self.facade.getUser(session, u'user')\n ...
[ "0.80467415", "0.8015131", "0.7970524", "0.7857167", "0.782778", "0.77688056", "0.77514106", "0.77355975", "0.7696272", "0.76695734", "0.76617557", "0.7623411", "0.7619199", "0.75815994", "0.75701547", "0.7553964", "0.750348", "0.7497086", "0.74873877", "0.7464809", "0.746417...
0.80435
1
Test getting an archived user from the database.
def test_get_user_including_archived(user_store: MockStore, archived_user_email: str): # GIVEN a database with an archived user # WHEN querying for a user user: User = user_store.get_user(email=archived_user_email, exclude_archived=False) # THEN it should be returned assert user.email == archived_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_user_including_archive_false(user_store: MockStore, archived_user_email: str):\n # GIVEN a database with an archived user\n\n # WHEN querying for a user\n user: User = user_store.get_user(email=archived_user_email, exclude_archived=True)\n\n # THEN no user should be returned\n assert no...
[ "0.7456595", "0.738311", "0.65067285", "0.6436026", "0.63516873", "0.62399125", "0.6210579", "0.62046766", "0.617632", "0.61279947", "0.61279947", "0.6096413", "0.60939574", "0.6072748", "0.5998641", "0.59969604", "0.5986697", "0.59809977", "0.59688866", "0.596384", "0.595570...
0.81311107
0
Test getting an archived user from the database.
def test_get_user_including_archive_false(user_store: MockStore, archived_user_email: str): # GIVEN a database with an archived user # WHEN querying for a user user: User = user_store.get_user(email=archived_user_email, exclude_archived=True) # THEN no user should be returned assert not user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_user_including_archived(user_store: MockStore, archived_user_email: str):\n # GIVEN a database with an archived user\n\n # WHEN querying for a user\n user: User = user_store.get_user(email=archived_user_email, exclude_archived=False)\n\n # THEN it should be returned\n assert user.email ...
[ "0.81330764", "0.7385193", "0.65025973", "0.6442499", "0.63574994", "0.6246142", "0.62167716", "0.62109834", "0.61833704", "0.6133558", "0.6133558", "0.61013573", "0.6095947", "0.60781145", "0.6004548", "0.6003449", "0.59916866", "0.5984867", "0.5974582", "0.5968191", "0.5961...
0.7458577
1
Test getting a nonexisting user from the database.
def test_get_user_when_non_existing(user_store: MockStore): # GIVEN a database with a user # WHEN querying for a user that doesn't exist user: User = user_store.get_user(email="this_is_a_made_up_email@fake_example.com") # THEN it should return as None assert user is None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_user_non_exist_id(self):\n print('(' + self.test_get_user_non_exist_id.__name__+')',\n self.test_get_user_non_exist_id.__doc__)\n self.assertIsNone(self.connection.get_user(NON_EXIST_PATIENT_USERNAME))", "def test_get_bad_user(self):\r\n user = UserMgr.get(username=...
[ "0.856584", "0.8538134", "0.8256169", "0.80339926", "0.7959935", "0.7942771", "0.7879475", "0.78456324", "0.77836406", "0.77539635", "0.77476394", "0.77425784", "0.7734177", "0.7665938", "0.7625372", "0.7607034", "0.7594667", "0.7572818", "0.7503314", "0.7482438", "0.7456589"...
0.8029911
4
Test getting a user with username and email.
def test_get_users(user_store: MockStore, user_email: str, username: str): # GIVEN a database with a user # WHEN getting users users: List[User] = user_store.get_users(name=username, email=user_email) # THEN the user should be returned assert users[0].email == user_email
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_user_by_emailuser_email_get(self):\n pass", "def test_get_user(user_store: MockStore, user_email: str):\n # GIVEN a database with a user\n\n # WHEN querying for a user\n user: User = user_store.get_user(email=user_email)\n\n # THEN it should be returned\n assert user.email == u...
[ "0.81518275", "0.79463357", "0.7895598", "0.7859849", "0.7718898", "0.77024853", "0.7650548", "0.76115036", "0.76060903", "0.7491955", "0.748591", "0.74647605", "0.7454479", "0.74482834", "0.74220383", "0.7405741", "0.73980224", "0.7391085", "0.73631626", "0.73486465", "0.734...
0.7497986
9