query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Get the height of the board.
def get_grid_height(self): return self.grid_height
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def height(self):\n return self.board.shape[0]", "def getHeight(self):\n return self.height", "def getHeight(self):\n return self.height", "def getHeight(self):\n return self._height", "def get_grid_height(self):\n return self._height", "def get_grid_height(self):\n ...
[ "0.8506178", "0.7828281", "0.7828281", "0.7792005", "0.7788401", "0.7788401", "0.77683884", "0.77683884", "0.77683884", "0.77683884", "0.77662206", "0.7763028", "0.776071", "0.77545404", "0.7742475", "0.77377915", "0.7721646", "0.769687", "0.76945823", "0.76945823", "0.769458...
0.7678935
22
Apply the QR decomposition to this matrix. Decompose this matrix into the product of an orthogonal and upper triangular matrix, returning the result as a tuple.
def qr_decomposition(self): if self.m != self.n: raise NotImplementedError('QR decomposition not yet available ' + 'for non-square matrices') orig_basis = [vec.Vector.fromMatrixColumn(self, j) for j in range(self.m)] orthog_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def QR(self):\n m, n = self.shape\n assert m >= n, \"Requires m>=n\"\n R = self.copy()\n Q = eye(m)\n\n for j in range(n):\n reflect_me = R[j:, j].copy()\n v, beta = reflect_me._house()\n H = eye(m)\n # A[j:, j:] = (I - beta*v*v.T)*A[j:...
[ "0.6598388", "0.59672034", "0.5609881", "0.55924284", "0.55765384", "0.5519256", "0.5508025", "0.5469608", "0.53900325", "0.529357", "0.529137", "0.5268985", "0.5247279", "0.52351326", "0.5216549", "0.520348", "0.5151719", "0.51425827", "0.5136921", "0.51350784", "0.5107533",...
0.7268903
0
Make a zero matrix of dimension m by n.
def makeZero(m, n): Matrix.validate_dimensions(m, n) data = [[False for j in range(n)] for i in range(m)] return BooleanMatrix(m, n, data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeZero(m, n):\n Matrix.validate_dimensions(m, n)\n data = [[0 for j in range(n)] for i in range(m)]\n return IntegerMatrix(m, n, data)", "def makeZero(m, n):\n Matrix.validate_dimensions(m, n)\n data = [[0. for j in range(n)] for i in range(m)]\n return RealMatrix(...
[ "0.87931824", "0.8702598", "0.84187156", "0.7984786", "0.7688622", "0.76761514", "0.7661081", "0.75629056", "0.75604486", "0.7559634", "0.7559634", "0.75470996", "0.75038904", "0.7459018", "0.74510133", "0.74015135", "0.73990643", "0.7032862", "0.70207566", "0.6995373", "0.69...
0.8344323
3
Evaluate whether two matrices are equal.
def all_equal(self, mtrx): if not isinstance(mtrx, Matrix): return False if not (self.m == mtrx.m and self.n == mtrx.n): return False if not type(self) == type(mtrx): return False for i in range(self.m): for j in range(self.n): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsEqual(*args, **kwargs):\n return _gdi_.GraphicsMatrix_IsEqual(*args, **kwargs)", "def _are_matrix_elements_equal(element, another_element):\n difference = sympy.N(sympy.expand(element) - sympy.expand(another_element))\n\n try:\n return np.allclose(\n float(sympy.re(difference...
[ "0.7654237", "0.7424824", "0.7361686", "0.7267436", "0.7243499", "0.71851456", "0.70666075", "0.7042347", "0.69299006", "0.69259715", "0.6917949", "0.6879514", "0.6844594", "0.68434376", "0.6814464", "0.68106973", "0.67989856", "0.67912227", "0.67904043", "0.67669725", "0.674...
0.69412047
8
Return the rowechelon form of this matrix.
def row_echelon(self): # TODO: This can be refactored for better efficiency if all([all([self[i, j] == 0 for j in range(self.n)]) for i in range(self.m)]): return Matrix.makeZero(self.m, self.n) res = deepcopy(self) i, j = 0, 0 while i < res.m and j < ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_row_echelon(self):\n return self._to_row_echelon(fully_reduce = False)", "def to_reduced_row_echelon(self):\n return self._to_row_echelon(fully_reduce = True)", "def row_echelon(self):\n # TODO: This can be refactored for better efficiency\n if all([all([self[i, j] == 0 for j...
[ "0.7492918", "0.7205681", "0.706652", "0.6943512", "0.68897986", "0.6721193", "0.65792674", "0.65778875", "0.6522429", "0.6475901", "0.64072955", "0.63148206", "0.62639713", "0.6164853", "0.614288", "0.614288", "0.614288", "0.614288", "0.614288", "0.614288", "0.614288", "0....
0.69685125
3
Make a zero matrix of dimension m by n.
def makeZero(m, n): Matrix.validate_dimensions(m, n) data = [[0 for j in range(n)] for i in range(m)] return IntegerMatrix(m, n, data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeZero(m, n):\n Matrix.validate_dimensions(m, n)\n data = [[0. for j in range(n)] for i in range(m)]\n return RealMatrix(m, n, data)", "def zeros(m, n):\n data = dict.fromkeys(itertools.product(range(m), range(n)), mpfr(0))\n return MPMatrix((m, n), data)", "def makeZero(m, n):...
[ "0.8702598", "0.84187156", "0.8344323", "0.7984786", "0.7688622", "0.76761514", "0.7661081", "0.75629056", "0.75604486", "0.7559634", "0.7559634", "0.75470996", "0.75038904", "0.7459018", "0.74510133", "0.74015135", "0.73990643", "0.7032862", "0.70207566", "0.6995373", "0.691...
0.87931824
0
Evaluate whether two matrices have all entries approximately equal. Check whether corresponding elements of two matrices are within a specified tolerance of one another.
def all_near(self, mtrx, tol=10e-8): if not isinstance(mtrx, Matrix): return False if not (self.m == mtrx.m and self.n == mtrx.n): return False for i in range(self.m): for j in range(self.n): if abs(self[i, j] - mtrx[i, j]) > tol: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_matrix_equality(A,B, tol=None):\n if len(A) != len(B) or len(A[0]) != len(B[0]):\n return False\n\n for i in range(len(A)):\n for j in range(len(A[0])):\n if tol == None:\n if abs(A[i][j] - B[i][j]) > 1e-10:\n return False\n else...
[ "0.75488275", "0.75458705", "0.74511164", "0.73459107", "0.71057653", "0.7063985", "0.70569223", "0.7011674", "0.7008502", "0.69944376", "0.69833493", "0.69792765", "0.6922949", "0.69128424", "0.6900966", "0.68942165", "0.68737435", "0.68594986", "0.6855178", "0.68403876", "0...
0.6365252
49
Return the rowechelon form of this matrix.
def row_echelon(self): # TODO: This can be refactored for better efficiency if all([all([self[i, j] == 0 for j in range(self.n)]) for i in range(self.m)]): return Matrix.makeZero(self.m, self.n) res = deepcopy(self) i, j = 0, 0 while i < res.m and j < ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_row_echelon(self):\n return self._to_row_echelon(fully_reduce = False)", "def to_reduced_row_echelon(self):\n return self._to_row_echelon(fully_reduce = True)", "def row_echelon(self):\n # TODO: This can be refactored for better efficiency\n if all([all([self[i, j] == 0 for j...
[ "0.7492918", "0.7205681", "0.69685125", "0.6943512", "0.68897986", "0.6721193", "0.65792674", "0.65778875", "0.6522429", "0.6475901", "0.64072955", "0.63148206", "0.62639713", "0.6164853", "0.614288", "0.614288", "0.614288", "0.614288", "0.614288", "0.614288", "0.614288", "...
0.706652
2
Make a zero matrix of dimension m by n.
def makeZero(m, n): Matrix.validate_dimensions(m, n) data = [[0. for j in range(n)] for i in range(m)] return RealMatrix(m, n, data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeZero(m, n):\n Matrix.validate_dimensions(m, n)\n data = [[0 for j in range(n)] for i in range(m)]\n return IntegerMatrix(m, n, data)", "def zeros(m, n):\n data = dict.fromkeys(itertools.product(range(m), range(n)), mpfr(0))\n return MPMatrix((m, n), data)", "def makeZero(m, n...
[ "0.8792867", "0.841994", "0.8343372", "0.7982616", "0.76915884", "0.7676163", "0.76599306", "0.7562079", "0.7558743", "0.7558743", "0.7557831", "0.75453925", "0.7501125", "0.74591345", "0.74484515", "0.74032515", "0.73965424", "0.7029756", "0.70214945", "0.69921505", "0.69145...
0.8702078
1
Returns a partnership's married date, or if that's unknown, 0.
def married_date_or_min_year(partnership): year = fuzzy_date_year(partnership.married_date) if year: return year return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paid(self):\n try:\n start_date = self.member_membership.start_date\n except AttributeError:\n # not available\n start_date = None\n try:\n paid_date = self.member_membership.membership_paid\n except AttributeError:\n # not avai...
[ "0.5553924", "0.54773486", "0.5348029", "0.53429747", "0.52663684", "0.5184913", "0.5136976", "0.5133511", "0.50035965", "0.49861515", "0.49825463", "0.49593318", "0.49374533", "0.49257797", "0.49196377", "0.4900989", "0.48931015", "0.4887172", "0.48670453", "0.48432726", "0....
0.7873832
0
The number of Record Set in the Hosted Zone.
def resource_record_set_count(self) -> int: return pulumi.get(self, "resource_record_set_count")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def host_count(self) -> list:\n return self.__host_count", "def get_num_records(self):\n return self.__num_records", "def get_num_servers():\n return 1", "def GetCount(self):\n return self._server.get_count()", "def size(self):\n return len(self.records)", "def valid_re...
[ "0.67740184", "0.66367716", "0.63688356", "0.63507205", "0.6305662", "0.6289728", "0.6289531", "0.62798434", "0.626668", "0.62558305", "0.6211027", "0.6208782", "0.6194545", "0.61868024", "0.61858153", "0.6164547", "0.6160839", "0.61591697", "0.61557496", "0.612175", "0.61214...
0.72843736
0
Test the get_album_tracks_lastfm function.
def test_album_tracks_lastfm(monkeypatch, bot): song = Song('Sabaton', '1 6 4 8') with monkeypatch.context() as mkp: # An empty list should be returned if we can't find the album's name mkp.setattr(song, 'fetch_album_name', lambda: None) assert bot.get_album_tracks_lastfm(song) == [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_album_tracks_lastfm_notfound(bot, monkeypatch):\n\n def get_lastfm(*args, **kwargs):\n return []\n\n song = Song('Horrendous', 'The Idolater', album='Idol')\n monkeypatch.setattr(bot, 'get_lastfm', get_lastfm)\n assert bot.get_album_tracks_lastfm(song) == []", "def test_get_gm_track_a...
[ "0.7396314", "0.73466265", "0.7263434", "0.7177026", "0.7151662", "0.7119123", "0.7052538", "0.6996615", "0.6951498", "0.6951156", "0.6921699", "0.68897605", "0.68730336", "0.68409187", "0.6780899", "0.67523515", "0.67197675", "0.6712656", "0.6706053", "0.66966254", "0.665186...
0.86596155
0
Test get_album_tracks_lastfm when the album isn't found in the lastfm database.
def test_album_tracks_lastfm_notfound(bot, monkeypatch): def get_lastfm(*args, **kwargs): return [] song = Song('Horrendous', 'The Idolater', album='Idol') monkeypatch.setattr(bot, 'get_lastfm', get_lastfm) assert bot.get_album_tracks_lastfm(song) == []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_album_tracks_lastfm(monkeypatch, bot):\n song = Song('Sabaton', '1 6 4 8')\n with monkeypatch.context() as mkp:\n # An empty list should be returned if we can't find the album's name\n mkp.setattr(song, 'fetch_album_name', lambda: None)\n assert bot.get_album_tracks_lastfm(song)...
[ "0.78057355", "0.7289795", "0.7252033", "0.7206001", "0.7122318", "0.70326763", "0.69643843", "0.69070643", "0.6903369", "0.6797229", "0.6772743", "0.6771438", "0.6686256", "0.6536612", "0.6468081", "0.64060736", "0.63993305", "0.6380914", "0.63439864", "0.62933856", "0.62925...
0.7764682
1
Check that bot.get_album_tracks() searches spotify first, and uses lastfm as a fallback.
def test_album_tracks(bot, monkeypatch): song = Song('wintersun', 'beyond the dark sun') monkeypatch.setattr(bot.SP, 'get_album_tracks', lambda x: []) monkeypatch.setattr(bot, 'get_album_tracks_lastfm', lambda x: ['lastfm']) assert bot.get_album_tracks(song)[0] == 'lastfm' monkeypatch.setattr(bot.S...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_next_song_no_album(monkeypatch, tracks, expect, bot):\n bot.log_result('chat_id', fake_log)\n monkeypatch.setattr(bot, 'get_album_tracks', lambda x: tracks)\n assert bot._get_next_song('chat_id') == expect", "def test_album_tracks_lastfm(monkeypatch, bot):\n song = Song('Sabaton', '1 6 4 8')...
[ "0.69324005", "0.68899894", "0.68229485", "0.6523489", "0.6467842", "0.64141905", "0.6302769", "0.61466485", "0.61390424", "0.6083401", "0.6080001", "0.6060152", "0.60554", "0.60321796", "0.5958487", "0.5917817", "0.5879173", "0.5825782", "0.575608", "0.5729728", "0.57274854"...
0.5874927
17
Return whether we are performing a dryrun execution. This setting is configured in each deployment by the absence or the value of the environment variable. By default, the variable is undefined. As a consequence, execution is NOT a dryrun. If the variable is defined in the deployment with an appropriate value, then we ...
def is_dry_run(self): try: v = environment.get("Run") return v.lower() == "dry" except KeyError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_dry_run(self):\n # Set this value to true if you want the entire operation to run, but not the ingestion.\n return os.environ.get('SNYK_DRY_RUN', 'false').lower() in ('1', 'yes', 'true')", "def is_dry_run():\n return 'DRY_RUN' in os.environ and os.environ['DRY_RUN']=='true'", "def dry_r...
[ "0.74135894", "0.73501337", "0.6974234", "0.6974234", "0.6864886", "0.60608554", "0.57374626", "0.57011545", "0.56689006", "0.56577766", "0.5643628", "0.5622917", "0.5621072", "0.56009734", "0.5477784", "0.5472303", "0.5439003", "0.5410364", "0.539929", "0.5372091", "0.537209...
0.7173085
2
Return whether we are performing a forcedrun execution. This setting is configured in each deployment by the absence or the value of the environment variable. By default, the variable is undefined. As a consequence, execution is NOT a forcedrun. If the variable is defined in the deployment with an appropriate value, th...
def is_forced_run(self): try: v = environment.get("Run") return v.lower() == "force" except KeyError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_dry_run():\n return 'DRY_RUN' in os.environ and os.environ['DRY_RUN']=='true'", "def force_run_ingestion(self):\n # Set this value when you want to run the ingestion forcefully (ignores runtime).\n return os.environ.get('SNYK_INGESTION_FORCE_RUN', 'false').lower() in ('1', 'yes', 'true')"...
[ "0.6732974", "0.6503736", "0.6381244", "0.61980015", "0.6027737", "0.5841637", "0.5828859", "0.5728668", "0.568781", "0.5658217", "0.5606263", "0.5547213", "0.5488605", "0.54747444", "0.5451495", "0.5408955", "0.5407869", "0.54043424", "0.53674996", "0.53574234", "0.5347121",...
0.6823267
0
Returns a string with dotted separation.
def left_justify_string(keyword, value): return '%s' % keyword .ljust(40, ".") + ": " + '%s\n' % value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dotted(self) -> str:\n return \".\".join(str(v) for v in self.value)", "def _dotted_path(segments):\n segments_without_separators = [s[:-1] for s in segments[:-1]]\n segments_without_separators.append(segments[-1])\n return '.'.join(segments_without_separators)", "def dotted_name(s):\n f...
[ "0.8448821", "0.7494335", "0.6877866", "0.68753177", "0.6539231", "0.6532928", "0.6390884", "0.6390884", "0.63796955", "0.6310665", "0.61789465", "0.6130913", "0.60956347", "0.6079059", "0.60684717", "0.6067269", "0.60586035", "0.6043727", "0.60025734", "0.5997822", "0.594185...
0.0
-1
Returns the URL of the job_id.
def explore_href(self, job_id): ## class QueuePage() jdict = mysql.job_get_dict(job_id) if self.admin: page = "admin" else: page = "explore" if self.admin: if jdict["tls_model"] == "ANISO": l = ['<a href="webtlsmd.cgi?page=%s&...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job_url_for(job):\n return '/api/v1/projects/{project}/jobs/{job}'.format(\n project=job.project.slug,\n job=job.slug,\n )", "def GetJobURL(cls, tag):\n return cls.SHOW_JOB_URL + '?tag=' + tag", "def job_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"job_id\")", ...
[ "0.813512", "0.7856912", "0.7490581", "0.7412089", "0.73379445", "0.73087525", "0.7140273", "0.71194243", "0.70236176", "0.6994907", "0.68577015", "0.6852151", "0.6846951", "0.6781149", "0.6752206", "0.67466646", "0.67466646", "0.671139", "0.66917133", "0.66417134", "0.655078...
0.59526885
96
Constructs an HTML table of currently queued TLSMD jobs.
def html_queued_job_table(self, job_list): ## class QueuePage() queued_list = [] for jdict in job_list: if jdict.get("state") == "queued": ## Populate queued list for XHTML table below queued_list.append(jdict) l = ['<center>', '<...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_running_job_table(self, job_list):\n ## class QueuePage()\n ## get an array of \"running\" jobs from the job dictionary\n run_jdict = []\n for jdict in job_list:\n if jdict[\"state\"] == \"running\":\n if self.pid_exists(jdict[\"job_id\"]) == False:\n ...
[ "0.7865275", "0.77305275", "0.73756", "0.67556727", "0.6353226", "0.62651986", "0.61604804", "0.60441345", "0.60264397", "0.6026279", "0.60135585", "0.59753984", "0.59500635", "0.59109086", "0.583598", "0.582497", "0.58104855", "0.5794076", "0.5787355", "0.5772024", "0.570150...
0.7951832
0
Set the size of the text widget font from font_size
def set_font_size(*args): size = font_size.get() message_inp.configure(font=f'TKDefault {size}')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def font_size(self, font_size):\n\n self._font_size = font_size", "def set_font_size(window, size):\n\n font = window.GetFont()\n\n clone = clone_font(font)\n clone.SetPointSize(size)\n\n window.SetFont(clone)\n\n sizer = window.GetSizer()\n if sizer is not None:\n sizer.Layout()\...
[ "0.825011", "0.79229647", "0.78743696", "0.7262421", "0.72342724", "0.7176061", "0.7148596", "0.7000839", "0.68073326", "0.67930865", "0.6782111", "0.6718226", "0.6685616", "0.6653118", "0.66332054", "0.6600073", "0.6575207", "0.6569996", "0.65508795", "0.65224886", "0.650452...
0.83728653
0
Compare two models (without calendar_id).
def check_model(expected_model, actual_model): assert (expected_model == actual_model), \ "Not Compare model: Expected model:\n {0}\nActual model:\n {1}".format(expected_model, actual_model)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_model_equality(self):\n class EqualityModel0(Model):\n pk = columns.Integer(primary_key=True)\n\n class EqualityModel1(Model):\n kk = columns.Integer(primary_key=True)\n\n m0 = EqualityModel0(pk=0)\n m1 = EqualityModel1(kk=1)\n\n self.assertEqual(m0...
[ "0.65581316", "0.65308255", "0.64758575", "0.64206296", "0.63559824", "0.6352946", "0.6314105", "0.62374216", "0.6232379", "0.6227823", "0.6123889", "0.6097611", "0.6077545", "0.60712284", "0.6071043", "0.6067083", "0.6057245", "0.6047295", "0.60448635", "0.6030416", "0.60170...
0.0
-1
Removes all the form_fields from the given form.
def clear_form(form_id): db.execute('update form_field set parent_form_field = null' ' where form_id = %s', form_id) # remove foreign keys db.execute('delete from form_field where form_id = %s', form_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_all_fields(self):\n self.fields = None", "def remove_ei_form(self, form):\n if form in self.ei_forms:\n self.ei_forms.remove(form)", "def whitelist_form_fields(form, whitlisted_fields):\n for schema in getAdditionalSchemata(form):\n behavior_interface_name = schema...
[ "0.7328138", "0.67329144", "0.66833776", "0.6117829", "0.6116454", "0.60049677", "0.59082365", "0.58605945", "0.58189774", "0.58025384", "0.57722956", "0.5757917", "0.5715277", "0.56766737", "0.5645078", "0.56342024", "0.56286347", "0.55984867", "0.55777204", "0.55396205", "0...
0.6876661
1
Applies the self transformation to the given 3d points.
def transform_points(self, points3d: np.ndarray) -> np.ndarray: assert self._r is not None assert self._t is not None assert isinstance(points3d, np.ndarray) if points3d.shape[1] == 6: # expunge RGB points3d = points3d[:, 0:3] points3d = points3d.transpose() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_transformation(self, points):\n assert (points.shape[0] == 3)\n n = points.shape[1]\n points_ = np.vstack((points, np.ones((1, n))))\n points_trans_ = np.matmul(self.pose_mat, points_)\n points_transformed = np.true_divide(points_trans_[:3, :], points_trans_[[-1], :])\n...
[ "0.7689879", "0.713288", "0.65990794", "0.6596445", "0.6500493", "0.63610286", "0.62373906", "0.6226523", "0.61161786", "0.6109853", "0.6094431", "0.60563225", "0.60294026", "0.59537977", "0.5943204", "0.593381", "0.5931117", "0.5930907", "0.59023726", "0.5888869", "0.5887731...
0.6908382
2
Computes the precision for the specified values of k
def accuracy(self, output, target, topk=(1,)): with torch.no_grad(): maxk = max(topk) batch_size = target.size(0) _, pred = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(target.view(1, -1).expand_as(pred)) res = [] for k in topk: correct_k = c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(gt, pred, k):\n k = min(len(pred), k)\n den = min(len(gt), k)\n return sum([int(pred[i] in gt) for i in range(k)]) / den", "def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\...
[ "0.7643041", "0.7418986", "0.7418119", "0.7270918", "0.7245867", "0.7244652", "0.72375184", "0.72214437", "0.7210162", "0.7058879", "0.6851859", "0.6786372", "0.6783499", "0.67681795", "0.6727462", "0.67179555", "0.67179555", "0.67179555", "0.67179555", "0.67179555", "0.67179...
0.0
-1
Returns tuple of (prefixer, cigar) from concatenated bytes or bytearray of data couple made up of qb64 or qb64b versions of pre+sig couple is used for receipts signed by nontransferable prefix keys
def decouple(data, deletive=False): if isinstance(data, bytearray): if not deletive: data = bytearray(data) # make copy so does not delete underlying data elif isinstance(data, memoryview): data = bytearray(data) elif hasattr(data, "encode"): data = bytearray(data.encode...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receiptize(serder, cigars):\n msg = bytearray(serder.raw) # make copy into new bytearray so can be deleted\n count = len(cigars)\n counter = Counter(code=CtrDex.NonTransReceiptCouples, count=count)\n msg.extend(counter.qb64b)\n for cigar in cigars:\n if cigar.verfer.code not in NonTransD...
[ "0.62424934", "0.5542669", "0.5443137", "0.54294467", "0.5411475", "0.53460675", "0.5343651", "0.53348476", "0.5233715", "0.52283907", "0.51789343", "0.51617414", "0.5113917", "0.5101181", "0.5099668", "0.50989664", "0.50751287", "0.5015005", "0.49649993", "0.49335024", "0.48...
0.5643064
1
Returns tuple of (diger, prefixer, cigar) from concatenated bytes of data triple made up of qb64 or qb64b versions of dig+pre+sig triple is used for escrows of unverified receipts signed by nontransferable prefix keys
def detriple(data, deletive=False): if isinstance(data, bytearray): if not deletive: data = bytearray(data) # make copy so does not delete underlying data elif isinstance(data, memoryview): data = bytearray(data) elif hasattr(data, "encode"): data = bytearray(data.encode...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receiptize(serder, cigars):\n msg = bytearray(serder.raw) # make copy into new bytearray so can be deleted\n count = len(cigars)\n counter = Counter(code=CtrDex.NonTransReceiptCouples, count=count)\n msg.extend(counter.qb64b)\n for cigar in cigars:\n if cigar.verfer.code not in NonTransD...
[ "0.59490556", "0.57163787", "0.568874", "0.5567074", "0.53856164", "0.53617924", "0.5346915", "0.5208561", "0.5160905", "0.51214534", "0.5071078", "0.5058566", "0.50510925", "0.50303745", "0.49964765", "0.4958071", "0.49414235", "0.48948917", "0.48762637", "0.48682418", "0.48...
0.5746446
1
Returns generator to process all messages from incoming message stream, ims until ims is exhausted (empty) then returns. If ims not provided then process messages from .ims Must be framed.
def allProcessor(self, ims=None, framed=None, pipeline=None, cloned=None): if ims is not None: # needs bytearray not bytes since deletes as processes if not isinstance(ims, bytearray): ims = bytearray(ims) # so make bytearray copy else: ims = self.ims # use ins...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processor(self, ims=None, framed=None, pipeline=None, cloned=None):\n if ims is not None: # needs bytearray not bytes since deletes as processes\n if not isinstance(ims, bytearray):\n ims = bytearray(ims) # so make bytearray copy\n else:\n ims = self.ims # ...
[ "0.7280267", "0.7102326", "0.69537127", "0.6921355", "0.683104", "0.64212596", "0.64173454", "0.62354684", "0.6234267", "0.6111383", "0.60373795", "0.60231596", "0.59423566", "0.59377104", "0.5879577", "0.5869029", "0.58453465", "0.57887495", "0.57767475", "0.57554877", "0.57...
0.72718674
1
Returns generator to continually process messages from incoming message stream, ims. Yields waits whenever ims empty. If ims not provided then process messages from .ims
def processor(self, ims=None, framed=None, pipeline=None, cloned=None): if ims is not None: # needs bytearray not bytes since deletes as processes if not isinstance(ims, bytearray): ims = bytearray(ims) # so make bytearray copy else: ims = self.ims # use instan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allProcessor(self, ims=None, framed=None, pipeline=None, cloned=None):\n if ims is not None: # needs bytearray not bytes since deletes as processes\n if not isinstance(ims, bytearray):\n ims = bytearray(ims) # so make bytearray copy\n else:\n ims = self.ims ...
[ "0.700756", "0.6966016", "0.6814322", "0.6708461", "0.6693279", "0.6355115", "0.6293897", "0.62454695", "0.62085795", "0.61390156", "0.6100407", "0.6096833", "0.6082772", "0.59236246", "0.5892272", "0.5852037", "0.5847334", "0.57978374", "0.5775372", "0.5743881", "0.5727557",...
0.71261346
0
Test case for brains_get
def test_brains_get(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_boat(self):\n pass", "def test_get_ban(self):\n pass", "def test_braces_disabled():\n assert get_html(BRACES_TEXT) == \"<p>I am a {{braces}} example.</p>\"", "def test_braces_enabled():\n assert (\n get_html(BRACES_TEXT, enable_braces=True)\n == \"<p>I am a <kbd...
[ "0.6350414", "0.63265574", "0.59365386", "0.585006", "0.582329", "0.57966876", "0.5663279", "0.56321985", "0.5576031", "0.55441236", "0.55272007", "0.5522783", "0.55140954", "0.5508781", "0.5492196", "0.5484934", "0.54773355", "0.5473548", "0.54375875", "0.54056185", "0.54007...
0.6676945
0
Return y string formatted. This function will use the attribute self.fmt_ydata if it is callable, else will fall back on the yaxis major formatter
def format_ydata(self, y): try: return self.fmt_ydata(y) except TypeError: fmt = self.w_yaxis.get_major_formatter() return sensible_format_data(fmt, y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def y_formatter_cb(self, ax):\n # y_vals should be the y-location of the labels.\n labels = getattr( self, 'labels', [] )\n labels = list(labels); #labels.reverse()\n y_vals = numpy.arange(.5,len(labels)+.5,1)\n\n # Locations should be fixed.\n fl = FixedLocator( y_vals )...
[ "0.7527546", "0.72269374", "0.66370326", "0.65920424", "0.6497946", "0.6424826", "0.63955826", "0.6334902", "0.6334902", "0.6306747", "0.62235653", "0.62140554", "0.62110204", "0.62094826", "0.62075233", "0.6140514", "0.61285925", "0.6106219", "0.61059654", "0.6090984", "0.59...
0.8820941
0
Get a random element from the set.
def getRandom(self) -> int: index = random.randint(0, len(self.lst) - 1) # self.lst[index], self.lst[len(self.lst) - 1] = self.lst[len(self.lst) - 1], self.lst[index] # val = self.lst.pop() # self.dic.pop(val) return self.lst[index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRandom(self):\n return self.nums[random.randint(0, len(self.nums) - 1)]\n\n # Your RandomizedSet object will be instantiated and called as such:\n # obj = RandomizedSet()\n # param_1 = obj.insert(val)\n # param_2 = obj.remove(val)\n # param_3 = obj.getRandom()", "...
[ "0.77060276", "0.738916", "0.7296881", "0.72187954", "0.6871744", "0.68453854", "0.68330806", "0.67740154", "0.67226046", "0.6703282", "0.6665089", "0.66356236", "0.66217655", "0.6612035", "0.66000897", "0.6567767", "0.6477719", "0.6462421", "0.64428514", "0.64162946", "0.640...
0.60073423
61
This function converts an example to a Tensor containing the indices
def __getitem__(self, index: int) -> (torch.Tensor, torch.Tensor): # retrieve sentence and label (correct class index) example, label = self.examples[index], self.labels[index] # tokenize sentence into words and other symbols tokenizer = get_tokenizer("spacy") tokens = tokenizer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def demo_select_indexes():\n\n ps = tf.constant([[0.2, 0.8],\n [0.4, 0.6],\n [0.25, 0.75]])\n\n idxs = tf.constant([1, 0, 1])\n\n y = tf.gather_nd(\n ps,\n tf.transpose(tf.stack([tf.range(idxs.shape[0]), idxs]))) # [[0, 1], [1, 0], [2, 1]]\n\n wit...
[ "0.64510286", "0.62759244", "0.6272609", "0.59602123", "0.58569616", "0.5856583", "0.57954973", "0.57513106", "0.57113683", "0.57113683", "0.57012224", "0.5694013", "0.56847996", "0.5673351", "0.5645479", "0.5644858", "0.56367826", "0.56101024", "0.55936795", "0.5571949", "0....
0.0
-1
Return the size of this dataset. This is given by the number of sentences.
def __len__(self): return len(self.examples)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size(self):\n return len(self.sentence)", "def dataset_size(self):\n return self.dataset.size", "def dataset_size(self):\n if not self._dataset_size:\n # pylint: disable=attribute-defined-outside-init\n self._dataset_size = count_file_lines(\n self....
[ "0.84375983", "0.80422515", "0.7860005", "0.7611409", "0.7449091", "0.7438289", "0.7395703", "0.7367784", "0.7351452", "0.72516376", "0.7208132", "0.7206233", "0.7206233", "0.7206233", "0.7206233", "0.7165774", "0.7142582", "0.7139968", "0.7139968", "0.7139968", "0.7139968", ...
0.0
-1
Computes the hidden states for the current batch (x, y).
def forward(self, batch: torch.LongTensor, hidden_start: torch.FloatTensor = None) -> torch.FloatTensor: # max_len = x.size(1) # x,label = batch # batch_size x max_len x embedding_dim x_embedded = self.embedding(batch) # x_drop = self.dropout x_drop = sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_hidden_state(self, batch_size):\n hidden_state = tf.tile(self.initial_hidden_state[None, ...], [batch_size, 1])\n cell_state = tf.tile(self.initial_cell_state[None, ...], [batch_size, 1])\n return hidden_state, cell_state", "def hidden_layers(self):\n\t\tif self.hidden is None:\n\t\...
[ "0.6710475", "0.6590623", "0.6510281", "0.6435971", "0.6433828", "0.6342601", "0.63123673", "0.6309199", "0.6259296", "0.62219834", "0.62219834", "0.62219834", "0.62079465", "0.61941564", "0.61824137", "0.60936636", "0.6053089", "0.60222864", "0.60222864", "0.5995126", "0.599...
0.57345694
45
Return the timezone name (e.g. CET), and offset, in hours, that need to be added to UTC to convert to the form location's timezone.
def tz_name_and_utc_offset(self) -> typing.Tuple[str, float]: month = MONTH_NAMES.index(self.event_month) + 1 timezone = caimira.data.weather.timezone_at( latitude=self.location_latitude, longitude=self.location_longitude, ) # We choose the first of the month for the current ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_tz():\n return 'UTC'", "def timezone():\n \n pass", "def _format_timezone_offset(converted_time):\n\n # Windows treats %z in the format string as %Z, so we compute the hour/minute offset\n # manually.\n if converted_time.tm_isdst == 1 and time.daylight:\n utc_of...
[ "0.66823304", "0.66425073", "0.63594604", "0.628442", "0.6178459", "0.6094182", "0.6004695", "0.60003704", "0.5993543", "0.59829426", "0.59764934", "0.5971102", "0.59645134", "0.5961961", "0.5940599", "0.593955", "0.5933366", "0.59305066", "0.5906155", "0.5866959", "0.5865691...
0.6395881
2
retrieve traces as 1port networks from a list returned by get_list_of_traces
def get_traces(self, traces, **kwargs): self.resource.clear() sweep = kwargs.get("sweep", False) name_prefix = kwargs.get("name_prefix", "") if name_prefix: name_prefix += " - " channels = OrderedDict() for trace in traces: ch = trace["channel"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def networks(view):\n return \"network?\" \\\n \"_return_fields=\" \\\n \"extattrs,\" \\\n \"comment,\" \\\n \"network,\" \\\n \"network_view,\" \\\n \"utilization&\" \\\n \"network_view=\" + view + \\\n ...
[ "0.56269556", "0.55539596", "0.5377853", "0.53152835", "0.5294652", "0.5291048", "0.5281379", "0.52650875", "0.526169", "0.52474886", "0.52430606", "0.5223905", "0.5222478", "0.51874423", "0.5139164", "0.51355976", "0.51224667", "0.51205623", "0.5119607", "0.50587183", "0.503...
0.60697514
0
Create and save an User with the given email, date username and password.
def _create_user(self, username, email, password): now = datetime.now() if username is None: raise ValueError('Must include username') if email is None: raise ValueError('Must include email') email = self.normalize_email(email) user = self.model( email=self.normalize_email(email), username=usernam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_user(self, email, password,username, **extra_fields):\r\n if not email:\r\n raise ValueError('The given email must be set')\r\n if not username:\r\n raise ValueError('The given username must be set')\r\n email = self.normalize_email(email)\r\n user = se...
[ "0.8264488", "0.8044632", "0.8017942", "0.79963917", "0.7975402", "0.7971667", "0.7956227", "0.7950401", "0.7944039", "0.7933995", "0.7920982", "0.78849393", "0.78843653", "0.78787684", "0.7863827", "0.7850802", "0.78485966", "0.7845105", "0.7843791", "0.78424984", "0.7837284...
0.81243074
1
Create and save an User with the given email and password.
def create_user(self, username=None, email=None, password=None): return self._create_user(username, email, password)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_user(self, email, password, **extra_fields):\n if not email:\n raise ValueError('The given email must be set')\n email = self.normalize_email(email)\n user = self.model(email=email, **extra_fields)\n user.set_password(password)\n user.save(using=self._db)\n return user", "def...
[ "0.85494155", "0.85124713", "0.85088307", "0.85034907", "0.8502821", "0.8492457", "0.8492457", "0.84905136", "0.84905136", "0.84905136", "0.8489425", "0.84818614", "0.84780324", "0.84762305", "0.84762305", "0.84762305", "0.84762305", "0.84762305", "0.84762305", "0.84762305", ...
0.0
-1
Create and save a superuser with the given email and password.
def create_superuser(self, username, email, password): user = self._create_user(username, email, password) user.is_admin = True user.is_author = True user.save(using=self._db) return user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createsuperuser():\n\n email = prompt('User E-Mail')\n email_confirm = prompt('Confirm E-Mail')\n\n if not email == email_confirm:\n sys.exit('\\nCould not create user: E-Mail did not match')\n\n if not EMAIL_REGEX.match(email):\n sys.exit('\\nCould not create user: Invalid E-Mail add...
[ "0.8414367", "0.83417505", "0.8334044", "0.82874274", "0.82836604", "0.8281098", "0.8274675", "0.8261955", "0.8253338", "0.8246862", "0.82340825", "0.8229148", "0.82189757", "0.82163477", "0.82144415", "0.82144415", "0.82144415", "0.8211598", "0.81994486", "0.8197141", "0.818...
0.79751897
70
Initialize the network object.
def __init__(self, network: Network): self.graph = network.graph
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialise_network(self):\n raise NotImplementedError", "def initialize_networkHandler(self):\n\t\tself.networkHandler = NetworkHandler(\n\t\t\tself.callbackQueue,\n\t\t\tself.received_order,\n\t\t\tself.set_light_callback,\n\t\t\tself.newOrderQueue,\n\t\t\tself.startedOrderQueue,\n\t\t\tself.lost_con...
[ "0.8311253", "0.7300697", "0.72333914", "0.72051275", "0.7202887", "0.7143717", "0.71095693", "0.71057093", "0.70741814", "0.6999863", "0.6982835", "0.6895302", "0.68354", "0.6832367", "0.67843825", "0.6771594", "0.6767722", "0.6760657", "0.67256033", "0.66914284", "0.6682826...
0.73163825
1
Compute the distance matrix where each element m[i][j] is the distance between X1[i] and X2[j].
def compute_dist_matrix(X1, X2, distance): N, M = X1.shape[0], X2.shape[0] dist_matrix = np.zeros((N, M)) for i in range(N): for j in range(M): dist_matrix[i][j] = dist(X1[i], X2[j], distance=distance) return dist_matrix
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_matrix(d1, d2=None):\n if d2 is None:\n dists = np.zeros(shape=(d1.shape[0], d1.shape[0]))\n for i in range(dists.shape[0]):\n dists[i] = (((d1 - d1[i]) ** 2).sum(axis=1)) ** 0.5\n else:\n dists = np.zeros(shape=(d1.shape[0], d2.shape[0]))\n for i in range(...
[ "0.75617665", "0.7318856", "0.72813463", "0.7276832", "0.70679265", "0.6998405", "0.6967657", "0.69262916", "0.69128615", "0.6912195", "0.6910449", "0.6898679", "0.6848797", "0.6822956", "0.6822956", "0.6811146", "0.67233676", "0.67047507", "0.66902006", "0.66814315", "0.6658...
0.8308153
0
Gets information if user is subscribed to channel
def _get_subscription(self): response = requests.get( 'https://www.googleapis.com/youtube/v3/subscriptions', params={ 'part': 'snippet', 'mine': 'true', 'forChannelId': self.channel_id }, headers=self.headers ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_subscribed(self, inst, channel):\r\n if channel not in self._channels:\r\n return False\r\n return inst in self._channels[channel].subscribers", "def get_is_subscribed(self, obj):\n user = self.context['request'].user\n if not user.is_authenticated:\n retu...
[ "0.67211527", "0.6639167", "0.6612881", "0.6546553", "0.6390723", "0.6356534", "0.63247204", "0.62033534", "0.61668503", "0.6149167", "0.6146261", "0.61237186", "0.6103285", "0.6047629", "0.6038185", "0.60244364", "0.6006235", "0.60038716", "0.5994237", "0.5993233", "0.598870...
0.632004
7
Reads file and converts to string.
def _read_grammar(filename): with open(filename, 'r') as file: data = file.read() return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file2str(file):\n with open(file, \"r\") as textFile:\n return textFile.read()", "def file_to_string(file_name):\n with open(file_name, 'r') as f:\n text = f.read()\n # delete original file\n os.remove(file_name)\n return text", "def file_to_string(path_to_file):\n\t\twith open...
[ "0.8288089", "0.79020804", "0.787436", "0.7704866", "0.7668061", "0.7624252", "0.7614562", "0.7531548", "0.750506", "0.74175143", "0.73381317", "0.7265363", "0.7250008", "0.72256964", "0.7209511", "0.7209511", "0.71395135", "0.71075535", "0.7100566", "0.70669836", "0.70423764...
0.0
-1
reset all parameters so that self.angle is change to self.newAngle
def adjustToNewAngle(self): self.a,self.b,self.c = parametersFromPointAngle( 0.5*(self.point1+self.pointN), self.newAngle) #print 'adjustToNewAngle ', self, self.angle, self.newAngle self.angle = self.newAngle self.normalv = numpy.array( [ self.a, self.b ]) self.unitv = numpy.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_angle(self, new_angle):\r\n self.angle = new_angle", "def delAngle(self):\n self.setAngle(0)", "def setAngle(self,angle = 2.5):\n pass", "def calibrer(self):\n self._angle_courant = self._angle_initial\n self.angle(self._angle_initial)", "def resetPos(self):\n ...
[ "0.73601097", "0.71844745", "0.68685937", "0.6776336", "0.6770462", "0.67478067", "0.6713154", "0.67034286", "0.66951406", "0.66843665", "0.66810244", "0.66554374", "0.6654665", "0.6624926", "0.66203195", "0.6577932", "0.6541271", "0.65358627", "0.6513171", "0.65054375", "0.6...
0.6439189
23
Testing the TMDB API seasons endpoint
def test_seasons(self): response = Tmdb.season(tmdb_show_id = 69740, season_number = 1) self.assertTrue(int(response.status_code) == 200) data = response.json() self.assertTrue(isinstance(data['episodes'], list)) # TODO check if all the shows are in the good format (can be from_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_seasonal_faceoffs(self):\n msg = \"Response status is not 200\"\n response = self.api.get_seasonal_faceoffs(self.season, self.nhl_season, self.team_id)\n self.assertEqual(response.status_code, 200, msg)", "def test_get_standings(self):\n msg = \"Response status is not 200...
[ "0.7294995", "0.7227316", "0.71596456", "0.69653505", "0.6889411", "0.6691677", "0.66718614", "0.66319495", "0.65817046", "0.6420952", "0.63585925", "0.6336846", "0.631154", "0.631154", "0.62844133", "0.62566775", "0.62529695", "0.6246284", "0.617973", "0.6154505", "0.6148209...
0.7882173
0
Fetches the DataLoader object for each type in types.
def fetch_dataloader(types, params, CViters): dataloaders = {} assert CViters[0] != CViters[1], 'ERROR! Test set and validation set cannot be the same!' if len(types)>0: for split in types: if split in ['train', 'val', 'test']: dl = DataLoader(imageDataset(split, params, CViters), batch_size=params.batch_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_dataloader(types, dataset_dir, params):\n\n dataloaders = {}\n samplers = {}\n\n for split in ['train', 'val', 'test']:\n if split in types:\n path = os.path.join(dataset_dir, \"{}\".format(split))\n\n # Use the train_transformer if training data, else use eval_trans...
[ "0.77953446", "0.73648304", "0.6888941", "0.6882041", "0.65158087", "0.6447888", "0.6436889", "0.6422035", "0.6362394", "0.6354395", "0.630299", "0.62888855", "0.62565106", "0.62565106", "0.62565106", "0.62565106", "0.62565106", "0.62565106", "0.62565106", "0.62565106", "0.62...
0.75840735
1
Sends a PATCH request.
def patch(url, to_error=_default_to_error, data=None, **kwargs): return request('patch', url, to_error=to_error, data=data, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def httpPatch(self, url='', data='', params={}, headers={}):\n\n return self.httpRequest('PATCH', url, data, params, headers)", "def patch(self, *args, **kwargs):\n self.request(\"patch\", *args, **kwargs)", "def test_client_can_do_patch_request(self):\n response = self.httpbin_4.test_requ...
[ "0.78879285", "0.78840005", "0.75265086", "0.7525407", "0.7426763", "0.7426763", "0.7426763", "0.73790526", "0.734557", "0.7331408", "0.7325037", "0.7317369", "0.72989714", "0.7294469", "0.7292885", "0.7249458", "0.7243931", "0.7208896", "0.7208896", "0.7208896", "0.7208896",...
0.71724725
58
Return lenght of the queue.
def __len__(self): return self._size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size(self):\r\n return len(self.queue)", "def size(self):\r\n return len(self.queue)", "def size(self):\n return len(self.queue)", "def size(self):\n return len(self.queue)", "def size(self):\n return len(self.queue)", "def size(self):\n return len(self.queue...
[ "0.8522818", "0.8522818", "0.8478503", "0.8478503", "0.8478503", "0.8478503", "0.84416807", "0.842351", "0.84200877", "0.83094954", "0.82882136", "0.81825775", "0.8181079", "0.8078734", "0.80770034", "0.80604047", "0.80232006", "0.79807246", "0.786002", "0.781849", "0.7780728...
0.7353395
60
Swap to elements of the heap.
def _swap(self, i, j): tmp = self._heap[i] self._heap[i] = self._heap[j] self._index[self._heap[j].key] = i self._heap[j] = tmp self._index[tmp.key] = j
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _swap(heap, i, j):\n heap[i], heap[j] = heap[j], heap[i]", "def swap(self, i, j):\n swap = self.heap[i]\n self.heap[i] = self.heap[j]\n self.heap[j] = swap", "def _heapify(self):\n for _ in range(len(self.elements)):\n for i in range(len(self.elements)-1, 0, -1):\n...
[ "0.8045141", "0.7676332", "0.74628747", "0.740457", "0.7271205", "0.72514886", "0.7188511", "0.7172437", "0.7172437", "0.71421236", "0.6936676", "0.69078904", "0.6739884", "0.6731289", "0.67170805", "0.668789", "0.66841406", "0.6677653", "0.66590685", "0.66405195", "0.6634291...
0.73909086
4
Sift up an element in the heap.
def _sift_up(self, i): while i > 0: p = (i-1)//2 if self._heap[i] < self._heap[p]: self._swap(i, p) i = p else: break
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sift_up(self, index):\n if self.size() == 1:\n return\n parent_index = self.parent(index)\n # sift up if it is larger than its parent\n while index > 0 and self.heap[index] > self.heap[parent_index]:\n self.heap[index], self.heap[parent_index] = self.heap[paren...
[ "0.821945", "0.7959089", "0.7853257", "0.77530557", "0.7692144", "0.7648635", "0.7554632", "0.7554632", "0.7523918", "0.7507099", "0.7501031", "0.7402723", "0.7287082", "0.72624105", "0.72581136", "0.7222675", "0.7200926", "0.7080144", "0.70542455", "0.7007618", "0.7006154", ...
0.79797375
1
Peek at the first element to dequeue.
def peek(self): if self._size == 0: raise EmptyQueue('pop from empty queue') priority = self._heap[0].priority value = self._heap[0].value key = self._heap[0].key return priority, value, key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peek(self):\n if self.isEmpty(): \n raise Exception(\"Queue underflow\")\n return self._q[self._first]", "def peek(self):\r\n if self.size():\r\n return self.queue[0]\r\n else:\r\n return None", "def peek(self):\n if self.is_empty():\n raise ...
[ "0.7960179", "0.7884413", "0.78827924", "0.77316886", "0.77316886", "0.7633148", "0.7621197", "0.76081896", "0.7535781", "0.7506971", "0.74729615", "0.74701655", "0.74368966", "0.73840666", "0.73722667", "0.73077154", "0.7264174", "0.72321755", "0.72243625", "0.72130567", "0....
0.0
-1
Generate random attitudes To generate a random quaternion a mapping in SO(3) is first created and then transformed as explained originally by [Shoemake]_ and summarized in [Kuffner]_.
def random_attitudes(n: int = 1, representation: str = 'quaternion') -> np.ndarray: if not isinstance(n, int): raise TypeError(f"n must be an integer. Got {type(n)}") if n < 1: raise ValueError(f"n must be greater than 0. Got {n}") if not isinstance(representation, str): raise TypeEr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_rotate():\n u = np.random.uniform(size=3)\n\n # Random quaternion\n q = np.array([np.sqrt(1-u[0])*np.sin(2*np.pi*u[1]),\n np.sqrt(1-u[0])*np.cos(2*np.pi*u[1]),\n np.sqrt(u[0])*np.sin(2*np.pi*u[2]),\n np.sqrt(u[0])*np.cos(2*np.pi*u[2])])\n \n # Convert the q...
[ "0.669615", "0.661402", "0.6477656", "0.6466201", "0.6424329", "0.6349754", "0.6294519", "0.62690204", "0.6232189", "0.61595255", "0.61102754", "0.60693043", "0.5926776", "0.59151584", "0.5884495", "0.5877461", "0.58065665", "0.57699054", "0.56350946", "0.561055", "0.5588173"...
0.69179857
0
Scalar part of the Quaternion.
def w(self) -> float: return self.A[0] if self.scalar_vector else self.A[3]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __truediv__(self, scalar: float):\n if not (isinstance(scalar, float) or isinstance(scalar, int)):\n raise TypeError('scalar must be an scalar type (integer or float')\n return Quaternion(self.__real / scalar, self.__img / scalar)", "def scalar(self):\n return self.q[0]", "d...
[ "0.78699523", "0.66534245", "0.6574314", "0.65291554", "0.65137273", "0.649896", "0.64171636", "0.6386786", "0.63772094", "0.6350116", "0.62784064", "0.6277335", "0.62339944", "0.6186652", "0.6156993", "0.61224216", "0.61083406", "0.60501784", "0.60463667", "0.6041541", "0.60...
0.55737895
58
Second element of the vector part of the Quaternion.
def y(self) -> float: return self.A[2] if self.scalar_vector else self.A[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector(self):\n return self.q[1:4]", "def __sub__(self, p: np.ndarray):\n return Quaternion(self.to_array() - p)", "def z(self) -> float:\n return self.A[3] if self.scalar_vector else self.A[2]", "def rotation(self):\n\t\treturn self.piv.a.rotate.v", "def getValue(self):\n r...
[ "0.63095665", "0.614372", "0.6071921", "0.6007615", "0.59920424", "0.59652907", "0.58444667", "0.5835958", "0.58064526", "0.57324713", "0.5732273", "0.57011795", "0.5697858", "0.5688112", "0.5658095", "0.5635923", "0.56070924", "0.5584673", "0.5572061", "0.55681705", "0.55564...
0.57501453
9
Third element of the vector part of the Quaternion.
def z(self) -> float: return self.A[3] if self.scalar_vector else self.A[2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def I3_u3(self) -> complex:\n return self.I3_u1() * cmath.rect(1, 120 / 180 * cmath.pi)", "def vector3(x, y, z):\n return np.array([x, y, z], dtype=np.float)", "def vector3(x, y, z):\n return np.array([x, y, z], dtype=float)", "def x3(self):\n return self._x + self._x3", "def I3_u1(self...
[ "0.6793091", "0.6354686", "0.6310501", "0.629769", "0.6229241", "0.6211433", "0.6158919", "0.61401063", "0.6086546", "0.60671574", "0.60487324", "0.6037592", "0.6028574", "0.6008026", "0.60024035", "0.59860307", "0.5975794", "0.5969387", "0.59557444", "0.59555686", "0.5933567...
0.6457046
1
Exponential of Quaternion The quaternion exponential works as in the ordinary case, defined with
def exponential(self) -> np.ndarray: if self.is_real(): return np.array([1.0, 0.0, 0.0, 0.0]) t = np.linalg.norm(self.v) u = self.v/t q_exp = np.array([np.cos(t), *u*np.sin(t)]) if self.is_pure(): return q_exp q_exp *= np.e**self.w return q...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exp(cls, q):\n tolerance = 1e-17\n v_norm = np.linalg.norm(q.vector)\n vec = q.vector\n if v_norm > tolerance:\n vec = vec / v_norm\n magnitude = exp(q.scalar)\n return Quaternion(scalar = magnitude * cos(v_norm), vector = magnitude * sin(v_norm) * vec)", ...
[ "0.77629757", "0.7213486", "0.70180804", "0.682456", "0.66706365", "0.6653395", "0.6598257", "0.6447853", "0.63795894", "0.6351678", "0.6327198", "0.6223102", "0.6176798", "0.6152401", "0.615056", "0.612286", "0.608904", "0.6088102", "0.6056831", "0.6003446", "0.5965981", "...
0.74150074
1
Build a printable representation of quaternion Returns
def __str__(self) -> str: if self.scalar_vector: return f"({self.w:-.4f} {self.x:+.4f}i {self.y:+.4f}j {self.z:+.4f}k)" return f"({self.x:-.4f}i {self.y:+.4f}j {self.z:+.4f}k {self.w:+.4f})"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n struct_repr = \", \".join([\n \"w: \" + str(self.w),\n \"x: \" + str(self.x),\n \"y: \" + str(self.y),\n \"z: \" + str(self.z)\n ])\n\n return f\"Quaternion: [{struct_repr}]\"", "def __repr__(self):\n ...
[ "0.79719114", "0.7766331", "0.76413137", "0.75642735", "0.7325075", "0.69913733", "0.6859907", "0.6567126", "0.647583", "0.64532703", "0.6450225", "0.6363894", "0.63560295", "0.63367337", "0.6302381", "0.6301896", "0.6299671", "0.6298583", "0.6291429", "0.6275667", "0.6250235...
0.65456146
8
Returns a bool value, where ``True`` if quaternion is pure.
def is_pure(self) -> bool: return self.w==0.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_pure(self):\r\n return True", "def is_pure(self) -> bool:\r\n return self.is_valid and np.all([x[\"operation\"].is_pure for x in self.operations_by_name.values()])", "def test_check_quaternion():\n q_list = [1, 0, 0, 0]\n q = pr.check_quaternion(q_list)\n assert_array_almost_equal...
[ "0.6396453", "0.6283286", "0.6101912", "0.59468055", "0.5885787", "0.5799285", "0.5798887", "0.57788783", "0.576559", "0.5762862", "0.57241136", "0.57171667", "0.5717132", "0.57046723", "0.5689904", "0.56590533", "0.5645887", "0.5569135", "0.5559882", "0.55593055", "0.5520994...
0.69090956
0
Returns a bool value, where ``True`` if quaternion is real.
def is_real(self) -> bool: return not any(self.v)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_real(self):\r\n return self._imag.is_zero()", "def is_real(self):\n return all([isinstance(dim, Real) for dim in self.dimensions])", "def is_same_quaternion(q0, q1):\r\n q0 = numpy.array(q0)\r\n q1 = numpy.array(q1)\r\n return numpy.allclose(q0, q1) or numpy.allclose(q0, -q1)", ...
[ "0.6654259", "0.65283984", "0.6380824", "0.63371676", "0.6321449", "0.62616616", "0.622338", "0.6177528", "0.61768085", "0.6135937", "0.61193335", "0.60988134", "0.6009501", "0.60006416", "0.59393764", "0.592297", "0.58443695", "0.58435535", "0.58217216", "0.580912", "0.57537...
0.660653
1
Matrix form of a rightsided quaternion multiplication Q. Matrix representation of quaternion product with a right sided
def mult_R(self) -> np.ndarray: return np.array([ [self.w, -self.x, -self.y, -self.z], [self.x, self.w, self.z, -self.y], [self.y, -self.z, self.w, self.x], [self.z, self.y, -self.x, self.w]])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quatRightMat(q):\n\ts = q[0]\n\tv = q[1:].reshape(-1,)\n\tR = np.zeros((4, 4))\n\tR[0, 0] = s\n\tR[0, 1:] = -v\n\tR[1:, 0] = v\n\tR[1:, 1:] = s*np.eye(3) - skewMat(v)\n\treturn R", "def quaternion_multiplication(self, q1, q2):\n\n # Unpack these quaternions\n a_scalar, a_vecx, a_vecy, a_vecz = ...
[ "0.7998098", "0.7399233", "0.7098958", "0.70121944", "0.6998181", "0.69604915", "0.69142365", "0.6875366", "0.6822977", "0.68163455", "0.6776996", "0.67424446", "0.6728108", "0.6677557", "0.66734433", "0.66634756", "0.66634756", "0.6622788", "0.65690434", "0.6568795", "0.6558...
0.0
-1
Return quaternion as a NumPy array Quaternion values are stored in attribute ``A``, which is a NumPy array. This method simply returns that attribute. Returns
def to_array(self) -> np.ndarray: return self.A
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_quaternion(self, method: str = 'chiaverini', **kw) -> np.ndarray:\n q = np.array([1., 0., 0., 0.])\n if method.lower()=='hughes':\n q = hughes(self.A)\n if method.lower()=='chiaverini':\n q = chiaverini(self.A)\n if method.lower()=='shepperd':\n q...
[ "0.7114105", "0.70128185", "0.68141055", "0.6795904", "0.66114634", "0.62984025", "0.62917715", "0.6285375", "0.6248311", "0.6215457", "0.6169272", "0.6150252", "0.61462015", "0.61396337", "0.61377174", "0.612302", "0.6096661", "0.60897154", "0.60826373", "0.6067521", "0.6034...
0.6424025
5
Return quaternion as list Quaternion values are stored in attribute ``A``, which is a NumPy array. This method reads that attribute and returns it as a list. Returns
def to_list(self) -> list: return self.A.tolist()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_quaternion(self, method: str = 'chiaverini', **kw) -> np.ndarray:\n q = np.array([1., 0., 0., 0.])\n if method.lower()=='hughes':\n q = hughes(self.A)\n if method.lower()=='chiaverini':\n q = chiaverini(self.A)\n if method.lower()=='shepperd':\n q...
[ "0.63015306", "0.6214695", "0.603074", "0.5974715", "0.59295547", "0.5881727", "0.5880824", "0.5874699", "0.587153", "0.581114", "0.5807405", "0.5794779", "0.57563674", "0.5708863", "0.56547475", "0.56452274", "0.5580709", "0.5568378", "0.5553339", "0.5548493", "0.5544915", ...
0.59373844
4
Return equivalent axisangle representation of the quaternion. Returns
def to_axang(self) -> Tuple[np.ndarray, float]: denom = np.linalg.norm(self.v) angle = 2.0*np.arctan2(denom, self.w) axis = np.zeros(3) if angle==0.0 else self.v/denom return axis, angle
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quaternion_to_angle_axis(quaternion):\n ha = np.arccos(quaternion[0])\n theta = 2 * ha\n if theta < np.finfo(float).eps:\n theta = 0\n axis = np.array([1, 0, 0])\n else:\n axis = quaternion[[1, 2, 3]] / np.sin(ha)\n return theta, axis", "def quat_to_angle(self, quat):\n\t\...
[ "0.7775409", "0.76622045", "0.75363106", "0.7503836", "0.7489028", "0.7354356", "0.73416454", "0.7306303", "0.7290138", "0.7273142", "0.7104767", "0.7072638", "0.7043243", "0.6834224", "0.6808054", "0.67883295", "0.67651", "0.6693893", "0.66084206", "0.6604963", "0.6596476", ...
0.7051776
12
Quaternion from Direction Cosine Matrix. There are five methods available to obtain a quaternion from a
def from_DCM(self, dcm: np.ndarray, method: str = 'chiaverini', **kw) -> np.ndarray: _assert_iterables(dcm, 'Direction Cosine Matrix') in_SO3 = np.isclose(np.linalg.det(np.atleast_2d(dcm)), 1.0) in_SO3 &= np.allclose(dcm@dcm.T, np.identity(3)) if not in_SO3: raise ValueError(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _rotate_quaternion(self, q):\n self._normalise()\n return self * q * self.conjugate", "def _quaternions(self, R):\n # Simple Wikipedia version\n # en.wikipedia.org/wiki/Rotation_matrix#Quaternion\n # For other options see math.stackexchange.com/questions/2074316/calculating...
[ "0.7252459", "0.7027318", "0.70142776", "0.6890068", "0.6868097", "0.68464077", "0.68280154", "0.68264914", "0.6825186", "0.68228716", "0.6821639", "0.68200916", "0.6804316", "0.67480844", "0.6719377", "0.6713683", "0.668459", "0.6675941", "0.6668051", "0.66632295", "0.665650...
0.0
-1
Quaternion from given RPY angles. The quaternion can be constructed from the Aerospace cardanian angle
def from_rpy(self, angles: np.ndarray) -> np.ndarray: _assert_iterables(angles, 'Roll-Pitch-Yaw angles') angles = np.array(angles) if angles.ndim != 1 or angles.shape[0] != 3: raise ValueError(f"Expected `angles` must have shape (3,), got {angles.shape}.") for angle in angles...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_rpy(self, Angles: np.ndarray) -> np.ndarray:\n _assert_iterables(Angles, 'Roll-Pitch-Yaw angles')\n Angles = np.copy(Angles)\n if Angles.ndim != 2 or Angles.shape[-1] != 3:\n raise ValueError(f\"Expected `angles` must have shape (N, 3), got {Angles.shape}.\")\n # RPY...
[ "0.72458893", "0.7219291", "0.7140985", "0.7110881", "0.7102752", "0.7051442", "0.6981416", "0.6928739", "0.69277245", "0.68430847", "0.6818834", "0.6807934", "0.6774795", "0.67527354", "0.6746149", "0.6664876", "0.66427106", "0.6594205", "0.65873754", "0.65663016", "0.655875...
0.7358275
0
Generate a random quaternion To generate a random quaternion a mapping in SO(3) is first created and then transformed as explained originally by [Shoemake]_. Returns
def random(self) -> np.ndarray: return random_attitudes(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_random_rot():\n from pyso3.quaternion import quat2rot\n import numpy as np\n q = np.random.randn(4)\n q = q / np.linalg.norm(q)\n return quat2rot(q)", "def get_random_quaternion(self):\n random_angles = self.get_random_vector([0,0,0], [2*np.pi, 2*np.pi, 1])\n return tf.t...
[ "0.80167085", "0.7617743", "0.7501405", "0.74150693", "0.7405384", "0.73624146", "0.70850337", "0.68073744", "0.6677623", "0.6491074", "0.6487334", "0.63789487", "0.6323148", "0.63194627", "0.62986827", "0.6256038", "0.6217594", "0.6216123", "0.62127995", "0.6204684", "0.6199...
0.0
-1
Scalar parts of all Quaternions.
def w(self) -> np.ndarray: return self.array[:, 0] if self.scalar_vector else self.array[:, 3]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiply_quaternions( qa, qb ):\n combined = Quaternion()\n\n combined.w = (qa.w * qb.w - qa.x * qb.x - qa.y * qb.y - qa.z * qb.z)\n combined.x = (qa.x * qb.w + qa.w * qb.x + qa.y * qb.z - qa.z * qb.y)\n combined.y = (qa.w * qb.y - qa.x * qb.z + qa.y * qb.w + qa.z * qb.x)\n combined.z = (qa.w * ...
[ "0.68073267", "0.6556849", "0.6436567", "0.61621976", "0.61536247", "0.614212", "0.61262906", "0.607506", "0.60633457", "0.6040731", "0.5990122", "0.5973852", "0.5834813", "0.58138734", "0.57882345", "0.57484466", "0.5744508", "0.5731546", "0.5729902", "0.5707339", "0.5702035...
0.0
-1
First elements of the vector part of all Quaternions.
def x(self) -> np.ndarray: return self.array[:, 1] if self.scalar_vector else self.array[:, 0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector(self):\n return self.q[1:4]", "def point_rotation_by_quaternion(v, q):\r\n r = [0] + v\r\n q_conj = [q[0], -q[1], -q[2], -q[3]]\r\n return quaternion_product(quaternion_product(q, r), q_conj)[1:]", "def _quaternions(self, R):\n # Simple Wikipedia version\n # en.wikipedi...
[ "0.6218173", "0.6120141", "0.5926152", "0.59230524", "0.58764845", "0.5752462", "0.5730774", "0.57201374", "0.56702834", "0.5659877", "0.564364", "0.5610953", "0.55918944", "0.55901754", "0.55798167", "0.5535748", "0.552053", "0.5520487", "0.5519382", "0.55146533", "0.5499133...
0.5201283
51
Third elements of the vector part of all Quaternions.
def z(self) -> np.ndarray: return self.array[:, 3] if self.scalar_vector else self.array[:, 2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fk3(joint_rotations):\n h0_3 = htm0_3(joint_rotations)\n x0_3 = h0_3[0, 3]\n y0_3 = h0_3[1, 3]\n z0_3 = h0_3[2, 3]\n d0_3 = [x0_3, y0_3, z0_3]\n return d0_3", "def three_dimensional(self, z): # Maybe I misunderstood the task. My method looks weird\n return (self.x, self.y, z)", "de...
[ "0.6491738", "0.6359093", "0.6283993", "0.6231474", "0.6197128", "0.6197128", "0.6115199", "0.6081567", "0.60688853", "0.6028108", "0.59688795", "0.5938064", "0.59227556", "0.5914518", "0.59139997", "0.5856894", "0.58449256", "0.58405226", "0.58218336", "0.57935715", "0.57764...
0.5408566
68
Quaternion Array from given RPY angles. The quaternion can be constructed from the Aerospace cardanian angle
def from_rpy(self, Angles: np.ndarray) -> np.ndarray: _assert_iterables(Angles, 'Roll-Pitch-Yaw angles') Angles = np.copy(Angles) if Angles.ndim != 2 or Angles.shape[-1] != 3: raise ValueError(f"Expected `angles` must have shape (N, 3), got {Angles.shape}.") # RPY to Quaterni...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_rpy(self, angles: np.ndarray) -> np.ndarray:\n _assert_iterables(angles, 'Roll-Pitch-Yaw angles')\n angles = np.array(angles)\n if angles.ndim != 1 or angles.shape[0] != 3:\n raise ValueError(f\"Expected `angles` must have shape (3,), got {angles.shape}.\")\n for ang...
[ "0.7644639", "0.7046615", "0.69144994", "0.6751744", "0.67498493", "0.67286915", "0.6699655", "0.6676206", "0.66539806", "0.66473985", "0.66402453", "0.6624343", "0.6602038", "0.65801984", "0.6568063", "0.6566676", "0.6558134", "0.6548521", "0.649762", "0.64747137", "0.643528...
0.7633397
1
Return corresponding rollpitchyaw angles of quaternion.
def to_angles(self) -> np.ndarray: phi = np.arctan2(2.0*(self.w*self.x + self.y*self.z), 1.0 - 2.0*(self.x**2 + self.y**2)) theta = np.arcsin(2.0*(self.w*self.y - self.z*self.x)) psi = np.arctan2(2.0*(self.w*self.z + self.x*self.y), 1.0 - 2.0*(self.y**2 + self.z**2)) return np.c_[phi, th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yaw_pitch_roll(self):\n\n self._normalise()\n yaw = np.arctan2(2*(self.q[0]*self.q[3] - self.q[1]*self.q[2]),\n 1 - 2*(self.q[2]**2 + self.q[3]**2))\n pitch = np.arcsin(2*(self.q[0]*self.q[2] + self.q[3]*self.q[1]))\n roll = np.arctan2(2*(self.q[0]*self.q[1] - self.q[2]*s...
[ "0.82805336", "0.7189984", "0.711505", "0.70589966", "0.6942176", "0.6910898", "0.6870528", "0.6868951", "0.6831267", "0.68028545", "0.67098445", "0.67087054", "0.66497034", "0.6647922", "0.66365945", "0.66164136", "0.657104", "0.65705496", "0.65439534", "0.65418464", "0.6541...
0.5722158
63
Having N quaternions return N `direction cosine matrices
def to_DCM(self) -> np.ndarray: if not all(self.is_versor()): raise AttributeError("All quaternions must be versors to be represented as Direction Cosine Matrices.") R = np.zeros((self.num_qts, 3, 3)) R[:, 0, 0] = 1.0 - 2.0*(self.y**2 + self.z**2) R[:, 1, 0] = 2.0*(self.x*sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _quaternions(self, R):\n # Simple Wikipedia version\n # en.wikipedia.org/wiki/Rotation_matrix#Quaternion\n # For other options see math.stackexchange.com/questions/2074316/calculating-rotation-axis-from-rotation-matrix\n diag = torch.diagonal(R, dim1=-2, dim2=-1)\n Rxx, Ryy, ...
[ "0.627787", "0.6202951", "0.61784834", "0.6133715", "0.61131096", "0.6087388", "0.60747737", "0.5926613", "0.5918302", "0.5907642", "0.5907642", "0.578579", "0.57835263", "0.57680285", "0.57460314", "0.5735381", "0.57302666", "0.5717302", "0.570202", "0.5699608", "0.5674529",...
0.5702588
18
Reset the stage for this outliner and child dialogs.
def ResetStage(self, stage): self._stage = stage self._dataModel.ResetStage(stage) self.stageChanged.emit(stage)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_stage():\n return set_stage('')", "def reset_step(self):\n # reset all levels\n for l in self.levels:\n l.reset_level()", "def reset(self, window, context):\n pass", "def reset(self):\n self.current = self.root\n env = self.env\n obs, infos = env....
[ "0.67629087", "0.6052151", "0.6004065", "0.59872866", "0.5976821", "0.59689575", "0.59572196", "0.5944264", "0.59157413", "0.58872324", "0.58732116", "0.581481", "0.58093554", "0.5793779", "0.57754314", "0.5764354", "0.5762724", "0.5721282", "0.5713886", "0.57050663", "0.5704...
0.6522153
1
Check a proper oidc user can be added.
def test_add_oidc(self, db_session: Session) -> None: user_service = get_user_service(db_session) identity_provider = RandomDbAdder().random_identity_provider(db_session) profile = RandomDbAdder().random_profile(db_session) oidc_user_dict = InputDictGenerator().random_oidc_user(profile.n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_user(self, user): # pylint: disable=unused-argument\r\n return False", "def validate_user_existence():\n from sfa_api.utils.storage import get_storage\n storage = get_storage()\n if not storage.user_exists():\n try:\n info = request_user_info()\n except (requests...
[ "0.6781529", "0.64783305", "0.6422051", "0.63401365", "0.62716377", "0.627131", "0.6268141", "0.6244082", "0.62347066", "0.62128186", "0.6204552", "0.6192932", "0.61716366", "0.61443716", "0.614201", "0.6141389", "0.61342645", "0.61148345", "0.61139995", "0.6113494", "0.60992...
0.6725915
1
Gets sample from truncated normal distribution
def get_trunc_norm(mean, sd, lower=1e-12, upper=1): mean = max(lower, min(mean, upper)) assert sd >= 0 if sd <= 0: sd = 1e-12 tn = stats.truncnorm((lower - mean) / sd, (upper - mean) / sd, loc=mean, scale=sd).rvs() return max(lower, min(tn, upper))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_sample(self):\n mu = self._get_mean()\n sample = self.random.normal(mu)\n return sample", "def sample_from_truncated_normal(mean, std, clip_a, clip_b, size=None):\n a, b = (clip_a - mean) / std, (clip_b - mean) / std\n r = stats.truncnorm.rvs(a, b, size=size)\n return r * std + m...
[ "0.74443525", "0.7277087", "0.710252", "0.70048517", "0.6922765", "0.6901767", "0.6863425", "0.6827234", "0.6827234", "0.6827234", "0.6827234", "0.6827234", "0.6793744", "0.67784303", "0.665255", "0.66171837", "0.65863925", "0.65797514", "0.6552966", "0.6537854", "0.65074354"...
0.6579031
18
Select best n solutions from a population
def select_best_n(solver, pop, n, minimising=None): assert n <= len(pop) if minimising is None: minimising = solver.alg_params.minimising key_f = operator.attrgetter('fitness') if minimising: f = copy.deepcopy(sorted(pop, key=key_f, reverse=False)) else: f = copy.deepcopy(so...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_n_best(self):\n pass", "def select(individuals, n):\r\n # return selBest(individuals, n)\r\n return individuals[:n]", "def _find_solution(self, population, num_of_best_chromosomes):\n data = self._Individuals()\n for x in population:\n curr_fit = self._fitness(x)\n...
[ "0.7206025", "0.71654224", "0.71230745", "0.6725943", "0.6594718", "0.65439", "0.65414584", "0.6531062", "0.6422889", "0.6337787", "0.6282793", "0.62078166", "0.62029624", "0.6191008", "0.61795396", "0.61662084", "0.6162691", "0.61474377", "0.6122851", "0.6112423", "0.6077574...
0.73968315
0
Get the status of collection.
def get_collection_status(self, db_cfg_name, collection_cfg_name): from ir_config import IRConfig db_name = IRConfig.get_instance().get(db_cfg_name) collection_name = IRConfig.get_instance().get(collection_cfg_name) res = self.__find_collection_in_meta(db_name, collection_name) i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_collection_status(self, **kwargs):\n\n return self.api_request(self._get_method_fullname(\"data_collection_status\"), kwargs)", "def get_status(self, collection):\n\n status_order = [\n Data.STATUS_ERROR,\n Data.STATUS_UPLOADING,\n Data.STATUS_PROCESSING,\n...
[ "0.7946667", "0.79024345", "0.7734547", "0.7314711", "0.7189774", "0.71143985", "0.7104099", "0.70867294", "0.7053053", "0.70458037", "0.70366305", "0.701162", "0.701162", "0.701162", "0.69920576", "0.69920576", "0.69920576", "0.69920576", "0.69920576", "0.69920576", "0.69920...
0.7614475
3
Equality comparison for heaps
def __eq__(self, other): if len(self.table) != len(other.table): return False for i in range(len(self.table)): if self.table[i] != other.table[i]: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return other and self.values == other.values", "def test_hash(self, tdim, tdim2):\n assert hash(tdim) != hash(tdim2)\n assert hash(tdim) == hash(copy.deepcopy(tdim))", "def __eq__(self, other):\n return np.array_equal(self.hp, other.hp) and np.array_equal(self...
[ "0.65074825", "0.6450293", "0.63817513", "0.6312217", "0.63055557", "0.62514025", "0.62091297", "0.61947185", "0.6189535", "0.6062819", "0.6044813", "0.6026616", "0.59891367", "0.59872586", "0.59654", "0.5947471", "0.59462804", "0.5939847", "0.59386325", "0.5937471", "0.59369...
0.5644845
62
swap elements in heap, (usually parent,child swaps)
def swap(self, p1, p2): self.table[p1], self.table[p2] = self.table[p2], self.table[p1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _swap(heap, i, j):\n heap[i], heap[j] = heap[j], heap[i]", "def swap(self, i, j):\n swap = self.heap[i]\n self.heap[i] = self.heap[j]\n self.heap[j] = swap", "def _swap(self, i, j):\n tmp = self._heap[i]\n self._heap[i] = self._heap[j]\n self._index[self._heap[j...
[ "0.803078", "0.7479347", "0.7434996", "0.73148155", "0.7244326", "0.71626407", "0.71517205", "0.71358824", "0.7113341", "0.7109958", "0.7087135", "0.707947", "0.7074785", "0.70715517", "0.70221674", "0.7011302", "0.698698", "0.698522", "0.6968491", "0.6963798", "0.6963798", ...
0.0
-1
promote node until its children are greater than it
def percolate_up(self, position): parent = self.parent(position) if position > 0 and self.table[position] < self.table[parent]: # not root and child > parent self.swap(position, parent) self.percolate_up(parent) # recurse
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heapify_up(self):\n index = len(self.heap) - 1\n while self.has_parent(index) and self.get_parent(index) > self.heap[index]:\n self.swap_values(self.get_parent_index(index), index)\n index = self.get_parent_index(index)", "def _heapify_after_remove(self,ele):\r\n \r...
[ "0.6514513", "0.6395537", "0.6372057", "0.63177913", "0.6246699", "0.6223821", "0.6194509", "0.6192801", "0.6181282", "0.61486197", "0.61374795", "0.61204404", "0.61031705", "0.6094075", "0.6083076", "0.60712934", "0.6056167", "0.6041147", "0.60390496", "0.6037902", "0.601982...
0.56910187
52
List of variables in the graphical model; equals model.X
def vars(self): return [Var(i,self.dims[i]) for i in range(self.nvar)] # TODO: use stored state info (=1 sometimes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variables(self):\n return [i.name for i in self.inputs + self.outputs]", "def variables(model: Model) -> AbstractSet[str]:\r\n assert is_model(model)\r\n return model.keys()", "def get_variables(self):\n return [self.g_t, self.m_t]", "def variables(model: Model) -> AbstractSet[str]:\n ...
[ "0.71537", "0.7095497", "0.7092222", "0.70812196", "0.7028589", "0.69994986", "0.6974364", "0.68044204", "0.680155", "0.67825454", "0.6702427", "0.6689236", "0.66822815", "0.6648105", "0.6611602", "0.66026515", "0.658932", "0.6582367", "0.6562528", "0.65559936", "0.6520596", ...
0.7132254
1
Return a variable object (with states) for id 'i'; equals model.X[i]
def var(self,i): # TODO: change to property to access (read only?) X? return Var(i,self.dims[i])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vars(self):\n return [Var(i,self.dims[i]) for i in range(self.nvar)] # TODO: use stored state info (=1 sometimes)", "def x(self):\n # REPLACE THE FOLLOWING WITH THE LOGIC TO CONSTRUCT/RETURN THE STATE\n x = {key: 0.0 for key in self.model.states}\n\n return x", "def get_variable_fr...
[ "0.60665554", "0.59195673", "0.5838082", "0.5730709", "0.570854", "0.5686629", "0.566703", "0.5563087", "0.5541318", "0.55122286", "0.54958653", "0.5446443", "0.53824", "0.5346341", "0.53371876", "0.53250223", "0.5296448", "0.5295435", "0.52895856", "0.5281432", "0.5272852", ...
0.7190818
0
Find the connected components of the model's Markov graph. Returns a list of sets of variables.
def connectedComponents(self): components = [] X = set(self.X) while X: Xi = X.pop() if Xi.states <= 1: continue # don't include missing or assigned variables group = {Xi} # start a new group with this variable queue = [Xi] # do DFS on the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nxMarkovGraph(self, all_vars=False):\n import networkx as nx\n return nx.from_scipy_sparse_matrix(self.L!=0)", "def connected_components(self) -> List[list]:\n self.reset_tags()\n ans = []\n visited = dict() # A dictionary of visited nodes\n\n for key in self._graph.get_all...
[ "0.6395554", "0.63244885", "0.61691284", "0.60650057", "0.6025276", "0.59588933", "0.59357953", "0.5887315", "0.586057", "0.58446604", "0.5805392", "0.57900643", "0.5778207", "0.57326496", "0.57238054", "0.5722187", "0.5720171", "0.5711577", "0.57085514", "0.5678446", "0.5657...
0.7487339
0
Rounds the value(s) in x to the number of significant figures in sigfigs.
def RoundToSigFigs( x, sigfigs ): __logBase10of2 = 3.010299956639811952137388947244930267681898814621085413104274611e-1 if not ( type(sigfigs) is int or np.issubdtype(sigfigs, np.integer)): raise TypeError( "RoundToSigFigs: sigfigs must be an integer." ) if not np.all(np.isreal( x )): raise...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_sigfigs(x):\n sigfig_re = re.compile(\"([0-9.]+)\")\n m = sigfig_re.search(\"{:e}\".format(float(x))) # turn to scientific form\n\n if m:\n val = m.group(1).replace(\".\", \"\")\n while val[-1:] == '0': # remove all trailing zeros\n val = val[0:-1]\n return len(v...
[ "0.69768053", "0.6958066", "0.6958066", "0.6945776", "0.68875176", "0.6797744", "0.67858464", "0.67486995", "0.6658438", "0.6658438", "0.64732695", "0.6251555", "0.62070763", "0.6185126", "0.6147775", "0.60465026", "0.6033288", "0.59099495", "0.5869586", "0.58428204", "0.5742...
0.68830657
5
this converts a multiline string into a list of individual lines=entries, stripped of white spaces and \n newlines.
def parse_multiline_string(s): result = [x.strip() for x in s.strip().split('\n')] return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_lines(s):\n return [l.strip() for l in s.splitlines() if l.strip()]", "def _str2lines(cls, text):\n lines = text.replace('\\r', '').split('\\n')\n lines[0] = lines[0].strip() # firts line is always detented\n if len(lines) > 1:\n # Get minimal indentation\n ...
[ "0.743767", "0.7229761", "0.7101724", "0.70156485", "0.68796915", "0.6628763", "0.6531216", "0.64587754", "0.6420906", "0.63896006", "0.6380917", "0.63807535", "0.63330936", "0.6249625", "0.62248987", "0.619419", "0.61721647", "0.6137706", "0.6128727", "0.6117737", "0.6110453...
0.7521817
0
Checks if neighbours to cell is crossed. Return False if neighbour, True if not.
def no_neighbour(x: int, y: int) -> bool: if not wall_check(x, y-1, False): if example[x, y-1] == 0: return False if not wall_check(x, y+1, False): if example[x, y+1] == 0: return False if not wall_check(x+1, y, False): if example[x+1, y] == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_crossed(self):\n left_boundary_clusters = np.extract(self.cluster[0] > 0,\n self.cluster[0])\n right_boundary_clusters = np.extract(self.cluster[-1] > 0,\n self.cluster[-1])\n return np.in1d(left_boun...
[ "0.7211435", "0.71420616", "0.71316123", "0.67956436", "0.6718297", "0.6695418", "0.6637726", "0.6632009", "0.6630515", "0.6521311", "0.65169525", "0.65067196", "0.6477736", "0.64534223", "0.64436376", "0.64387643", "0.6411939", "0.64057225", "0.6405268", "0.63929427", "0.637...
0.6561607
9
Parse a userspecified path into an absolute path.
def explode( self, path: PagePathLike ) -> str: path = str(path) # We rely on pathlib for parsing all of the path segments. An important note in # pathlib's parsing behavior is that any segments that would be equivalent to # '.' will be ommitted from the returned par...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _normalized_path(path):\n return os.path.abspath(os.path.expanduser(path))", "def _get_absolute(self, path: Path) -> Path:\n return path.expanduser().absolute()", "def parse_path(path): # -> Path | UnparsedPath | ParsedPath:\n ...", "def format_path (in_path):\n return os.path.realpath(o...
[ "0.69239485", "0.6828866", "0.66142905", "0.6576021", "0.6575469", "0.6493446", "0.6476022", "0.64443344", "0.6442872", "0.6399606", "0.63844275", "0.63734144", "0.63673383", "0.6266357", "0.6263962", "0.62626463", "0.6183093", "0.6178532", "0.6167198", "0.61435044", "0.60792...
0.0
-1
The current page within this navigator.
def current_page( self ) -> AbstractPage: return self._current_page
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _currentPage(self):\n view = self._window.currentBrowser()\n if view is None:\n return None\n \n return view.page()", "def GetCurrentPage(self):\r\n\r\n if self._curpage >= 0 and self._curpage < self._tabs.GetPageCount():\r\n return self.GetPage(self._...
[ "0.8514561", "0.79256123", "0.78558654", "0.7707269", "0.7698711", "0.7328907", "0.7261823", "0.72005963", "0.7128613", "0.7108345", "0.70872545", "0.7063684", "0.6865034", "0.6733071", "0.6718827", "0.6714636", "0.67096746", "0.6604453", "0.6533142", "0.6480815", "0.64742553...
0.83133423
1
Calculates the range that the object is able to see.
def calculate_sight_range(self): if not self.check_map_obstacle_has_sight(): return 0 else: return self.map_obstacle.sight_range
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_range(self):\n return time_to_range(self.get_time())", "def range(self):\n return self._upper - self._lower", "def _calc_range(self) -> np.ndarray:\n if self._is_ct25k():\n range_resolution = 30\n n_gates = 256\n else:\n n_gates = int(self.me...
[ "0.7054947", "0.6985235", "0.698506", "0.69824034", "0.69068736", "0.68773425", "0.68696356", "0.68574417", "0.6852971", "0.6852971", "0.6852971", "0.6852971", "0.6852971", "0.6852971", "0.6852971", "0.6852971", "0.68285257", "0.68285257", "0.6808143", "0.67840767", "0.674759...
0.65294176
38
The group ID of this algorithm. Should not be localised.
def groupId(self): return self.algorithm_spec.category
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_id(self):\n # type: () -> string_types\n return self._group_id", "def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")", "def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")", "def group_id(self):\n return self._id", "def group_ident...
[ "0.89262736", "0.89070594", "0.89070594", "0.8662571", "0.8633984", "0.86078006", "0.86078006", "0.86078006", "0.8499357", "0.84745574", "0.846353", "0.845268", "0.8381798", "0.8165488", "0.8165488", "0.8165488", "0.80998176", "0.7985264", "0.7880558", "0.7742656", "0.7737354...
0.77026784
26
Cleans up our test config files
def tearDownClass(cls): os.remove(cls._config) os.remove(cls._auth)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\n test_utils.delete_test_config()", "def cleanup(self):\n self.qemu.clean_run_files()\n for tmp in glob.glob(self.configfile + \"?*\"):\n os.unlink(tmp)", "def tearDown(self) -> None:\n os.remove(TestConfigFile.TEST_CONFIG)", "def tearDown():\n fo...
[ "0.82954127", "0.8179375", "0.8162203", "0.78456604", "0.7733473", "0.7677196", "0.7509513", "0.7505887", "0.74682695", "0.72384274", "0.72033614", "0.7175446", "0.71684974", "0.71427387", "0.7117693", "0.7107452", "0.70857364", "0.7080637", "0.7080637", "0.70670825", "0.7064...
0.6896175
50
Cleans up our test config files
def tearDownClass(cls): os.remove(cls._no_default) os.remove(cls._no_workers) os.remove(cls._zero_workers) os.remove(cls._no_server) os.remove(cls._server_no_save_timeout) os.remove(cls._server_no_retain_image) os.remove(cls._server_no_region) os.remove(cl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\n test_utils.delete_test_config()", "def cleanup(self):\n self.qemu.clean_run_files()\n for tmp in glob.glob(self.configfile + \"?*\"):\n os.unlink(tmp)", "def tearDown(self) -> None:\n os.remove(TestConfigFile.TEST_CONFIG)", "def tearDown():\n fo...
[ "0.82954127", "0.8179375", "0.8162203", "0.78456604", "0.7733473", "0.7677196", "0.7509513", "0.7505887", "0.74682695", "0.72384274", "0.72033614", "0.7175446", "0.71684974", "0.71427387", "0.7117693", "0.7107452", "0.70857364", "0.7080637", "0.7080637", "0.70670825", "0.7064...
0.0
-1
Cleans up our test config files
def tearDownClass(cls): os.remove(cls._no_section) os.remove(cls._no_user) os.remove(cls._blank_user) os.remove(cls._no_key) os.remove(cls._blank_key) os.remove(cls._valid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\n test_utils.delete_test_config()", "def cleanup(self):\n self.qemu.clean_run_files()\n for tmp in glob.glob(self.configfile + \"?*\"):\n os.unlink(tmp)", "def tearDown(self) -> None:\n os.remove(TestConfigFile.TEST_CONFIG)", "def tearDown():\n fo...
[ "0.82954127", "0.8179375", "0.8162203", "0.78456604", "0.7733473", "0.7677196", "0.7509513", "0.7505887", "0.74682695", "0.72384274", "0.72033614", "0.7175446", "0.71684974", "0.71427387", "0.7117693", "0.7107452", "0.70857364", "0.7080637", "0.7080637", "0.70670825", "0.7064...
0.0
-1
Test auth config with no ApiUser key
def test_no_user(self): with self.assertRaises(ConfigError) as cm: imageroller.main.read_authconfig( imageroller.test.get_config_parser(self._no_user)) self.assertEqual(str(cm.exception), "AuthConfig must contain ApiUser")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_blank_user(self):\n with self.assertRaises(ConfigError) as cm:\n imageroller.main.read_authconfig(\n imageroller.test.get_config_parser(self._blank_user))\n self.assertEqual(str(cm.exception), \"AuthConfig must contain ApiUser\")", "def test_auth0_config_anon(anon...
[ "0.7339472", "0.7298195", "0.70554227", "0.6965093", "0.6886279", "0.6864067", "0.6784296", "0.6761126", "0.6677262", "0.6585729", "0.6567952", "0.6554833", "0.6533842", "0.65302294", "0.6514896", "0.65003186", "0.6490403", "0.64753026", "0.64716136", "0.64716136", "0.6402134...
0.7379715
0
Test auth config with no ApiKey key
def test_no_key(self): with self.assertRaises(ConfigError) as cm: imageroller.main.read_authconfig( imageroller.test.get_config_parser(self._no_key)) self.assertEqual(str(cm.exception), "AuthConfig must contain ApiKey")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_blank_key(self):\n with self.assertRaises(ConfigError) as cm:\n imageroller.main.read_authconfig(\n imageroller.test.get_config_parser(self._blank_key))\n self.assertEqual(str(cm.exception), \"AuthConfig must contain ApiKey\")", "def a_valid_api_key(configuration)...
[ "0.7462683", "0.73790747", "0.72114646", "0.69960606", "0.6991453", "0.6954508", "0.6915566", "0.6873325", "0.68384326", "0.68320215", "0.6796821", "0.6775761", "0.6772674", "0.6768656", "0.6757531", "0.6625573", "0.66205496", "0.6614271", "0.65810287", "0.656183", "0.6548065...
0.75365764
0
Apply an independent roll for each dimensions of a single axis.
def indep_roll(arr, shifts, axis=1): arr = np.swapaxes(arr, axis, -1) all_idcs = np.ogrid[[slice(0, n) for n in arr.shape]] # Convert to a positive shift shifts[shifts < 0] += arr.shape[-1] all_idcs[-1] = all_idcs[-1] - shifts[:, np.newaxis] result = arr[tuple(all_idcs)] arr = np.swapaxes(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roll(\n tensor: tf.Tensor,\n shift: Union[int, Sequence[int]],\n axis: Union[int, Sequence[int]],\n) -> tf.Tensor:\n if isinstance(axis, int):\n axis = [axis]\n if isinstance(shift, int):\n shift = [shift]\n result = tensor\n for axis_element, shift_element in zip(axis, shift):\n result =...
[ "0.66416997", "0.66079587", "0.64977175", "0.64939183", "0.6300855", "0.62910795", "0.62910795", "0.62910795", "0.62910795", "0.62861246", "0.624665", "0.6100358", "0.6046522", "0.6018671", "0.6013796", "0.5913399", "0.5912705", "0.5895981", "0.5862049", "0.5848315", "0.57987...
0.5852988
19
Adds the new transition using `time_step` to the replay buffer. Adds the transition from `self._prev_timestep` to `time_step` by `self._prev_action`.
def add_transition(self, prev_time_step, prev_action, time_step): assert prev_time_step is not None legal_actions = ( prev_time_step.observations["legal_actions"][self.player_id]) legal_actions_mask = np.zeros(self._num_actions) legal_actions_mask[legal_actions] = 1.0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_trajectory(self, prev_time_step, action, new_time_step):\n\n traj = tf_agents.trajectories.trajectory.from_transition(\n prev_time_step, action, new_time_step)\n\n self.replay_buffer.add_batch(traj)\n self.replay_buffer_position += 1\n\n if self.replay_buffer_positio...
[ "0.73648083", "0.6423484", "0.63654953", "0.62825084", "0.6085455", "0.6005418", "0.59090614", "0.58365744", "0.57959193", "0.57572985", "0.5752847", "0.5746639", "0.5743602", "0.5651727", "0.55769384", "0.5573565", "0.55378646", "0.55239344", "0.55213517", "0.55170715", "0.5...
0.8534917
0
Create TF ops copying the params of the network to the target network.
def _create_target_network_update_op(self, q_network, target_q_network): variables = q_network.get_variables() target_variables = target_q_network.get_variables() # problem return tf.group([ tf.assign(target_v, target_v + self.tau * (v - target_v)) # same as original arm ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_network_parameters(sess):\n e1_params = [t for t in tf.trainable_variables() if t.name.startswith('q_network')]\n e1_params = sorted(e1_params, key=lambda v: v.name)\n e2_params = [t for t in tf.trainable_variables() if t.name.startswith('target')]\n e2_params = sorted(e2_params, key=lambda v:...
[ "0.7390843", "0.68741804", "0.67029196", "0.665507", "0.6509292", "0.6229956", "0.61885196", "0.61367434", "0.6095319", "0.59850127", "0.5970698", "0.590594", "0.5901211", "0.5888207", "0.5879602", "0.58706075", "0.5864949", "0.5862743", "0.5858625", "0.5857816", "0.5840897",...
0.65118545
4
Returns True is string is a number.
def is_number_tryexcept(s): try: float(s) return True except ValueError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_number(string):\r\n try:\r\n float(string)\r\n return True\r\n except ValueError: return False", "def is_number(string):\n try:\n float(string)\n return True\n except ValueError:\n return False", "def is_number(s):\r\n try:\r\n int(s)\r\n r...
[ "0.8850884", "0.8807396", "0.87623763", "0.87143797", "0.86495125", "0.86369324", "0.8611852", "0.8602863", "0.8597067", "0.8597067", "0.8597067", "0.85868895", "0.8556723", "0.8540039", "0.846474", "0.83899784", "0.83504224", "0.82912153", "0.8217023", "0.81620115", "0.81181...
0.75407887
61
restore a preset from a json file
def tempcontrol_preset_restore(self, filename: str) -> None: if filename == "-": return filename = os.path.join(self.tempcontrol_presets_path, str(filename) + ".json") # print(filename) try: with open(filename) as f: tempcontrol_preset = json.loads...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore(self, filename=\".azimint.json\"):\n logger.debug(\"Restore\")\n if not os.path.isfile(filename):\n logger.error(\"No such file: %s\" % filename)\n return\n data = json.load(open(filename))\n setup_data = { \"poni\": self.poni.setText,\n# \"dete...
[ "0.6819465", "0.681742", "0.59871584", "0.5828821", "0.5716159", "0.5630111", "0.56096715", "0.5575501", "0.55467796", "0.5539216", "0.5455987", "0.54179984", "0.53913265", "0.53611207", "0.5346904", "0.5345367", "0.53257084", "0.53080916", "0.53048027", "0.5291933", "0.52915...
0.7014069
0