query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Get MAC address of specified interface.
def get_mac_address(ifname): try: return open('/sys/class/net/' + ifname + '/address') \ .readline().strip() except: SysTools.logger.error("Failed to get mac-address of %s", ifname) return "00:00:00:00:00:00"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_mac(interface):\r\n ifconfig_result = subprocess.check_output([\"sudo\", \"ifconfig\", interface])\r\n mac_result = re.search(r\"\\w\\w:\\w\\w:\\w\\w:\\w\\w:\\w\\w:\\w\\w\", ifconfig_result.decode('utf-8'))\r\n if mac_result:\r\n return mac_result.group(0)\r\n else:\r\n pr...
[ "0.7971111", "0.7913799", "0.75797963", "0.7524818", "0.7482219", "0.73251265", "0.73251265", "0.72717047", "0.7081322", "0.6825977", "0.67889637", "0.67612916", "0.6567606", "0.6521194", "0.6521194", "0.6452518", "0.64286375", "0.6426995", "0.63696957", "0.6359645", "0.63228...
0.7893475
2
Get MAC address of specified interface.
def get_sys_mac_address(): mac = "00:00:00:00:00:00" try: if os.path.exists(SysTools.SYS_MAC_FILE): with open(SysTools.SYS_MAC_FILE, 'r') as fd: mac = fd.readline().strip() except: SysTools.logger.error("Failed to get sys-mac-address fr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_mac(interface):\r\n ifconfig_result = subprocess.check_output([\"sudo\", \"ifconfig\", interface])\r\n mac_result = re.search(r\"\\w\\w:\\w\\w:\\w\\w:\\w\\w:\\w\\w:\\w\\w\", ifconfig_result.decode('utf-8'))\r\n if mac_result:\r\n return mac_result.group(0)\r\n else:\r\n pr...
[ "0.7971111", "0.7913799", "0.7893475", "0.75797963", "0.7524818", "0.7482219", "0.73251265", "0.73251265", "0.72717047", "0.7081322", "0.6825977", "0.67889637", "0.67612916", "0.6567606", "0.6521194", "0.6521194", "0.6452518", "0.64286375", "0.6426995", "0.63696957", "0.63596...
0.0
-1
Renders the home page.
def home(): return render_template( 'index.html', title='Home Page', year=datetime.now().year, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_home():\r\n\treturn render_template(\"index.html\")", "def home():\n\n return render_template('home_page.html')", "def home():\n\n return render_template(\"home.html\")", "def home():\n return render_template('home.html')", "def home():\n return render_template('home.html')", "def ...
[ "0.85574406", "0.853399", "0.8351404", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.827363", "...
0.8061255
36
Renders the about page.
def about(): return render_template( 'about.html', title='About', year=datetime.now().year, message='Your application description page.' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def about():\n return render_template('about.html', title='About')", "def about():\n\n return render_template('about_page.html', title='About')", "def about():\n\n\treturn render_template(\"about.html\")", "def on_about(self):\n render_about_window()", "def about():\n return render_temp...
[ "0.85650355", "0.85034525", "0.84489655", "0.84044397", "0.8394454", "0.82935613", "0.82680845", "0.8243358", "0.8239194", "0.8224137", "0.82079816", "0.8204868", "0.8173699", "0.8172736", "0.80967313", "0.80501616", "0.80501616", "0.80501616", "0.80501616", "0.80501616", "0....
0.82709616
10
Return a string representation of a date according to RFC 1123 (HTTP/1.1).
def httpdate(dt): weekday = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"][dt.weekday()] month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][dt.month - 1] return "%s, %02d %s %04d %02d:%02d:%02d GMT" % (weekday, dt.day, month, dt.year, dt.hour...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rfc3999(date):\n if not date: return ''\n date = date + datetime.timedelta(seconds = -time.timezone)\n if time.daylight:\n date += datetime.timedelta(seconds = time.altzone)\n return date.strftime('%m-%d-%YT%H:%M:%SZ')", "def format_date(self, data):\r\n if self.datetime_formatting ...
[ "0.72588915", "0.706182", "0.6939739", "0.6767841", "0.6670827", "0.6656972", "0.6468026", "0.64664483", "0.64020157", "0.6396578", "0.6392156", "0.6360225", "0.6309831", "0.62805", "0.627069", "0.6214595", "0.61855215", "0.6167396", "0.60820025", "0.60820025", "0.6076715", ...
0.6457222
8
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, UpdateApiGroupV2Response): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.8455985", "0.83913255", "0.81440157", "0.8140831", "0.8132328", "0.80937284", "0.809181", "0.809181", "0.809181", "0.808509", "0.808509", "0.8076134", "0.8076134", "0.8065528" ]
0.0
-1
Transforms dict params to list.
def fixed_params_from_dict( fixed_dict: dict, order: tuple, seasonal: dict, intercept: bool, n_ex: int ): ar_dict = {f"ar{i+1}": np.nan for i in range(order[0])} ma_dict = {f"ma{i+1}": np.nan for i in range(order[2])} sar_dict = {f"sar{i+1}": np.nan for i in range(seasonal["order"][0])} sma_dict = {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_params_to_list(self,params):\n result = {}\n for i in params:\n result_list = []\n result_list.append(params[i])\n result[i] = result_list\n return result", "def _dict_params(self, the_dict: Dict):\n return [p for _, e in the_dict.items() f...
[ "0.79286146", "0.73012215", "0.7249738", "0.7034238", "0.6991078", "0.68355864", "0.67949164", "0.6777637", "0.6720772", "0.670666", "0.66439104", "0.6627178", "0.66247445", "0.6536826", "0.65166533", "0.645407", "0.6398166", "0.63974065", "0.63390577", "0.6327886", "0.629829...
0.0
-1
Returns the discounted price of a dollar at the given discount rate for the given time periods. For a time period t, the discounted price of a dollar is given by 1/(1 + t) ^ discount_rate.
def discount(time, discount_rate): if not isinstance(time, Iterable): discounts = (1 + discount_rate) ** (-time) else: discounts = pd.DataFrame( [(1 + discount_rate) ** (-t) for t in time], index=time ) return discounts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discount(self, period):\n\t\treturn 1.0/compound(period)", "def discount(ir, period):\n\treturn ir.discount(period)", "def get_discount_rate_function(self,x: float):\n discount_rate = Bootstrapping.P_Tn(self,Bootstrapping.get_ytm_function(self,x), x)\n return discount_rate", "def duty_free(...
[ "0.6626953", "0.61505955", "0.5977611", "0.5964716", "0.59392506", "0.5846129", "0.57573825", "0.56890523", "0.5597095", "0.5443714", "0.5431241", "0.5420039", "0.54143596", "0.54027027", "0.53439355", "0.5328756", "0.5303341", "0.52942944", "0.52248615", "0.51605004", "0.511...
0.6086986
2
Returns if the word is in the trie.
def search(self, word): pointer = self.tries for i in range(len(word)): ascii = ord(word[i]) - ord('a') if pointer[ascii] == None: return False pointer = pointer[ascii] if word in pointer[26:]: return True else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_trie(self, trie, word):\n current_dict = trie\n for letter in word:\n if letter in current_dict:\n current_dict = current_dict[letter]\n else:\n return False\n else:\n if '_end_' in current_dict:\n return curr...
[ "0.838632", "0.8150416", "0.8123471", "0.7856802", "0.7830664", "0.77935004", "0.7792806", "0.77642965", "0.7753436", "0.7747724", "0.7711298", "0.76816714", "0.7677101", "0.7664614", "0.76506114", "0.76338875", "0.7628353", "0.76114196", "0.7577657", "0.75695884", "0.756079"...
0.6831798
74
Test that the XML generated for delete_shipping_address is valid according to the XMLSchema.
def test_delete_shipping_address(self): self.cim.delete_shipping_address( customer_profile_id=u"123", customer_address_id=u"543" )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_client_address_delete(self):\n pass", "def test_delete_email_address(self):\n email_addr = 'delete@' + self.email_dom\n addr = SpokeEmailAddress(self.org_name, self.user_id)\n addr.create(email_addr)\n self.assertTrue(addr.delete(email_addr))", "def test_new_empty_sh...
[ "0.68369865", "0.66824484", "0.6507282", "0.63197136", "0.6262055", "0.6112484", "0.59423053", "0.58628386", "0.5808613", "0.5806347", "0.5767972", "0.5766934", "0.5763025", "0.57395744", "0.57236254", "0.57016706", "0.5675912", "0.567367", "0.5641863", "0.5614649", "0.552908...
0.76828986
0
Test that the XML generated for update_payment_profile is valid according to the XMLSchema.
def test_update_payment_profile(self): self.cim.update_payment_profile( customer_profile_id=u"122", customer_payment_profile_id=u"444", card_number=u"422222222222", expiration_date=u"2009-10" )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_validate_payment_profile(self):\n self.cim.validate_payment_profile(\n customer_profile_id=u\"222\",\n customer_payment_profile_id=u\"444\",\n customer_address_id=u\"555\",\n )", "def test_update_profile(self):\n self.cim.update_profile(\n ...
[ "0.7119274", "0.602158", "0.5898556", "0.58042413", "0.56440306", "0.5576488", "0.55467504", "0.5540403", "0.55178946", "0.54757077", "0.546285", "0.5445346", "0.5433411", "0.54249924", "0.53623986", "0.5358247", "0.5330804", "0.5329271", "0.53166217", "0.53070897", "0.528655...
0.6887109
1
Test that XML generated for arb subscription creation is valid according to XMLSchema.
def test_create_subscription(self): try: self.arb.create_subscription( trial_occurrences=4, interval_length=1, interval_unit=arb.MONTHS_INTERVAL, start_date=u"2008-09-09", amount=39.99, card_number=u"4222...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_aws_service_api_validate_subscription_post(self):\n pass", "def test_create_subscription(self):\n pass", "def test_create_subscription_template(self):\n pass", "def test_valid_xml(self):\r\n self.build_problem()\r\n self.assertTrue(True)", "def test_issue_add_sub...
[ "0.68451685", "0.6603458", "0.62124455", "0.591246", "0.590252", "0.5889444", "0.587485", "0.58403957", "0.58090097", "0.58051455", "0.56968975", "0.5688304", "0.5658726", "0.5613725", "0.5609618", "0.5588784", "0.5587057", "0.5584466", "0.556534", "0.55565584", "0.5547764", ...
0.6206175
3
Test that XML generated for arb subscription creation is valid according to XMLSchema.
def test_update_subscription(self): args = dict(trial_amount=5.00, trial_occurrences=4, interval_length=1, interval_unit=arb.MONTHS_INTERVAL, start_date=u"2008-09-09", amount=39.99, card_numbe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_aws_service_api_validate_subscription_post(self):\n pass", "def test_create_subscription(self):\n pass", "def test_create_subscription_template(self):\n pass", "def test_create_subscription(self):\n try:\n self.arb.create_subscription(\n trial_oc...
[ "0.684662", "0.66048056", "0.62136173", "0.6206528", "0.5911894", "0.590377", "0.58901656", "0.58737355", "0.5839358", "0.5807121", "0.580338", "0.56996244", "0.5690741", "0.56608665", "0.56131303", "0.56114995", "0.5587182", "0.55869347", "0.5585075", "0.55648565", "0.555555...
0.0
-1
Returns a rectangle suitable for using as a crenellation on a wall of width rectWidth. Rectangle should be used to make numCren meshes. Also returns a list of xpositions for the center of each crenelation. Crenellations are crenHeight units tall. The width of the wall is divided up into numCren2 points, where the dista...
def rectangleCrenellation(rectWidth, numCren, crenHeight): s = N.linspace(0.0, rectWidth, numCren*2) #create a list of indexes into s that mark starting edges of crenellations si = [x for x in range(numCren*2) if x%2 == 0] crenWidth = s[1] xcenters = [s[x]+(crenWidth/2) for x in si] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rect(rows: int, cols: int, top: int = 0,\n left: int = 0) -> List['GridQubit']:\n return [\n GridQubit(row, col)\n for row in range(top, top + rows)\n for col in range(left, left + cols)\n ]", "def make_wander_box(self):\n x = int(self.locatio...
[ "0.5609175", "0.5506376", "0.55015635", "0.5499815", "0.5461805", "0.543794", "0.5436022", "0.536138", "0.52871656", "0.5279356", "0.5274486", "0.52718115", "0.5255457", "0.52531415", "0.52455354", "0.5220105", "0.5216389", "0.519111", "0.51670736", "0.5161852", "0.51254094",...
0.8378836
0
Returns a 1dimensional gaussian of form H,A,dx,w = params H+Anp.exp((xdx)2/(2w2))
def onedgauss(x,H,A,dx,w): #H,A,dx,w = params return H+A*np.exp(-(x-dx)**2/(2*w**2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian1d(x, x0, w0, A, offset):\n if w0 == 0:\n return 0\n return A * np.exp(-2 * (x - x0) ** 2 / (w0 ** 2)) + offset", "def gaussian(mu, wid, x):\n return np.exp(-((x - mu) / (0.6005612 * wid))**2)", "def gaussian(amp, fwhm, mean, x):\n return amp * np.exp(-4. * np.log(2) * (x-mean)**...
[ "0.7256354", "0.7146348", "0.696865", "0.69082737", "0.6888896", "0.68545413", "0.6770614", "0.67670685", "0.6750786", "0.6723022", "0.67044634", "0.66448486", "0.6639246", "0.6633128", "0.6633128", "0.6633128", "0.6627218", "0.66163915", "0.6599127", "0.65882987", "0.6588298...
0.7514844
0
try to determine the 'noisy slope' of y(x), where y is noisy AND get jumps and heratic behaviors. dx is the (small) range for which
def NoisySlope(x,y, dx, plot=None): # compute slopes slopes = [] synth = np.zeros(len(x)) x0 = x[0] xmax = x.max() # default slope def_slope = (y[-1]-y[0])/(x[-1]-x[0]) while x0+dx<xmax: w = np.where((x>=x0)*(x<=x0+dx)) if len(w[0])>10: coef = np.polyfit(x[w]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slope(x1, y1, x2, y2):\r\n delta_y = y2-y1\r\n delta_x = x2-x1\r\n return delta_y / delta_x", "def find_slopes(x, y):\n slopes = np.zeros((len(x) - 1))\n for i in range(len(x) - 1):\n # m = (y2 - y1) / (x2 - x1)\n delta_x = x[i + 1] - x[i]\n delta_y = y[i + 1] - y[i]\n ...
[ "0.6119427", "0.60541016", "0.6011191", "0.5964323", "0.58797306", "0.5812594", "0.58013827", "0.5781024", "0.57780486", "0.5777308", "0.57647735", "0.5747485", "0.572231", "0.5718869", "0.57185066", "0.5704473", "0.56944495", "0.56395185", "0.5639006", "0.5586288", "0.557656...
0.74790376
0
returns MJD for max of AC and BD fringes
def scanGetTimeMaxEnv(self, i=0, calibrated=False, plot=False): t, opd, fringesA, fringesB, fringesC, fringesD = \ self.getScan(i=i, isolate=False, calibrated=calibrated) # compute Morlet's transform dopd = np.abs(np.diff(opd).mean()) wavAC = morlet.CWT(fringesA-fringesC, dop...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMJD():\n myme = createCasaTool(metool)\n mjd = myme.epoch('utc','today')['m0']['value']\n myme.done()\n return(mjd)", "def find_x_max(self, persistence, inf_delta=0.1, band=0.0):\n\n (min_birth, max_death) = self.__min_birth_max_death(persistence, band)\n delta = (max_death - min...
[ "0.638362", "0.63410366", "0.62027895", "0.61168903", "0.606898", "0.6040835", "0.60005516", "0.598112", "0.5950423", "0.5940392", "0.5935496", "0.5896057", "0.5892708", "0.58655983", "0.58630276", "0.58367217", "0.5830076", "0.58113354", "0.5802572", "0.5795623", "0.5793672"...
0.0
-1
Compute the derivative of the score difference for the 'other' weights. Features across, samples down.
def gradient_other(self): # This is just the difference in the feature values return self.fvs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight_difference(weights_og, new_weights):\n difference = weights_og - new_weights\n return(np.absolute(difference).sum())", "def feature_derivative(self, errors, weights, l2, is_feature_constant = False):\n # Compute the dot product of errors and feature\n if is_feature_constant: \n ...
[ "0.69186145", "0.6582274", "0.64347774", "0.6362035", "0.6238054", "0.62318426", "0.61810505", "0.6119181", "0.6119181", "0.6060153", "0.60587746", "0.6011943", "0.59993005", "0.5976823", "0.5972349", "0.5926266", "0.5923953", "0.5912751", "0.5899371", "0.58960146", "0.589371...
0.70946217
0
Get current system mode.
def get_mode(self): self.read(":FUNC?")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mode(self):\r\n return self._api.get_mode()", "def get_mode(self) -> str:\n\n return self.send(self.cmd.GET_MODE)", "def get_current_mode(self):\n return self.read(0xa2)", "def get_mode(self):\r\n return self.mode", "def getmode(self):\n return self.mode", "def ...
[ "0.8249153", "0.82406646", "0.8154318", "0.7918999", "0.79122496", "0.78349155", "0.7751873", "0.7673137", "0.76272875", "0.75628334", "0.75628334", "0.7480675", "0.74368876", "0.74368876", "0.74368876", "0.7425868", "0.7416419", "0.7416419", "0.7416419", "0.73869735", "0.737...
0.6539219
60
Return resistance setting value.
def get_setResistance(self): self.read(":RES?")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_resistance(self):\n\t\tself.resistance = int(input(\"Enter the Value from (0-256)= \"))\n\t\tif self.resistance > 256 :\n\t\t\tself.resistance = int(input(\"Enter the Value from (0-256)= \"))\n\t\t\n\t\treturn self.resistance", "def set_resistance(self, resistance):\n\t\tself.resistance = int(input(\"Ent...
[ "0.7099825", "0.6885828", "0.6838011", "0.67475414", "0.67012316", "0.6687883", "0.6641754", "0.65034586", "0.63919073", "0.62946874", "0.6278066", "0.626316", "0.61937386", "0.60624033", "0.6056963", "0.6047366", "0.601192", "0.59735745", "0.5967475", "0.5955135", "0.5914551...
0.7606481
0
Return the index representation of the string or tuple x.
def index(self, x): if isinstance(x, str): return self.string_to_index[x] elif isinstance(x, tuple): return self.tuple_to_index[x] else: raise ValueError('x should be tuple or string; received {}'.format( x))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string(self, x):\n if isinstance(x, tuple):\n index = self.tuple_to_index[x]\n elif isinstance(x, int):\n index = x\n else:\n raise ValueError('x should be tuple or int; received {}'.format(x))\n return self.strings[index]", "def normalize_index(x)...
[ "0.7945456", "0.66414154", "0.639185", "0.6346053", "0.6300318", "0.622401", "0.60909057", "0.6060737", "0.60376817", "0.5993741", "0.59782237", "0.5940201", "0.5930422", "0.592606", "0.58963484", "0.58585656", "0.5855596", "0.5839916", "0.5791628", "0.5756236", "0.57486016",...
0.8636546
0
Generates maximumlength sequence (MLS) for the given linear feedback shift register (LFSR) length, feedback taps, and output taps. The initial state of the LFSR is taken to be all ones.
def generate_mls(self, N, feedback_taps, output_taps): shift_register = ones((N,)) len_of_mls = 2**N-1 values = zeros((len_of_mls,)) # since python counts at 0, we need to account for output and feedback taps starting to count at 1 # for example, if we want feedback tap position ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def BuildLSTMLayer(batch_size, seq_length, num_inputs, num_nodes):\n weights = RandomVar(\n LSTMCellWeightsShape(num_inputs, num_nodes), name='weights')\n m = array_ops.zeros([batch_size, num_nodes], name='init_m')\n c = array_ops.zeros([batch_size, num_nodes], name='init_c')\n x_seq, pad_seq = RandomInpu...
[ "0.59942347", "0.556606", "0.53739816", "0.50898767", "0.5035204", "0.5021636", "0.49775746", "0.495743", "0.49550647", "0.4954031", "0.49408233", "0.49138936", "0.4899472", "0.4898126", "0.48791122", "0.48480964", "0.48315832", "0.48313525", "0.48134112", "0.48080918", "0.48...
0.67372614
0
Initialize a Flask app instance
def create_app() -> Flask: # Setup this app's loggers. logging.config.dictConfig(settings.LOGGING) app = Flask(__name__) # Perform slack_utils module's app initialization slack_utils.init_app(app) # Perform google_client module's app initialization google_client.init_app(app) slack_e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_app(self):\r\n self.app = Flask(__name__, instance_relative_config=True)\r\n\r\n # Init the secret key of the app -it is a must for flask to run\r\n self.app.config.from_mapping(\r\n SECRET_KEY='!ZNeverSayNever116Z!',\r\n MONGODB_SETTINGS= {'host': 'mongodb://l...
[ "0.8496252", "0.8259077", "0.82216865", "0.81745595", "0.8112859", "0.8071096", "0.80101323", "0.78664446", "0.783678", "0.78316987", "0.77892506", "0.7771727", "0.7758138", "0.77300894", "0.77299225", "0.7722756", "0.7697864", "0.76598626", "0.76415974", "0.76207024", "0.759...
0.0
-1
Yield a 3tuple containing the key, a normalized key, and the value.
def _normalize(args): # type: (Dict[str, Any]) -> Generator[Tuple[str, str, Any], None, None] for k, v in six.iteritems(args): nk = re.sub(r'\W|^(?=\d)', '_', k).strip('_').lower() if keyword.iskeyword(nk): nk += '_' _LOGGER.debug('Normalized "%s" to "%s".', k, nk) yi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exact_key_items(self):\n for key_node, value in self.get_tree_entries():\n for key in self._defining_context.infer_node(key_node):\n if is_string(key):\n yield key.get_safe_value(), LazyTreeValue(self._defining_context, value)", "def _yield_keys(self, key):...
[ "0.6460627", "0.6434361", "0.6294974", "0.6214948", "0.60771364", "0.6056978", "0.6056978", "0.6048192", "0.5969702", "0.5963301", "0.5946623", "0.5900313", "0.58426684", "0.58073527", "0.5785461", "0.5764716", "0.5751182", "0.5731369", "0.572794", "0.57102615", "0.56974125",...
0.6500525
0
The display coordinate system axis which maps to the Y (vertical) canvas axis.
def yax(self): return self.__yax
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_axis_y(self):\r\n return self.__y_axis", "def yaxis ( self ) :\n return self.__yaxis", "def yaxis ( self ) :\n return self.__yaxis", "def yaxis(self):\n return self._yaxis", "def y(self):\n return self.axes[0]", "def y_axis_location(self) -> pulumi.Input[str]:...
[ "0.7841023", "0.77658445", "0.77658445", "0.77262145", "0.72798663", "0.70655024", "0.70655024", "0.70655024", "0.7023963", "0.68886274", "0.6841471", "0.6790863", "0.6784135", "0.6783279", "0.67382383", "0.6728187", "0.6710814", "0.67091334", "0.67047393", "0.66988564", "0.6...
0.6853542
10
Compute the softmax function for each row of the input x.
def softmax(x): orig_shape = x.shape if len(x.shape) > 1: # Matrix exp_minmax = lambda x: np.exp(x - np.max(x)) denom = lambda x: 1.0 / np.sum(x) x = np.apply_along_axis(exp_minmax, 1, x) denominator = np.apply_along_axis(denom, 1, x) if len(denominator.shape) =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(self, x):\n\n out = np.zeros(x.shape)\n for i in range(x.shape[0]):\n max_x = x[i] - np.max(x[i])\n out[i] = np.exp(max_x) / np.sum(np.exp(max_x), axis=0)\n\n return out", "def softmax(x: npt.NDArray) -> npt.NDArray:\n row_wise_max = np.max(x, axis=1).res...
[ "0.8561987", "0.8526665", "0.8486924", "0.8480227", "0.84658504", "0.8465362", "0.8410628", "0.8397011", "0.8391288", "0.8374014", "0.8334504", "0.83247024", "0.8324305", "0.8324305", "0.8324305", "0.8324305", "0.8324305", "0.8324305", "0.8324305", "0.8324305", "0.83107936", ...
0.8006663
87
Returns True if `self` allows `method` for `user`.
def allow_method (self, method, user, ** kw) : if self.auth_required and not \ (user and user.authenticated and user.active) : return False if isinstance (method, pyk.string_types) : try : method = GTW.RST.HTTP_Method.Table [method] exce...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_perm(self, user):\n return True", "def has_user(self, user): # pylint: disable=unused-argument\r\n return False", "def is_method(self):\n try:\n self.method\n except Transformation.DoesNotExist:\n return False\n return True", "def _has_permiss...
[ "0.6573734", "0.6461744", "0.64580315", "0.6442347", "0.629352", "0.629261", "0.62864494", "0.62789005", "0.62075204", "0.61663914", "0.6155627", "0.61355084", "0.60928535", "0.6078934", "0.60784864", "0.6075684", "0.60692465", "0.60362524", "0.6025603", "0.6018322", "0.60116...
0.7881585
0
Initialise the weights of the ESIM model.
def _init_esim_weights(module): if isinstance(module, nn.Linear): nn.init.xavier_uniform_(module.weight.data) nn.init.constant_(module.bias.data, 0.0) elif isinstance(module, nn.LSTM): nn.init.xavier_uniform_(module.weight_ih_l0.data) nn.init.orthogonal_(module.weight_hh_l0.data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_weights(self):\n pass", "def init_weights(model):\n ...", "def init_weights(self):\n # Initialize weights\n self.apply(self._init_weights)\n # Tie weights if needed\n self.tie_weights()", "def init_weights(self):\n # Initialize weights\n ...
[ "0.7948795", "0.791889", "0.7916553", "0.79133403", "0.7717142", "0.76740867", "0.7670459", "0.7665397", "0.7627345", "0.7601293", "0.75917876", "0.730495", "0.7301711", "0.7301711", "0.7301711", "0.7273246", "0.724169", "0.7238179", "0.7222038", "0.7220882", "0.7216713", "...
0.68387777
66
Generate all ordered pairs (a, b) where a <= b < n
def pairs_upto(n): return ((a, b) for a in range(1, n) for b in range(1, n) if a <= b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_pairs(number: int) -> List[List[int]]:\n return [\n [top, inner]\n for top in range(number + 1)\n for inner in range(top, number + 1)\n ]", "def pick_pairs(amount):\n return [(i,i+1,2) for i in range(0, amount, 2)]", "def partitions(n):\n for a in range(2,n//2+1):\n ...
[ "0.72475904", "0.7115587", "0.7097336", "0.6864467", "0.67711884", "0.6694886", "0.6628928", "0.66148907", "0.6549616", "0.65275806", "0.6504304", "0.64824355", "0.6474029", "0.64610136", "0.6456059", "0.64474475", "0.64370745", "0.6431238", "0.6382641", "0.63820255", "0.6362...
0.86008555
0
Ensure that no url with an appid that has no s~ and no .appspot.com builds the correct GAE domain.
def test_no_url_with_non_hrd_not_full_domain_appid_passed_in(self): gae_req = AppEngineRequest(appid="test") url = gae_req.build_url() self.assertEqual(url, "http://test.appspot.com/")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_url_with_hrd_and_full_domain_appid_passed_in(self):\n gae_req = AppEngineRequest(appid=\"s~test.appspot.com\")\n\n url = gae_req.build_url()\n\n self.assertEqual(url, \"http://test.appspot.com/\")", "def test_no_url_with_hrd_not_full_domain_appid_passed_in(self):\n gae_req...
[ "0.80340165", "0.79560566", "0.78863376", "0.6924406", "0.684174", "0.68330765", "0.6782534", "0.6711432", "0.6589769", "0.63818514", "0.6348791", "0.6304217", "0.6253555", "0.62447095", "0.617727", "0.6155926", "0.6124227", "0.61003184", "0.6075416", "0.60637444", "0.6046515...
0.79595155
1
Ensure that no url with an appid that has no s~ but with .appspot.com builds the correct GAE domain.
def test_no_url_with_non_hrd_not_domain_appid_passed_in(self): gae_req = AppEngineRequest(appid="test.appspot.com") url = gae_req.build_url() self.assertEqual(url, "http://test.appspot.com/")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_url_with_hrd_and_full_domain_appid_passed_in(self):\n gae_req = AppEngineRequest(appid=\"s~test.appspot.com\")\n\n url = gae_req.build_url()\n\n self.assertEqual(url, \"http://test.appspot.com/\")", "def test_no_url_with_hrd_not_full_domain_appid_passed_in(self):\n gae_req...
[ "0.7917726", "0.7812908", "0.780377", "0.68001664", "0.6765455", "0.67400014", "0.66772556", "0.664811", "0.65035826", "0.6496849", "0.63881713", "0.6278891", "0.6255819", "0.6219649", "0.6218414", "0.621093", "0.62029546", "0.61754245", "0.617314", "0.6165517", "0.61626595",...
0.77283776
3
Ensure that no url with an appid that has s~ and no .appspot.com builds the correct GAE domain.
def test_no_url_with_hrd_not_full_domain_appid_passed_in(self): gae_req = AppEngineRequest(appid="s~test") url = gae_req.build_url() self.assertEqual(url, "http://test.appspot.com/")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_url_with_hrd_and_full_domain_appid_passed_in(self):\n gae_req = AppEngineRequest(appid=\"s~test.appspot.com\")\n\n url = gae_req.build_url()\n\n self.assertEqual(url, \"http://test.appspot.com/\")", "def test_no_url_with_non_hrd_not_full_domain_appid_passed_in(self):\n gae...
[ "0.78987896", "0.7783706", "0.7710697", "0.68282974", "0.6763808", "0.675828", "0.66818315", "0.6572049", "0.65274787", "0.6378055", "0.6315968", "0.6259842", "0.62518287", "0.62499213", "0.6227673", "0.6185104", "0.6143552", "0.61038136", "0.6093303", "0.6076243", "0.6066082...
0.7813815
1
Ensure that no url with an appid that has s~ and .appspot.com builds the correct GAE domain.
def test_no_url_with_hrd_and_full_domain_appid_passed_in(self): gae_req = AppEngineRequest(appid="s~test.appspot.com") url = gae_req.build_url() self.assertEqual(url, "http://test.appspot.com/")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_url_with_hrd_not_full_domain_appid_passed_in(self):\n gae_req = AppEngineRequest(appid=\"s~test\")\n\n url = gae_req.build_url()\n\n self.assertEqual(url, \"http://test.appspot.com/\")", "def test_no_url_with_non_hrd_not_full_domain_appid_passed_in(self):\n gae_req = AppEn...
[ "0.7731827", "0.7703436", "0.76535404", "0.6689008", "0.6675558", "0.667008", "0.6625004", "0.65532273", "0.64588886", "0.6381543", "0.63382435", "0.6285426", "0.6211132", "0.6190514", "0.6155", "0.6142499", "0.6132167", "0.61253524", "0.6115625", "0.6101043", "0.60970557", ...
0.7854583
0
Ensure that a full url with no appid but has ssl still matches the url passed in.
def test_full_url_with_no_appid_but_has_ssl(self): gae_req = AppEngineRequest(url="http://test.appspot.com", use_ssl=True) url = gae_req.build_url() self.assertEqual(url, "http://test.appspot.com/")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_full_url_with_appid_but_has_ssl(self):\n gae_req = AppEngineRequest(url=\"http://test.appspot.com\", appid=\"foo\")\n\n url = gae_req.build_url()\n\n self.assertEqual(url, \"http://test.appspot.com/\")", "def test_no_url_or_appid_passed_in_and_is_ssl(self):\n gae_req = AppEng...
[ "0.7565136", "0.73904175", "0.71041685", "0.69363695", "0.6877584", "0.6856516", "0.6747883", "0.6629884", "0.66045994", "0.6457605", "0.63729745", "0.626651", "0.6261171", "0.6227274", "0.6210469", "0.6196956", "0.61926275", "0.618503", "0.6168563", "0.6102867", "0.6072138",...
0.75635284
1
Ensure that a full url with appid or ssl still matches the url passed in.
def test_full_url_with_appid_but_has_ssl(self): gae_req = AppEngineRequest(url="http://test.appspot.com", appid="foo") url = gae_req.build_url() self.assertEqual(url, "http://test.appspot.com/")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_full_url_with_no_appid_but_has_ssl(self):\n gae_req = AppEngineRequest(url=\"http://test.appspot.com\", use_ssl=True)\n\n url = gae_req.build_url()\n\n self.assertEqual(url, \"http://test.appspot.com/\")", "def test_full_url_with_no_appid_or_ssl(self):\n gae_req = AppEngineRe...
[ "0.7387688", "0.7155479", "0.70110786", "0.6891876", "0.68747425", "0.6674033", "0.6637914", "0.6621204", "0.6602704", "0.65323097", "0.65062404", "0.6454315", "0.64195555", "0.6412006", "0.6398936", "0.6389253", "0.6362675", "0.6362551", "0.63564163", "0.63341016", "0.633372...
0.75223124
0
Assert allclose for sparse and dense data. Both x_arr and y_arr need to be either sparse or dense, they can't be mixed.
def assert_allclose_dense_sparse(x_arr, y_arr, rtol=1e-07, atol=1e-9, err_msg=''): if sp.sparse.issparse(x_arr) and sp.sparse.issparse(y_arr): x_arr = x_arr.tocsr() y_arr = y_arr.tocsr() x_arr.sum_duplicates() y_arr.sum_duplicates() assert_arr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _raise_assert_on_np_is_close_all(self, np0, np1):\r\n\r\n return self.assertTrue(np.isclose(np0, np1).all())", "def check_all(X, x_lat_dim, x_lon_dim, x_sample_dim, x_feature_dim):\n\tcheck_dimensions(X, x_lat_dim, x_lon_dim, x_sample_dim, x_feature_dim)\n\tcheck_coords(X, x_lat_dim, x_lon_dim, x_samp...
[ "0.65501636", "0.6301932", "0.6272894", "0.61091197", "0.60158247", "0.59637356", "0.5929885", "0.59168935", "0.5907477", "0.5882", "0.58333147", "0.57601935", "0.5731993", "0.568874", "0.5630202", "0.5613783", "0.56071836", "0.5574428", "0.5570935", "0.5564527", "0.55472136"...
0.6854217
0
The Consturctor for the Student Class
def __init__(self,student_id,lname,fname, major='Computer Science',gpa='0.0'): super().__init__(lname,fname) # Call init on parent class self._student_id = student_id self._major = major self._gpa = gpa
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, student):\n pass", "def __init__(self, first_name, last_name, grad_year):\n super().__init__(first_name, last_name)\n self.grad_year = grad_year # The attribute \"grad_year\" is specific to the \"Student\" class.", "def __repr__(self):\n return f\"<Student {str(self)}>\"", ...
[ "0.7842542", "0.7038351", "0.6786078", "0.6709854", "0.6691024", "0.6681707", "0.664556", "0.6540198", "0.65063095", "0.6498874", "0.6479227", "0.6449232", "0.6384962", "0.62019783", "0.61766493", "0.616158", "0.6121009", "0.61071914", "0.6087166", "0.60536027", "0.60444945",...
0.7051329
1
Return the set of nodes calculated to be roots (i.e., those that have no incoming edges). This caches the roots calculated in a previous invocation.
def roots(self): if not self.__roots: self.__roots = set() for n in self.__nodes: if n not in self.__reverse_map: self.__roots.add(n) return self.__roots
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roots (self, reset=False):\n if reset or (self.__roots is None):\n self.__roots = set()\n for n in self.__nodes:\n if not (n in self.__reverseMap):\n self.__roots.add(n)\n return self.__roots", "def roots(self):\n return {\n ...
[ "0.7999736", "0.72956336", "0.727626", "0.72664595", "0.7066699", "0.7051728", "0.6877249", "0.675576", "0.6675337", "0.66235733", "0.6611422", "0.6577812", "0.6551299", "0.6534946", "0.6421426", "0.6285544", "0.6283867", "0.62681544", "0.62172174", "0.61744815", "0.6133952",...
0.8147531
0
Tests the input object, obj, to encode as JSON.
def default(self, obj): if hasattr(obj, 'to_dict'): return getattr(obj, 'to_dict')() if isinstance(obj, query.Query): return list(obj) elif isinstance(obj, datetime.datetime): return obj.isoformat() elif isinstance(obj, time.struct_time): return list(obj) elif isinstance...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_json(obj):\n\treturn json.dumps(obj)", "def json_encode(obj):\n return json.dumps(obj)", "def jsonify(obj):\n raise NotImplementedError", "def is_JSONable(obj, encoder=json_encoder):\n try:\n encoded_string = json_encoder.encode(obj)\n except Exception as e:\n return Fals...
[ "0.7956465", "0.7649501", "0.76239735", "0.7529117", "0.7523264", "0.7384985", "0.7384048", "0.729201", "0.7253562", "0.7208663", "0.7180412", "0.713767", "0.7132318", "0.71225697", "0.70461524", "0.69760966", "0.6955352", "0.691386", "0.690199", "0.68833727", "0.68746734", ...
0.0
-1
Change the value of the currently focused slider.
def change_slider(self, step="1"): try: step = get_int(step, allow_sign=True) except StringConversionError as e: self._app["statusbar"].message(str(e), "error") return for slider in self.sliders.values(): if slider.is_focus(): val =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setValue(self, value):\n\t\tratio = (value - self.range[0]) / (self.range[1] - self.range[0])\n\t\tself._changed = False\n\t\tself.slider.setValue(ratio * 100)\n\t\tself._changed = False\n\t\tself.spinbox.setValue(value)\n\t\tself._changed = False", "def _set_slider_value(self, slider, name):\n val = ...
[ "0.72220373", "0.71615434", "0.6943709", "0.6854739", "0.68223286", "0.66861737", "0.6665478", "0.66362756", "0.6552973", "0.65392", "0.65091586", "0.65004975", "0.6442013", "0.64374316", "0.6423883", "0.64218116", "0.6370527", "0.63582295", "0.63176805", "0.6313095", "0.6287...
0.69852424
2
Save precomputed Tree to TEMP_DIR as a pickle file
def _save_tree(tree, tree_path): try: with open(tree_path, 'wb') as f: pickle.dump(tree, f) except Exception as e: logger.warning('Could not save tree to {}: {}' .format(tree_path, e))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _save_tree_pickle(self, folderpath):\n\n if not os.path.exists(folderpath):\n raise EnvironmentError('Unable to save pickle file to {}, does not exist'.format(folderpath))\n self.tree.manager = None\n\n picklefile = open(os.path.join(folderpath, \"grid.pickle\"), \"wb\")\n ...
[ "0.6810984", "0.67053837", "0.6579001", "0.64206666", "0.6398704", "0.6390029", "0.63181114", "0.6299962", "0.62672275", "0.6258406", "0.6154937", "0.61512357", "0.6141332", "0.60855424", "0.6081557", "0.60808194", "0.60798603", "0.607436", "0.6074181", "0.6072896", "0.606603...
0.68667
0
Computes the average error and true fraction of a dataframe
def compute_metrics(data): num_true = 0.0 total = 0.0 error = 0.0 for index, row in data.iterrows(): total += 1 true = row['transition_true'] pred = row['transition_predicted'] if true == pred: num_true += 1 error += np.abs(float(true) - float(pred)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_verified_rate(df):\n total_tokens = token_count(df)\n total_errors = df['num_errors'].sum()\n\n if total_tokens > 0:\n return (total_tokens - total_errors)/total_tokens\n else:\n return np.nan", "def calc_mard(df):\n df = add_error_fields(df)\n\n abs_relative_differenc...
[ "0.6771849", "0.642468", "0.6380675", "0.6243393", "0.6105491", "0.61039144", "0.60892344", "0.6078415", "0.6071759", "0.6071015", "0.60700715", "0.60534304", "0.5981431", "0.5968121", "0.5946398", "0.59447217", "0.5941373", "0.5941247", "0.5933675", "0.59289193", "0.5928114"...
0.6465076
1
Find a group ID from a string containing a group name or ID. Raises ValueError if the string can't be resolved to a valid group ID on the system.
def name_to_gid(name): try: gid = int(name) except ValueError: try: grprec = grp.getgrnam(name) except KeyError: raise ValueError("Invalid group name %s" % name) gid = grprec[2] else: try: grp.getgrgid(gid) # check if gid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_group_id(self, group_name):\n uri_vars = {\"q\": group_name, \"start\": 0, \"count\": \"Infinity\"}\n group_uri = urllib.parse.urlencode(uri_vars)\n full_url = self.base_url + f\"/group/group/findgroup.html?{group_uri}\"\n result_str = self.fetch(full_url)\n result = json...
[ "0.65004885", "0.6402883", "0.6402883", "0.6402883", "0.6168891", "0.6043444", "0.59909356", "0.598514", "0.5878768", "0.5842378", "0.582505", "0.5761912", "0.5761912", "0.5714784", "0.568488", "0.56109583", "0.55908364", "0.55775017", "0.5561659", "0.5554969", "0.5526913", ...
0.6518297
0
Remove all ANSI color escapes from the given string.
def stripEscapes(s): result = '' show = 1 i = 0 L = len(s) while i < L: if show == 0 and s[i] in ANSI_TERMINATORS: show = 1 elif show: n = s.find(ANSI_ESCAPE_BEGIN, i) if n == -1: return result + s[i:] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_ansi(text):\n return ANSI_ESCAPE_RE.sub('', text)", "def strip_ansi(content):\n return ANSI_ESCAPES_REGEX.sub('', content)", "def strip_ansi(text: str):\n return _ANSI_SEQUENCE_REGEX.sub('', text)", "def remove_ansi_escape_sequences(input_string):\n ansi_escape = re.compile(r'(\\x9B|\\x...
[ "0.8234734", "0.8208664", "0.8040151", "0.7864009", "0.7853919", "0.7827919", "0.7795247", "0.7751296", "0.76295656", "0.75681454", "0.75019747", "0.72742707", "0.7263386", "0.7251305", "0.72345895", "0.68963593", "0.67531645", "0.6712818", "0.66767013", "0.6670891", "0.65885...
0.77160233
8
Return a symbolic name for a signal. Return "signal NNN" if there is no corresponding SIG name in the signal module.
def signame(sig): if _signames is None: _init_signames() return _signames.get(sig) or "signal %d" % sig
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSignalName(sig):\n try:\n return sig._name\n except AttributeError:\n pass\n return sig.name", "def getSignalName(sig):\n try:\n return sig._name\n except AttributeError:\n pass\n return sig.name", "def name2signal(string):\n try:\n v = int(string)...
[ "0.7843286", "0.7843286", "0.73225564", "0.70580703", "0.69929916", "0.66042894", "0.659641", "0.6189449", "0.60586506", "0.6008543", "0.59300786", "0.5891526", "0.58624005", "0.56920224", "0.5598146", "0.559582", "0.5503463", "0.5455866", "0.54453534", "0.54345727", "0.54176...
0.8159103
0
Send a signal to the subprocess. This may or may not kill it. Return None if the signal was sent, or an error message string if an error occurred or if the subprocess is not running.
def kill(self, sig): now = time.time() options = self.config.options # Properly stop processes in BACKOFF state. if self.state == ProcessStates.BACKOFF: msg = ("Attempted to kill %s, which is in BACKOFF state." % (self.config.name)) opt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sendSignal (self, signal) :\n\n data = streamModule.WriteBuffer()\n\n data.writeStruct('B', signal)\n\n return self.sendCommand(\"CMD_IN_DO_KILL\", data.getvalue()).addCallback(self._sendSignal_result)", "def send_signal(self, sig):\n os.kill(self.pid, sig)", "def send_signal(se...
[ "0.6820816", "0.68153375", "0.6797943", "0.6772776", "0.659181", "0.64851004", "0.6315368", "0.6132675", "0.603007", "0.5902756", "0.58116734", "0.57842654", "0.5677382", "0.56546813", "0.55899584", "0.55864084", "0.5583611", "0.5554574", "0.5546251", "0.5468038", "0.5392306"...
0.5591944
14
Build a completion list of action names matching text
def _complete_actions(self, text): return [ a + ' ' for a in self.vocab if a.startswith(text)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_action_choices():\n from hardware.management.commands.gpio_buttons import Command\n import re\n pattern = re.compile(r'^on_(?P<name>\\w+)_press$')\n choices = []\n for member in dir(Command):\n match = pattern.match(member)\n if match:\n action = match.groupdict()['n...
[ "0.62659776", "0.6001682", "0.5942429", "0.5912361", "0.5892503", "0.58538586", "0.5820629", "0.57876176", "0.5745819", "0.57237816", "0.56744117", "0.56694514", "0.55924207", "0.553145", "0.55229825", "0.54993415", "0.548934", "0.5481118", "0.54563904", "0.545125", "0.542456...
0.7298995
0
DO NOT MODIFY THIS FUNCTION. Turns a concatenated string of integers separated by commas into an array of integers. (Inverse of array_to_concatenated_string).
def concatenated_string_to_array(string): return np.array([int(x) for x in string.split(",")])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concatenated_string_to_array(string):\r\n return np.array([int(x) for x in string.split(\",\")])", "def parse_int_list(input_str):\n return [int(part) for part in input_str.split(\",\")]", "def strToIntArray(line, delim=\",\"):\n\tarr = line.split(delim)\n\treturn [int(a) for a in arr]", "def strTo...
[ "0.7136949", "0.70993084", "0.70623255", "0.7034449", "0.6964795", "0.6869297", "0.6811152", "0.6683457", "0.6660619", "0.663857", "0.65851396", "0.65430206", "0.6469615", "0.6462557", "0.6403212", "0.6387657", "0.6272814", "0.6263803", "0.62634224", "0.6212205", "0.616965", ...
0.70861775
2
This function creates a filename number. If one has 20000 data samples, the first file should be called 00000.xyz and not 0.xyz. This function deals with this problem.
def pad_filename(filenumber, n_of_zeros=5): padding = "0" str_file_n = str(filenumber) n = n_of_zeros - len(str_file_n) file_idx = n * padding + str_file_n return file_idx
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_file_name(file_path):\r\n file_base, file_ext = os.path.splitext(file_path)\r\n if os.path.isfile(file_path):\r\n nfile = 1\r\n check = True\r\n while check:\r\n name_add = '0000' + str(nfile)\r\n file_path = file_base + \"_\" + name_add[-4:] + file_ext\...
[ "0.7389932", "0.7352545", "0.720552", "0.71066594", "0.7010931", "0.6981077", "0.6920724", "0.681298", "0.67451704", "0.6733076", "0.67050844", "0.66571796", "0.6626867", "0.6618935", "0.6580103", "0.6567721", "0.6528952", "0.6520565", "0.6515874", "0.6500347", "0.650012", ...
0.65885466
14
Returns a string of whitespace padding to insert between strings s1 and s2 so that the length of s1 + padding + s2 = 40.
def get_pad2(s1, s2): return " " * (40 - len(s1) - len(s2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _padboth(width, s):\n fmt = \"{0:^%ds}\" % width\n return fmt.format(s)", "def add_padding(text1: str) -> str:\n\n pad_len = 8 - (len(text1) % 8)\n return text1 + (pad_len * '\\0')", "def str_padding(length, val):\n return '{0:<{fill}}'.format(val, fill=length)", "def padder(str_li...
[ "0.7414062", "0.7409585", "0.69631326", "0.6710383", "0.6663951", "0.6579775", "0.65639526", "0.6545024", "0.654161", "0.6536736", "0.64538413", "0.6414943", "0.638392", "0.63770825", "0.6350194", "0.6309118", "0.6298225", "0.62975276", "0.62054247", "0.61619735", "0.6140846"...
0.8604335
0
Write a dict to an ssm .json file.
def write_map_to_file(dir, version, role, map_id, d): if not os.path.exists(dir): os.makedirs(dir) path = build_output_file_path(dir, version, role, map_id) with open(path, "w") as f: json.dump(d, f, sort_keys=True, indent=4) f.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to_json(dict, file):\n with open(file, 'w') as f:\n json.dump(dict, f, indent=2)\n return file", "def write(self, fp, **kwds):\n json.dump(self._dict, fp)", "def write_to_json(missense_dict, frame_shift_dict, missense_name_dict, frame_shift_name_dict, person):\n json_file[person...
[ "0.7260208", "0.7213948", "0.72013533", "0.7112508", "0.710174", "0.7040818", "0.70400333", "0.7026444", "0.698111", "0.6968449", "0.6958007", "0.69073045", "0.68703425", "0.6847981", "0.68181217", "0.6723503", "0.670992", "0.6660994", "0.6646371", "0.66390026", "0.6603685", ...
0.6740587
15
Find the best (latest stable) release matching version
def best_version(version, versions): compatibles = (v for v in versions if v.startswith(version)) sorted_compatibles = sorted(compatibles, reverse=True, key=_version_key) return next(iter(sorted_compatibles), None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_latest_version(versions):\n\n highest_version = 0\n for version in versions:\n version = parse_version(version)\n\n if version > highest_version:\n highest_version = version\n\n return highest_version", "def get_latest_version():\n found_version = \"unknown\"\n ve...
[ "0.70043766", "0.698648", "0.69080967", "0.6781013", "0.6768267", "0.6710947", "0.66394466", "0.65350544", "0.65328526", "0.6477424", "0.6440638", "0.64135677", "0.63965267", "0.6390945", "0.6388328", "0.6330844", "0.6311764", "0.62787646", "0.6276881", "0.6275519", "0.626579...
0.74463433
0
The bare file name without path or extension.
def title(self): if self.file_name is None: return None else: fname = os.path.split(self.file_name)[-1] fname, *ext = fname.rsplit('.', 1) procgen = ext and ext[0] in ('json', 'yaml') if procgen and self._seed and self._seed.spawn_key: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_sans_ext(self) -> str:\n return os.path.splitext(self.path)[0]", "def get_file_name(self):\n return self.path.name[6:]", "def get_file_name(self):\n return str(self.get_file())", "def base_filename(self):\n return self.filename.split('.')[0]", "def name(self):\n ...
[ "0.8062212", "0.77596676", "0.75892144", "0.757278", "0.75492924", "0.75189644", "0.750894", "0.74929404", "0.74699664", "0.74119943", "0.74098384", "0.7408563", "0.7403132", "0.73448634", "0.7332908", "0.7330307", "0.7316706", "0.73064524", "0.7301133", "0.7299242", "0.72981...
0.0
-1
Initialize data object for a log entry
def __init__(self): self.parser = None self.date_stamp_noyear = None self.date_stamp = None self.date_stamp_utc = None self.year = None self.month = None self.day = None self.tstamp = None self.tzone = None self.raw_text = None self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, data, logger):\n self.data = data\n self.logger = logger", "def __init__(self, entry):\n \n self.lastChangedDate = entry.time\n self.size = entry.size\n self.kind = entry.kind\n self.logMessage = None", "def __init__(self, log_file, csv_file, ...
[ "0.74895716", "0.72528327", "0.7112819", "0.71060836", "0.71026695", "0.6965318", "0.6873593", "0.6784495", "0.67073417", "0.6645496", "0.6643836", "0.6588347", "0.6556561", "0.65201896", "0.65119046", "0.6451816", "0.6446414", "0.6363076", "0.63545436", "0.63419217", "0.6330...
0.58836854
76
Return datestamp converted to UTC
def _utc_date(self): if self.date_stamp == '0': return '0' else: if '.' in self.date_stamp: t = datetime.datetime.strptime(self.date_stamp, '%Y%m%d%H%M%S.%f') else: t = datetime.datetime.strptime(self.date_stamp,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def localtime2utc(date):\n return date + (datetime.utcnow() - datetime.now())", "def utctime(stamp):\n return stamp + utc_offset", "def utc_timestamp(ts):\n import pandas\n\n ts = pandas.Timestamp(ts)\n if not ts.tzinfo:\n ts = ts.tz_localize(\"UTC\")\n else:\n ts = ts.tz_conver...
[ "0.72865945", "0.72738886", "0.7208024", "0.7057737", "0.7051459", "0.69816047", "0.688973", "0.6885604", "0.6845516", "0.68006486", "0.67649376", "0.67635983", "0.6729798", "0.6693813", "0.66580063", "0.6621874", "0.65948504", "0.6591757", "0.6573858", "0.65518266", "0.65352...
0.7641419
0
Initialize data object for multiple parsed logs
def __init__(self): self.data_set = [] self.finalized_data = LogData()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.status = ''\n self.message = ''\n self.remediation_status = ''\n self.logdata = []", "def __init__(self, data, logger):\n self.data = data\n self.logger = logger", "def log_init(self):\n\t\tlayer_id = \"Data\"\n\t\tself.graph[layer_id] = laye...
[ "0.7008622", "0.69766784", "0.66994387", "0.66672343", "0.6665927", "0.66527486", "0.66310865", "0.6574381", "0.64285916", "0.63655865", "0.6337346", "0.6287167", "0.6239272", "0.62297726", "0.6228061", "0.6137922", "0.6124673", "0.6121011", "0.6117786", "0.6112237", "0.61052...
0.73620933
0
Returns the mean squared error between y_true & y_pred
def mean_squared_error(y_true, y_pred): mse = np.mean(np.power(y_true, y_pred, 2)) return mse
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_squared_error(y_true, y_pred):\n mse = np.mean((y_true - y_pred)**2)\n return mse", "def mean_squared_error(y_true, y_pred):\n mse = np.mean(np.power(y_true - y_pred, 2))\n return mse", "def error(self, y_true, y_pred):\n\n return mean_squared_error(y_true, y_pred)", "def rmse(y_t...
[ "0.8846344", "0.8823697", "0.85954374", "0.8513764", "0.84913665", "0.8480937", "0.84739363", "0.8445602", "0.8396934", "0.8394208", "0.83756435", "0.8321576", "0.82539994", "0.8209817", "0.8075168", "0.80571944", "0.8034213", "0.80341303", "0.79994166", "0.798469", "0.794753...
0.88486683
0
Test removal of a community from the record.
def test_remove_community( client, uploader, curator, record_community, headers, community ): for user in [uploader, curator]: record = record_community.create_record() data = {"communities": [{"id": community.id}]} client = user.login(client) response = client.delete( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_remove_another_community(\n client,\n headers,\n db,\n curator,\n community2,\n record_community,\n):\n client = curator.login(client)\n record = record_community.create_record()\n record = _add_to_community(db, record, community2)\n # record is part of `community` and `commu...
[ "0.7839784", "0.7634505", "0.73626244", "0.7114082", "0.6617034", "0.6596385", "0.6389408", "0.6238289", "0.6222251", "0.6168493", "0.60803026", "0.60516727", "0.6002939", "0.598661", "0.5887693", "0.5879507", "0.5874813", "0.5865965", "0.58304644", "0.58127326", "0.58050036"...
0.7972811
0
Test add/remove of a nonexisting community from the record.
def test_add_remove_non_existing_community( client, uploader, record_community, headers, community, payload ): data = {"communities": payload} client = uploader.login(client) record = record_community.create_record() for operation in [client.post, client.delete]: response = operation( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_remove_existing_non_existing_community(\n client, uploader, record_community, headers, community\n):\n data = {\"communities\": [{\"id\": \"wrong-id\"}, {\"id\": community.id}]}\n\n client = uploader.login(client)\n record = record_community.create_record()\n\n response = client.delete(\n ...
[ "0.7631636", "0.7466784", "0.698705", "0.6899006", "0.6859428", "0.6830376", "0.68071127", "0.6782127", "0.6689016", "0.666084", "0.6604336", "0.65704274", "0.64357406", "0.6420283", "0.6357099", "0.6317589", "0.6309014", "0.6169069", "0.60457027", "0.6019887", "0.5873175", ...
0.81090117
0
Randomly blank input words.
def word_blank(self, x, l, lang_id): if self.params.word_blank == 0: return x, l assert 0 < self.params.word_blank < 1 # define words to blank bos_index = self.params.bos_index[lang_id] assert (x[:, 0] == bos_index).sum() == l.size(0) keep = np.random.rand(x....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_words(name, times=1, words_in_token=2):\r\n\twords = name.split(\" \")\r\n\tif words_in_token > len(words):\r\n\t\twords_in_token = len(words)\r\n\tfor i in range(times):\r\n\t\trandnum = random.randint(0, len(words) - words_in_token)\r\n\t\tremoved = \"\"\r\n\t\tfor index in range(words_in_token):\...
[ "0.71243674", "0.6794822", "0.6755961", "0.6622092", "0.65642047", "0.6558932", "0.6490112", "0.63830966", "0.63684475", "0.62439", "0.6230462", "0.62100255", "0.61784554", "0.6122306", "0.6122306", "0.6122306", "0.6110098", "0.60995924", "0.6078731", "0.6078078", "0.60726124...
0.6377494
8
Return a batch of sentences from a dataset.
def get_batch(self, iter_name, lang1, lang2, back=False): assert back is False or lang2 is not None assert lang1 in self.params.langs assert lang2 is None or lang2 in self.params.langs key = ','.join([x for x in [iter_name, lang1, lang2] if x is not None]) + ('_back' if back else '') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gather_sentences(self):\n sentences = Sentence.objects.all()\n return sentences", "def split_to_sentences(data):\r\n sentences = data.split(\"\\n\")\r\n \r\n sentences = [s.strip() for s in sentences]\r\n sentences = [s for s in sentences if len(s) > 0]\r\n \r\n return sentenc...
[ "0.6724796", "0.6619705", "0.64720875", "0.6435097", "0.64037824", "0.63717926", "0.63717926", "0.63504994", "0.63474", "0.62938994", "0.62938994", "0.6270098", "0.619197", "0.61856043", "0.61792094", "0.61736786", "0.61695194", "0.6154717", "0.610849", "0.60986835", "0.60839...
0.0
-1
ValueError is raised when an expected UID is missing.
def testUidMissingError(self): self.assertRaises(ValueError, dicom_path.Path, 'p', 'l', 'd', 's', None, '4.5.6') self.assertRaises(ValueError, dicom_path.Path, 'p', 'l', 'd', 's', 'stuid', None, '7.8.9')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getUIDValidity(self):\n return 42", "def test_uidvalidity(self):\n d = self._examineOrSelect()\n self._response(b'* OK [UIDVALIDITY 12345] UIDs valid')\n self.assertEqual(\n self.successResultOf(d),\n {'READ-WRITE': False, 'UIDVALIDITY': 12345})", "def test...
[ "0.7014378", "0.68719834", "0.6765608", "0.6730605", "0.66800886", "0.65725785", "0.64027596", "0.63214594", "0.59884626", "0.59829694", "0.5956462", "0.5906866", "0.58939266", "0.5888079", "0.5884346", "0.5805085", "0.5756036", "0.57367367", "0.57345194", "0.5726338", "0.572...
0.6852566
2
Numpy implementation of the Frechet Distance. The Frechet distance between two multivariate Gaussians X_1 ~ N(mu_1, C_1) and X_2 ~ N(mu_2, C_2) is d^2 = ||mu_1 mu_2||^2 + Tr(C_1 + C_2 2sqrt(C_1C_2)).
def calculate_frechet_distance(self, mu1, sigma1, mu2, sigma2, eps=1e-6): mu1 = np.atleast_1d(mu1) mu2 = np.atleast_1d(mu2) sigma1 = np.atleast_2d(sigma1) sigma2 = np.atleast_2d(sigma2) assert mu1.shape == mu2.shape, \ 'Training and test mean vectors have different...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_frechet_distance(mu1, sigma1, mu2, sigma2, eps=1e-6):\r\n\r\n mu1 = np.atleast_1d(mu1)\r\n mu2 = np.atleast_1d(mu2)\r\n\r\n sigma1 = np.atleast_2d(sigma1)\r\n sigma2 = np.atleast_2d(sigma2)\r\n\r\n assert mu1.shape == mu2.shape, \\\r\n 'Training and test mean vectors have differ...
[ "0.75821805", "0.75805646", "0.7571136", "0.7555783", "0.75500077", "0.75500077", "0.75500077", "0.7095994", "0.6810773", "0.66732", "0.66543245", "0.64223117", "0.636462", "0.6267896", "0.624056", "0.6086667", "0.6056519", "0.6041287", "0.6018872", "0.596504", "0.59531176", ...
0.7437406
7
Calculate split probabilities for all rows in values
def split_probability_all(values, deltas, flags, threshold): nof_objcts = values.shape[0] ps = [ split_probability(values[i], deltas[i], flags[i], threshold) for i in range(nof_objcts) ] ps = numpy.array(ps) return ps
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_data(data, prob):\n results = [], []\n for row in data:\n results[0 if random.random() < prob else 1].append(row)\n return results", "def split_data(data, prob):\n\tresults = [], []\n\tfor row in data:\n\t\tresults[0 if random.random() < prob else 1].append(row)\n\treturn results", "d...
[ "0.6172379", "0.6160449", "0.6160449", "0.6078279", "0.59629035", "0.5912157", "0.5666303", "0.56498355", "0.56128556", "0.5585566", "0.5577548", "0.54992414", "0.54974806", "0.5414682", "0.5412388", "0.5408131", "0.5401223", "0.5400987", "0.5373648", "0.53730714", "0.5372279...
0.6152959
3
Test resolve state with electric_displacement sensor.
def test_str_electric_displacement(self): xknx = XKNX() sensor = Sensor( xknx, "TestSensor", group_address_state="1/2/3", value_type="electric_displacement", ) sensor.sensor_value.payload = DPTArray( ( 0xC5, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_str_electric_potential(self):\n xknx = XKNX(loop=self.loop)\n sensor = Sensor(\n xknx,\n 'TestSensor',\n group_address_state='1/2/3',\n value_type=\"electric_potential\")\n sensor.sensor_value.payload = DPTArray((0x43, 0x65, 0xE3, 0xD7))\n\n...
[ "0.66917866", "0.65066963", "0.628563", "0.62752134", "0.62732565", "0.6256749", "0.62538445", "0.6236971", "0.6058551", "0.6007121", "0.5992349", "0.59797555", "0.583006", "0.5782286", "0.5697939", "0.56551325", "0.56388247", "0.5592843", "0.55783075", "0.55406165", "0.54755...
0.7495741
0
Test resolve state with electric_flux sensor.
def test_str_electric_flux(self): xknx = XKNX() sensor = Sensor( xknx, "TestSensor", group_address_state="1/2/3", value_type="electric_flux" ) sensor.sensor_value.payload = DPTArray( ( 0x45, 0x8F, 0x6C, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_str_electric_flux_density(self):\n xknx = XKNX()\n sensor = Sensor(\n xknx,\n \"TestSensor\",\n group_address_state=\"1/2/3\",\n value_type=\"electric_flux_density\",\n )\n sensor.sensor_value.payload = DPTArray(\n (\n ...
[ "0.6551268", "0.6343939", "0.6334032", "0.6219933", "0.6186172", "0.6177109", "0.6175207", "0.6170472", "0.61396533", "0.6090312", "0.6067249", "0.6059255", "0.60474485", "0.5919116", "0.59150827", "0.59127545", "0.59071755", "0.5898005", "0.5891983", "0.58614296", "0.5807201...
0.73248905
0
Test resolve state with electric_flux_density sensor.
def test_str_electric_flux_density(self): xknx = XKNX() sensor = Sensor( xknx, "TestSensor", group_address_state="1/2/3", value_type="electric_flux_density", ) sensor.sensor_value.payload = DPTArray( ( 0xC6, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_str_magnetic_flux_density(self):\n xknx = XKNX()\n sensor = Sensor(\n xknx,\n \"TestSensor\",\n group_address_state=\"1/2/3\",\n value_type=\"magnetic_flux_density\",\n )\n sensor.sensor_value.payload = DPTArray(\n (\n ...
[ "0.67414373", "0.6728751", "0.6436214", "0.6427312", "0.60220706", "0.6001049", "0.5908386", "0.58322", "0.57961893", "0.5784182", "0.57774", "0.57720697", "0.57636744", "0.5718528", "0.56969106", "0.5680578", "0.5661069", "0.56550455", "0.5649965", "0.5619119", "0.56083596",...
0.7301525
0
Test resolve state with heat_quantity sensor.
def test_str_heat_quantity(self): xknx = XKNX() sensor = Sensor( xknx, "TestSensor", group_address_state="1/2/3", value_type="heat_quantity" ) sensor.sensor_value.payload = DPTArray( ( 0xC5, 0xA6, 0xB6, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_stretch_sensor_entities(\n hass: HomeAssistant, mock_stretch: MagicMock, init_integration: MockConfigEntry\n) -> None:\n state = hass.states.get(\"sensor.koelkast_92c4a_electricity_consumed\")\n assert state\n assert float(state.state) == 50.5\n\n state = hass.states.get(\"sensor.drog...
[ "0.63871753", "0.6067377", "0.60263306", "0.5986225", "0.59817195", "0.5979464", "0.5933312", "0.59121513", "0.59045273", "0.58993095", "0.5889053", "0.58725053", "0.5870094", "0.58470243", "0.58336425", "0.5815726", "0.5807475", "0.57673335", "0.57616156", "0.5757488", "0.57...
0.6961294
0
Test resolve state with luminous_flux sensor.
def test_str_luminous_flux(self): xknx = XKNX() sensor = Sensor( xknx, "TestSensor", group_address_state="1/2/3", value_type="luminous_flux" ) sensor.sensor_value.payload = DPTArray( ( 0x45, 0xBD, 0x16, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_str_luminous_intensity(self):\n xknx = XKNX()\n sensor = Sensor(\n xknx,\n \"TestSensor\",\n group_address_state=\"1/2/3\",\n value_type=\"luminous_intensity\",\n )\n sensor.sensor_value.payload = DPTArray(\n (\n ...
[ "0.6147642", "0.6137587", "0.6050736", "0.6032027", "0.59297097", "0.5854836", "0.584904", "0.5804019", "0.57914865", "0.574767", "0.5668048", "0.56595755", "0.5643757", "0.56282073", "0.5541296", "0.552142", "0.5521179", "0.55172044", "0.55152506", "0.550678", "0.5474448", ...
0.7434262
0
Serializes this instance to a Python dictionary.
def to_dict(self): output = copy.deepcopy(self.__dict__) return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n return dumpd(self)", "def to_dict(self):\n serialized = self._serializer().dump(self)\n return serialized.data", "def to_dict(self):\n return to_dict(self.__dict__)", "def to_dict(self):\r\n return self.__dict__", "def to_dict(self):\n return s...
[ "0.8421195", "0.84043926", "0.8362277", "0.83090377", "0.82829785", "0.82829785", "0.82829785", "0.82829785", "0.82829785", "0.82829785", "0.8236021", "0.82179517", "0.82133806", "0.82032114", "0.8181652", "0.8179579", "0.81732064", "0.81534773", "0.8118078", "0.8090142", "0....
0.0
-1
Serializes this instance to a JSON string.
def to_json_string(self): return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self) -> str:\n return json.dumps(self.__dict__)", "def serialize(self):\n return json.dumps(self.as_dict())", "def to_json(self) -> str:\n return json.dumps(self.to_dict())", "def to_json(self) -> str:\n return json.dumps(self.to_dict())", "def to_json(self) -> st...
[ "0.88999254", "0.8837045", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.87147456", "0.8637419", "0.8619328", "0.8598524", "0.8572258", "0.8568808", "0.8568808", "0.8446259", "0.8446259", "0.8446259", ...
0.0
-1
Serializes this instance to a Python dictionary.
def to_dict(self): output = copy.deepcopy(self.__dict__) return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n return dumpd(self)", "def to_dict(self):\n serialized = self._serializer().dump(self)\n return serialized.data", "def to_dict(self):\n return to_dict(self.__dict__)", "def to_dict(self):\r\n return self.__dict__", "def to_dict(self):\n return s...
[ "0.8421195", "0.84043926", "0.8362277", "0.83090377", "0.82829785", "0.82829785", "0.82829785", "0.82829785", "0.82829785", "0.82829785", "0.8236021", "0.82179517", "0.82133806", "0.82032114", "0.8181652", "0.8179579", "0.81732064", "0.81534773", "0.8118078", "0.8090142", "0....
0.0
-1
Serializes this instance to a JSON string.
def to_json_string(self): return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self) -> str:\n return json.dumps(self.__dict__)", "def serialize(self):\n return json.dumps(self.as_dict())", "def to_json(self) -> str:\n return json.dumps(self.to_dict())", "def to_json(self) -> str:\n return json.dumps(self.to_dict())", "def to_json(self) -> st...
[ "0.88999254", "0.8837045", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.87147456", "0.8637419", "0.8619328", "0.8598524", "0.8572258", "0.8568808", "0.8568808", "0.8446259", "0.8446259", "0.8446259", ...
0.0
-1
Serializes this instance to a Python dictionary.
def to_dict(self): output = copy.deepcopy(self.__dict__) return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n return dumpd(self)", "def to_dict(self):\n serialized = self._serializer().dump(self)\n return serialized.data", "def to_dict(self):\n return to_dict(self.__dict__)", "def to_dict(self):\r\n return self.__dict__", "def to_dict(self):\n return s...
[ "0.8421195", "0.84043926", "0.8362277", "0.83090377", "0.82829785", "0.82829785", "0.82829785", "0.82829785", "0.82829785", "0.82829785", "0.8236021", "0.82179517", "0.82133806", "0.82032114", "0.8181652", "0.8179579", "0.81732064", "0.81534773", "0.8118078", "0.8090142", "0....
0.0
-1
Serializes this instance to a JSON string.
def to_json_string(self): return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self) -> str:\n return json.dumps(self.__dict__)", "def serialize(self):\n return json.dumps(self.as_dict())", "def to_json(self) -> str:\n return json.dumps(self.to_dict())", "def to_json(self) -> str:\n return json.dumps(self.to_dict())", "def to_json(self) -> st...
[ "0.88999254", "0.8837045", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.87147456", "0.8637419", "0.8619328", "0.8598524", "0.8572258", "0.8568808", "0.8568808", "0.8446259", "0.8446259", "0.8446259", ...
0.0
-1
Gets a collection of `InputExample`s for the train set.
def get_train_examples(self, data_dir): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_train_inputs(self, example):\n return example", "def get_train_examples(self):\n raise NotImplementedError()", "def get_train_examples(self, input_file):\r\n raise NotImplementedError()", "def _create_examples(self, data, set_type):\n examples = []\n for (i, elem) in en...
[ "0.73499966", "0.7173421", "0.7126833", "0.65602446", "0.64204013", "0.64052176", "0.63422555", "0.6290186", "0.6282746", "0.625262", "0.62499267", "0.62466323", "0.62466323", "0.62466323", "0.62466323", "0.62466323", "0.62466323", "0.62466323", "0.62466323", "0.62466323", "0...
0.6205607
32
Serializes this instance to a Python dictionary.
def to_dict(self): output = copy.deepcopy(self.__dict__) return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n return dumpd(self)", "def to_dict(self):\n serialized = self._serializer().dump(self)\n return serialized.data", "def to_dict(self):\n return to_dict(self.__dict__)", "def to_dict(self):\r\n return self.__dict__", "def to_dict(self):\n return s...
[ "0.8421195", "0.84043926", "0.8362277", "0.83090377", "0.82829785", "0.82829785", "0.82829785", "0.82829785", "0.82829785", "0.82829785", "0.8236021", "0.82179517", "0.82133806", "0.82032114", "0.8181652", "0.8179579", "0.81732064", "0.81534773", "0.8118078", "0.8090142", "0....
0.0
-1
Serializes this instance to a JSON string.
def to_json_string(self): return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self) -> str:\n return json.dumps(self.__dict__)", "def serialize(self):\n return json.dumps(self.as_dict())", "def to_json(self) -> str:\n return json.dumps(self.to_dict())", "def to_json(self) -> str:\n return json.dumps(self.to_dict())", "def to_json(self) -> st...
[ "0.88999254", "0.8837045", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.8805053", "0.87147456", "0.8637419", "0.8619328", "0.8598524", "0.8572258", "0.8568808", "0.8568808", "0.8446259", "0.8446259", "0.8446259", ...
0.0
-1
Removes duplicates from a list to return unique values USED ONLY ONCE
def find_remove_duplicates(list_of_values): output = [] seen = set() for value in list_of_values: if value not in seen: output.append(value) seen.add(value) return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeDuplicates(list):\n\treturn set((item for item in list))", "def removeDuplicates(list):\n\treturn Set((item for item in list))", "def remove_duplicates(somelist):\n return set(somelist)", "def remove_duplicates(mylist):\n return list(set(mylist))", "def _unique(li):\n return list(set(li)...
[ "0.85555637", "0.8500797", "0.8264837", "0.8134553", "0.80485123", "0.79956824", "0.79697573", "0.7933595", "0.79128546", "0.78814554", "0.78761667", "0.7871457", "0.7852023", "0.7809507", "0.78046155", "0.78031677", "0.7776434", "0.77623075", "0.7690719", "0.7684941", "0.767...
0.7888835
9
This function gives you the count of all the rows including null rows in your data. It returns a dataframe with id_col as the index and the counts of rows (incl null rows) as a new column
def count_rows_by_group_incl_nulls(dft, id_col): new_col = 'row_count_incl_null_rows' if isinstance(id_col, str): groupby_columns = [id_col] else: groupby_columns = copy.deepcopy(id_col) ### len gives you count of all the rows including null rows in your data grouped_len = df...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def null_count(df):\n return df.isnull().sum().sum()", "def get_nan_counts(data, cols, null_col_suffix=''):\n nulls_df = pd.DataFrame(pd.isnull(data[cols]).sum())\n nulls_df.columns = ['null_counts'+null_col_suffix]\n nulls_df['feature'] = nulls_df.index\n nulls_df.reset_index(inplace=True, drop=T...
[ "0.7246387", "0.6790731", "0.65052575", "0.61411005", "0.611741", "0.607612", "0.60575604", "0.6022607", "0.59673405", "0.58976364", "0.58248895", "0.5812978", "0.5790062", "0.5759668", "0.5701485", "0.56798667", "0.5574436", "0.55685425", "0.5532819", "0.55299795", "0.551707...
0.8016825
0
This handy function combines multiple string columns into a single NLP text column. You can do further preprocessing on such a combined column with TFIDF or BERT style embedding. Inputs
def FE_concatenate_multiple_columns(df, cols, filler=" ", drop=True): df = df.copy(deep=True) df['combined'] = df[cols].apply(lambda row: filler.join(row.values.astype(str)), axis=1) if drop: df.drop(cols, axis=1, inplace=True) return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combine_text_columns(data_frame, to_drop=NUMERIC_COLUMNS + LABELS):\n \n # Drop non-text columns that are in the df\n to_drop = set(to_drop) & set(data_frame.columns.tolist())\n text_data = data_frame.drop(to_drop, axis=1)\n \n # Replace nans with blanks\n text_data.fillna(\"\", inplace=Tr...
[ "0.6122919", "0.59562457", "0.5860936", "0.5728995", "0.56914294", "0.55705065", "0.5489442", "0.5479762", "0.5466774", "0.54456776", "0.5429175", "0.53490126", "0.53487706", "0.53416914", "0.53319705", "0.5317199", "0.53148824", "0.5296901", "0.52938604", "0.5284265", "0.527...
0.53537685
11
Calculate the great circle distance between two points on the earth (specified in decimal degrees)
def haversine(lon1, lat1, lon2, lat2): # convert decimal degrees to radians lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2]) # haversine formula dlon = lon2 - lon1 dlat = lat2 - lat1 a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2 c = 2 * asin(sqrt(a)) km ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long...
[ "0.81450045", "0.7863265", "0.76322985", "0.76064754", "0.75978696", "0.75965863", "0.75944835", "0.75720793", "0.75630087", "0.7555095", "0.7528691", "0.7517629", "0.7492963", "0.7467739", "0.7452678", "0.7434477", "0.73914117", "0.7357736", "0.73484355", "0.73318124", "0.73...
0.0
-1
returns 2d gaussian of given shape and variance
def make_gaussian(shape, var): h,w = shape x = np.arange(w, dtype=float) y = np.arange(h, dtype=float)[:,np.newaxis] x0 = w // 2 y0 = h // 2 mat = np.exp(-0.5 * (pow(x-x0, 2) + pow(y-y0, 2)) / var) normalized_img = np.zeros((h, w)) cv2.normalize(mat, normalized_img, alpha=0, beta=1, norm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matlab_style_gauss2D(shape=(3,3),sigma=0.5):\n m,n = [(ss-1.)/2. for ss in shape]\n y,x = np.ogrid[-m:m+1,-n:n+1]\n h = np.exp( -(x*x + y*y) / (2.*sigma*sigma) )\n h[ h < np.finfo(h.dtype).eps*h.max() ] = 0\n sumh = h.sum()\n if sumh != 0:\n h /= sumh\n return h", "def matlab_styl...
[ "0.726162", "0.726162", "0.7228678", "0.7228678", "0.7161786", "0.71248", "0.70704526", "0.6910427", "0.6905897", "0.68300223", "0.67451924", "0.67220163", "0.6677456", "0.6650047", "0.6629378", "0.6629378", "0.6629378", "0.6593034", "0.65873116", "0.65858495", "0.6572952", ...
0.71129745
6
Construct tuple of slices to slice an array in the given dimension.
def _slice_at_axis(sl, axis): return (slice(None),) * axis + (sl,) + (...,)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _slice(self, start, stop, step=None):\n\n slices = [slice(None)] * self.data.ndim\n slices[self.axis] = slice(start, stop, step)\n return tuple(slices)", "def slice_dims(data_array: sc.DataArray, slices: Dict[str, slice]) -> sc.DataArray:\n out = data_array\n for dim, sl in slices....
[ "0.6974031", "0.6692772", "0.6633128", "0.6609752", "0.6450018", "0.64288527", "0.6367438", "0.63415235", "0.63344437", "0.6331067", "0.63263166", "0.6278273", "0.6268319", "0.62054366", "0.61639655", "0.6068898", "0.60015655", "0.5981205", "0.59677637", "0.59662855", "0.5953...
0.6644016
2
Pad array on all sides with either a single value or undefined values.
def _pad_simple(array, pad_width, fill_value=None): # Allocate grown array new_shape = tuple( left + size + right for size, (left, right) in zip(array.shape, pad_width) ) order = 'F' if array.flags.fnc else 'C' # Fortran and not also C-order padded = np.empty(new_shape, dtype=array....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def padnone(iterable):\r\n return chain(iterable, repeat(None))", "def _pad(self, array, sentinel, max_len=None):\n # Compute max length.\n maxlen = 0\n for seq in array:\n maxlen = max(maxlen, len(seq))\n\n if max_len is not None:\n maxlen = max(maxlen, max_l...
[ "0.6736924", "0.65970623", "0.6583004", "0.6423922", "0.610075", "0.6037424", "0.6000893", "0.59851885", "0.5965734", "0.5961246", "0.5888716", "0.58678424", "0.58655536", "0.5836295", "0.58248466", "0.58208704", "0.5807079", "0.57789594", "0.57429606", "0.5742713", "0.574266...
0.6428297
3
Construct linear ramps for emptypadded array in given dimension.
def _get_linear_ramps(padded, axis, width_pair, end_value_pair): edge_pair = _get_edges(padded, axis, width_pair) left_ramp, right_ramp = ( np.linspace( start=end_value, stop=edge.squeeze(axis), # Dimension is replaced by linspace num=width, endpoint=Fals...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def left_dimension_pad(array, n):\n if array.ndim >= n:\n return array\n nadd = n - array.ndim\n atts = [_new_attribute_label('_dim%i' % i, array) for i in range(nadd)]\n apply_args = [x for item in enumerate(atts) for x in item[::-1]]\n\n ds = array.datashape.copy()\n ds.dim_low = ([0] * ...
[ "0.62443125", "0.6082335", "0.57092613", "0.5642762", "0.5589406", "0.55634224", "0.55234855", "0.54957044", "0.546951", "0.54547405", "0.54499525", "0.54064626", "0.54050887", "0.54038596", "0.5343525", "0.53377956", "0.526257", "0.5248705", "0.5248434", "0.522894", "0.52284...
0.5992991
2
Broadcast `x` to an array with the shape (`ndim`, 2). A helper function for `pad` that prepares and validates arguments like `pad_width` for iteration in pairs.
def _as_pairs(x, ndim, as_index=False): if x is None: # Pass through None as a special case, otherwise np.round(x) fails # with an AttributeError return ((None, None),) * ndim x = np.array(x) if as_index: x = np.round(x).astype(np.intp, copy=False) if x.ndim < 3: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conv_broadcast(x, kernel_shape, padding, strides):\n if len(kernel_shape) == 2:\n return conv2d_broadcast(x, kernel_shape[0], kernel_shape[1],\n padding, strides)\n elif len(kernel_shape) == 1:\n return conv1d_broadcast(x, kernel_shape[0], padding, strides[0])\n else:\n r...
[ "0.6772882", "0.6421526", "0.61280066", "0.61171854", "0.608278", "0.6081477", "0.60047096", "0.59562427", "0.59437984", "0.5917361", "0.58194864", "0.57826847", "0.56885594", "0.56850636", "0.5646492", "0.5643425", "0.56371456", "0.5627696", "0.56031185", "0.551657", "0.5506...
0.0
-1
Return a standard commandline parser.
def get_parser(): parser = argparse.ArgumentParser( description="""Start a Classy Vision training job. This can be used for training on your local machine, using CPU or GPU, and for distributed training. This script also supports Tensorboard, Visdom and checkpointing.""" ) parser = add...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmdline_parser():\n\n # http://docs.python.org/dev/howto/argparse.html\n parser = argparse.ArgumentParser(description=__doc__)\n \n parser.add_argument(\"--verbose\",\n action=\"store_true\",\n help=\"Be verbose\")\n parser.add_argument(\"--debug\",\...
[ "0.78363454", "0.76368093", "0.76164347", "0.7444962", "0.7384553", "0.737258", "0.73505783", "0.7313102", "0.7247337", "0.72400624", "0.7238309", "0.7186557", "0.71624005", "0.71454215", "0.7143918", "0.7127855", "0.7127855", "0.712184", "0.7077699", "0.7061537", "0.70561033...
0.720635
11
function that builds a UNetlike model whose encoder is resnext (weights pretrained on imagenet and whose decoder is a mirror image of the encoder the function is taking the inputs as arguments, depth_is_50 must be set to True to use ResNext50 otherwise, ResNext101 is used
def unet_resnext(inputs, num_classes, shape, depth_is_50): if depth_is_50: encoder = ResNeXt50(include_top=False, weights='imagenet', input_tensor=inputs, input_shape=shape, pooling=None, backend=backend, layers=layers, models=models, utils=utils) num_blocks = [3, 4, 6, 3...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(\n self,\n encoder_name: str = \"resnet34\",\n encoder_depth: int = 5,\n encoder_weights: Optional[str] = \"imagenet\",\n decoder_use_batchnorm: bool = True,\n decoder_channels: Sequence[int] = (256, 128, 64, 32, 16),\n decoder_attention_type: Optional[...
[ "0.69037724", "0.6802961", "0.6802381", "0.6789101", "0.6786313", "0.67718273", "0.668708", "0.6683559", "0.6622862", "0.65944517", "0.65667164", "0.6512333", "0.64826167", "0.64591926", "0.64490813", "0.6446302", "0.64321613", "0.64218044", "0.6409752", "0.63810134", "0.6362...
0.77033335
0
Provide descriptive median and interquartile range for nonnormal (or small) data sets
def summarizeData(data, dataLabel=None, decimals=4): if dataLabel is not None: print ('%s: Data Set Summary (median, IQR)' % dataLabel) n = max([len(l) for l in data.keys()]) for i, k in enumerate(data.keys()): g1 = data[k] iqr1 = np.subtract(*np.percentile(g1, [75, 25])) pri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def median(self):\n # TO DO\n pass", "def test__quantile(self):\r\n # regular cases\r\n sample_data = array(range(25, 42))\r\n assert_almost_equal(_quantile(sample_data, 0.5), median(sample_data))\r\n\r\n # sorted data is assumed for this function\r\n sample_data ...
[ "0.6789959", "0.6619191", "0.6610916", "0.64987904", "0.649406", "0.647504", "0.64690953", "0.64680755", "0.6461735", "0.6422434", "0.6400492", "0.63931334", "0.638319", "0.63586074", "0.63390905", "0.63176453", "0.6294902", "0.6293809", "0.62795097", "0.6279157", "0.6279157"...
0.0
-1
Gets actual rotation speed.
def get_speed(self): return self.send(self.cmd.GET_ROTATION_ACT)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotation_rate(self) -> int:\n return self._rotation_rate", "def get_speed(self):\n return self._speed", "def speed(self):\n return self._turtle.speed()", "def speed(self):\n return self._turtle.speed()", "def _get_speed(self):\n t_now = time.perf_counter()\n de...
[ "0.76675105", "0.74180675", "0.7332777", "0.7332777", "0.7320188", "0.72747815", "0.7241825", "0.7240565", "0.7187356", "0.71123666", "0.71123666", "0.709412", "0.69444895", "0.69386053", "0.6906993", "0.68930227", "0.68930227", "0.6856619", "0.6856619", "0.68409765", "0.6787...
0.8504652
0
Gets lift bottom position limit.
def get_lift_limit(self) -> float: return self.send(self.cmd.GET_LIFT_LIMIT)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bottom(self, model, limit):\n return self.get_top(model=model, limit=limit, reversed=True)", "def get_bottom(self, Model, limit=10):\r\n return self.get_top(Model, limit, True)", "def get_bottom(self, Model, limit=10):\n return self.get_top(Model, limit, True)", "def getPageBotto...
[ "0.70970494", "0.7090043", "0.70800245", "0.70142066", "0.7006517", "0.6997502", "0.69063574", "0.69063574", "0.6798406", "0.67862487", "0.6670819", "0.66661775", "0.6650709", "0.66494447", "0.66494447", "0.6600013", "0.65861183", "0.65572417", "0.65453714", "0.64944637", "0....
0.7150376
0
Checks whether `chars` is a control character.
def _is_control(char): # These are technically control characters but we count them as whitespace # characters. if char == "\t" or char == "\n" or char == "\r": return False cat = unicodedata.category(char) if cat.startswith("C"): return True retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_control(char):\n # These are technically control characters but we count them as whitespace\n # characters.\n if char == \"\\t\" or char == \"\\n\" or char == \"\\r\":\n return False\n cat = unicodedata.category(char)\n if cat.startswith(\"C\"):\n return True\n return False"...
[ "0.81981814", "0.81981814", "0.8169858", "0.80915713", "0.6468453", "0.58763784", "0.582512", "0.5796899", "0.5719301", "0.57148904", "0.57065594", "0.56959367", "0.5653251", "0.5603813", "0.5585948", "0.55843735", "0.55716395", "0.55498976", "0.55498976", "0.55404437", "0.55...
0.8177336
2
Checks whether `chars` is a whitespace character.
def _is_whitespace(char): # \t, \n, and \r are technically contorl characters but we treat them # as whitespace since they are generally considered as such. if char == " " or char == "\t" or char == "\n" or char == "\r": return True cat = unicodedata.category(char) if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_whitespace(char):\n if char == ' ' or char == '\\t' or char == '\\n' or char == '\\r':\n return True\n cat = unicodedata.category(char)\n if cat == 'Zs':\n return True\n return False", "def _is_whitespace(char):\n # \\t, \\n, and \\r are technically contorl characters but we ...
[ "0.78012747", "0.7680234", "0.76118195", "0.7108098", "0.6929217", "0.6814356", "0.67606235", "0.65372074", "0.64895546", "0.64892155", "0.6466964", "0.64537275", "0.64364225", "0.6071991", "0.5989213", "0.59863365", "0.59160656", "0.5889098", "0.5882985", "0.58735234", "0.58...
0.7633813
2
returns a list of list of nodes that are connected between them
def connex_components(self): unchecked = set(self.v.values()) groups = [] while len(unchecked): vcon = self.member_family(unchecked.pop()) unchecked -= set(vcon) groups.append(set(vcon)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connecting(node1, node2):\n comp_list = []\n \"\"\":type : list[components.Component]\"\"\"\n if node1 == node2:\n return []\n for comp in node1.connected_comps:\n if comp.neg == node2:\n comp_list.append(comp)\n elif comp.pos == node2:\n comp_list.append(...
[ "0.7672175", "0.7560604", "0.73514897", "0.7303175", "0.7269564", "0.7252286", "0.7117781", "0.7032667", "0.695559", "0.6933376", "0.6929945", "0.692007", "0.68976027", "0.68886036", "0.68777835", "0.68719864", "0.68481445", "0.6847005", "0.6793686", "0.67895955", "0.6788333"...
0.0
-1
calculate_cumulative_returns from returns df
def calculate_cumulative_returns(returns, starting_value=0, out=None): if len(returns) < 1: return returns.copy() nanmask = np.isnan(returns) if np.any(nanmask): returns = returns.copy() returns[nanmask] = 0 allocated_output = out is None if allocated_output: out = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cum_returns(returns, starting_value=None):\n\n # df_price.pct_change() adds a nan in first position, we can use\n # that to have cum_returns start at the origin so that\n # df_cum.iloc[0] == starting_value\n # Note that we can't add that ourselves as we don't know which dt\n # to use.\n if pd...
[ "0.78472894", "0.7701678", "0.76081795", "0.7573034", "0.7492005", "0.7257859", "0.72348195", "0.7171094", "0.70538026", "0.66006315", "0.6555426", "0.64951324", "0.63766176", "0.6218097", "0.6104973", "0.60557157", "0.60525507", "0.60261154", "0.59706354", "0.5967785", "0.59...
0.7793053
1
Convert a C++ type ZSparseMatrix to python type scipy.sparse.csc_matrix.
def ZSparseMatrix2Scipy(matrix): data = np.ndarray(matrix.get_value_size(), dtype=float); outer_idx = np.ndarray(matrix.get_outer_size(), dtype=np.int32); inner_idx = np.ndarray(matrix.get_inner_size(), dtype=np.int32); matrix.get_values(data); matrix.get_outer_indices(outer_idx); matrix.get_in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_csc(self):\n return sparse.csc_matrix((self.data, (self.col, self.row)),\n shape=(self.nrows, self.ncols))", "def j_sparse_vector_wrapper_to_scipy_spmatrix(j_obj: JavaObject):\n indices = np.frombuffer(j_obj.getIndicesBytes(), dtype=\"<i4\")\n v...
[ "0.7471771", "0.72099525", "0.7103255", "0.6973739", "0.69710153", "0.6669875", "0.6652854", "0.6616312", "0.66056544", "0.65703", "0.6561898", "0.6538825", "0.6452391", "0.6403625", "0.639825", "0.628727", "0.6280813", "0.6272066", "0.6260741", "0.6183715", "0.6119796", "0...
0.8315733
0
initialize weights and biases so that the network models the unconditional density of the target data p(t)
def init_weights(self, t, prior, scaled_prior = False): from scipy.cluster.vq import kmeans2 from scipy.spatial.distance import cdist # check if t has the right shape if not t.ndim == 2: t = t[:, None] if scaled_prior: #self.w1 = np.random.normal(loc=0.0, scale = 1,size=[H, d+1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_weights(self):\n self._q_neuron.h(self._weights) \n self._q_neuron.x(self._weights)", "def initWeights(self):\n self.weights = []\n self.bias = []\n for i, dim in enumerate(self.dimensions[1:]):\n self.weights.append(np.random.uniform(-1,1,(self.dimensions[i...
[ "0.7351921", "0.73208344", "0.72950673", "0.727988", "0.72581655", "0.7226986", "0.71765286", "0.7163139", "0.71547675", "0.7143229", "0.7124816", "0.7124816", "0.7124816", "0.7088403", "0.708142", "0.70560056", "0.70476806", "0.70126885", "0.69869906", "0.69646513", "0.69386...
0.0
-1
Gets the additional_data of this SalesDataCreditmemoItemInterface. Additional data.
def additional_data(self): return self._additional_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def additional_data(self):\n # type: () -> string_types\n return self._additional_data", "def additional_data(self) -> pulumi.Output[Optional[Mapping[str, str]]]:\n return pulumi.get(self, \"additional_data\")", "def additional_data(self) -> pulumi.Output[Optional[Mapping[str, str]]]:\n ...
[ "0.7248006", "0.7056027", "0.7056027", "0.65459454", "0.64380705", "0.6124107", "0.5939032", "0.587624", "0.587624", "0.587624", "0.5870023", "0.5870023", "0.5870023", "0.5870023", "0.5837515", "0.5837515", "0.5837515", "0.58154196", "0.5813224", "0.58127725", "0.58072793", ...
0.8001785
0