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
Initialize the timestamp that is associated with the workflow state.
def __init__(self, created_at=None): super(StatePending, self).__init__( type_id=STATE_PENDING, created_at=created_at )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(self):\n self._startTime = time.time()", "def __init__(self, timestamp: int) -> None:\n self.timestamp = timestamp", "def __init__(self, timestamp):\n self.timestamp = timestamp", "def _set_timestamp(self):\n d = datetime.now()\n self._time_stamp = \"{:>2} {}...
[ "0.69470435", "0.68437815", "0.6825608", "0.68010944", "0.6471377", "0.6427787", "0.6412947", "0.6349547", "0.63423645", "0.6294193", "0.6256572", "0.6169232", "0.6124387", "0.6079734", "0.6079734", "0.6079734", "0.6079734", "0.6079734", "0.6079734", "0.6079734", "0.6043813",...
0.55940735
89
Get instance of running state with the same create at timestamp as this state and the started at with the current timestamp. Returns flowserv.model.workflow.state.StateRunning
def start(self): return StateRunning(created_at=self.created_at)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def running_state(self) -> int | None:\n return self.cluster.get(\"running_state\")", "def __init__(self, created_at, started_at=None):\n super(StateRunning, self).__init__(\n type_id=STATE_RUNNING,\n created_at=created_at\n )\n self.started_at = started_at if st...
[ "0.6402036", "0.6387232", "0.6314984", "0.61633575", "0.6013092", "0.6005772", "0.58371174", "0.5743196", "0.56835604", "0.5664729", "0.55953306", "0.5555169", "0.5547319", "0.553596", "0.5523575", "0.5490098", "0.548636", "0.5447633", "0.54464835", "0.54221183", "0.5411388",...
0.75945795
0
Initialize the timestamps that are associated with the workflow state.
def __init__(self, created_at, started_at=None): super(StateRunning, self).__init__( type_id=STATE_RUNNING, created_at=created_at ) self.started_at = started_at if started_at is not None else utc_now()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init(self) -> None:\n now = time()\n\n # Timestamps for tracking compute durations by task group.\n # Start with length 2 so that we always can compute a valid dt later.\n self.time = [now] * 2\n # The amount of compute since the last timestamp\n self.compute = {}\n ...
[ "0.662486", "0.6544752", "0.6362393", "0.62042767", "0.6186606", "0.61759233", "0.615613", "0.61534125", "0.60887194", "0.6030508", "0.59864223", "0.5916276", "0.5891385", "0.587826", "0.587426", "0.58722687", "0.58082974", "0.58011687", "0.5800979", "0.5799046", "0.5791142",...
0.59843045
11
Create instance of workflow state from a given dictionary serialization.
def deserialize_state(doc): type_id = doc[LABEL_STATE_TYPE] # All state serializations have to have a 'created at' timestamp created_at = doc[LABEL_CREATED_AT] if type_id == STATE_PENDING: return StatePending(created_at=created_at) elif type_id == STATE_RUNNING: return StateRunning( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_from_dict(input_dict):\n return WorkflowStepInformation(input_dict)", "def load_from_dict(input_dict):\n return WorkflowViewStepInformation(input_dict)", "def load(cls, serializer: URLSafeSerializer, encoded_state: Optional[str] = None):\n if encoded_state:\n try:\n ...
[ "0.7290355", "0.6869887", "0.6754909", "0.6658709", "0.6623265", "0.65894413", "0.64970046", "0.6488711", "0.6458486", "0.64542246", "0.64288354", "0.64288354", "0.64288354", "0.64288354", "0.64288354", "0.64288354", "0.64288354", "0.64288354", "0.64288354", "0.64288354", "0....
0.0
-1
Find a test server of the given type or raise SkipTest. This is useful for running tests in environments where we can't launch servers. If an environment variable like BASEPLATE_MEMCACHED_ADDR is present, that will
def get_endpoint_or_skip_container(name, default_port): address = os.environ.get(f"BASEPLATE_{name.upper()}_ADDR", f"{name}:{default_port:d}") endpoint = Endpoint(address) try: sock = socket.socket(endpoint.family, socket.SOCK_STREAM) sock.settimeout(0.1) sock.connect(endpoint.addre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_type(pytestconfig, request):\n if pytestconfig.getoption(\"--mongodb\"):\n pytest.skip(\"ephemeraldb tests disabled\")\n yield \"ephemeraldb\"", "def test_server_no_port(self):\n (code, out, err) = run([\"./server\"]);\n self.assertEqual(code, 1)", "def selenium_server(request...
[ "0.540185", "0.5378539", "0.53239036", "0.5320749", "0.52022535", "0.5175826", "0.51593435", "0.49885276", "0.49630222", "0.49377564", "0.49263054", "0.4926188", "0.48806623", "0.48632804", "0.48418492", "0.47821465", "0.47785884", "0.47407973", "0.4736404", "0.47159377", "0....
0.51440394
7
Returns the WWWAuthenticate headers. We use Basic unless the clients has set the UseXBasic header. In that case we use XBasic instead. This is because most web browsers insist on showing the Basic auth dialogue even if the request is done using XHR.
def get_auth_headers(): auth_type = "Basic" if request.headers.get('UseXBasic'): auth_type = "XBasic" return { 'WWW-Authenticate': '%s realm="Login Required"' % auth_type }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getBasicAuthorization(self):\n header = self.request.getHeader(\"Authorization\")\n if header:\n try:\n if header.lower().startswith(\"basic \"):\n authstr = base64.b64decode(header[6:]).split(\":\")\n if len(authstr) == 1:\n ...
[ "0.69509023", "0.69396883", "0.6538345", "0.6519706", "0.6482184", "0.646225", "0.64590865", "0.6312395", "0.621496", "0.6131667", "0.60668355", "0.6002495", "0.5982309", "0.59624344", "0.5923833", "0.59024143", "0.5900171", "0.58832777", "0.58703077", "0.5845533", "0.5821243...
0.81525135
0
Sends a 401 response that enables basic auth
def authenticate(): return Response( 'Could not verify your access level for that URL.\n' 'You have to login with proper credentials', 401, get_auth_headers())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})", "def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )", "def authenticate():\n return Response(\n 'You have to login with pro...
[ "0.8093736", "0.80926424", "0.7958403", "0.7852648", "0.7843114", "0.7824419", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", ...
0.66088307
65
given a timestamp in iso8601 string format, add a timedelta of nseconds to the time and return a new iso8601 string with the incremented time.
def add_to_timestring(nseconds, isostring): currenttime = datetime.datetime.strptime(isostring,"%Y-%m-%dT%H:%M:%S.%f") delta = datetime.timedelta(seconds=nseconds) futuretime = currenttime+delta return datetime.datetime.strftime(futuretime,"%Y-%m-%dT%H:%M:%S.%f")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_seconds(date1, n_seconds):\n return date1 + timedelta(seconds=n_seconds)", "def iso_string_add_delta(inp, days=0, hours=0, minutes=0):\n dt=iso_from_string(inp)\n td=timedelta(days=days, hours=hours, minutes=minutes)\n r=dt+td\n return (r, r.isoformat())", "def _add_time(time_to_add: int...
[ "0.6815897", "0.5949231", "0.5863975", "0.5792141", "0.56532896", "0.56397504", "0.5629165", "0.56078815", "0.5602144", "0.5556757", "0.5474727", "0.5426263", "0.54139805", "0.53972566", "0.52987164", "0.52755475", "0.5248217", "0.52353334", "0.5187057", "0.517025", "0.516563...
0.81766963
0
Return the sigmoid curve for the x values.
def sigmo_transform(x, base, amplitude, xhalf, slope): return base + amplitude / (1. + np.exp(-slope * (x - xhalf)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid(self, x):\n y = 1/(1 + np.exp((-x)))\n return y \n raise NotImplementedError(\"Sigmoid not implemented\")", "def sigmoid(self, x):\n return 1 / (1 + np.exp(-4.9 * x))", "def sigmoid(self, x):\n\n #logging.debug(\"sigmoid received %s as input\" % (x))\n r...
[ "0.84313214", "0.8293333", "0.82716626", "0.8235582", "0.8235582", "0.8212669", "0.8192875", "0.81679827", "0.8163558", "0.8162054", "0.8162054", "0.8161744", "0.81530255", "0.81524545", "0.81520766", "0.8150253", "0.81298304", "0.8128974", "0.8128974", "0.8128974", "0.812897...
0.0
-1
Test that `_renew_token` makes a new record.
def test_renew_token(self): self.assertEqual(CloudCredentials.objects.count(), 0) with HTTMock(spark_cloud_mock): CloudCredentials.objects._renew_token(self.cloud) self.assertEqual(CloudCredentials.objects.count(), 1) self.assertEqual(CloudCredentials.objects._access_token(),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_renews_token(self):\n self.assertEqual(CloudCredentials.objects.count(), 0)\n old = self.factory.create(access_token='old_token', expires_at=self.expired_dt)\n with HTTMock(spark_cloud_mock):\n refresh_access_token()\n self.assertEqual(CloudCredentials.objects.count(...
[ "0.7187631", "0.6810269", "0.66848624", "0.66664624", "0.66517204", "0.65931344", "0.64662015", "0.6427854", "0.63933855", "0.6363439", "0.6357534", "0.62938225", "0.6288141", "0.6270464", "0.6255693", "0.6195633", "0.61518687", "0.61262393", "0.61077607", "0.60881746", "0.60...
0.7497364
0
Test that the `DEFAULT_APP` is returned when the device's `app_name` is not in `APPS`.
def test_get_app_default_app(self): settings = SparkSettings() self.device.app_name = 'not an app' app = self.device.get_app() self.assertIsInstance(app, settings.DEFAULT_APP)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_app(self):\n settings = SparkSettings()\n self.device.app_name = 'test_app'\n app = self.device.get_app()\n self.assertIsInstance(app, settings.APPS[self.device.app_name])", "def test_app_exists(self):\n self.assertFalse(current_app is None)", "def check_sysapps(...
[ "0.70428467", "0.7003862", "0.6537117", "0.6500249", "0.62723196", "0.6203335", "0.6134394", "0.6118381", "0.61074114", "0.6079382", "0.60329145", "0.5889105", "0.5887545", "0.58535266", "0.5823424", "0.57865727", "0.5775028", "0.57706827", "0.5758799", "0.57541776", "0.57392...
0.7942184
0
Aplica una convolucion sin padding de dos matrices
def convolution(image, kernel): #Se encuentra la dimencion de la imagen if len(image.shape) == 3: #De 3 dimenciones print("Dimenciones de imagen: {}".format(image.shape)) image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) #Se cambia a dos dimenciones print("Nuevas dimenciones: {}".format(i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(self, matrices, pad_value):\n shapes = [m.shape for m in matrices]\n M, N = sum([s[0] for s in shapes]), sum([s[1] for s in shapes])\n zeros = torch.FloatTensor(np.zeros((M, N))).to(device)\n pad_matrices = pad_value + zeros\n i, j = 0, 0\n for k, matrix in enumera...
[ "0.69728357", "0.6751041", "0.6520065", "0.64924914", "0.6422296", "0.63539004", "0.6350325", "0.6332388", "0.63143396", "0.6306413", "0.6305096", "0.629795", "0.62965685", "0.62886244", "0.62595725", "0.6255488", "0.6225325", "0.6219588", "0.6207467", "0.61893016", "0.618461...
0.0
-1
A rule takes a LHS symbol and a list/tuple of RHS symbols
def __init__(self, lhs: Symbol, rhs: list): assert isinstance(lhs, Symbol), 'LHS must be an instance of Symbol' assert len(rhs) > 0, 'If you want an empty RHS, use an epsilon Terminal' assert all(isinstance(s, Symbol) for s in rhs), 'RHS must be a sequence of Symbol objects' self._lhs = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rule(name):\n\tdef df(s, loc, tok):\n\t\trules = []\n\t\tundec_tok = []\n\t\tfor t in tok:\n\t\t\tif isinstance(t, tuple):\n\t\t\t\trules += [t[0]]\n\t\t\t\tundec_tok += [t[1]]\n\t\t\telse:\n\t\t\t\tundec_tok += [t]\n\t\treturn ((name, rules), undec_tok)\n\treturn df", "def get_rules_by_rhs(grammar, symbol):...
[ "0.6612539", "0.6340573", "0.6211391", "0.59999686", "0.59822494", "0.5921956", "0.590036", "0.58280516", "0.578193", "0.5749917", "0.5738341", "0.56983954", "0.567962", "0.56656927", "0.56368464", "0.563341", "0.55657625", "0.5549758", "0.5530101", "0.55136156", "0.5499152",...
0.5850752
7
Converts camelcase text to underscore format.
def camelcase_to_underscore(text): s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', text) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_underscore_to_camel_case(text):\n words = text.split('_')\n words = [word.capitalize() for word in words]\n return ''.join(words)", "def underscore_to_camelcase(text):\n text = text.replace('_', ' ').title()\n return text.replace(' ', '')", "def underscore(text):\n # return '__'+t...
[ "0.8361283", "0.82762533", "0.80918324", "0.79224956", "0.79123586", "0.775897", "0.77458984", "0.77179056", "0.7616218", "0.7615685", "0.7503876", "0.7481525", "0.740126", "0.72967094", "0.71329993", "0.6953588", "0.6852946", "0.6851504", "0.68457544", "0.68457544", "0.68303...
0.88031095
0
Converts underscore text to camelcase format.
def underscore_to_camelcase(text): text = text.replace('_', ' ').title() return text.replace(' ', '')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_underscore_to_camel_case(text):\n words = text.split('_')\n words = [word.capitalize() for word in words]\n return ''.join(words)", "def camelcase_to_underscore(text):\n s1 = re.sub('(.)([A-Z][a-z]+)', r'\\1_\\2', text)\n return re.sub('([a-z0-9])([A-Z])', r'\\1_\\2', s1).lower()", "...
[ "0.8775311", "0.838952", "0.823766", "0.79560465", "0.77701974", "0.7607584", "0.75505424", "0.75364625", "0.7470709", "0.7396742", "0.73771524", "0.73588747", "0.73552835", "0.7306965", "0.7266782", "0.72291654", "0.71784145", "0.7115801", "0.7089862", "0.7087546", "0.706440...
0.8752492
1
Determine whether mmlist contains val.
def minmax_contains(mmlist, val): if len(mmlist) == 0: return False if val < mmlist[0] or val > mmlist[-1]: return False return val in mmlist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __contains__(self, item):\n return item in self.__keys or item in self.__vals", "def __contains__(self, val):\n if self.lookup.get(val, 0) > 0:\n return True\n else:\n return False", "def __contains__(self, item): # __iter__ would do this job by itself\n r...
[ "0.6913002", "0.68778837", "0.68751174", "0.67422926", "0.6727357", "0.6717134", "0.6699749", "0.66898197", "0.6669296", "0.6628136", "0.65878", "0.6558988", "0.6544177", "0.65086263", "0.6503706", "0.6502765", "0.6498404", "0.6483393", "0.6478058", "0.63824576", "0.6378211",...
0.71807593
0
Renders the about page.
def about(): global version return render_template( 'about.html', title='About', year=datetime.now().year, message='Loughton Languages suite', version=version )
{ "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.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82680845",...
0.7592873
79
Returns true if the two urls should be treated as if they're from the same domain (trusted).
def is_same_domain(url1, url2): url1 = urlparse(url1) url2 = urlparse(url2) return url1.netloc == url2.netloc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def same_domain(url1, url2):\n return urlparse.urlparse(url1).netloc == urlparse.urlparse(url2).netloc", "def is_same_domain(url1, url2):\n url1 = urlparse(url1)\n url2 = urlparse(url2)\n return url1.netloc == url2.netloc", "def is_same_domain(url1, url2):\n return tldextract.extract(url1).domai...
[ "0.81003034", "0.79911524", "0.7957636", "0.7892564", "0.74590194", "0.7232909", "0.72292197", "0.7020304", "0.68417114", "0.6650329", "0.6589728", "0.6485966", "0.63029945", "0.63014644", "0.6298336", "0.62896883", "0.62152654", "0.6168908", "0.6159071", "0.6159071", "0.6155...
0.8035336
1
Visualizes input image, segmentation map and overlay view.
def vis_segmentation(image, seg_map, FULL_COLOR_MAP, LABEL_NAMES): plt.figure(figsize=(15, 5)) grid_spec = gridspec.GridSpec(1, 4, width_ratios=[6, 6, 6, 1]) plt.subplot(grid_spec[0]) plt.imshow(image) plt.axis('off') plt.title('input image') plt.subplot(grid_spec[1]) seg_image = label...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vis_segmentation(image, seg_map):\n plt.figure(figsize=(15, 5))\n grid_spec = gridspec.GridSpec(1, 4, width_ratios=[6, 6, 6, 1])\n\n plt.subplot(grid_spec[0])\n plt.imshow(image)\n plt.axis('off')\n plt.title('input image')\n\n plt.subplot(grid_spec[1])\n seg_image = label_to_color_image(seg_map).astyp...
[ "0.69926476", "0.69773686", "0.6961605", "0.69606674", "0.6953871", "0.6872205", "0.6867784", "0.68528426", "0.66746914", "0.66683316", "0.664309", "0.66321903", "0.66207135", "0.6615741", "0.6601977", "0.65702325", "0.64633095", "0.6454649", "0.63971007", "0.63927853", "0.63...
0.6647922
10
Return a pytz.tzinfo object
def _parse_timezone(val): if not val: return if val == "Z" or val == "+00:00": return pytz.utc negative = val.startswith("-") minutes = int(val[-2:]) minutes += int(val[1:3]) * 60 if negative: minutes = 0 - minutes return pytz.FixedOffset(minutes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_timezone():\n return dates.get_timezone(_get_tz())", "def _get_tz():\n return 'UTC'", "def tz(self, tz):\n return timezones.maybe_get_tz('dateutil/' + tz)", "def _get_tzinfo(zonelabel):\n return moment.tzinfo(zonelabel) if zonelabel else _get_global_tz()", "def timezone():\n\n retu...
[ "0.7881428", "0.765464", "0.7650772", "0.7631971", "0.762649", "0.7605076", "0.75092185", "0.7304117", "0.72182554", "0.71573347", "0.7094021", "0.70851195", "0.7027936", "0.6974379", "0.68469167", "0.6764812", "0.6764262", "0.67346615", "0.66274154", "0.66267616", "0.6623373...
0.56993896
93
Asks user to specify a city, month, and day to analyze.
def get_filters(): # TO DO: get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs print("Hello! Let\'s explore some US bikeshare data!") while True: city = input("Would you like to see data for Chicago, New York City or Washington?\n").sp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)", "def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f...
[ "0.6671077", "0.65363395", "0.64597565", "0.6374352", "0.6349016", "0.6310872", "0.6287443", "0.62599736", "0.62324905", "0.62140554", "0.6205851", "0.6182028", "0.6172251", "0.61696005", "0.61590976", "0.6159067", "0.6153877", "0.6145122", "0.6132135", "0.61053854", "0.61032...
0.0
-1
Loads data for the specified city and filters by month and day if applicable.
def load_data(city, month, day): df = pd.read_csv(CITY_DATA[city]) # convert the Start Time column to datetime df['Start Time'] = pd.to_datetime(df['Start Time']) # extract month and day of week from Start Time to create new columns df['month'] = df['Start Time'].dt.month df['day_of_w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ...
[ "0.81320685", "0.8108889", "0.8045821", "0.8042514", "0.80090284", "0.80071104", "0.79991937", "0.7998333", "0.7988789", "0.797905", "0.79737365", "0.79610896", "0.7956163", "0.7947432", "0.79463065", "0.7908287", "0.7908229", "0.7904569", "0.7900715", "0.78930074", "0.788921...
0.7718287
61
Displays statistics on the most frequent times of travel.
def time_stats(df): df['Start Time'] = pd.to_datetime(df['Start Time']) df['month'] = df['Start Time'].dt.month df['day_of_week'] =df['Start Time'].dt.weekday_name print('\nCalculating The Most Frequent Times of Travel...\n') start_time = time.time() # TO DO: display the most common ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\...
[ "0.80247396", "0.80233026", "0.7915788", "0.78266186", "0.7822246", "0.78143597", "0.77659196", "0.7740343", "0.773628", "0.77344066", "0.76867086", "0.7668633", "0.7651731", "0.7644636", "0.76399267", "0.76367253", "0.7625196", "0.7623158", "0.7612803", "0.76002145", "0.7583...
0.7065316
90
Displays statistics on the most popular stations and trip.
def station_stats(df): print("\nCalculating The Most Popular Stations and Trip...\n") start_time = time.time() # TO DO: display most commonly used start station popular_start_station = df['Start Station'].mode()[0] print("\nMost commonly used start station is: {}".format(popular_start_stati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m...
[ "0.7815675", "0.7662213", "0.7553417", "0.74914914", "0.74748665", "0.7446617", "0.7428588", "0.74237514", "0.74177027", "0.7400495", "0.7387161", "0.7385634", "0.73647535", "0.735934", "0.73566747", "0.73548365", "0.7351854", "0.7351274", "0.735057", "0.73421645", "0.7340198...
0.68506134
91
Displays statistics on the total and average trip duration.
def trip_duration_stats(df): print("\nCalculating Trip Duration...\n") start_time = time.time() # TO DO: display total travel time total_travel_time = df['Trip Duration'].sum() #Alternative logic : total_travel_time = df.sum(axis = 0, skipna = True)['Trip Duration'] print("\nTotal trav...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri...
[ "0.814274", "0.8025143", "0.80041367", "0.79496753", "0.7937415", "0.79312176", "0.7926815", "0.7915187", "0.79142886", "0.7908032", "0.79055744", "0.7900715", "0.7891682", "0.78894734", "0.7886722", "0.78851086", "0.7884266", "0.7882474", "0.78738385", "0.78686154", "0.78664...
0.7718059
65
Draw an ellipse with a given position and covariance
def draw_ellipse(position, covariance, ax=None, **kwargs): ax = ax or plt.gca() # Convert covariance to principal axes if covariance.shape == (2, 2): U, s, Vt = np.linalg.svd(covariance) angle = np.degrees(np.arctan2(U[1, 0], U[0, 0])) width, height = 2 * np.sqrt(s) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_ellipse(position, covariance, ax=None, **kwargs):\r\n # Convert covariance to principal axes\r\n if covariance.shape == (2, 2):\r\n U, s, Vt = np.linalg.svd(covariance)\r\n angle = np.degrees(np.arctan2(U[1, 0], U[0, 0]))\r\n width, height = 2 * np.sqrt(s)\r\n else:\r\n ...
[ "0.840408", "0.8376353", "0.83385664", "0.8117954", "0.7819908", "0.7780715", "0.7749703", "0.7740195", "0.77339417", "0.7724917", "0.771405", "0.7710944", "0.7593914", "0.7255161", "0.7168584", "0.71576935", "0.7078389", "0.6957663", "0.69198805", "0.69095415", "0.69095415",...
0.83872885
1
Get the state of the control.
def getCheckBoxState( self, cCtrlName ): oControl = self.getControl( cCtrlName ) return oControl.getState();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetState(self):\r\n \r\n return self.state", "def getState( self, cCtrlName ):\n return self.getControlModelProperty( cCtrlName, \"State\" )", "def get_state(self):\n return self.controller.get_state()", "def get_state(self):\n return self.state", "def get_state(self)...
[ "0.7713072", "0.7550801", "0.7550297", "0.75244486", "0.75244486", "0.73523945", "0.7341323", "0.7341323", "0.7341323", "0.7341323", "0.7341323", "0.7302949", "0.72987294", "0.72327673", "0.72327673", "0.7227151", "0.7120375", "0.7102456", "0.7102456", "0.7102456", "0.7102456...
0.71298826
16
Set the text of the ComboBox.
def setComboBoxText( self, cCtrlName, cText ): oControl = self.getControl( cCtrlName ) oControl.setText( cText )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_text(self):\n pass", "def set_text(self, T):\n self.text = T", "def set_text(self, text):\n\n self.text = text", "def set_text(widget, text):\n if isinstance(widget, QLineEdit):\n widget.setText(text)\n widget.setCursorPosition(0)\n\n if isinstance(widget, QPl...
[ "0.7183482", "0.7025641", "0.69841087", "0.69648516", "0.6928391", "0.6916036", "0.6915587", "0.6765291", "0.67549056", "0.6739587", "0.67345995", "0.6701489", "0.66546065", "0.6654229", "0.6580795", "0.657918", "0.65529495", "0.65525883", "0.65123296", "0.6504762", "0.648271...
0.83729434
0
Set the text of the ComboBox.
def getComboBoxText( self, cCtrlName): oControl = self.getControl( cCtrlName ) return oControl.getText()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setComboBoxText( self, cCtrlName, cText ):\n oControl = self.getControl( cCtrlName )\n oControl.setText( cText )", "def set_text(self):\n pass", "def set_text(self, T):\n self.text = T", "def set_text(self, text):\n\n self.text = text", "def set_text(widget, text):\n ...
[ "0.83729434", "0.7183482", "0.7025641", "0.69841087", "0.69648516", "0.6928391", "0.6916036", "0.6915587", "0.6765291", "0.67549056", "0.6739587", "0.67345995", "0.6701489", "0.66546065", "0.6654229", "0.6580795", "0.657918", "0.65529495", "0.65525883", "0.65123296", "0.65047...
0.0
-1
Get the control model (not the control) for a particular control name. The model returned includes the service UnoControlModel, and another controlspecific service which inherits from it.
def getControlModel( self, cCtrlName ): oControl = self.getControl( cCtrlName ) oControlModel = oControl.getModel() return oControlModel
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_control(self, name):\n\n return self._control_manager.get_control(name)", "def getControl( self, cCtrlName ):\n oControl = self.oDialogControl.getControl( cCtrlName )\n return oControl", "def retrieve_model(self, model_name):\n\t\tmodel_detail = dbop.get_model(self, model_name)\n\t...
[ "0.5874913", "0.5867581", "0.5860222", "0.58568245", "0.56913966", "0.5681632", "0.5593972", "0.5569165", "0.556387", "0.54582965", "0.5429152", "0.5429152", "0.5429152", "0.5429152", "0.5429152", "0.5429152", "0.5429152", "0.5429152", "0.5429152", "0.5429152", "0.54038125", ...
0.79969704
0
Create a com.sun.star.awt.Point struct.
def makePoint( nX, nY ): oPoint = createUnoStruct( "com.sun.star.awt.Point" ) oPoint.X = nX oPoint.Y = nY return oPoint
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_point(x_crd, y_crd):\n\n Point = namedtuple(\"Point\", \"x_crd y_crd\")\n return Point(x_crd, y_crd)", "def point(self):\n return collections.namedtuple(self.name, [self.x, self.y, self.units])", "def getPoint(self):\n return Point(*self.position)", "def pos_as_point(self) -> P...
[ "0.72424793", "0.679952", "0.6563331", "0.65581805", "0.6548123", "0.6467836", "0.64251125", "0.63404197", "0.6292544", "0.6270017", "0.62531495", "0.62179846", "0.6177019", "0.61752564", "0.5988643", "0.59822726", "0.5966006", "0.59334815", "0.59281564", "0.5908807", "0.5888...
0.8446832
0
Create a com.sun.star.awt.Rectangle struct.
def makeRectangle( nX, nY, nWidth, nHeight ): oRect = createUnoStruct( "com.sun.star.awt.Rectangle" ) oRect.X = nX oRect.Y = nY oRect.Width = nWidth oRect.Height = nHeight return oRect
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rectangle(xcenter, ycenter, width, height):\n x1, x2 = xcenter - width, xcenter + width\n y1, y2 = ycenter - height, ycenter + height\n return Shape([Point(x1, y1), Point(x1, y2), Point(x2, y2), Point(x2, y1)])", "def create_rectangle(width, height, color):\n data = [-width / 2, -height / 2,\n ...
[ "0.6828365", "0.6743847", "0.66186297", "0.66161364", "0.6569437", "0.6505746", "0.64751107", "0.6452088", "0.6452088", "0.644122", "0.6427341", "0.6410263", "0.6400243", "0.63662827", "0.62920314", "0.6218914", "0.62058485", "0.6205646", "0.62001854", "0.6198113", "0.6197054...
0.8647006
0
Sets the learning rate to the initial LR decayed by 10 every 30 epochs
def adjust_learning_rate(self, optimizer, epoch): lr = self.lr if epoch >= 80: lr = self.lr * (0.1 ** ((epoch-80) // 40)) for param_group in optimizer.param_groups: param_group['lr'] = lr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjust_learning_rate(init_lr, optimizer, epoch, n=100):\n init_lr = init_lr * (0.1 ** (epoch // n))\n print('learning rate : ', init_lr)\n for param_group in optimizer.param_groups:\n param_group['lr'] = init_lr", "def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #l...
[ "0.7913536", "0.7906521", "0.7849834", "0.777524", "0.77338326", "0.77306354", "0.7722718", "0.77224237", "0.771982", "0.77092624", "0.7693604", "0.76742035", "0.7665748", "0.7665748", "0.7665748", "0.7655329", "0.76419765", "0.76399755", "0.7637868", "0.7626077", "0.76247585...
0.7544546
42
This method plots the collection area scale map, which can be useful for checking the used settings. Must be run after the scale_irf() method.
def plot_aeff_scale_map(self, vmin=-0.5, vmax=0.5): scale_map = self.get_aeff_scale_map() pyplot.title("Collection area scale map") pyplot.semilogx() pyplot.xlabel('Energy, TeV') pyplot.ylabel('Off-center angle, deg') pyplot.pcolormesh(scale_map['E_edges'], scale_map['...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotmap(self):\n if self.plotfigure is None: return\n\n self.plotfigure.clf()\n collist = [\"#%.2x%.2x%.2x\" % (i, i, i) for i in self.currentshades]\n cmap = colors.ListedColormap(collist)\n if self.gs.isfixed:\n crange = [self.minvalue] + self.currentvalues\n ...
[ "0.66851836", "0.63734704", "0.61565167", "0.6148599", "0.61434036", "0.60903305", "0.606588", "0.6052468", "0.600291", "0.59837526", "0.59608847", "0.5940858", "0.5898155", "0.5890855", "0.5838886", "0.58027", "0.5801149", "0.577781", "0.5777189", "0.5765916", "0.5765797", ...
0.74713296
0
This method plots the collection area scale map, which can be useful for checking the used settings. Must be run after the scale_irf() method.
def plot_bkg_scale_map_detx(self, vmin=0., vmax=2.): scale_map = self.get_bkg_scale_map() pyplot.title("Background scale map") pyplot.semilogx() pyplot.xlabel('Energy, TeV') pyplot.ylabel('FOV coordinate X-axis \nbinning (in AltAz frame), deg') tp = numpy.swap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_aeff_scale_map(self, vmin=-0.5, vmax=0.5):\n\n scale_map = self.get_aeff_scale_map()\n\n pyplot.title(\"Collection area scale map\")\n pyplot.semilogx()\n\n pyplot.xlabel('Energy, TeV')\n pyplot.ylabel('Off-center angle, deg')\n pyplot.pcolormesh(scale_map['E_edge...
[ "0.74713767", "0.66850907", "0.63732195", "0.6157887", "0.6147552", "0.6146414", "0.6090301", "0.6065986", "0.6053382", "0.60057634", "0.5983938", "0.5959152", "0.59410214", "0.5896602", "0.5888399", "0.58389187", "0.5803075", "0.5800234", "0.5777337", "0.5777236", "0.5769942...
0.0
-1
This method plots the collection area scale map, which can be useful for checking the used settings. Must be run after the scale_irf() method.
def plot_bkg_scale_map_dety(self, vmin=0., vmax=2.): scale_map = self.get_bkg_scale_map() pyplot.title("Background scale map") pyplot.semilogx() pyplot.xlabel('Energy, TeV') pyplot.ylabel('FOV coordinate Y-axis \nbinning (in AltAz frame), deg') tp = nu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_aeff_scale_map(self, vmin=-0.5, vmax=0.5):\n\n scale_map = self.get_aeff_scale_map()\n\n pyplot.title(\"Collection area scale map\")\n pyplot.semilogx()\n\n pyplot.xlabel('Energy, TeV')\n pyplot.ylabel('Off-center angle, deg')\n pyplot.pcolormesh(scale_map['E_edge...
[ "0.74713296", "0.66851836", "0.63734704", "0.61565167", "0.6148599", "0.61434036", "0.60903305", "0.606588", "0.6052468", "0.600291", "0.59837526", "0.59608847", "0.5940858", "0.5898155", "0.5890855", "0.5838886", "0.58027", "0.5801149", "0.577781", "0.5777189", "0.5765916", ...
0.5437051
74
Add most_severe_consequence annotation to transcript consequences.
def add_most_severe_consequence_to_consequence( tc: hl.expr.StructExpression, ) -> hl.expr.StructExpression: csqs = hl.literal(CSQ_ORDER) return tc.annotate( most_severe_consequence=csqs.find(lambda c: tc.consequence_terms.contains(c)) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_most_severe(consequences):\n \n if consequences is None:\n return None\n \n most_severe = None\n \n for consequence in consequences:\n # check if this is the most severe consequence; prefer HGNC transcripts\n if most_severe is None or severity[consequence] < severity[...
[ "0.6555489", "0.54984164", "0.5273789", "0.5205444", "0.50748456", "0.4662173", "0.45644486", "0.4467017", "0.43975502", "0.4390304", "0.43893424", "0.43493015", "0.4321759", "0.42909536", "0.42909536", "0.42909536", "0.42909536", "0.42909536", "0.42909536", "0.42909536", "0....
0.6688654
0
Filter VEP transcript consequences to those with a most severe consequence of synonymous_variant.
def filter_vep_to_synonymous_variants( mt: Union[hl.MatrixTable, hl.Table], vep_root: str = "vep" ) -> Union[hl.MatrixTable, hl.Table]: synonymous = mt[vep_root].transcript_consequences.filter( lambda csq: csq.most_severe_consequence == "synonymous_variant" ) vep_data = mt[vep_root].annotate(tra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_common_variation(self):\n # Filter common variation\n unknown_freq_df = self.variant_df.query('gnomAD_exome_ALL == \".\"')\n other_freq_df = self.variant_df.query('gnomAD_exome_ALL != \".\"')\n self.unknown_maf_count = unknown_freq_df.shape[0]\n \n # Filter commo...
[ "0.58217245", "0.56402266", "0.54618555", "0.5454636", "0.5371693", "0.52297926", "0.51061594", "0.50193447", "0.49609655", "0.49316716", "0.48905328", "0.48854867", "0.488352", "0.48781073", "0.4863006", "0.48332325", "0.4825436", "0.48035395", "0.47880048", "0.4782303", "0....
0.572074
1
Generate a string of a given length String consists of numbers between 0 alphabet, inclusive
def rng_string(alphabet, length): bitList = [] for _ in range(0, length): bitList.append(str(randint(0, alphabet))) return ''.join(bitList)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate(length):\n alpha = map(chr, range(97, 123))\n alpha.append(' ')\n result = \"\"\n for x in range(length):\n result += alpha[random.randrange(0,27)]\n return result", "def gen_chars(length, character):\n return ''.join([character for i in range(length)])", "def rand_str(len...
[ "0.77096176", "0.7666185", "0.7602581", "0.7595434", "0.7581019", "0.7524946", "0.75116104", "0.7511202", "0.74978673", "0.745938", "0.74575365", "0.7449701", "0.7425797", "0.7403858", "0.73647743", "0.73549294", "0.73459655", "0.73430645", "0.73310506", "0.7322888", "0.73220...
0.7705444
1
Generate a number of strings Between 0 alphabet Of random length between 0 and length Returns a list of strings
def generate_strings(nr_strings, alphabet, length): strings = [] for _ in range(0, nr_strings): strings.append(rng_string(alphabet, randint(0, length))) return strings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_test_strings(nr_strings, alphabet, length):\n for _ in range(0, nr_strings):\n yield rng_string(alphabet, randint(0, length))", "def generate_random_sequences(\n N, minimum_length=4, maximum_length=20, seed=1, letters=\"ACDEFGHIKLMNPQRSTVWY\"\n):\n set_seed(seed)\n\n string_list =...
[ "0.79718316", "0.7565656", "0.74351144", "0.74282974", "0.73993874", "0.72894025", "0.72464895", "0.7184304", "0.7149259", "0.71371096", "0.7065593", "0.70450574", "0.70343363", "0.7027484", "0.70165753", "0.70042604", "0.6995587", "0.6981897", "0.6977321", "0.69628656", "0.6...
0.8389128
0
Convert dictionary representations of 2d bounding boxes into objects of the BBox2D class
def read_bounding_box_2d(annotation, label_mappings=None): bboxes = [] for b in annotation: label_id = b["label_id"] x = b["x"] y = b["y"] w = b["width"] h = b["height"] if label_mappings and label_id not in label_mappings: continue box = BBox2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bbox2fields():\n bbox2label = {\n 'gt_bboxes': 'gt_labels',\n 'gt_bboxes_ignore': 'gt_labels_ignore'\n }\n bbox2mask = {\n 'gt_bboxes': 'gt_masks',\n 'gt_bboxes_ignore': 'gt_masks_ignore'\n }\n bbox2seg = {\n 'gt_bboxes': 'gt_semantic_seg',\n }\n return b...
[ "0.6676892", "0.6581434", "0.62871414", "0.6272231", "0.6169191", "0.6165965", "0.6135782", "0.613047", "0.6077207", "0.6077207", "0.60771435", "0.6021383", "0.59702975", "0.596057", "0.59365267", "0.59058076", "0.5863613", "0.58523244", "0.58440346", "0.5838191", "0.58264005...
0.6586348
1
Vector number of data Returns list of int The number of data for each receivers.
def vnD(self): return self.source_field.vnD
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_count(self):\n return(len(self.data))", "def count(self):\r\n return self.data_array.size", "def getNumData(self):\n return len(self.data)", "def get_num_slots(self):\n # Your code here\n return len(self.data)", "def amount_of_receivers(self) -> int:\n ret...
[ "0.71954674", "0.6993063", "0.69387656", "0.67687756", "0.67342806", "0.67240787", "0.666438", "0.6628837", "0.65838236", "0.6576964", "0.6527135", "0.6457573", "0.645703", "0.6450006", "0.63773954", "0.6352168", "0.6348397", "0.6321677", "0.6318887", "0.6279056", "0.6252326"...
0.0
-1
Set the default file type for the file dialog. Generally the first found file type will be used, but this is overridden if it is not appropriate. Returns
def _set_defaults(self): defaults = {key: val[0][1].replace("*", "") for key, val in self._filetypes.items()} defaults["default"] = None defaults["video"] = ".mp4" defaults["image"] = ".png" logger.debug(defaults) return defaults
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"file_type\")", "def file_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"file_type\")", "def set_file_type(self, doc, type_value):\n\n type_dict = {\n 'fileType_source': 'SOURC...
[ "0.6866069", "0.6866069", "0.6738403", "0.6702073", "0.6675902", "0.6507005", "0.6480766", "0.6423764", "0.6418143", "0.6416306", "0.6409068", "0.63116544", "0.6229452", "0.61502546", "0.61251974", "0.6027797", "0.60256433", "0.6010065", "0.59732777", "0.58847684", "0.5867014...
0.5817696
22
View root page function that returns the index page and its data
def index(): #Getting source sources = get_sources() print(sources) return render_template('index.html', sources = sources)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n\n return {\n 'page': 'index',\n }", "def main():\n page = get_page_arg()\n\n items = load_data(page)\n total_pages = get_total_pages()\n context = {\"current_page\": page,\n \"total_pages\": total_pages,\n \"items\": items}\n\n return render_...
[ "0.834029", "0.8194094", "0.80399597", "0.79941577", "0.79941577", "0.79941577", "0.7966623", "0.79607356", "0.7926696", "0.79239005", "0.7918905", "0.78887975", "0.7882536", "0.7877497", "0.7874792", "0.78684336", "0.7863146", "0.7863146", "0.7835081", "0.7835081", "0.782381...
0.0
-1
Builds a unitary transformation representing a quantum circuit operating on a register of qubits.
def unitary_builder(qubit_register, circuit): no_of_qubits = math.log(next(x for x in qubit_register.shape if x != 1), 2) qubit_ordering = [] operations_in_slice = [] operation_list = None for slice in circuit: for step in slice["operations"]: qubit_ordering.extend(step[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile(self, seq, registers):\n\n # Check which modes are actually being used\n used_modes = []\n for operations in seq:\n modes = [modes_label.ind for modes_label in operations.reg]\n used_modes.append(modes)\n\n used_modes = list(set(item for sublist in used...
[ "0.58040667", "0.57962734", "0.57612365", "0.5690916", "0.5677934", "0.56570274", "0.5650889", "0.56067985", "0.5568018", "0.5562412", "0.55538666", "0.55348414", "0.55247015", "0.5499961", "0.54898405", "0.5449706", "0.5439784", "0.54339796", "0.54323757", "0.54230887", "0.5...
0.7319423
0
r"""Fills the input Tensor with values drawn from a truncated normal distribution. The values are effectively drawn from the
def trunc_normal_(tensor, mean=0., std=1., a=-2., b=2.): # type: (Tensor, float, float, float, float) -> Tensor return _no_grad_trunc_normal_(tensor, mean, std, a, b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def truncated_normal_(tensor):\n mean = 0\n std = 1/float(np.sqrt(tensor.shape[0]))\n size = tensor.shape\n tmp = tensor.new_empty(size + (4,)).normal_()\n valid = (tmp < 2) & (tmp > -2)\n ind = valid.max(-1, keepdim=True)[1]\n tensor.data.copy_(tmp.gather(-1, ind).squeeze(-1))\n tensor.dat...
[ "0.67517334", "0.6720702", "0.65562874", "0.63755536", "0.61646926", "0.60623974", "0.60570794", "0.59341407", "0.592934", "0.5913863", "0.58814806", "0.5845515", "0.5844254", "0.5828195", "0.5787514", "0.57667047", "0.57624525", "0.57624525", "0.57624525", "0.57624525", "0.5...
0.66173005
2
Function to convert yaml formatted string to python dict
def yaml2py(yaml_str): yaml = YAML(typ='safe', pure=True) return yaml.load(yaml_str)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yaml_str_to_schema_dict(yaml_str: str) -> dict:\n schema = load(yaml_str, get_type_schema_yaml_validator())\n revalidate_typeschema(schema)\n return schema.data", "def yaml_parse(yamlstr):\n try:\n # PyYAML doesn't support json as well as it should, so if the input\n # i...
[ "0.75044394", "0.7438241", "0.7004615", "0.6969506", "0.69523716", "0.67101115", "0.67029405", "0.6653134", "0.6610358", "0.65753603", "0.65509796", "0.65100765", "0.6481357", "0.64028245", "0.63827264", "0.63796985", "0.6327455", "0.6285148", "0.6282342", "0.62444276", "0.62...
0.67005914
7
Function to convert python object to yaml formatted string
def py2yaml(obj): str_stream = STREAM2STR() yaml = YAML(typ='safe', pure=True) yaml.default_flow_style = False yaml.dump(obj, str_stream) return str_stream.get_string()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_yaml(obj):\n # Is there a better way to do this by adding a representation with\n # yaml.Dumper?\n # Ordered dict: http://pyyaml.org/ticket/29#comment:11\n if obj is None or isinstance(obj, str):\n out = str(obj)\n elif isinstance(obj, Linkable) and obj.stringable():\n return st...
[ "0.7684663", "0.74573815", "0.73483217", "0.724653", "0.72239447", "0.71829236", "0.71827453", "0.7168303", "0.7102404", "0.7084116", "0.70400643", "0.6891522", "0.68688035", "0.68141264", "0.67958164", "0.67703724", "0.67510456", "0.67199016", "0.67093164", "0.6693379", "0.6...
0.7674672
1
coord_list > list of points to be checked normal_plane > normal vector to plane used for the comparision point_on_plane > a point on the plane returns a bool of the size of coords_list with True or false
def semi_plan_check(coords_list, normal_plane, point_on_plane, tol=1e-8): center_to_coords = coords_list - \ np.repeat(point_on_plane.reshape((-1,3)), len(coords_list), axis=0) normal_plane = \ np.repeat(normal_plane.reshape((-1,3)), len(coords_list), axis=0) inner_product = np.sum(center_to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_me(triplet, list_of_coords):\n c = True\n for element in list_of_coords:\n if (float(triplet[0])*0.99 <= float(element[0]) <= float(triplet[0])*1.01):\n if (float(triplet[1])*0.99 <= float(element[1]) <= float(triplet[1])*1.01):\n if (float(triplet[2])*0.99 <= float...
[ "0.6596154", "0.65187806", "0.6504258", "0.6426806", "0.6356195", "0.6273676", "0.6205567", "0.6193565", "0.6156936", "0.61503375", "0.60627425", "0.60519516", "0.5983829", "0.5943327", "0.5938923", "0.59345114", "0.59038395", "0.58973897", "0.58516276", "0.5818492", "0.57992...
0.76836556
0
plot_changes(stock, data) > None Takes in a stock and dataframe and plots changes (gradient) normalized vs stock price daily change (gradient) normalized
def plot_changes(stock, data): data['Date'] = pd.to_datetime(data['Date']).dt.date x = np.arange(0,len(data)) fig, ax = plt.subplots() ax.plot(x,data['Change_Norm']) ax.plot(x, data['Mentions_Norm']) ax.legend([F"{stock} Daily Change", f"{stock} Mentions"]) plt.ylabel('Normalized Value') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_high_low_changes(stock, data):\n data['Date'] = pd.to_datetime(data['Date']).dt.date\n x = np.arange(0,len(data))\n fig, ax = plt.subplots()\n ax.plot(x,data['Change_High_Low_Norm'])\n ax.plot(x, data['Mentions_Norm'])\n ax.legend([F\"{stock} Daily High, Low Change\", f\"{stock} Mentions...
[ "0.70108485", "0.6606524", "0.6556408", "0.64659566", "0.64084405", "0.6393355", "0.63736963", "0.6306916", "0.62134147", "0.6091561", "0.6006313", "0.59640855", "0.59434557", "0.5869743", "0.584645", "0.57535857", "0.57392097", "0.5713349", "0.57011396", "0.5679812", "0.5641...
0.7765548
0
Sets the order sell amount from buy amount so that it satisfies xrate.
def set_sell_amount_from_buy_amount(self, *args, **kwargs): self._sell_amount = self.get_sell_amount_from_buy_amount(*args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def selling_rate(self, selling_rate):\n\n self._selling_rate = selling_rate", "def sell_min_amount(self, sell_min_amount):\n\n self._sell_min_amount = sell_min_amount", "def sell_currency(self, sell_currency):\n\n self._sell_currency = sell_currency", "def orderSell(self, rate = None, am...
[ "0.7027161", "0.69452643", "0.691519", "0.6791583", "0.6736076", "0.6614018", "0.6608537", "0.65670574", "0.6492969", "0.64861614", "0.64497274", "0.6446258", "0.64457405", "0.64235497", "0.6369229", "0.63054127", "0.6296835", "0.6293252", "0.6275233", "0.6264036", "0.6258954...
0.79369205
0
Check whether a stream was created by a user.
def isOwner(id, userId): db = core.connect() return db[id]["createdBy"] == userId
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_stream(self, stream_name: str) -> bool:\n return self._path_exist(stream_name=stream_name)", "def isPublicUserStream(id):\n db = core.connect()\n return (not db[id][\"meta\"] == \"public\")", "def is_stream_live(username=None):\n\tchannel_data = get_info(username, use_fallback=False)\n\tret...
[ "0.69750905", "0.69131696", "0.6398119", "0.63860357", "0.6248244", "0.62157124", "0.6050019", "0.60044897", "0.60006064", "0.59784245", "0.59704214", "0.5876842", "0.5831613", "0.58287764", "0.5805501", "0.5775753", "0.57582176", "0.57525826", "0.57383657", "0.57349503", "0....
0.5486069
55
Give a user join permission.
def invite(id, adminId, userId): db = core.connect(); permission.create({ "streamId": id, "createdBy": adminId, "userId": userId, "level": 0 }) event.create({ "createdBy": userId, "streamId": user.messageStream(userId), "displayString": "%s has...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def join(self, ctx, invite : discord.Invite):\r\n if ctx.message.author.id == \"481270883701358602\":\r\n await self.client.accept_invite(invite)\r\n await self.client.say(\"Joined the server.\")\r\n else:\r\n await self.client.say(\"**Owner only command.**\")",...
[ "0.6803183", "0.66971415", "0.66882896", "0.66621107", "0.66158056", "0.66030866", "0.652507", "0.64030397", "0.63196415", "0.6247099", "0.6212574", "0.62054145", "0.6195875", "0.61849636", "0.61434", "0.61375004", "0.6133723", "0.6106112", "0.6085183", "0.6066214", "0.605269...
0.0
-1
Check if hashed password matches actual password
def verify_password(self, password): return Bcrypt().check_password_hash(self.password, password)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_encrypted_password(password: str, hashed: str) -> bool:\n return pwd_context.verify(password, hashed)", "def check_hashed_password(password, hashed_password):\n\n\n return sha256_crypt.verify(password,hashed_password)", "def verify_password(self, password):\n return check_password_hash(s...
[ "0.81750333", "0.81654465", "0.81029165", "0.8091229", "0.80758476", "0.8071933", "0.8042396", "0.8026053", "0.79251105", "0.7912885", "0.79124117", "0.79056114", "0.7889633", "0.78833985", "0.7860269", "0.7850504", "0.78410155", "0.7839047", "0.7839047", "0.78045964", "0.779...
0.7621998
63
Constructs a partition of the set of indices in labels, grouping indices according to their label.
def get_partition_from_labels(self, labels): partition = defaultdict(list) for ind, label in enumerate(labels): partition[label].append(ind) self.clean_partition(partition) return partition
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partition(self, data, labels):\n\t\treturn self.kfold.split(labels)", "def partition(self, data, labels):\n\t\t#TODO remove\n\t\tprint(\"label shape {}\".format(labels.shape))\n\t\treturn self.kfold.split(data[0], labels)", "def partition(self, data, labels):\n\t\tfor i in range(self.splits):\n\t\t\tyield ...
[ "0.6762113", "0.667177", "0.6490245", "0.6459165", "0.6321457", "0.6291771", "0.62190074", "0.61924654", "0.59653884", "0.59361124", "0.5930132", "0.5815756", "0.5800253", "0.5733778", "0.5701966", "0.5695419", "0.5675591", "0.5666529", "0.5666529", "0.5646061", "0.56029624",...
0.82170296
0
Split line into many lines, starting with the first matching bracket pair.
def left_hand_split( line: Line, _features: Collection[Feature], mode: Mode ) -> Iterator[Line]: tail_leaves: List[Leaf] = [] body_leaves: List[Leaf] = [] head_leaves: List[Leaf] = [] current_leaves = head_leaves matching_bracket: Optional[Leaf] = None for leaf in line.leaves: if ( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parenthesis_splits(line, split_sign): \n split = list()\n counter = 0\n previous_split = 0\n while counter + len(split_sign) <= len(line): # Studies each position in the line\n if line[counter] == '(': # If fortran character is being written jumps to end of char\n jump = find_c...
[ "0.6265715", "0.60923326", "0.6072111", "0.6027087", "0.5997973", "0.59957486", "0.5926128", "0.59231865", "0.5915676", "0.5823901", "0.575465", "0.5735647", "0.5674658", "0.56346613", "0.5628139", "0.5591083", "0.5553461", "0.55381954", "0.5473768", "0.5473352", "0.5461346",...
0.6345881
0
Split line into many lines, starting with the last matching bracket pair. If the split was by optional parentheses, attempt splitting without them, too. `omit` is a collection of closing bracket IDs that shouldn't be considered for this split.
def right_hand_split( line: Line, mode: Mode, features: Collection[Feature] = (), omit: Collection[LeafID] = (), ) -> Iterator[Line]: rhs_result = _first_right_hand_split(line, omit=omit) yield from _maybe_split_omitting_optional_parens( rhs_result, line, mode, features=features, omit=om...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _first_right_hand_split(\n line: Line,\n omit: Collection[LeafID] = (),\n) -> RHSResult:\n tail_leaves: List[Leaf] = []\n body_leaves: List[Leaf] = []\n head_leaves: List[Leaf] = []\n current_leaves = tail_leaves\n opening_bracket: Optional[Leaf] = None\n closing_bracket: Optional[Leaf]...
[ "0.67619246", "0.66219115", "0.6048946", "0.5804838", "0.56893325", "0.51839584", "0.5151876", "0.5138072", "0.49450547", "0.49191758", "0.48496085", "0.47505775", "0.47253534", "0.4717162", "0.46780178", "0.4675563", "0.46187833", "0.4609957", "0.4566752", "0.4551547", "0.45...
0.65317905
2
Append `leaf` to current line or to new line if appending impossible.
def append_to_line(leaf: Leaf) -> Iterator[Line]: nonlocal current_line try: current_line.append_safe(leaf, preformatted=True) except ValueError: yield current_line current_line = Line( mode=line.mode, depth=line.depth, inside_brackets=line.in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_to_line(leaf: Leaf) -> Iterator[Line]:\n nonlocal current_line\n try:\n current_line.append_safe(leaf, preformatted=True)\n except ValueError:\n yield current_line\n\n current_line = Line(\n line.mode, depth=line.depth, inside_brackets...
[ "0.7848045", "0.6298407", "0.5623498", "0.56151044", "0.555744", "0.54985106", "0.5256638", "0.52517474", "0.5250364", "0.5238578", "0.5201002", "0.5178309", "0.5171909", "0.51567364", "0.5148723", "0.5140093", "0.5133959", "0.5121782", "0.50961936", "0.50946355", "0.5066202"...
0.78365976
1
Append `leaf` to current line or to new line if appending impossible.
def append_to_line(leaf: Leaf) -> Iterator[Line]: nonlocal current_line try: current_line.append_safe(leaf, preformatted=True) except ValueError: yield current_line current_line = Line( line.mode, depth=line.depth, inside_brackets=line.inside_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_to_line(leaf: Leaf) -> Iterator[Line]:\n nonlocal current_line\n try:\n current_line.append_safe(leaf, preformatted=True)\n except ValueError:\n yield current_line\n\n current_line = Line(\n mode=line.mode, depth=line.depth, inside_bra...
[ "0.78365976", "0.6298407", "0.5623498", "0.56151044", "0.555744", "0.54985106", "0.5256638", "0.52517474", "0.5250364", "0.5238578", "0.5201002", "0.5178309", "0.5171909", "0.51567364", "0.5148723", "0.5140093", "0.5133959", "0.5121782", "0.50961936", "0.50946355", "0.5066202...
0.7848045
0
Generate sets of closing bracket IDs that should be omitted in a RHS. Brackets can be omitted if the entire trailer up to and including a preceding closing bracket fits in one line. Yielded sets are cumulative (contain results of previous yields, too). First set is empty, unless the line should explode, in which case b...
def generate_trailers_to_omit(line: Line, line_length: int) -> Iterator[Set[LeafID]]: omit: Set[LeafID] = set() if not line.magic_trailing_comma: yield omit length = 4 * line.depth opening_bracket: Optional[Leaf] = None closing_bracket: Optional[Leaf] = None inner_brackets: Set[LeafID]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _first_right_hand_split(\n line: Line,\n omit: Collection[LeafID] = (),\n) -> RHSResult:\n tail_leaves: List[Leaf] = []\n body_leaves: List[Leaf] = []\n head_leaves: List[Leaf] = []\n current_leaves = tail_leaves\n opening_bracket: Optional[Leaf] = None\n closing_bracket: Optional[Leaf]...
[ "0.569721", "0.52825326", "0.51151145", "0.5034241", "0.4896403", "0.48744336", "0.48141295", "0.48083612", "0.46925086", "0.46653306", "0.46522915", "0.46257776", "0.46211234", "0.45781818", "0.45635155", "0.45527235", "0.45258874", "0.4520331", "0.4519943", "0.45119813", "0...
0.66201717
0
Extracts predictor and response variables from a list of variables.
def _varfilter(self, vrs, response, predictor) -> List[str]: if not response and not predictor: return vrs if response: vrs = _list_union(vrs, self.response_vars) if predictor: vrs = _list_union(vrs, self.predictor_vars) return vrs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_variables(expected_variables, _request):\n extracted_variables = {}\n for variable in expected_variables:\n form_var = _request.form.get(variable)\n args_var = _request.args.get(variable)\n if form_var and args_var:\n extracted_variables[variable] = [form_var, args...
[ "0.6388715", "0.6313585", "0.6053384", "0.5956489", "0.58286166", "0.57880855", "0.5771935", "0.5757789", "0.5756554", "0.56979734", "0.5654562", "0.5625604", "0.5593121", "0.55927354", "0.5538446", "0.5512273", "0.55113935", "0.55010927", "0.5495622", "0.5485291", "0.5463354...
0.5999879
3
Initialize a Cross shape
def __init__(self, height, color, rotation): super(Cross, self).__init__(color, rotation) self.height = height self.coordinates = self.get_coordinates()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross(length = 10, width = 3, layer = 0):\n D = Device(name = 'cross')\n R = rectangle(size = (width, length), layer = layer)\n r1 = D.add_ref(R).rotate(90)\n r2 = D.add_ref(R)\n r1.center = (0,0)\n r2.center = (0,0)\n return D", "def createFixCross():\n # vertical endpoints\n expG...
[ "0.64720565", "0.6104243", "0.5991313", "0.5922945", "0.58705056", "0.5813657", "0.57580894", "0.57227826", "0.5696929", "0.5686129", "0.56418604", "0.56266606", "0.56184053", "0.5600994", "0.5585008", "0.55167705", "0.55136234", "0.55136234", "0.5508846", "0.550739", "0.5503...
0.68755466
0
Function getMIfromGM Put some documentation here.
def getMIfromGM(self, amps, imt, dists=None, mag=None): c, c2 = self.__getConsts(imt) if dists is not None and mag is not None: doresid = True ldd = np.log10(np.clip(dists, 10, 300)) if mag < 3.0: mag = 3.0 elif mag > 7.3: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getGMfromMI(self, mmi, imt, dists=None, mag=None): # noqa\r\n lfact = np.log10(np.e)\r\n c = self._getConsts(imt)\r\n mmi = mmi.copy()\r\n # Set nan values to 1\r\n ix_nan = np.isnan(mmi)\r\n mmi[ix_nan] = 1.0\r\n\r\n pgm = np.zeros_like(mmi)\r\n dpgm_dm...
[ "0.68208617", "0.65988165", "0.65950954", "0.655273", "0.64507335", "0.62191933", "0.60857964", "0.54355514", "0.5402382", "0.53283066", "0.5280798", "0.51845896", "0.5110284", "0.5106542", "0.497201", "0.49325156", "0.49074158", "0.4898668", "0.4830241", "0.48283738", "0.482...
0.62186766
6
Function getGMfromMI Put some documentation here.
def getGMfromMI(self, mmi, imt, dists=None, mag=None): c, c2 = self.__getConsts(imt) if dists is not None and mag is not None: doresid = True ldd = np.log10(np.clip(dists, 10, 300)) if mag < 3.0: mag = 3.0 elif mag > 7.3: m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getGMfromMI(self, mmi, imt, dists=None, mag=None): # noqa\r\n lfact = np.log10(np.e)\r\n c = self._getConsts(imt)\r\n mmi = mmi.copy()\r\n # Set nan values to 1\r\n ix_nan = np.isnan(mmi)\r\n mmi[ix_nan] = 1.0\r\n\r\n pgm = np.zeros_like(mmi)\r\n dpgm_dm...
[ "0.7028177", "0.6615265", "0.6522649", "0.64862365", "0.62413543", "0.5999488", "0.59660715", "0.52155626", "0.51838726", "0.5042442", "0.5042297", "0.50122267", "0.50073236", "0.49431604", "0.4909104", "0.488868", "0.48600248", "0.48374403", "0.48080376", "0.47961026", "0.47...
0.6797562
1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, CreateDeploymentResponse): 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.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Get data disk name for an instance.
def GetDataDiskName(cls, instance): name = cls.DATA_DISK_NAME_FMT.format(instance=instance) return cls._FormalizeName(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_disk_name(disk_type, instance, short=False):\n prefix = '%s_' % (disk_type[0] if short else disk_type)\n base = ('%s_%s' % (instance.name[:8], instance.uuid[:4]) if short\n else instance.name)\n return pvm_util.sanitize_file_name_for_api(\n base, prefix=prefi...
[ "0.7462343", "0.69211113", "0.6604343", "0.6568223", "0.6553796", "0.646116", "0.64351237", "0.6294314", "0.62849385", "0.6276108", "0.6264837", "0.61667037", "0.6150725", "0.61497754", "0.60925776", "0.60891944", "0.6064016", "0.6056977", "0.604818", "0.60254514", "0.601524"...
0.9161254
0
Generate an instance name given build_target, build_id. Target is not used as instance name has a length limit.
def GenerateInstanceName(self, build_target=None, build_id=None): name = self._instance_name_pattern.format(build_target=build_target, build_id=build_id, uuid=uuid.uuid4().hex[:8]) return self._FormalizeN...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GenerateImageName(cls, build_target=None, build_id=None):\n if not build_target and not build_id:\n return \"image-\" + uuid.uuid4().hex\n name = cls.IMAGE_NAME_FMT.format(\n build_target=build_target,\n build_id=build_id,\n uuid=uuid.uuid4().hex[:8])\n...
[ "0.73153794", "0.6547962", "0.64919114", "0.64290154", "0.6278023", "0.6111542", "0.60669595", "0.6059063", "0.5979647", "0.5971141", "0.59302956", "0.5902631", "0.5873183", "0.5863868", "0.5858424", "0.58569974", "0.5846349", "0.58455294", "0.583743", "0.5825777", "0.5776762...
0.8289746
0
Obtains last part of the netns os path. Normally as /var/run/netns/XXXXX
def get_id_netnspath(path): return os.path.basename(os.path.normpath(path))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_last_part_of_path(path: str) -> str:\n multi_os_path = path.replace(\"\\\\\", \"/\")\n return re.search(\"(?:[^/](?!/))+$\", multi_os_path).group(0)", "def part_address(self):\n address = self.address\n if address.startswith(\"/\"):\n address = address[1:]\n if addre...
[ "0.6368412", "0.6167757", "0.61434495", "0.6117434", "0.6040465", "0.6038377", "0.59367067", "0.5913215", "0.5910513", "0.5835193", "0.5814797", "0.57289654", "0.57115823", "0.567507", "0.5665927", "0.5651682", "0.5597754", "0.5558566", "0.55155814", "0.55138963", "0.5501337"...
0.7082052
0
return the first index of item in array or None if item is not found
def linear_search(array, item): # implement linear_search_iterative and linear_search_recursive below, then # change this to call your implementation to verify it passes all tests # return linear_search_iterative(array, item) return linear_search_recursive(array, item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def np_index_of(array, item):\n where = np.where(array == item)\n if len(where) == 0:\n raise ValueError(\"{0} not found in array\".format(item))\n return where[0][0] # where is a 2d array", "def __find_index(arr, val):\n if val is not None:\n return numpy.searchsorted(arr, val)\n e...
[ "0.7654498", "0.76485795", "0.73254657", "0.7152995", "0.70068246", "0.6965024", "0.6964481", "0.6916574", "0.6872765", "0.6827316", "0.67693734", "0.6750015", "0.66990155", "0.668622", "0.66723377", "0.6657315", "0.66358805", "0.66342586", "0.661365", "0.6607807", "0.6569612...
0.60730076
58
return the index of item in sorted array or None if item is not found
def binary_search(array, item): # implement binary_search_iterative and binary_search_recursive below, then # change this to call your implementation to verify it passes all tests return binary_search_iterative(array, item) # return binary_search_recursive(array, item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __find_index(arr, val):\n if val is not None:\n return numpy.searchsorted(arr, val)\n else:\n return val", "def index_equals_value_search1(arr):\n for key, value in enumerate(arr):\n if value == key:\n return value\n return -1", "def binary_search(elem: int, arr:...
[ "0.79116553", "0.7231691", "0.70945144", "0.70503265", "0.702492", "0.7014106", "0.6975659", "0.693756", "0.69133765", "0.69059515", "0.688041", "0.6863463", "0.6828841", "0.6823668", "0.676312", "0.67249036", "0.6687773", "0.66777045", "0.66451496", "0.65669006", "0.6558889"...
0.59163046
89
Predicts the next state of X. If you need to compute the next state yourself, override this function. You would need to do this, for example, if the usual Taylor expansion to generate F is not providing accurate results for you.
def predict_x(self, u=0): self.x = dot(self.F, self.x) + dot(self.B, u)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, X):\n return self.decision_function(X)", "def predict(self, x):\n if self.training:\n self.eval()\n\n with torch.no_grad():\n x = self.forward(x)\n if self.activation:\n x = self.activation(x)\n\n return x", "def pred...
[ "0.70402", "0.7014949", "0.7014949", "0.6979905", "0.6925484", "0.69205", "0.68313384", "0.6727731", "0.668455", "0.6675645", "0.66536146", "0.6638346", "0.6622978", "0.6617829", "0.66159487", "0.6607438", "0.6596278", "0.65745187", "0.6573105", "0.6570777", "0.65503114", "...
0.0
-1
r"""Test applying a scalar colormap.
def test_apply_scalar_map(self): super(TestObjDict, self).test_apply_scalar_map(_as_obj=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_density_colormap(self):\n cmap = matplotlib.cm.get_cmap('density')\n np.testing.assert_allclose(cmap(0.0), [0.214, 0.152, 0.535, 1], atol=0.001)\n np.testing.assert_allclose(cmap(1.0), [0.988, 0.978, 0.042, 1], atol=0.001)", "def empty_scalar_mappable(vmin, vmax, cmap):\n norm = matplotlib.c...
[ "0.6889513", "0.6789326", "0.67118686", "0.66525745", "0.6578556", "0.63339275", "0.6224824", "0.6215659", "0.61139596", "0.6106838", "0.60506", "0.6003708", "0.5763233", "0.5758357", "0.57250583", "0.5672498", "0.5670392", "0.5647369", "0.5630178", "0.5600967", "0.5553219", ...
0.54396313
26
Returns the target output for this task.
def output(self): time.sleep(1) return luigi.LocalTarget('/tmp/bar/%d' % self.num)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_output(self):\n return self.output", "def get_output(self):\n return self.output", "def get_output(self):\n return self._output", "def get_output(self, **kwargs):\n return self.out", "def get_target(self):\n task = self.task.get_task(self.task_id)\n if 'nam...
[ "0.76913494", "0.76913494", "0.7591348", "0.74682355", "0.7363378", "0.73447067", "0.73104286", "0.7308671", "0.7308671", "0.7308671", "0.7282424", "0.7280702", "0.7234891", "0.7165149", "0.7151598", "0.71489656", "0.71489656", "0.71489656", "0.71489656", "0.71489656", "0.714...
0.64198136
70
convert e.g., 3 to 1e3 where 3 is the number of decimal places
def precision2eml(precision): # FIXME is that correct? return '1e-{}'.format(precision)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def HighPrecisionE(number):\n\n return \"%.22e\" % number", "def scientific(x):\n return '{:.2e}'.format(x)", "def decimalize(n):\n return '{:.2f}'.format(n)", "def scinotation(self, num):\n num = num.replace(\"D\", \"e\")\n return f\"{decimal.Decimal(num):.9e}\"", "def number_conver...
[ "0.7351454", "0.70024556", "0.68653345", "0.6697734", "0.6671969", "0.6519983", "0.65114874", "0.6452472", "0.63777333", "0.6374699", "0.6291492", "0.62858784", "0.6243373", "0.6220072", "0.62053126", "0.61356175", "0.61356175", "0.61356175", "0.61356175", "0.6119284", "0.609...
0.6503655
7
given an arraylike of string representations of floating point numbers, infer the precision (number of decimal places
def infer_precision(string_arraylike, as_eml=True): def count_decimals(string): if np.isnan(float(string)): return 0 return len(re.sub(r'.*\.','',string)) precision = np.max([count_decimals(s) for s in string_arraylike]) return precision
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array_output_precision(no_of_decimals):\n sys.float_output_precision = no_of_decimals", "def precision(self):\n string = self.ask('od;E;') # get the actual output\n i1 = string.find('.')\n # find the indices of the dot before the decimal part and the E before\n ...
[ "0.6599426", "0.6449303", "0.6361786", "0.6348009", "0.6145111", "0.61190873", "0.6101951", "0.60985893", "0.60654926", "0.606401", "0.6056092", "0.60470307", "0.60200804", "0.6000072", "0.5988053", "0.5988053", "0.59843975", "0.59448665", "0.5939803", "0.5888907", "0.5860923...
0.80103403
0
makes sure labels are of same dims as corresponding placeholders
def format_labels(self, data): ret = [] for sentence, labels, attr in data: sentence_length = len(sentence) labels_copy = copy.deepcopy(labels) labels_copy = [label[0] for label in labels_copy if type(label) is list ] ret.append((sentence, labels_copy, att...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_shape_equal(pred, labels):\n if pred.shape != labels.shape:\n raise ValueError('Prediction and labels shapes must be equal:'\n f'{pred.shape} vs {labels.shape}.')", "def standardize_labels(labels: np.array, width: int, height: int) -> np.array:\n labels[:, [1, 3]] *= width\n ...
[ "0.6438662", "0.6111245", "0.60905087", "0.60615104", "0.59787303", "0.59228086", "0.5910985", "0.5836485", "0.57830226", "0.57814205", "0.5754395", "0.57541156", "0.5753778", "0.56833297", "0.56385577", "0.56049824", "0.55951315", "0.5573072", "0.5569327", "0.55470127", "0.5...
0.0
-1
Return the sorted list of all octads Each octad is given as a 24bit integer describing a bit vector in `vector`` representation. Octads are sorted lexicographically, so lower bits of the integer are sorted with higher priority.
def octad_list(): global _OCTAD_LIST if _OCTAD_LIST is not None: return _OCTAD_LIST[:] l_oct = [set24_to_list(gc.octad_to_vect(o)) for o in range(759)] l_oct.sort() _OCTAD_LIST = [list_to_set24(l) for l in l_oct] return _OCTAD_LIST[:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set24_to_list(v):\n return [x for x in range(24) if v & (1 << x)]", "def oct_calc(abundance_vect): \n #converts abundances into which bin they belong to. vector operation\n octaves_sps_belong = sc.floor(sc.log2(abundance_vect)).astype(int)\n #how many octaves for this community? how long the o...
[ "0.580885", "0.57278895", "0.55791336", "0.53791034", "0.5371558", "0.534483", "0.5308094", "0.525523", "0.52250695", "0.5138702", "0.51262695", "0.5072813", "0.5064514", "0.5053955", "0.50508845", "0.50403285", "0.50403285", "0.50376254", "0.50304615", "0.5022919", "0.500224...
0.715289
0
Returns an image with reduced opacity
def opacity(im,alpha): if im.mode != 'RGBA': im = im.convert('RGBA') else: im = im.copy() alphachannel = im.split()[3] alphachannel = ImageEnhance.Brightness(alphachannel).enhance(alpha) im.putalpha(alphachannel) return im
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduce_opacity(im, opacity):\n if im.mode != 'RGBA':\n im = im.convert('RGBA')\n else:\n im = im.copy()\n alpha = im.split()[3]\n alpha = ImageEnhance.Brightness(alpha).enhance(opacity)\n im.putalpha(alpha)\n return im", "def reduce_opacity(image, opacity):\n assert 0 <= op...
[ "0.76640165", "0.76032346", "0.756929", "0.74747145", "0.66596013", "0.64815754", "0.6481502", "0.64344823", "0.6390634", "0.638129", "0.63715875", "0.6298922", "0.62890697", "0.62239534", "0.6184103", "0.61627424", "0.6107081", "0.60919225", "0.60874414", "0.60719806", "0.60...
0.74925166
3
convert cost value from str to float
def get_price(str_val): return float(str_val.replace('.', '').replace(',', '.'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_float(self, s: str) -> float:\n return int(s[:-1]) / 1e9 if s.endswith('n') else float(s[:-1])", "def _convert_to_float(s):\n try:\n return float(s)\n except:\n return s", "def __parse_float(str):\n return float(str.strip().replace(',','.'))", "def str2floatTrap(self, so...
[ "0.73366255", "0.71641505", "0.7135648", "0.71250385", "0.7106039", "0.70855206", "0.7064198", "0.69937354", "0.6928555", "0.6888824", "0.68776447", "0.6876995", "0.6854212", "0.68464416", "0.68221563", "0.6813239", "0.68052495", "0.67854923", "0.6769095", "0.67394483", "0.67...
0.73735917
0
Provide a friendly representation
def __repr__(self): return '<Twilio.Preview.TrustedComms.BrandedCallList>'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_representation(self) -> str:\n raise NotImplementedError()", "def __str__(self):\n return self.make_flat()", "def __str__(self):\n return self.format()", "def __str__(self):\n return \"<%s: %s>\" % (self.__class__, self.describe())", "def __str__(self):\n \n ...
[ "0.76010835", "0.7571921", "0.7230172", "0.7216933", "0.7194604", "0.71428955", "0.714158", "0.71369046", "0.7134454", "0.7134454", "0.7131177", "0.7104331", "0.70761895", "0.70686626", "0.70685405", "0.70685405", "0.70685405", "0.70685405", "0.70685405", "0.70311874", "0.701...
0.0
-1
Provide a friendly representation
def __repr__(self): return '<Twilio.Preview.TrustedComms.BrandedCallPage>'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_representation(self) -> str:\n raise NotImplementedError()", "def __str__(self):\n return self.make_flat()", "def __str__(self):\n return self.format()", "def __str__(self):\n return \"<%s: %s>\" % (self.__class__, self.describe())", "def __str__(self):\n \n ...
[ "0.76010835", "0.7571921", "0.7230172", "0.7216933", "0.7194604", "0.71428955", "0.714158", "0.71369046", "0.7134454", "0.7134454", "0.7131177", "0.7104331", "0.70761895", "0.70686626", "0.70685405", "0.70685405", "0.70685405", "0.70685405", "0.70685405", "0.70311874", "0.701...
0.0
-1
Provide a friendly representation
def __repr__(self): return '<Twilio.Preview.TrustedComms.BrandedCallInstance>'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_representation(self) -> str:\n raise NotImplementedError()", "def __str__(self):\n return self.make_flat()", "def __str__(self):\n return self.format()", "def __str__(self):\n return \"<%s: %s>\" % (self.__class__, self.describe())", "def __str__(self):\n \n ...
[ "0.76010835", "0.7571921", "0.7230172", "0.7216933", "0.7194604", "0.71428955", "0.714158", "0.71369046", "0.7134454", "0.7134454", "0.7131177", "0.7104331", "0.70761895", "0.70686626", "0.70685405", "0.70685405", "0.70685405", "0.70685405", "0.70685405", "0.70311874", "0.701...
0.0
-1
Ensures that out of bounds episode indices are handled correctly.
def test_episode_out_of_bounds_indices(self): _, data_directory = self._collect_episode_data( num_episodes=6, max_episodes_per_file=3) with riegeli_backend_reader.RiegeliBackendReader( data_directory) as data_reader: self.assertRaises(IndexError, operator.getitem, data_reader.episodes, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_episode_step_out_of_bounds_indices(self):\n _, backend = _collect_episode_data(num_episodes=6)\n data_reader = in_memory_backend.InMemoryBackendReader(backend)\n for episode in data_reader.episodes:\n self.assertRaises(IndexError, operator.getitem, episode, len(episode))\n self.assertRa...
[ "0.8179856", "0.8104957", "0.789724", "0.74500746", "0.7413553", "0.7304317", "0.72874296", "0.7078592", "0.7069531", "0.67282695", "0.6573131", "0.63908", "0.6234583", "0.6216588", "0.6044556", "0.5975068", "0.595843", "0.59372634", "0.5918472", "0.5860877", "0.58577144", ...
0.7990847
2
Ensures that out of bounds episode step indices are handled correctly.
def test_episode_step_out_of_bounds_indices(self): _, data_directory = self._collect_episode_data( num_episodes=6, max_episodes_per_file=3) with riegeli_backend_reader.RiegeliBackendReader( data_directory) as data_reader: for episode in data_reader.episodes: self.assertRaises(Index...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_episode_step_out_of_bounds_indices(self):\n _, backend = _collect_episode_data(num_episodes=6)\n data_reader = in_memory_backend.InMemoryBackendReader(backend)\n for episode in data_reader.episodes:\n self.assertRaises(IndexError, operator.getitem, episode, len(episode))\n self.assertRa...
[ "0.81165326", "0.8046732", "0.7904854", "0.7506848", "0.7461245", "0.73811585", "0.7316648", "0.7194448", "0.7079886", "0.6769185", "0.6631672", "0.6093321", "0.60225743", "0.58945113", "0.5813518", "0.5804819", "0.5785129", "0.5779925", "0.57425296", "0.56568", "0.56101227",...
0.8043557
2
Return a shared copy of the immutable object `obj`. This saves memory and consistent use allows code to use `is` for equality testing.
def intern(self, obj): try: return self._cache[obj] except KeyError: self._cache[obj] = obj return obj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(obj):\n return loads(dumps(obj))", "def make_mutable(obj):\n _mutable_objs.append(obj)", "def empty_copy(obj):\n class Empty(obj.__class__):\n def __init__(self):\n pass\n newcopy = Empty()\n newcopy.__class__ = obj.__class__\n return newcopy", "def Clone(cls, obj...
[ "0.6367049", "0.6363567", "0.61832225", "0.60510564", "0.6021291", "0.5988998", "0.5963159", "0.583196", "0.57804984", "0.5729588", "0.5724751", "0.5680609", "0.5635878", "0.5604047", "0.5534341", "0.55258495", "0.55149126", "0.55012983", "0.54891634", "0.54859793", "0.545425...
0.65183514
0
Copy a set of terminals, replacing any synthetic terminals with their representations. Returns a new OrderedSet. terminals an iterable of terminals and/or other unique elements like None or ErrorToken.
def expand_set_of_terminals(self, terminals): result = OrderedSet() for t in terminals: if t in self.synthetic_terminals: result |= self.expand_set_of_terminals(self.synthetic_terminals[t]) else: result.add(t) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def terminals(self) -> AbstractSet[Terminal]:\n return self._terminals", "def terminals(g):\n return set(g._lexical_index.keys())", "def get_terminals(self):\r\n return {symbol for _, symbols in self.productions for symbol in symbols if is_terminal(symbol)}", "def terminals(self):\n\n ...
[ "0.6577835", "0.60372806", "0.5774448", "0.5470112", "0.5470112", "0.5395096", "0.538725", "0.5336221", "0.5246311", "0.5230081", "0.5191314", "0.5185407", "0.5144205", "0.5135818", "0.5134978", "0.5093189", "0.5090788", "0.50847745", "0.50658756", "0.50101495", "0.5007748", ...
0.75371575
0
Return a list of this grammar's goal nonterminals.
def goals(self): return [init_nt.name.goal for init_nt in self.init_nts]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nonterminal(self):\n return self._nonterm", "def nonterminals(g):\n return g._categories.copy()", "def nt_grammar(self):\n return [self._productions[n] for n in self._nt_grammar]", "def get_nonterminals(self):\n for node in self.hosttree.traverse():\n if not node.is_lea...
[ "0.70904297", "0.6998696", "0.6979676", "0.69782996", "0.6916879", "0.67994285", "0.6498573", "0.64729226", "0.614236", "0.5979094", "0.580174", "0.57190055", "0.570537", "0.570537", "0.5658784", "0.5599579", "0.5579691", "0.5539667", "0.5539667", "0.5539667", "0.5539667", ...
0.62957907
8
Create a list of Model field instances from the passed in 'attrs', plus any similar fields on the base classes (in 'bases').
def get_declared_fields(bases, attrs): fields = [(field_name, attrs.pop(field_name)) \ for field_name, obj in attrs.items() \ if isinstance(obj, Field)] fields.sort(key=lambda x: x[1].creation_counter) for base in bases[::-1]: if hasattr(base, 'declared_fields'): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_fields(bases):\n fields = {}\n for base in bases[::-1]:\n if issubclass(base, Model):\n fields.update({\n key: copy.deepcopy(value)\n for key, value in six.iteritems(base._fields)\n })\n return fields", "def iterate_over_fields(cls):\n ...
[ "0.68990874", "0.68148756", "0.6291189", "0.6046088", "0.60043335", "0.596178", "0.58912456", "0.58624434", "0.5719149", "0.5643859", "0.56113076", "0.55661213", "0.55244553", "0.55093896", "0.54822314", "0.547377", "0.54632", "0.5449892", "0.54300565", "0.5419397", "0.541801...
0.7128529
0
Equality operator. Two tokens are equal if they are of the same type and have equal data. Positions are insignificant.
def __eq__(self, other): if (type(self) != type(other) or not isinstance(self, other.__class__)): return False if (isinstance(self, TokKeyword) and isinstance(other, TokKeyword)): return self._data.lower() == other._data.lower() return self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n if isinstance(other, Token):\n return self.text == other.text\n else:\n return self.text == other", "def __eq__(self, other):\r\n\r\n return type(self) == type(other) and self.ttype == other.ttype", "def __eq__(self,other):\n if type...
[ "0.7859566", "0.67986566", "0.67051136", "0.644475", "0.6277002", "0.6254858", "0.6248071", "0.6244377", "0.6217144", "0.62160605", "0.61976457", "0.6195654", "0.6109747", "0.61054003", "0.60953057", "0.60934824", "0.6083003", "0.60579884", "0.6032284", "0.60194623", "0.60049...
0.7008547
1
Resovle the path of the target module.
def get_target_module_path(request: 'pytest.FixtureRequest' ) -> pathlib.Path: return pathlib.Path(inspect.getfile(request.module))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _path(self):\n if self.target[-1] != \"/\":\n self.target += \"/\"\n\n if \"/\" in self.source:\n self.path = self.target + self.source.split(\"/\")[-1]\n else:\n raise NotImplementedError(\"This software is not done for Windows\")\n if self.method =...
[ "0.649938", "0.62409925", "0.6224248", "0.6140783", "0.59904563", "0.597231", "0.5884701", "0.5780793", "0.5780308", "0.57213706", "0.57063025", "0.567", "0.5660322", "0.56505847", "0.56477755", "0.562947", "0.55871856", "0.5556888", "0.5550489", "0.55157584", "0.5501609", ...
0.60367954
4
Sends a 401 response that enables basic auth
def authenticate(): return Response( 'Could not verify your access level for that URL.\n' 'You have to login with proper credentials', 401, {'WWW-Authenticate': 'Basic realm="Login Required"'})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})", "def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )", "def authenticate():\n return Response(\n 'You have to login with pro...
[ "0.8093736", "0.80926424", "0.7958403", "0.7852648", "0.7843114", "0.7824419", "0.776624", "0.7754693", "0.774767", "0.774767", "0.774767", "0.774767", "0.774767", "0.774767", "0.774767", "0.774767", "0.771945", "0.7667712", "0.7664151", "0.76493174", "0.76140213", "0.76131...
0.7810746
16
Get age of guitar.
def get_age(self): return Guitar.CURRENT_YEAR - self.year
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_age(self):\n\t\treturn self.age", "def get_age(self):\n return self.glb[iage]", "def get_age(self):\r\n return self.age", "def get_age(self) -> int:\n return self.age", "def get_age(self):\n age = CURRENT_YEAR - self.year\n return age", "def get_age(self):\n ...
[ "0.77584475", "0.76878345", "0.76566404", "0.7651083", "0.757051", "0.75521964", "0.7512939", "0.7494675", "0.74860406", "0.74860406", "0.74860406", "0.7481775", "0.7481775", "0.7465721", "0.7459379", "0.7441809", "0.7420463", "0.74136597", "0.73773193", "0.72822326", "0.7194...
0.84469885
0
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(Reset, self).__init__(*args, **kwds)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ...
[ "0.7794795", "0.77207875", "0.77207875", "0.7687243", "0.7625947", "0.7564293", "0.7440383", "0.74175525", "0.7352349", "0.7308313", "0.72808266", "0.72378874", "0.722805", "0.7225032", "0.7225032", "0.7219433", "0.72120637", "0.72120637", "0.72120637", "0.72120637", "0.72120...
0.0
-1
Derive x values function
def x_step_size(self,S): h_n = self.Derive_hn(self,S) doubleh_n = 2*h_n Difference= max(S)-min(S) x_hn =Difference*doubleh_n return x_hn
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def df(self, x):\n\n return 2*math.exp(x*2) - math.exp(x)", "def dmy_fn(x):\n return 0.4*(2.0*(np.exp(x*4) + np.exp(-x*4)) - 8 + 0.6*x - 6*x**2)", "def fn(self, x):\n\n return math.exp(x*2) - math.exp(x) - 2", "def fn(self, x):\n\n return math.exp(x*2) - math.exp(x) - 2", "def fn(x):\...
[ "0.70801735", "0.7011516", "0.68875396", "0.68875396", "0.68838364", "0.68730736", "0.683909", "0.68379045", "0.67888933", "0.67033297", "0.66653", "0.6662213", "0.6623562", "0.6609126", "0.6586452", "0.65683365", "0.6541663", "0.65246737", "0.65231144", "0.6490547", "0.64888...
0.0
-1
True if total value hasn't reduced to half of it's initial value
def status(self): return self.value > self.initial_value/2 \ and self.bag > 0 \ and self.balance > 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_valid_sum(self):\n return 1 - MassFunction.precision <= self._sum() <= 1 + MassFunction.precision", "def close_to_exceeding(self) -> bool:\n mean = self.current / self.num_cuts\n if self.max_frames is not None:\n return self.current + mean > self.max_frames\n if sel...
[ "0.6490609", "0.62172425", "0.620301", "0.6169678", "0.61083126", "0.6055857", "0.597202", "0.5936011", "0.59354347", "0.59303397", "0.59198", "0.5902563", "0.5898965", "0.58889717", "0.58867884", "0.5883473", "0.58817977", "0.58548135", "0.5854774", "0.5841794", "0.57977", ...
0.57435805
29
Test create_app without passing test config.
def test_config(): assert not create_app().testing assert create_app(TestConfig).testing
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_app():\n assert not create_app().testing\n assert create_app({'TESTING': True}).testing", "def test_config():\n assert not sample.create_app().testing\n assert sample.create_app({\"TESTING\": True}).testing", "def test_app_is_created(app):\n assert app.name == \"myapp.app\"", "...
[ "0.88498396", "0.8132289", "0.803595", "0.8010812", "0.76881677", "0.76236284", "0.7604287", "0.7598619", "0.7561507", "0.75018466", "0.73570627", "0.73001164", "0.7252014", "0.7214372", "0.7185277", "0.7180016", "0.71766704", "0.71629363", "0.71615326", "0.71521", "0.7067521...
0.8124712
2
Plot xy markers on top of an image
def plotXY(data, x, y): fig, ax = plt.subplots() m, s = np.mean(data), np.std(data) im = ax.imshow(data, interpolation='nearest', cmap='gray', vmin=m-s, vmax=m+s, origin='lower') for (i, j) in zip(x, y): c = Circle(xy=(i, j), radius=3) c.set_facecolor('none') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_points_on_img(mask,img):\n labeled, num_objects = ndi.label(mask)\n slices = ndi.find_objects(labeled)\n x, y = [], []\n for dy,dx in slices:\n x_center = (dx.start + dx.stop - 1)/2\n x.append(x_center)\n y_center = (dy.start + dy.stop - 1)/2 \n y.append(y_center...
[ "0.7367216", "0.6564814", "0.6552935", "0.6552935", "0.6552935", "0.6446037", "0.64084023", "0.639093", "0.6362926", "0.6361293", "0.6301431", "0.6276385", "0.6254015", "0.62160033", "0.61774313", "0.61362684", "0.61331135", "0.6132962", "0.6124804", "0.6124804", "0.6124804",...
0.62323534
13
Convert a potency measurement in uM concentrations to kJ/mol.
def convert_uM_to_kJ_per_mole(amount_in_uM: float, experiment_temp: float = 298.15) -> float: return convert_uIC50_to_kJ_per_mole(amount_in_uM, experiment_temp=experiment_temp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_uIC50_to_kJ_per_mole(amount_in_uM: float, experiment_temp: float = 298.15) -> float:\n RT = (constants.BOLTZ * experiment_temp) / constants.KCAL_TO_KJ\n return RT * np.log(amount_in_uM * 1e-6) * constants.KCAL_TO_KJ", "def convert_kcalmol_kJmol(en_kcalmol):\n return en_kcalmol/kJmol_kcalmol"...
[ "0.74102455", "0.7336353", "0.7192637", "0.6819751", "0.6566183", "0.6511339", "0.6462904", "0.6425449", "0.63601977", "0.6264186", "0.62423927", "0.61782956", "0.61082286", "0.60305715", "0.6015179", "0.598935", "0.59827167", "0.5963901", "0.594696", "0.588416", "0.586443", ...
0.7531909
0
Return the metrics provider resource definition which matches the type and namespace parameters given.
def get_metrics_provider(self, metric): return self._metric_to_metrics_provider[metric]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_metrics(self, mp_type, namespace, unreachable=False):\n kind = ResourceKind.METRIC if namespace else ResourceKind.GLOBALMETRIC\n metrics_info = (\n self._METRICS_PROVIDER_INFO.get(mp_type, {})\n .get(namespace, {})\n .get(\"metrics\", [])\n )\n\n ...
[ "0.5802154", "0.56266034", "0.5582836", "0.5424354", "0.5306914", "0.5278947", "0.5267723", "0.526258", "0.5235236", "0.5225103", "0.522158", "0.522158", "0.51955396", "0.5146596", "0.5146596", "0.51301616", "0.51301616", "0.51198137", "0.5101473", "0.5085228", "0.50658745", ...
0.48957986
39