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
Whether import is from Python `builtins` module.
def is_builtins(self) -> bool: return self.source.startswith(self.builtins_import_string)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isbuiltin(object):\n if inspect.isbuiltin(object):\n return True\n\n return getattr(object, '__module__', None) == 'builtins'", "def can_import(name):\n try:\n __import__(name)\n return True\n except ImportError:\n return False", "def is_builtin(fn) -> bool:\n ret...
[ "0.7769979", "0.7204395", "0.70813054", "0.6808869", "0.67874414", "0.6704766", "0.66938317", "0.6655915", "0.65290385", "0.6506746", "0.6412168", "0.6361563", "0.6315668", "0.62910324", "0.62482315", "0.61838263", "0.6172486", "0.6084502", "0.6044414", "0.599626", "0.5993880...
0.8617272
0
Get list of global variable names in exodus file.
def get_global_variable_names(self): return [b"".join(_i).strip().decode() for _i in self._f.variables["name_glo_var"][:]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def global_values(self):\n return self.globals.values()", "def list_of_vars_in_user_file():\n # parser = argparse.ArgumentParser()\n # parser.add_argument(\"path\")\n # path = parser.parse_args().path\n # path = DUMMY_FILE_PATH\n path = parser.parse_args().path\n logger.info(\"Using the ...
[ "0.7005294", "0.6926549", "0.69198376", "0.67853296", "0.67798495", "0.6777889", "0.66388804", "0.66081005", "0.6588747", "0.65842366", "0.64675844", "0.645544", "0.6445328", "0.6369555", "0.6356497", "0.63554895", "0.63462335", "0.6332596", "0.63029397", "0.62456274", "0.623...
0.74201846
0
Tests tuple in which, in comparison order does not matter.
def test_unorder_tuple() -> None: assert UnorderedTuple((1, 2, 3)) == (3, 2, 1) assert UnorderedTuple((1, 3)) != (3,) assert UnorderedTuple((1, 2, 3)) == (1, 2, 3) assert UnorderedTuple((1, 2, 3)) == (2, 3, 1) assert not UnorderedTuple((7, 2, 3)).__eq__((1, 2, 5))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unpack_all_equal_tuple(t):\n if not isinstance(t, tuple):\n return t\n\n assert all(x == t[0] for x in t)\n return t[0]", "def test_tuples_to_avoid(self):\n self.assertFalse(\n any(key in self.resultDict and self.resultDict[key] == tuplesToAvoid[key] for key in tuplesToAvoid...
[ "0.7438869", "0.7215219", "0.7138882", "0.6944386", "0.6940476", "0.68486047", "0.68054307", "0.6765844", "0.6594706", "0.65943456", "0.65751874", "0.6561736", "0.64943", "0.64874905", "0.64801335", "0.6458465", "0.64491165", "0.6411613", "0.63956076", "0.63847715", "0.633042...
0.78470224
0
Tests mock for SQLAlchemy with scalar when rows are empty.
def test_scalar_none() -> None: mock_session = UnifiedAlchemyMagicMock() data = mock_session.query(Model).scalar() assert data is None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_scalar_attribute() -> None:\n expected_column_val = \"test\"\n mock_session = UnifiedAlchemyMagicMock(\n data=[\n (\n [\n mock.call.query(Model.name),\n mock.call.filter(Model.pk1 == 3),\n ],\n [(exp...
[ "0.8088177", "0.7255612", "0.66960675", "0.6680683", "0.6672585", "0.6467992", "0.63236195", "0.6287787", "0.628413", "0.6246249", "0.6107963", "0.610712", "0.5974273", "0.59724617", "0.5951871", "0.59417254", "0.5919405", "0.5903869", "0.58950835", "0.5891279", "0.5888563", ...
0.8431401
0
Tests mock for SQLAlchemy with scalar for getting an attribute.
def test_scalar_attribute() -> None: expected_column_val = "test" mock_session = UnifiedAlchemyMagicMock( data=[ ( [ mock.call.query(Model.name), mock.call.filter(Model.pk1 == 3), ], [(expected_column_val...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_tuple() -> None:\n mock_session = UnifiedAlchemyMagicMock()\n mock_session.add(Model(pk1=\"123\", name=\"test\"))\n user = mock_session.query(Model).get((\"123\",))\n assert user is not None", "def test_scalar_singular() -> None:\n mock_session = UnifiedAlchemyMagicMock()\n expecte...
[ "0.6941098", "0.6464978", "0.64299685", "0.64219916", "0.6375519", "0.63062084", "0.6149681", "0.6095504", "0.60744876", "0.6042962", "0.5965748", "0.5943618", "0.59241813", "0.5885507", "0.58711976", "0.57113004", "0.5672664", "0.5628886", "0.56203496", "0.5602872", "0.55819...
0.80826706
0
Convert UNIX timestamp to date of game. Timestamp is in UTC time. If before 10am, assign to previous day
def date_from_timestamp(ts): datetime = dt.datetime.fromtimestamp(ts, tz=dt.timezone.utc) date = datetime.date() if datetime.hour < 10: date -= dt.timedelta(1) return date
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def utcfromtimestamp(unix_epoch_timestamp):\n (y, m, d, hour, min, sec) = time.gmtime(unix_epoch_timestamp)[:6]\n return datetime.datetime(y, m, d, hour, min, sec, 0, UTC_TZ)", "def _make_timestamp(self):\r\n\t\tlogger.debug(\"Get a timestamp\")\r\n\t\treturn time.mktime(datetime.today().timetuple())", "...
[ "0.59150136", "0.587712", "0.5839828", "0.5767954", "0.57527727", "0.57394856", "0.57302254", "0.5723907", "0.57170767", "0.56959844", "0.56266594", "0.5583265", "0.55781156", "0.55321723", "0.55050194", "0.5493355", "0.5462932", "0.5449407", "0.54479223", "0.5440364", "0.543...
0.6825801
0
get the top k indexes of elements in list
def get_top_k_indexes_of_list(target_list, k, is_max=True, min_value=None): indexes = sorted(range(len(target_list)), key=lambda i: target_list[i], reverse=is_max)[:k] result = list() if min_value is not None: for index in indexes: if target_list[index] <= min_value: brea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def indices_of_top_k(arr, k):\n return np.sort(np.argpartition(np.array(arr), -k)[-k:])", "def sorted_top_k(item_counts, k):\n # Partitioning runs in O(d) time.\n top_k_unsorted = np.argpartition(-item_counts, k - 1)[:k]\n # Sorting highest k counts runs in O(k * log(k)) time.\n sorting_order = np.argsort...
[ "0.81564945", "0.75693125", "0.7451825", "0.7416087", "0.7389833", "0.73073125", "0.7287712", "0.7287541", "0.71782684", "0.71492666", "0.7050277", "0.7016585", "0.6957951", "0.6935773", "0.69040745", "0.6887736", "0.68736106", "0.6822242", "0.6808193", "0.67954326", "0.67589...
0.7762503
1
n = len(grid) m = len(grid[0]) Add extra column at start and end to make the DP code below easier as we wont have to worry about array index going out of bounds dp = [[[1 for i in range(m + 2)] for j in range(m + 2)] for k in range(2)] curr = 1
def cherryPickup(self, grid: List[List[int]]) -> int: # Solution 1 - 752 ms # Solution 2 - 296 ms n, m = len(grid), len(grid[0]) dp = [[0] * (m + 2) for _ in range(m + 2)] dp[0][m - 1] = grid[0][0] + grid[0][m - 1] for i in range(1, n): # each level tmp = [[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_dp(arr, n, value):\n dp = [[False for i in range(value+1)] for j in range(n+1)]\n \n for i in range(n+1):\n for j in range(value+1):\n if j ==0:\n dp[i][j] = True\n elif i == 0:\n dp[i][j] = False\n else:\n if dp...
[ "0.6929614", "0.6894414", "0.6581324", "0.6387183", "0.63011676", "0.61915535", "0.615863", "0.61510926", "0.6119725", "0.6109836", "0.61079246", "0.608929", "0.60850555", "0.6052707", "0.604016", "0.6006788", "0.59918404", "0.5986282", "0.59667504", "0.5948518", "0.59244055"...
0.5936244
20
Create start state s_0 by creating an instance of chess.Board without parameters.
def start_state(): return chess.Board()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial_state() -> Board:\n board = (\"rnbqkbnr\", \"pppppppp\", \"........\", \"........\", \"........\",\n \"........\", \"PPPPPPPP\", \"RNBQKBNR\")\n\n return board", "def __init__(self, s = None): # Constructor Initializes New TicTacToe Board\n\n if s is None:\n self...
[ "0.7175675", "0.7163925", "0.69524217", "0.68722296", "0.6820933", "0.67646563", "0.6751897", "0.67451715", "0.66671586", "0.65852535", "0.6583955", "0.6528703", "0.6526843", "0.6517267", "0.64318043", "0.64065593", "0.6396193", "0.63906384", "0.6380939", "0.63762546", "0.636...
0.7407132
0
Takes a string or bytes instance Returns bytes, encoding strings in utf8 as necessary
def kafka_bytestring(s): if isinstance(s, bytes): return s if isinstance(s, bytes): return s.encode('utf-8') raise TypeError(s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _as_bytes(s):\n if isinstance(s, bytes):\n return s\n return bytes(s, encoding='latin_1')", "def give_me_bytes(string):\n return string.encode('utf8') if isinstance(string, str) else string", "def as_utf8(value):\n assert value is None or isinstance(value,types.StringTypes)\n if isins...
[ "0.78789115", "0.786755", "0.7853331", "0.781696", "0.77882993", "0.77628845", "0.775935", "0.7742865", "0.76835704", "0.76126474", "0.75809926", "0.7560572", "0.75466776", "0.75369805", "0.748969", "0.7446199", "0.7407698", "0.73765635", "0.7370925", "0.7366173", "0.7313073"...
0.72077256
27
Gets the command string to the left of the autocomp activation character.
def GetCommandStr(self, line=None, col=None): if None in (line, col): # NOTE: the column position returned by GetCurLine is not correct # for multibyte characters. line, col = self.GetCurLine() col = self.GetColumn(self.GetCurrentPos()) cmd = self._c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command(self) -> str:\n cmd = ''\n if self.argv:\n cmd = self.argv[0]\n return cmd", "def accelerator_string():\n if is_mac():\n return \"Command\"\n else:\n return \"Ctrl\"", "def get_command(self):\n return self.c_dict['COMMAND']", "def _get_co...
[ "0.65989995", "0.65966505", "0.6444107", "0.6407239", "0.636327", "0.6315185", "0.63031125", "0.6292603", "0.62836796", "0.62830573", "0.6268605", "0.6266396", "0.6228238", "0.6149656", "0.6137546", "0.61362547", "0.6132986", "0.61143917", "0.609516", "0.6082235", "0.6074455"...
0.5542928
69
Return a reference to the document object represented in this buffer.
def GetDocument(self): return self.file
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_document(self):\n return self.document", "def current_document(self):\n return self.current_buffer.document", "def get_doc(self):\n return self._doc", "def get_doc(self):\n return self.p", "def document(self):\n query = {\"_id\": ObjectId(self.document_id)}\n ...
[ "0.7754489", "0.7752174", "0.73847544", "0.71739477", "0.71615356", "0.6927931", "0.6892295", "0.6892246", "0.68866545", "0.6709929", "0.6632898", "0.65285605", "0.6519638", "0.6512118", "0.6395905", "0.63928676", "0.63756174", "0.6363685", "0.6352276", "0.6347696", "0.630649...
0.70110404
5
Returns the full path name of the current file
def GetFileName(self): return self.file.GetPath()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCurrentFileName(self):\n return os.path.basename(self.filePath)", "def get_file_name(self):\n return str(self.get_file())", "def get_name(self) -> str:\n return os.path.split(os.getcwd())[-1]", "def get_current_file_uri(self): # real signature unknown; restored from __doc__\n ...
[ "0.84706455", "0.7943912", "0.7880384", "0.7726042", "0.7687154", "0.761016", "0.76094806", "0.7597246", "0.7569293", "0.75638306", "0.7559089", "0.75495315", "0.7462976", "0.74420065", "0.74420065", "0.74420065", "0.74420065", "0.74420065", "0.743451", "0.74292463", "0.74153...
0.7777628
3
Get the keyword set for the current document.
def GetKeywords(self): return self._code['keywords']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getKeywords(self):\n return", "def keywords(self) -> Set[str]:\n return self._keywords", "def get_keywords(self):\r\n\t\treturn list(self.keyword_headlines().keys())", "def keywords(self):\n return self._keywords", "def keywords(self):\n return self._keywords", "def keywor...
[ "0.69609123", "0.67799413", "0.66237193", "0.6587038", "0.6587038", "0.65765136", "0.63525665", "0.6314063", "0.6294022", "0.6271629", "0.62711895", "0.6235446", "0.618823", "0.6141747", "0.6077335", "0.6065039", "0.6063697", "0.60342526", "0.59869814", "0.59662396", "0.59306...
0.64262956
6
Hide autocomp/calltip popup windows if any are active
def HidePopups(self): if self.AutoCompActive(): self.AutoCompCancel() self.CallTipCancel()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide(self):\n super().hide()\n\n warnings.warn(\"Use of show() and hide() methods of UIToolTip objects is not supported.\")", "def hide_gui():\n pass", "def __editShowCallTips(self):\n self.activeWindow().callTip()", "def DoShowHide(self):\r\n\r\n pages = self.GetPages(...
[ "0.6634318", "0.65855145", "0.65289015", "0.6328443", "0.6278066", "0.6205472", "0.6155302", "0.6144133", "0.6141024", "0.6083898", "0.6074375", "0.6073089", "0.60657525", "0.6031467", "0.5998974", "0.5980013", "0.5957826", "0.5945813", "0.5933806", "0.59165543", "0.5911912",...
0.84292096
0
Add entire contents of the map (or scope) to this scope.
def include(self, map): self.map.update(map)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append(self, m=None):\n if m is None:\n m = {}\n if self.mapper is not None:\n m = self.mapper(m)\n self._maps.insert(0, m)", "def scope_push(self) -> None:\n self.scope_stack.appendleft(defaultdict(lambda: 0))", "def push(self, mapping):\n self.mapp...
[ "0.5950232", "0.56513035", "0.5554205", "0.5496433", "0.54815125", "0.5428497", "0.53264177", "0.52691275", "0.5252456", "0.5252456", "0.52465665", "0.5212838", "0.5211486", "0.5210575", "0.52035135", "0.5187728", "0.51600635", "0.51319045", "0.51128864", "0.5108049", "0.5099...
0.65408236
0
Adds a temp var with a particular name. Adds the same var only once.
def addTemp(self, type, name): temp = " %s %s;" % (type, name) self.temps.add(temp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_variable(self, name):\n self.all_variables.add(name)", "def var_name ( self , name ) :\n if name in self.__var_names and not NameDuplicates.allowed() :\n self.warning ( 'The variable name \"%s\" is already defined!' % name )\n \n self.__var_names.add ( name )...
[ "0.7145549", "0.682994", "0.68005913", "0.68005913", "0.67591023", "0.66517466", "0.6591053", "0.6449306", "0.63693726", "0.63074255", "0.62553465", "0.6225449", "0.6217692", "0.6182188", "0.60841864", "0.6065289", "0.5878625", "0.5867975", "0.5795167", "0.5795078", "0.578651...
0.5981792
16
Constructs 4D homogeneous rotation matrix given the rotation angles (degrees) around the x, y and zaxis. Rotation is implemented in XYZ order.
def rotation_matrix(rx, ry, rz): # Convert from degrees to radians. rx = np.pi * rx / 180 ry = np.pi * ry / 180 rz = np.pi * rz / 180 # Pre-compute sine and cosine of angles. cx, cy, cz = np.cos([rx, ry, rz]) sx, sy, sz = np.sin([rx, ry, rz]) # Set up euler rotations. Rx = np.array...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_rotation_matrix(x_angle, y_angle, z_angle):\n return np.array([\n [1, 0, 0],\n [0, np.cos(x_angle), -np.sin(x_angle)],\n [0, np.sin(x_angle), np.cos(x_angle)],\n ]).dot([\n [np.cos(y_angle), 0, np.sin(y_angle)],\n [0, 1, 0],\n ...
[ "0.77897334", "0.7526077", "0.7479741", "0.7239904", "0.7133518", "0.71079236", "0.70733625", "0.7063366", "0.7020628", "0.7007095", "0.6998829", "0.69801474", "0.6944173", "0.6944173", "0.6929848", "0.6881783", "0.68540263", "0.6847796", "0.68283296", "0.68283296", "0.682832...
0.67861193
24
Constructs a 4D homogeneous translation matrix given translations along each axis in 3D.
def translation_matrix(tx, ty, tz): T = np.array([[1, 0, 0, tx], [0, 1, 0, ty], [0, 0, 1, tz], [0, 0, 0, 1 ]]) return T
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matrix_translate_3d(tx: float, ty: float, tz: float) -> np.matrix:\n return np.matrix([[1, 0, 0, tx], [0, 1, 0, ty], [0, 0, 1, tz], [0, 0, 0, 1]])", "def get_affine_matrix3d(\n translations: torch.Tensor,\n center: torch.Tensor,\n scale: torch.Tensor,\n angles: torch.Tensor,\n sxy: Optional...
[ "0.73995066", "0.7138529", "0.7031038", "0.6940252", "0.68516237", "0.6737939", "0.6498432", "0.6344508", "0.62567097", "0.62078106", "0.61975265", "0.61405706", "0.6091014", "0.60847783", "0.60373956", "0.5968538", "0.59646744", "0.5951252", "0.5924158", "0.5915942", "0.5880...
0.63440347
8
Constructs a 4D homogeneous scaling matrix given coefficients for along each axis in 3D.
def scaling_matrix(sx, sy, sz): S = np.array([[sx, 0, 0, 0], [0, sy, 0, 0], [0, 0, sz, 0], [0, 0, 0, 1]]) return S
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_4x4_transform(scale_x, scale_y, trans_x, trans_y, trans_z):\r\n transform = [[scale_x, 0.0, 0.0, trans_x],\r\n [0.0, scale_y, 0.0, trans_y],\r\n [0.0, 0.0, 1.0, trans_z],\r\n [0.0, 0.0, 0.0, 1.0]]\r\n return transform", "def scale_on_3d(x3d, scaler):\...
[ "0.64456284", "0.6251178", "0.6069709", "0.6032151", "0.5829363", "0.5779725", "0.57516825", "0.5743453", "0.5716767", "0.56997925", "0.5549493", "0.5491846", "0.54084843", "0.5355805", "0.5355507", "0.52865636", "0.528564", "0.5279906", "0.52771086", "0.5242258", "0.5242258"...
0.58104616
5
Constructs a 4D homogeneous camera matrix used to convert points defined in XYZ world coordinates into UVW camera coordinates.
def camera_matrix(e, p, t): # Translates all points such that the camera is centered at the origin. T = np.array([[1, 0, 0, -e[0]], [0, 1, 0, -e[1]], [0, 0, 1, -e[2]], [0, 0, 0, 1]]) # Set up orthonormal basis. w = e - p w = w / np.linalg.no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_cam2world_matrix(forward_vector,\n origin,\n device=None):\n \"\"\"\"\"\"\n\n forward_vector = normalize_vecs(forward_vector)\n up_vector = torch.tensor([0, 1, 0], dtype=torch.float, device=device) \\\n .expand_as(forward_vector)\n\n left_vect...
[ "0.656684", "0.64433134", "0.6431393", "0.61653274", "0.61488014", "0.61158794", "0.60222054", "0.6007472", "0.60003954", "0.59789073", "0.5974462", "0.595589", "0.59053206", "0.58979625", "0.58119667", "0.57961875", "0.57760084", "0.5726807", "0.56944716", "0.5690399", "0.56...
0.63592356
3
Constructs a 4D homogeneous orthographic projection which takes the orthographic view volume in camera coordinates and projects points in the zdirection onto the view plane.
def orthographic_projection_matrix(width, height, w=5, h=5, n=0.01, f=5): # Transformation that maps from orthographic vv to canonical vv. Morth = np.array([[2/w, 0, 0, 0], [ 0, 2/h, 0, 0], [ 0, 0, 2/(n-f), -(n+f)/(n-f)], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ortho(self):\r\n\r\n m11,m12,m13,m14,m21,m22,m23,m24,m31,m32,m33,m34,m41,m42,m43,m44 = self.mlist\r\n\r\n x = _vec3(m11, m21, m31)\r\n y = _vec3(m12, m22, m32)\r\n z = _vec3(m13, m23, m33)\r\n\r\n xl = x.length()\r\n xl*=xl\r\n y = y - ((x*y)/xl)*x\r\n z ...
[ "0.703008", "0.6563406", "0.64877576", "0.6414314", "0.63702804", "0.626806", "0.61560285", "0.60030985", "0.59109914", "0.58733064", "0.5817149", "0.57849216", "0.578156", "0.5760139", "0.57500225", "0.57060647", "0.56950665", "0.56950665", "0.56950665", "0.5677936", "0.5675...
0.66393363
1
Removes tabs and newlines from string.
def stripchars(string): return ''.join(re.split('\t+|\n+', string))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_whitespace(text):\n return text\n #return re.sub(r'\\r\\n|\\n', \"\\t\", text)", "def _clean(self, string):\n return re.sub('\\s+', ' ', string).strip()", "def trim_spaces_and_tabs_from_lines_in_txt(txt: str) -> str:\n\n clean_txt = ''\n\n # convert the text string into a buffer so...
[ "0.7131498", "0.6815469", "0.68133026", "0.67697644", "0.67097414", "0.66640854", "0.6655165", "0.66426", "0.6469221", "0.6413262", "0.64002585", "0.6316176", "0.6282253", "0.62691593", "0.62503856", "0.6229829", "0.6224153", "0.6211109", "0.6211109", "0.6199217", "0.61830556...
0.7090024
1
The number of seconds since the current time that the Timer object was created. If stop() was called, it is the number of seconds from the instance creation until stop() was called.
def elapsed(self): return self.__last_time() - self.__start
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_time(self):\n return self.__stopped", "def seconds(self):\n end = self.end or timezone.now()\n result = end - self.start\n return result.seconds", "def get_time_taken_sec(self) -> float:\n return self.time_stop - self.time_start", "def span(self):\n\t\tif self._ini...
[ "0.7374453", "0.7228181", "0.7172592", "0.7143886", "0.71120405", "0.7111584", "0.7099551", "0.7083851", "0.7075201", "0.7041047", "0.70302045", "0.70089567", "0.70064896", "0.70007235", "0.69817567", "0.69696903", "0.69371533", "0.69265455", "0.6866689", "0.6861071", "0.6860...
0.6807719
29
Total elapsed time formatted into full time units, such as minutes, hours, days, and weeks. Merely for humanreadable convenience.
def elapsed_human(self): intervals = ( ('weeks', 604800), ('days', 86400), ('hours', 3600), ('mins', 60), ('secs', 1), ) seconds = self.elapsed result = [] for name, count in intervals: value = int(seconds //...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_elapsed__(self):\n elapsed = (self.__end_time - self.__start_time)\n unit = \"seconds\"\n if elapsed >= 3600:\n unit = \"minutes\"\n hours = elapsed / 3600\n minutes = hours % 60\n hours = floor(hours)\n print(self.name, \"took\"...
[ "0.7248333", "0.71959794", "0.70962316", "0.70399606", "0.7036604", "0.689992", "0.68363327", "0.679965", "0.674469", "0.66846013", "0.6675882", "0.6617891", "0.6611681", "0.6570431", "0.6543147", "0.6524653", "0.649252", "0.64885646", "0.647779", "0.6453928", "0.63972926", ...
0.7440106
0
Nicely format the elapsed time
def __str__(self): return str(self.elapsed) + ' sec'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def elapsed_time_formatted(begin_time):\n return time.strftime(\n \"%H:%M:%S\", (time.gmtime(time.perf_counter() - begin_time))\n )", "def print_time_elapsed(self):\r\n stop_time = time.time()\r\n elapsed_time = stop_time - self.start_time\r\n print(f\"-- time elapsed: {elapsed_...
[ "0.8056446", "0.761588", "0.7571828", "0.74103373", "0.73772144", "0.7280322", "0.7274481", "0.7256777", "0.7241627", "0.7139499", "0.71394044", "0.712192", "0.71147853", "0.7085338", "0.6965322", "0.68510187", "0.6800423", "0.6781992", "0.6763407", "0.6739775", "0.6739775", ...
0.78823423
1
Turn left or right, and update self.facing.
def make_rotation(self, rotation): if rotation == "r": self.facing += 1 else: self.facing -= 1 if self.facing > 3: self.facing = self.facing - 4 elif self.facing < 0: self.facing = self.facing + 4
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_left(self):\n self.facing_direction -= self.config\n if self.facing_direction < 0:\n self.facing_direction += 8\n self.x, self.y = self.compute_positions()", "def MoveLeftStep(self):\n if self.facing == 0:\n self.facing = 3\n self.x -= self.st...
[ "0.83907086", "0.78416497", "0.7721693", "0.7714201", "0.7560327", "0.74728197", "0.74133885", "0.7395737", "0.73637086", "0.7318562", "0.7317247", "0.7316994", "0.7266569", "0.7187408", "0.71710896", "0.7102229", "0.70881844", "0.70572394", "0.7041981", "0.7001698", "0.69212...
0.0
-1
Get the config for this program, returning a dict with the settings.
def _get_config(): default_config = { "venv_command": "virtualenv", "venv_dir_name": "python_env", "debug": False } config = {} # the config that is read from the config file config_location = os.path.join(os.path.expanduser("~"), ".ashconfig") if (os.path.exists(config_loca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config(self) -> Dict[str, Any]:\n if self.config is None:\n self.config = self.load_config()\n\n return self.config", "def get_config(self) -> Dict[str, Any]:\n if self.config is None:\n self.config = self.load_config()\n\n return self.config", "def get...
[ "0.7874162", "0.7874162", "0.7721656", "0.7705732", "0.7681489", "0.7639969", "0.75157416", "0.7498866", "0.746978", "0.746348", "0.74596083", "0.7454312", "0.74264735", "0.7420661", "0.73547137", "0.73503673", "0.7348374", "0.7323422", "0.7281526", "0.72723025", "0.72705215"...
0.7183027
29
Returns the sector for occupation
def sector(self): return self.sub_sector.sector
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sector(self) -> str:\n return self._sector", "def get_sector(self):\n _FUNCTION_KEY = \"SECTOR\"\n # The keys for the json output\n _DATA_KEYS = [\"Rank A: Real-Time Performance\",\n \"Rank B: 1 Day Performance\",\n \"Rank C: 5 Day Performance\",\n \"Rank D: 1...
[ "0.7832576", "0.6933661", "0.6229794", "0.6073522", "0.6045569", "0.6008484", "0.6003909", "0.5953048", "0.59001565", "0.58677125", "0.58618003", "0.5746578", "0.57450277", "0.57260764", "0.5676001", "0.561831", "0.5585232", "0.55805814", "0.5546895", "0.55357665", "0.5526631...
0.8010936
0
Get the last name.
def get_last_name(name): names = name.split(' ') last_name_reversed = [names[-1]] # Get all tussenvoegsels. for name in reversed(names[:-1]): # If it starts with a lower letter, then it is a tussenvoegsel. if name[0] == name[0].lower(): last_name_reversed.append(name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_last_name(self) -> str:\n return self.last_name", "def get_last_name(self):\n return self._last_name", "def last_name(self):\n return self._last_name", "def last_name(self):\n return self._last_name", "def last_name(self):\n return self._last_name", "def last_na...
[ "0.91555804", "0.91361827", "0.8858747", "0.8858747", "0.8858747", "0.8858747", "0.8841243", "0.8810566", "0.8767634", "0.87093616", "0.87093616", "0.87093616", "0.87093616", "0.87093616", "0.87020123", "0.8692867", "0.86670375", "0.86670375", "0.85378474", "0.84221745", "0.8...
0.7320188
74
Given a RGB list, it will return RGBA. Given a RGBA list, it will return the same RGBA.
def get_four_byte_color(color: Color) -> RGBA: if len(color) == 4: return cast(RGBA, color) elif len(color) == 3: return color[0], color[1], color[2], 255 else: raise ValueError("This isn't a 3 or 4 byte color")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_colors(color_list):\n rgba_colors = []\n a = [0.5,0.5,0.6,0.4,0.3,0.2]\n i = 0\n for c in color_list:\n rgba_colors.append(list(colors.to_rgba(c)))\n rgba_colors[i][3] = a[i]\n i+=1\n\n return rgba_colors", "def _rgb_to_rgba(self, r, g, b):\n # r, g, b must be o...
[ "0.73821336", "0.67090815", "0.66064924", "0.658714", "0.6526058", "0.6471333", "0.6413131", "0.63349825", "0.62323904", "0.62301177", "0.6216219", "0.6178115", "0.61683345", "0.614354", "0.6100281", "0.60829926", "0.6061172", "0.6057479", "0.60466146", "0.6018253", "0.599965...
0.58129615
33
Given a 3 or 4 RGB/RGBA color where each color goes 0255, this returns a RGBA tuple where each item is a scaled float from 0 to 1.
def get_four_float_color(color: Color) -> Tuple[float, float, float, float]: if len(color) == 4: return color[0] / 255, color[1] / 255, color[2] / 255, color[3] / 255 # type: ignore elif len(color) == 3: return color[0] / 255, color[1] / 255, color[2] / 255, 1.0 else: raise Va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale_to_01(color: C3I) -> C3F:\n r, g, b = color\n return r / 255, g / 255, b / 255", "def int2color_tuple(x):\n red_val = int(1000 * x % 255)\n green_val = int(10000 * x % 255)\n blue_val = int(100000 * x % 255)\n return red_val, green_val, blue_val", "def _rgb(x, y, z):\n rg...
[ "0.71369964", "0.7089543", "0.70342153", "0.70069474", "0.69829077", "0.6957394", "0.6884102", "0.6754152", "0.6747241", "0.66614246", "0.66549826", "0.66485894", "0.6643773", "0.6641664", "0.6620446", "0.66188705", "0.66138583", "0.6580415", "0.6579433", "0.6558158", "0.6554...
0.7273119
0
Return a random sample of size elements from the set values with the specified probabilities
def weighted_values(values, probabilities, size): bins = np.add.accumulate(probabilities) indices = np.digitize(random_sample(size), bins) sample = [] for ind in indices: sample.append(deepcopy(values[ind])) return sample
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample(probs):\n\n probs = probs / probs.sum()\n return np.random.choice(np.arange(len(probs)), p=probs.flatten())", "def sample(self, probabilities):\n return self.sample_bernoulli(probabilities)", "def sample_from_probabilities(probabilities, topn=ALPHASIZE):\n p = np.squeeze(probabilities)\n...
[ "0.773701", "0.7685272", "0.7265837", "0.70998913", "0.6991657", "0.6874625", "0.6835768", "0.6806354", "0.6799155", "0.67314327", "0.67314327", "0.67265946", "0.6653857", "0.66339856", "0.6592515", "0.6589461", "0.65481406", "0.65452516", "0.65274304", "0.651309", "0.6485539...
0.7155044
3
Should return a 400 when users do not exist
def test_post_invalid(self): sender = UserFactory() data = { 'senderId': sender.id, 'recipientId': 999, 'text': '...' } response = self.client.post( reverse('messages:list'), content_type='application/json', data=da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_exists_without_email(self):\n response = self.client.post(self.url)\n expected_response_code = 400\n\n self.assertEqual(expected_response_code, response.status_code)", "def test_get_single_user_is_missing(self):\n add_user(\"neilb\", \"neilb14@mailinator.com\")\n ...
[ "0.76681226", "0.75198215", "0.73395085", "0.71774733", "0.7155559", "0.71433884", "0.71291727", "0.70543295", "0.70141894", "0.69891006", "0.69761795", "0.69621897", "0.6936803", "0.6925479", "0.68853277", "0.68737656", "0.68721706", "0.6866711", "0.68602943", "0.68190134", ...
0.0
-1
Returns `seq` as tuple or the singular element. Which is returned is determined by how the AttentionMechanism(s) were passed to the constructor.
def _item_or_tuple(self, seq): t = tuple(seq) if self._is_multi: return t else: return t[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _item_or_tuple(self, seq):\n t = tuple(seq)\n if self._is_multi:\n return t\n else:\n return t[0]", "def to_sequence(arg, seq_type=None):\n def return_type(t):\n if t:\n if t is tuple:\n return (arg, ) if arg else tuple()\n elif t is dict:\n ...
[ "0.6939912", "0.5811643", "0.5799722", "0.57843417", "0.5691608", "0.5684094", "0.5639943", "0.5623543", "0.5592669", "0.55210155", "0.54793924", "0.54213285", "0.5358898", "0.5354659", "0.533129", "0.533129", "0.533129", "0.533129", "0.533129", "0.533129", "0.533129", "0.5...
0.69283915
2
Helper function to turn all cells to the same value
def render_grid(grid): rows = grid.shape[0] cols = grid.shape[1] for row in range(rows): for col in range(cols): if grid[row, col] != 1 and grid[row, col] != 0: grid[row, col] = 1 return grid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_cell_change(self, x, y):\n self.cells[x][y] = 1 if not self.cells[x][y] else 0", "def set_value(self, value):\n for row in self.rows:\n row.set_values(value)", "def values_to_grid(self):\n str = []\n for r in self.rows:\n for c in self.cols:\n ...
[ "0.56222826", "0.5539462", "0.5469502", "0.5456232", "0.54366046", "0.5435179", "0.5418345", "0.5413742", "0.541372", "0.5346108", "0.5304557", "0.5287137", "0.5277188", "0.5259613", "0.52584255", "0.52323335", "0.5229255", "0.5216543", "0.513518", "0.51315093", "0.51315093",...
0.0
-1
Provides the root page
def index(request): logger = logging.getLogger('dri.custom') model = _detect_platform(request) logger.info("request from %s" % model['platform']) if request.user.is_authenticated(): model['username'] = request.user.username else: model['username'] = '__ANONYMOUS' return render_to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root_page(\n self\n ) -> AbstractPage:\n return self._root_page", "def get_root():\r\n return render_template(\"index.html\"), 200", "def root():\n return render_template('root.html')", "def root():\n return render_template('index.html')", "def root():\n return render_templ...
[ "0.849095", "0.83811444", "0.8245176", "0.80568844", "0.80568844", "0.80568844", "0.76346093", "0.7584435", "0.7513413", "0.74725497", "0.7437352", "0.74009526", "0.73994344", "0.73428357", "0.7320466", "0.72995067", "0.7297373", "0.728499", "0.7283204", "0.72448516", "0.7244...
0.0
-1
This extension indicates the suspected date/time the private key was compromised or the certificate became invalid. This would usually be before the revocation date, which is when the CA processed the revocation.
def invalidity_date_value(self): if self._processed_extensions is False: self._set_extensions() return self._invalidity_date_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid(self):\n created = datetime.datetime(2019, 1, 1, tzinfo=datetime.timezone.utc)\n last_used = datetime.datetime(2019, 1, 2, tzinfo=datetime.timezone.utc)\n key = Key('user2', 'ldasfkk', 'Inactive', created, last_used)\n with pytest.raises(AssertionError):\n ke...
[ "0.5781822", "0.567098", "0.5645613", "0.5575619", "0.5365794", "0.5358108", "0.530108", "0.52100646", "0.5204799", "0.51714444", "0.5145594", "0.51134306", "0.51095545", "0.50828993", "0.5037756", "0.50318545", "0.49901834", "0.49711666", "0.49694875", "0.49510258", "0.49503...
0.47214004
56
Ensure a search is absent
def absent(name, profile="splunk"): ret = { "name": name, "changes": {}, "result": True, "comment": "{} is absent.".format(name), } target = __salt__["splunk_search.get"](name, profile=profile) if target: if __opts__["test"]: ret = {} ret[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_non_existent_term_search(self):\n\n expected_results = []\n results = self.searcher.search(\"asdasdasdas\")\n\n self.assertListEqual(results, expected_results)", "def test_search_nolocation_noquery(objectsearch):\n with pytest.raises(InvalidSearchParameterError):\n objects...
[ "0.7274467", "0.69201213", "0.6856707", "0.6780216", "0.6722034", "0.67181987", "0.66916144", "0.66897696", "0.6593837", "0.65421075", "0.6486469", "0.6433917", "0.6427549", "0.6419896", "0.6407969", "0.63993263", "0.6392781", "0.6368896", "0.6344802", "0.6343901", "0.6326062...
0.5536898
82
Returns an array of indices where the indices are computed such that indices[..., i + 1, ...] indices[..., i, ...] >= spacing instantaneous_period[..., i, ...] for all i. The returned indices do not contain the first spacing period and last spacing period indices. Here i is indexing the time_axis. Since the number of v...
def period_indices(instantaneous_frequencies, spacing=1, dt=1, time_axis=-1): skips = np.ceil(spacing * ((2 * np.pi) / instantaneous_frequencies * dt)).astype(int) indices = [np.take(skips, 0, time_axis)] indices[-1][indices[-1] >= instantaneous_frequencies.shape[time_axis] - 1] = -1 while np.any(indice...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _indicies_of_periods(datetime_index, freq, use_local_time=True):\n\n if use_local_time:\n datetime_index = _tz_to_naive(datetime_index)\n\n periods = pd.period_range(datetime_index[0], datetime_index[-1], freq=freq)\n\n # Declare and initialise some constants and variables used\n # during th...
[ "0.62710446", "0.5572225", "0.53506887", "0.5339127", "0.5328395", "0.5326511", "0.5269407", "0.52231854", "0.5222472", "0.52003497", "0.5142711", "0.5119126", "0.5116413", "0.5085673", "0.50808406", "0.49289274", "0.48887897", "0.48330262", "0.48299977", "0.48104307", "0.480...
0.8512424
0
Convert a list of sed pairs to a string for the sed command.
def SedPairsToString(pairs): sed_str = '; '.join(['s/%s/%s/g' % pair for pair in pairs]) if pairs: sed_str += ';' return sed_str
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command_list_to_str(command):\n return \" \".join(pipes.quote(i) for i in command)", "def _toStr(toList):\n\n names = [formataddr(i) for i in zip(*toList)]\n return ', '.join(names)", "def list_to_sentence(self, list):\n sentence = \"\\n\"\n for i in range(0, len(list)):\n ...
[ "0.590633", "0.5718408", "0.5235378", "0.52312064", "0.5191583", "0.5184724", "0.5184099", "0.51792705", "0.51644224", "0.5142555", "0.5140919", "0.50996995", "0.50992095", "0.506604", "0.5050447", "0.4996769", "0.4983027", "0.4980119", "0.49611506", "0.4957372", "0.495534", ...
0.80745894
0
Return a string of length num_bytes, made of random bytes suitable for cryptographic use (because randomfloat draws from a os provided random source). WARNING If python implements float as a C single precision floating point number instead of a double precision then there will not be 53 bits of data in the coefficient.
def random_randombytes(num_bytes, random_float=None): # To ensure accurate testing, this allows the source # of random floats to be supplied. if random_float is None: random_float = randomfloat() randombytes = '' # num_bytes/6 + 1 is used because at most a single float # can only result ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_bytes(num):\n\treturn numpy.fromstring(\n\t\tos.urandom(num),\n\t\tdtype=numpy.uint8\n\t)", "def random_bytes(N):\n return Crypto.Random.get_random_bytes(N)", "def get_random(self, num_bytes: int) -> bytes:\n if num_bytes > 1024:\n logger.warning(\n \"Requesting a...
[ "0.66996133", "0.6584932", "0.65840244", "0.6543467", "0.64583164", "0.6288619", "0.5916267", "0.58964574", "0.58914614", "0.5891183", "0.58809507", "0.5829821", "0.58171844", "0.58127975", "0.5785366", "0.56840634", "0.5668295", "0.565096", "0.5643558", "0.5635315", "0.55740...
0.8050053
0
Return a list that has no duplicate items list_a The list to operate on TypeError if list_a is not a list. None. A list containing the unique items in list_a
def listops_uniq(list_a): retlist = [] for item in list_a: if item not in retlist: retlist.append(item) return retlist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique(input_list): \n try:\n # intilize a null list \n unique_list = [] \n # traverse for all elements \n for x in input_list: \n # check if exists in unique_list or not \n if x not in unique_list: \n unique_list.append(x)\n return(un...
[ "0.7303466", "0.7286975", "0.71356225", "0.7121483", "0.711358", "0.7083522", "0.70649517", "0.69522727", "0.68819344", "0.6857622", "0.68518835", "0.6772112", "0.6742464", "0.6721509", "0.67207545", "0.66689694", "0.66335154", "0.6628316", "0.66202205", "0.6606312", "0.65833...
0.8459525
0
Encode a string to go in the query fragment of a URL.
def urllib_quote_plus(inputstring, safestring=""): if type(inputstring) is not str: raise TypeError("urllib_quote_plus' inputstring parameter must be a string, not '"+str(type(inputstring))+"'") if type(safestring) is not str: raise TypeError("urllib_quote_plus' safestring parameter must be a string, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _encode_url(full_url):\n return urllib.parse.quote(full_url, safe=\"%/:=&?~#+!$,;'@()*[]|\")", "def _url_encode(self, text):\n try:\n return (urllib.quote(text.replace(u'and', u'&'), safe='')\n .replace(u'%20', u'+'))\n except:\n print('Using pyth...
[ "0.70569295", "0.70454586", "0.69930124", "0.68769807", "0.6838194", "0.67498964", "0.66761625", "0.6597267", "0.6576176", "0.6555812", "0.6551991", "0.650856", "0.6501401", "0.64935625", "0.6439764", "0.6439764", "0.6417391", "0.6368108", "0.6310636", "0.63014597", "0.627381...
0.0
-1
Unquote a urlencoded string.
def urllib_unquote(inputstring): if type(inputstring) is not str: raise TypeError("urllib_unquote's inputstring parameter must be a string, not '"+str(type(inputstring))+"'") resultstr = "" # We go through the inputstring from end to beginning, looking for wrapped # octets. When one is found ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _unquote(s, encoding='utf-8'):\n return urllib.unquote(s).decode(encoding)", "def _unquote(src, encoding=\"utf-8\"):\n return urllib.unquote(src).decode(encoding)", "def _safe_urlunquote(string, charset='utf-8', errors='replace', unsafe=''):\n rv = _safe_urlunquote_to_bytes(string, unsafe)\n if...
[ "0.82473546", "0.778585", "0.77454245", "0.74391717", "0.7417779", "0.7365394", "0.6996479", "0.69169354", "0.6908334", "0.6882838", "0.6852325", "0.6684939", "0.6674152", "0.6648583", "0.66089284", "0.6568208", "0.64435434", "0.63871217", "0.63474977", "0.62975204", "0.62915...
0.65503347
16
Unquote the urlencoded query fragment of a URL.
def urllib_unquote_plus(inputstring): if type(inputstring) is not str: raise TypeError("urllib_unquote_plus' inputstring parameter must be a string, not '"+str(type(inputstring))+"'") return urllib_unquote(inputstring.replace("+", " "))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def urlparse(url):\n\tunquote_url=urllib.parse.unquote(url)\n\treturn unquote_url", "def clean_params(self, url):\n if isinstance(url, unicode):\n url = url.encode(\"utf-8\")\n parts = list(urlparse.urlsplit(url))\n if not parts[3]:\n return url\n query = urlpars...
[ "0.6808747", "0.6630341", "0.65743923", "0.65590864", "0.6541089", "0.65012944", "0.6488638", "0.6437236", "0.6354556", "0.6348515", "0.6346561", "0.632208", "0.6321765", "0.63087386", "0.62827224", "0.6231945", "0.6185669", "0.6174215", "0.6159867", "0.6154405", "0.6104001",...
0.0
-1
Returns False for 'don't trust', None for 'use your discretion' and True for everything is okay. The second item in the return value is a list of reasons / justifications newsigneddata must contain full request by default, oldsigneddata must contain only the full previous request (for compatibility issues). if oldsigne...
def signeddata_shouldtrust(oldsigneddata, newsigneddata, publickey=None, oldsigneddata_is_fullrequest=True): returned_comments = [] # we likely only want to keep the signature data around in many cases. For # example, if the request is huge. # if not signeddata_issignedcorrectly(oldsigneddata, publicke...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signeddata_shouldtrustmeta(oldsignature, newsigneddata, publickey=None):\r\n return signeddata_shouldtrust(oldsignature, newsigneddata, publickey=None, oldsigneddata_is_fullrequest=False)", "def check_persistent(data, signatures):\n\n if should_upgrade:\n return True\n\n if verify_data(data, si...
[ "0.7777103", "0.53076535", "0.5171078", "0.50925547", "0.5047929", "0.5044387", "0.49383107", "0.49322924", "0.49233347", "0.49089885", "0.4890658", "0.48669547", "0.48355365", "0.48250213", "0.477888", "0.47549137", "0.47467527", "0.474322", "0.47350755", "0.47142226", "0.47...
0.7780654
0
Creates mapping from layer name to its index in the layers array.
def LayersToDict(network): layers_dict = {} for i, layer in enumerate(network.layer): if layer.name in layers_dict: raise AssertionError('Network should not have duplicate layer names') layers_dict[layer.name] = i return layers_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ret_layer_index(file):\n\t\tnames={}\n\t\tfor i in range(len(file[0])):\n\t\t\tprint(file[0][i][0][0][0])\n\t\t\tnames[file[0][i][0][0][0][0]]=i\n\t\tprint(\"Success layer_index\")\n\t\treturn names", "def get_feature_layer_index(feature_layer_collection, layer_name):\r\n for index, url in zip(range(len(f...
[ "0.68279344", "0.65490454", "0.6522157", "0.64500403", "0.62212235", "0.6023958", "0.59797055", "0.5969139", "0.5950468", "0.58173084", "0.5750115", "0.5750115", "0.5750115", "0.57330936", "0.5692017", "0.5664986", "0.5640263", "0.56366575", "0.5568411", "0.5563068", "0.55561...
0.5603997
18
Close the connection and reclaim to connection pool
def close(self): if getattr(self, "_db", None): self._db.close() self._db = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\r\n self.conn.close()\r\n gc.collect()", "def close(self):\n # Instead of actually closing the connection,\n # return it to the pool so that it can be reused.\n if self._con is not None:\n self._pool.returnConnection(self._con)\n self._con...
[ "0.84006894", "0.8184836", "0.811713", "0.8027628", "0.78066635", "0.7768433", "0.77576584", "0.7756549", "0.7750243", "0.77219373", "0.7713075", "0.7708889", "0.7680378", "0.7677778", "0.76644766", "0.76640046", "0.7648282", "0.7648282", "0.7638025", "0.7627721", "0.7584692"...
0.0
-1
Test content view with an invalid url
def test_content_invalid_url(self): from .views import WikiViews request = testing.DummyRequest() request.POST = {'wiki_url': INVALID_URL} wiki_view = WikiViews(request) info = wiki_view.content() self.assertTrue('error_message' in info)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_download_view_invalid_url(self):\n factory = RequestFactory()\n request = factory.get('/downloads');\n error = False\n try:\n response = views.download(request, 'fake_id');\n except: \n error = True\n\n self.assertTrue(error)", "def test_content_valid_url(self):\n from...
[ "0.7461196", "0.7330342", "0.71264124", "0.6979722", "0.68899745", "0.68126285", "0.6792618", "0.67626464", "0.6703165", "0.66923916", "0.66893643", "0.6642208", "0.6637848", "0.6635446", "0.6605738", "0.65887916", "0.6510099", "0.6510099", "0.6510099", "0.6510099", "0.649673...
0.84053254
0
Retrieves podcast episodes by username.
def podcast_episodes_by_username(username, *, page=1): try: return _get_podcast_episodes(username=username, page=page) except exceptions.NotFound as exc: return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def podcast_show(url, name):\n for recording in scraper.get_podcast_episodes(url):\n INTERFACE.add_item(recording['title'],\n 'play_podcast',\n recording['url'],\n extra_info=recording)", "def _get_feed_episodes(self, show_ke...
[ "0.60400665", "0.6015998", "0.58328587", "0.5791422", "0.577275", "0.56913024", "0.56771183", "0.56032795", "0.55588555", "0.54486614", "0.54289275", "0.53564847", "0.5319116", "0.5303787", "0.5302216", "0.5298815", "0.52370447", "0.5230516", "0.5222261", "0.52210414", "0.521...
0.8410669
0
Update your policy. Behavior may differ based on what stage of training your in. If you're in training mode then you should check if you should update your network parameters based on the current step and the value you set for train_freq. Inside, you'll want to sample a minibatch, calculate the target values, update yo...
def update_policy(self): # this is update_policy # sample batch of 32 from the memory batch_of_samples = self.replay_memory.sample(batch_size=32) current_state_samples = batch_of_samples['current_state_samples'] next_state_samples = batch_of_samples['next_state_samples'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def policy_update(self):\n mini_batch = random.sample(self.data_buffer, self.batch_size)\n state_batch = [data[0] for data in mini_batch]\n mcts_probs_batch = [data[1] for data in mini_batch]\n winner_batch = [data[2] for data in mini_batch]\n loss, entropy = self.policy_value_ne...
[ "0.73503506", "0.7006701", "0.69865555", "0.68984425", "0.6843435", "0.6673789", "0.6540192", "0.6507718", "0.6493951", "0.6476405", "0.6395478", "0.6389557", "0.6325243", "0.6318873", "0.63146526", "0.6299186", "0.6290823", "0.6275576", "0.6273195", "0.62586766", "0.62358016...
0.6913679
3
Sets cost and capacity for the batteries.
def set_attributes(self): for i, battery in enumerate(sorted(self.batteries.values(), key=operator.attrgetter("weight"))): setattr(battery, "cap", self.caps[self.big_iterations][i]) if self.caps[self.big_iterations][i] is 450: cost = 90...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_costs(self):\n plant_size_kw = (self.sam_sys_inputs[\"resource_potential\"]\n / self._RESOURCE_POTENTIAL_MULT) * 1000\n\n cc_per_kw = self.sam_sys_inputs.pop(\"capital_cost_per_kw\", None)\n if cc_per_kw is not None:\n capital_cost = cc_per_kw * plan...
[ "0.6384189", "0.63597924", "0.633854", "0.63364667", "0.6129922", "0.6119545", "0.6074736", "0.60039765", "0.59370995", "0.5867402", "0.5830723", "0.5813903", "0.57950574", "0.5731161", "0.57254714", "0.569206", "0.56478125", "0.5582783", "0.5543123", "0.5499928", "0.5497146"...
0.7383766
0
Integration test for the GradingPeriodsAPI.list_grading_periods_courses method.
def test_list_grading_periods_courses(self): course_id = None # Change me!! r = self.client.list_grading_periods_courses(course_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_grading_periods_accounts(self):\r\n account_id = None # Change me!!\r\n\r\n r = self.client.list_grading_periods_accounts(account_id)", "def test_delete_grading_period_courses(self):\r\n course_id = None # Change me!!\r\n id = None # Change me!!\r\n\r\n r = sel...
[ "0.7108761", "0.7059082", "0.65951127", "0.6310765", "0.62711495", "0.6216145", "0.61631775", "0.59279877", "0.5824827", "0.5781228", "0.57209325", "0.56694126", "0.5661068", "0.5652117", "0.5602861", "0.5600922", "0.5556388", "0.5550436", "0.55304736", "0.55053717", "0.54378...
0.894887
0
Integration test for the GradingPeriodsAPI.update_single_grading_period method.
def test_update_single_grading_period(self): # This method utilises the PUT request method and will make changes to the Canvas instance. This needs consideration. pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_single_grading_period(self):\r\n course_id = None # Change me!!\r\n id = None # Change me!!\r\n\r\n r = self.client.get_single_grading_period(id, course_id)", "def test_update_status_period(self):\n prev_status = self.test_period.status\n self.test_period.status ...
[ "0.69845796", "0.6812234", "0.6412379", "0.6157303", "0.60062796", "0.5985099", "0.59689444", "0.5940228", "0.59345084", "0.5927067", "0.59146667", "0.59098744", "0.58964896", "0.58612126", "0.58491373", "0.58360356", "0.58297294", "0.5810597", "0.5799645", "0.57896626", "0.5...
0.8215607
0
Integration test for the GradingPeriodsAPI.delete_grading_period_courses method.
def test_delete_grading_period_courses(self): course_id = None # Change me!! id = None # Change me!! r = self.client.delete_grading_period_courses(id, course_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_grading_period_accounts(self):\r\n account_id = None # Change me!!\r\n id = None # Change me!!\r\n\r\n r = self.client.delete_grading_period_accounts(id, account_id)", "def test_list_grading_periods_courses(self):\r\n course_id = None # Change me!!\r\n\r\n r ...
[ "0.75833064", "0.6909592", "0.6792736", "0.6424348", "0.64069575", "0.63611716", "0.6360712", "0.62079555", "0.61742896", "0.616665", "0.6148095", "0.6141553", "0.6101076", "0.60638005", "0.60261947", "0.5979559", "0.5968472", "0.5917169", "0.5835212", "0.5814243", "0.5801908...
0.8991518
0
Integration test for the GradingPeriodsAPI.delete_grading_period_accounts method.
def test_delete_grading_period_accounts(self): account_id = None # Change me!! id = None # Change me!! r = self.client.delete_grading_period_accounts(id, account_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_grading_period_courses(self):\r\n course_id = None # Change me!!\r\n id = None # Change me!!\r\n\r\n r = self.client.delete_grading_period_courses(id, course_id)", "def test_list_grading_periods_accounts(self):\r\n account_id = None # Change me!!\r\n\r\n r = ...
[ "0.7284307", "0.6545909", "0.64688987", "0.62764364", "0.6233528", "0.61143774", "0.6093314", "0.60529953", "0.5863081", "0.58551776", "0.5769698", "0.57656384", "0.5757938", "0.5757938", "0.5721929", "0.5716139", "0.5716139", "0.5685281", "0.56666476", "0.5658521", "0.561058...
0.896754
0
Get credentials api key from os environment. Set environment variable named 'DEVELOPER_KEY' and put the credentials api key there.
def get_credential_key(): try: developer_key = os.environ["DEVELOPER_KEY"] except DevKeyNotFoundError as e: raise DevKeyNotFoundError("environment var 'DEVELOPER_KEY' not found.", e) return developer_key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_api_key():\n if not os.getenv(\"SPOON_API_KEY\"):\n raise RuntimeError(\"SPOON_API_KEY is not set\")\n return os.getenv(\"SPOON_API_KEY\")", "def get_api_key():\n try:\n return os.environ[\"GOOGLE_APPLICATION_CREDENTIALS\"]\n except Exception:\n raise EnvErro...
[ "0.7215546", "0.71962875", "0.71143264", "0.6951302", "0.6931595", "0.6837858", "0.6803877", "0.66552377", "0.6547555", "0.6501168", "0.64675975", "0.6458996", "0.6375849", "0.6327537", "0.63211334", "0.6292651", "0.62908393", "0.62860316", "0.6285024", "0.625393", "0.6235968...
0.79030865
0
Assumes myList is sorted. Returns closest value to myNumber. If two numbers are equally close, return the smallest number.
def get_closest(a, n): pos = bisect_left(a, n) if pos == 0: return a[0] if pos == len(a): return a[-1] before = a[pos - 1] after = a[pos] if after - n < n - before: return after else: return before
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def takeClosest(myList, myNumber):\r\n pos = bisect_left(myList, myNumber)\r\n if pos == 0:\r\n return myList[0]\r\n if pos == len(myList):\r\n return myList[-1]\r\n before = myList[pos - 1]\r\n after = myList[pos]\r\n if after - myNumber < myNumber - before:\r\n return after\...
[ "0.8773548", "0.8521784", "0.76910925", "0.7655947", "0.72878736", "0.7014442", "0.6730663", "0.6696116", "0.6679095", "0.663801", "0.6608539", "0.6563781", "0.65589035", "0.64773256", "0.64609545", "0.64382815", "0.6437101", "0.6386349", "0.6370029", "0.63542634", "0.6332671...
0.64118
17
Calculate the Hamming distance between two strings
def hamming(s1, s2): assert len(s1) == len(s2) return sum(c1 != c2 for c1, c2 in zip(s1, s2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def HammingDist(str1, str2):\n\tHdist = 0\n\tfor i, base in enumerate(str1):\n\t\tif base != str2[i]:\n\t\t\tHdist += 1\n\n\treturn Hdist", "def compute_hamming_distance(str1, str2):\n\n mismatches = 0\n len_strs = len(str1)\n for i in range(len_strs):\n if str1[i] != str2[i]:\n mismat...
[ "0.8766253", "0.8736932", "0.86937994", "0.8684328", "0.8628626", "0.85640013", "0.85608804", "0.84767383", "0.84472585", "0.8428427", "0.83657295", "0.8365521", "0.83173376", "0.83006084", "0.82374394", "0.8078711", "0.80054915", "0.8000618", "0.79753214", "0.7959728", "0.79...
0.7625429
31
Creates logger to debug HTTP messages sent and responses received. Output should be sent to Nammu's console.
def setup_logger(self): logger = logging.getLogger() logger.setLevel(logging.DEBUG) request_log = logging.getLogger("requests.packages.urllib3") request_log.setLevel(logging.DEBUG) request_log.propagate = True return logger, request_log
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logger(request):\n log = logging.getLogger()\n hdlr = logging.StreamHandler()\n fmt = '%(asctime)s %(name)s %(levelname)s %(message)s'\n formatter = logging.Formatter(fmt)\n hdlr.setFormatter(formatter)\n log.addHandler(hdlr)\n log.setLevel(logging.DEBUG)\n log.propagate = False\n\n ...
[ "0.6708473", "0.65318024", "0.6449779", "0.64493966", "0.64345473", "0.64054173", "0.6301283", "0.6279755", "0.6192836", "0.6174732", "0.6146249", "0.61042714", "0.6061431", "0.60521466", "0.60218453", "0.6017474", "0.6008965", "0.60064375", "0.5996023", "0.5985881", "0.59766...
0.6460974
2
Test case to check if self.new_project is instance of Project
def test_instance(self): self.assertIsInstance(self.new_project, Project)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_project_from_template(self):\n project_new = self.project_template.take_template()\n\n self.assertTrue(project_new)", "def _check_project(cls, project):\n \n if project is None:\n raise TypeError(\"Sequence.project can not be None\")\n \n if no...
[ "0.75852174", "0.73515385", "0.7276486", "0.7265314", "0.7023589", "0.7023589", "0.7023589", "0.7004742", "0.69663554", "0.69524276", "0.69516253", "0.69476146", "0.67799765", "0.6769305", "0.67472154", "0.6684736", "0.6669059", "0.6604833", "0.6603394", "0.6594571", "0.65931...
0.8792662
0
Test case to ckeck if class method returns queryset of projects by user
def test_find_by_user(self): self.new_project.save() projects = Project.find_by_user(self.new_user) self.assertTrue(len(projects) > 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\r\n username = self.kwargs['username']\r\n return models.Projects.objects.filter(username = username).order_by('-id')", "def get_queryset(self):\n queryset = Project.objects.filter(contributor__user=self.request.user.pk)\n return queryset", "def test_returns_...
[ "0.7231784", "0.72082376", "0.68474317", "0.6800799", "0.6752884", "0.6723066", "0.67031246", "0.6607588", "0.66003174", "0.66003174", "0.65997124", "0.65997124", "0.65718985", "0.6555672", "0.6537444", "0.6522701", "0.6517143", "0.6494893", "0.64805347", "0.6463387", "0.6462...
0.6810093
3
Test to check if object is being added to database with proper properties
def test_database(self): review = Review(project=self.new_project, user=self.new_user, design=7, usability=6, content=5, comment="This is a nice website.") review.save() reviews = Review.objects.all() self.assertTrue(len(reviews) > 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create(self):\n\t\tself.obj.save()\n\t\tself.assertEqual(1, self.obj.id)", "def test_database_object_can_be_created(self):\n database = generate_database_object()", "def test_member_created_if_valid_fields(self):\n member = Member.objects.create(**self.data)\n\n member_dict = mode...
[ "0.7054895", "0.6906998", "0.6674186", "0.66502666", "0.66105974", "0.6564696", "0.65618926", "0.6508318", "0.64905477", "0.6478231", "0.6461382", "0.6412122", "0.640414", "0.640281", "0.63942283", "0.63834023", "0.63717294", "0.636524", "0.63594687", "0.63376", "0.63342226",...
0.0
-1
Returns template path in current site's theme if it finds one there otherwise returns same path.
def get_template_path_with_theme(relative_path): relative_path = os.path.normpath(relative_path) theme = get_current_theme() if not theme: return relative_path # strip `/` if present at the start of relative_path template_name = re.sub(r'^/+', '', relative_path) template_path = theme...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def template_path(self):\n return self.get_config(\"templates\")", "def get_html_theme_path():\n theme_path = os.path.abspath(Path(__file__).parent)\n return theme_path", "def get_template_name(self):\n if self.template_name:\n return self.template_name\n\n if Path('_templ...
[ "0.69739556", "0.690675", "0.6891636", "0.67688745", "0.67627597", "0.67404675", "0.6713622", "0.66970164", "0.6595784", "0.6573577", "0.6527588", "0.65024334", "0.64771044", "0.6465", "0.63946366", "0.62714314", "0.6190552", "0.61054933", "0.60886174", "0.6078952", "0.606936...
0.7382813
0
Return current site theme object. Returns None if theming is disabled.
def get_current_site_theme(): # Return None if theming is disabled if not is_comprehensive_theming_enabled(): return None request = get_current_request() if not request: return None return getattr(request, 'site_theme', None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_theme():\n # Return None if theming is disabled\n if not is_comprehensive_theming_enabled():\n return None\n\n site_theme = get_current_site_theme()\n if not site_theme:\n return None\n try:\n return Theme(\n name=site_theme.theme_dir_name,\n ...
[ "0.8250695", "0.76589316", "0.698671", "0.6760024", "0.6483215", "0.64658403", "0.64248043", "0.62334526", "0.60471624", "0.60143644", "0.59761035", "0.5924598", "0.5914873", "0.58678544", "0.57791895", "0.5741412", "0.5683378", "0.5650629", "0.5650629", "0.5630643", "0.55620...
0.84940505
0
Return current theme object. Returns None if theming is disabled.
def get_current_theme(): # Return None if theming is disabled if not is_comprehensive_theming_enabled(): return None site_theme = get_current_site_theme() if not site_theme: return None try: return Theme( name=site_theme.theme_dir_name, theme_dir_name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_theme(self) -> str:\n return self.theme or self.account.theme", "def get_current_site_theme():\n # Return None if theming is disabled\n if not is_comprehensive_theming_enabled():\n return None\n\n request = get_current_request()\n if not request:\n return None\n return...
[ "0.7741704", "0.7685231", "0.70820934", "0.68839675", "0.6833027", "0.6743844", "0.66950154", "0.64078367", "0.6382941", "0.6276829", "0.59897673", "0.59424835", "0.58195364", "0.5774384", "0.5774384", "0.5738433", "0.562897", "0.55609053", "0.55376756", "0.54944664", "0.5469...
0.8076537
0
True if current request has an associated SiteTheme, False otherwise.
def current_request_has_associated_site_theme(): request = get_current_request() site_theme = getattr(request, 'site_theme', None) return bool(site_theme and site_theme.id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_request_in_themed_site():\n # We need to give priority to theming/site-configuration over microsites\n return configuration_helpers.is_site_configuration_enabled()", "def theme_exists(theme_name, themes_dir=None):\n for theme in get_themes(themes_dir=themes_dir):\n if theme.theme_dir_name ...
[ "0.7778505", "0.64130974", "0.62077755", "0.6121127", "0.60960716", "0.58464235", "0.58065736", "0.5786061", "0.5771539", "0.5771321", "0.5749466", "0.57431406", "0.57415074", "0.56331855", "0.55992913", "0.55985594", "0.5565457", "0.55493623", "0.55429244", "0.5526863", "0.5...
0.89896756
0
Returns absolute path to the directory that contains the given theme.
def get_theme_base_dir(theme_dir_name, suppress_error=False): for themes_dir in get_theme_base_dirs(): if theme_dir_name in get_theme_dirs(themes_dir): return themes_dir if suppress_error: return None raise ValueError( "Theme '{theme}' not found in any of the following ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_html_theme_path():\n cur_dir = path.abspath(path.dirname(path.dirname(__file__)))\n return cur_dir", "def get_html_theme_path():\n theme_path = os.path.abspath(Path(__file__).parent)\n return theme_path", "def path_for(filename):\n if settings.value(Key.Theme) == Themes.Light.value:\n ...
[ "0.83916837", "0.8235648", "0.70113474", "0.669696", "0.66495794", "0.6554418", "0.6434663", "0.64265186", "0.64180124", "0.6410468", "0.63965416", "0.6377103", "0.63733345", "0.6372273", "0.63592577", "0.6358978", "0.63468796", "0.63225657", "0.6283258", "0.6261193", "0.6254...
0.6767352
3
Returns True if a theme exists with the specified name.
def theme_exists(theme_name, themes_dir=None): for theme in get_themes(themes_dir=themes_dir): if theme.theme_dir_name == theme_name: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_theme(theme: str) -> bool:\n themes = [\"dark\", \"light\"]\n\n return theme in themes", "def has_theme(cards, theme):\n for card in cards:\n if card.CARDTYPE == theme:\n return True\n\n return False", "def theme_named(self, name):\n for theme in self.themes:\n ...
[ "0.69477934", "0.67651", "0.6572805", "0.6489543", "0.6396061", "0.6382874", "0.63825196", "0.63773435", "0.6372545", "0.6346465", "0.6249786", "0.61879647", "0.6182132", "0.6150977", "0.6105677", "0.6104482", "0.6089566", "0.6001367", "0.5999713", "0.5909561", "0.59078085", ...
0.8665631
0
Given a configuration setting name, try to get it from the site configuration and then fall back on the settings. If site_config_name is not specified then "name" is used as the key for both collections.
def get_config_value_from_site_or_settings(name, site=None, site_config_name=None): from openedx.core.djangoapps.site_configuration.models import SiteConfiguration if site_config_name is None: site_config_name = name if site is None: site = get_current_site() site_configuration = None...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lookup(self, name):\n for config in self._config:\n if name in config:\n return config[name]\n raise AttributeError(\"%s not found\" % name)", "def get(config_name):\n if config_name.lower() in GlobalConfig.__CONFIG__:\n return GlobalConfig.__CONFIG__...
[ "0.6901054", "0.68115896", "0.6794572", "0.67648077", "0.6377811", "0.6297295", "0.6231046", "0.6217044", "0.61751527", "0.6167867", "0.61327803", "0.6120906", "0.61104524", "0.6046321", "0.6042534", "0.59831536", "0.5971346", "0.58899873", "0.58101517", "0.57999504", "0.5782...
0.74300796
0
Create an empty queue.
def __init__(self): self.head = None self.tail = None self.size = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_empty_queue():\n return Queue(0, None, None)", "def empty_queue():\n return Queue()", "def empty_queue():\n return Queue()", "def test_new_queue_is_empty(self):\n queue = Queue_()\n self.assertTrue(queue.empty())\n self.assertEqual(queue.size(), 0)", "def new_queue() ...
[ "0.90226257", "0.8610326", "0.8610326", "0.7646727", "0.73392534", "0.7214641", "0.7142951", "0.6982411", "0.6858135", "0.68511164", "0.6781897", "0.6774313", "0.6763828", "0.6726111", "0.66783184", "0.6677383", "0.6663354", "0.6637819", "0.66147155", "0.65712017", "0.6567653...
0.0
-1
Returns an iterator over all pairs in the dictionary.
def iteritems(self): for aVal, bValues in self._forwardMap.iteritems(): for bVal in bValues: yield aVal, bVal return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_over_pairs(pairs):\r\n if isinstance(pairs, dict):\r\n return pairs.iteritems()\r\n else:\r\n return pairs", "def iteritems(self):\n return iter((kvp.key, kvp.value) for kvp in self.keyvaluepair_set.all())", "def iter_pairs(iterable):\n if isinstance(iterable, Mapping):\n...
[ "0.77233595", "0.76620656", "0.74234", "0.74155945", "0.73725754", "0.7356539", "0.7354709", "0.73396003", "0.7335147", "0.72835", "0.7276098", "0.71971494", "0.7170003", "0.7133238", "0.7117946", "0.71056044", "0.70852494", "0.7075732", "0.7063353", "0.7037241", "0.70282096"...
0.67448527
42
View function for home page of site.
def index(request): # # Generate counts of some of the main objects # class_iter = Course.objects.all() # num_instances = BookInstance.objects.all().count() # # Available books (status = 'a') # num_instances_available = BookInstance.objects.filter(status__exact='a').count() # num_authors = Autho...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home(request):\n\treturn render(request, \"compta/home.html\")", "def home_page(request):\r\n return render(request, 'ez_main/home_page.html')", "def home(request):\r\n return render(request, 'home.html')", "def homepage(request):\n\treturn render(request, 'core/homepage.html')", "def homepage(req...
[ "0.8493426", "0.84268916", "0.83415145", "0.83306193", "0.82976943", "0.8295291", "0.8276345", "0.82545686", "0.82155704", "0.8132563", "0.81246215", "0.81224865", "0.8121264", "0.81049734", "0.8098485", "0.80935514", "0.80935514", "0.80935514", "0.80935514", "0.80935514", "0...
0.0
-1
Return the corresponding comorbidity age interval for a specific age.
def age_to_interval(i): for idx, a in enumerate(intervals): if i >= a[0] and i < a[1]: return idx return idx
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAgeRange(brand):\n from numpy import arange, append\n \n # search dictionary for tuple containing age limits (min, max, delta)\n #age_limits = age_range[brand]\n \n # hard code age range properties (temporary)\n if brand in ['Lyon', 'Lyon10', 'Lyon19']:\n ages = 10.0**arange(6.0,...
[ "0.6455693", "0.640271", "0.6327247", "0.6300604", "0.6205258", "0.60999656", "0.6064718", "0.59822494", "0.596171", "0.5887836", "0.5883653", "0.5843932", "0.5843125", "0.58104235", "0.58104235", "0.5768421", "0.57676464", "0.5740681", "0.57178587", "0.571724", "0.56994736",...
0.6703571
0
Returns redundant entity columns. Returns list List containing redundant entity columns.
def get_redundant_entity_attributes(self): return self.__redundant_entity_attributes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def graphcols(self):\n columns = []\n table = self.__parent_table\n for col in self.__column_list:\n columns.append(table.table_column(col).title())\n return columns", "def columns(self) -> List[str]:\n return self._columns.tolist()", "def columns(self) -> List[str...
[ "0.6134326", "0.6031242", "0.60053396", "0.5987721", "0.59580076", "0.5910951", "0.5909695", "0.5873988", "0.58475816", "0.58324593", "0.58288604", "0.58193094", "0.5802081", "0.5792087", "0.5784093", "0.5740437", "0.5739823", "0.5734095", "0.5687649", "0.5684333", "0.5678777...
0.6497619
0
Returns the current status of the data frame. Returns DataFrame DataFrame with current state.
def get_df(self): return self.__df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAllStatus(self) -> DataFrame:\n return self.writer.getAllStatus()", "def df(self):\n return self._df", "def dataframe(self):\n return self._df", "def dataframe(self):\n\t\treturn self._dataframe", "def _fetch_status_data(self, force=False):\n if self.status is None or force:\...
[ "0.6795013", "0.64420336", "0.6418395", "0.6346773", "0.6232229", "0.6191857", "0.61263585", "0.60699", "0.60471743", "0.5843687", "0.5806156", "0.5800556", "0.5733715", "0.5730203", "0.57008666", "0.5679983", "0.5662189", "0.5662189", "0.5653932", "0.5636732", "0.56089634", ...
0.599845
9
Returns a dictionary with the original textual attribute as key and the new temporary non redundant entity attributes as values. Returns dict Dictionary with textual attributes and nonredundant entity attributes as values.
def get_textual_attribute_mapping(self): textual_attributes = self.__config.get_textual_attributes() textual_attributes_mapping = {} for textual_attribute in textual_attributes: textual_attributes_mapping[textual_attribute] = [attribute for attribute in self.__non_redundant_entity_at...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_attributes(self):\n \n retdict = {}\n retdict['s'] = str(self.s)\n if self.t != None:\n retdict['t'] = str(self.t)\n retdict['a'] = str(self.a)\n retdict['b'] = str(self.b)\n retdict['c'] = str(self.c)\n retdict['d'] = str(self.d)\n retu...
[ "0.61704963", "0.6125045", "0.6108884", "0.5915138", "0.5908417", "0.57849437", "0.56523573", "0.5651087", "0.55761325", "0.5536961", "0.55347776", "0.5526084", "0.55090594", "0.5499553", "0.54907674", "0.5489312", "0.54405063", "0.5412314", "0.53534317", "0.53508794", "0.534...
0.66483885
0
Create a measurespace (i.e. loglikelihood) graph for a random variable or a list of random variables at a given point. The input `var` determines which loglikelihood graph is used and `rv_value` is that graph's input parameter. For example, if `var` is the output of a ``NormalRV`` ``Op``, then the output is a graph of ...
def logpt( var: Union[TensorVariable, List[TensorVariable]], rv_values: Optional[Union[TensorVariable, Dict[TensorVariable, TensorVariable]]] = None, *, jacobian: bool = True, scaling: bool = True, transformed: bool = True, sum: bool = True, **kwargs, ) -> Union[TensorVariable, List[Tens...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_variable(mean=0., variance=1., shape=None, rand_gen=None, dtype=None, ctx=None):\n dist = GammaMeanVariance(mean=mean, variance=variance,\n rand_gen=rand_gen, dtype=dtype, ctx=ctx)\n dist._generate_outputs(shape=shape)\n return dist.random_variable", ...
[ "0.5476776", "0.5175515", "0.5175515", "0.5171044", "0.5137063", "0.51322067", "0.5106136", "0.50240594", "0.50226885", "0.501719", "0.5003001", "0.5002476", "0.4997248", "0.49942818", "0.49888542", "0.49850997", "0.49850997", "0.49756703", "0.4967799", "0.49664396", "0.49441...
0.5551725
0
Get CEPH Service Config
def get_srv_config(name): cmd = "ceph --admin-daemon %s/%s.asok config show" % \ (CEPH_SOCKET_PATH, name) out = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, \ stdout=subprocess.PIPE, stderr=subprocess.STDOUT) return json.loads(out.stdout.read())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_config():\n global _service_config\n if not _service_config:\n r = requests.get('https://tech.lds.org/mobile/ldstools/config.json')\n r.raise_for_status()\n _service_config = r.json()\n return _service_config", "def Get():\n return ServiceConfig() # Singleton decorat...
[ "0.7256941", "0.70819736", "0.7079839", "0.7012895", "0.6980297", "0.6898995", "0.6852244", "0.6821273", "0.6810551", "0.6810551", "0.6810551", "0.6810551", "0.6810551", "0.6810551", "0.6810551", "0.6810551", "0.6810551", "0.6810551", "0.6810551", "0.6810551", "0.6810551", ...
0.666912
81
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order.
def twoSum(nums, target): for i in range(len(nums)): print(i, '= i -->', nums[i]) for j in range(len(nums)): print(j, '= j -->', nums[j]) guess = nums[i]+nums[j] print(str(target) + ' = ' + str(nums[i]+nums[j])+ ' ?' ) if target == guess: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_indices(nums, target):\n indices = []\n i = 0\n number_found = False\n while not number_found:\n my_target = nums[i]\n \n for j in range(i+1,len(nums)):\n my_target += nums[j]\n if my_target == target:\n number_found = True\n ...
[ "0.86316645", "0.81819457", "0.81629694", "0.8010719", "0.79435533", "0.7934517", "0.78285635", "0.78203166", "0.7808818", "0.7787377", "0.7759948", "0.77566195", "0.77133876", "0.7684208", "0.76838756", "0.7665235", "0.75577307", "0.75416005", "0.7492591", "0.73422474", "0.7...
0.7448171
19
Get a single user by id.
async def get(self, id: UUID4) -> Optional[UD]: user = await self.async_deta_base.get(key=id) return self.user_db_model(**user) if user else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_by_id(self, id):\n\t\treturn self.users.get(id)", "def get(id):\n return User.query.filter_by(id=id).first()", "def get(self, id):\n\t\ttry:\n\t\t\tflask_app.logger.debug('We are getting the user: %d', id)\n\t\t\treturn user_service.get(id)\n\t\texcept AssertionError as e:\n\t\t\tuser_space...
[ "0.8954462", "0.86967933", "0.86164325", "0.85865873", "0.8586173", "0.84648013", "0.84557533", "0.8447721", "0.8442431", "0.84335", "0.8426591", "0.8410328", "0.8351894", "0.8344186", "0.8327877", "0.8327877", "0.8327877", "0.8327877", "0.8324929", "0.83147055", "0.82802576"...
0.0
-1
Get a single user by OAuth account id.
async def get_by_oauth_account(self, oauth: str, account_id: str) -> Optional[UD]: user = await looped_fetch( self.async_deta_base.fetch, query={ "oauth_accounts.oauth_name": oauth, "oauth_accounts.account_id": account_id, }, ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user(self, user_id):\n oauth_user = OAuthioUser.objects.filter(user__id=user_id)\n if oauth_user.exists():\n return oauth_user.get().user", "def get_user(self, user_id):\n try:\n return Account.objects.get(pk=user_id)\n except Account.DoesNotExist:\n ...
[ "0.78990144", "0.75036436", "0.7502418", "0.74207425", "0.74126434", "0.7410573", "0.7401202", "0.73905855", "0.73869073", "0.737774", "0.737774", "0.737774", "0.737774", "0.73652303", "0.73590463", "0.7332562", "0.7290661", "0.7287023", "0.7285151", "0.7280264", "0.7269433",...
0.72821635
19
Split the worked days as an string into an array
def __split_worked_days(self, worked_days): if worked_days == "": return [] days = [] for day_text in worked_days.split(","): day = [day_text[0:2], day_text[2 : len(day_text)]] days.append(day) return days
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(day):\n data = Input(day).read().split('\\n')\n return [el for el in data if el != '']", "def _calc_date(time_lines) -> list:\n return time_lines[0].split()[0].strip(\"-\").split(\"-\")", "def beautifyWorkDays(self,ugly):\n\n pretty = []\n tempString = \"\"\n for duc...
[ "0.6648418", "0.6288119", "0.61545366", "0.60354996", "0.59857017", "0.5920627", "0.5824163", "0.5806444", "0.5792925", "0.578244", "0.5714562", "0.56184655", "0.5605369", "0.55613935", "0.5529067", "0.547354", "0.5420463", "0.53940874", "0.538898", "0.5358761", "0.53407276",...
0.80634594
0
Iterate through a list in multiple chunks
def _chunk(iterable, size, fillvalue=None): args = [iter(iterable)] * size return [''.join(x) for x in itertools.izip_longest(*args, fillvalue=fillvalue)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunk(list, chunksize):\n for i in range(0, len(list), chunksize):\n yield list[i:i + chunksize]", "def chunks(lst, chunk_size):\n for i in range(0, len(lst), chunk_size):\n yield lst[i:i + chunk_size]", "def chunks(item_list, n_items):\n for i in range(0, len(item_list), n_items):\n...
[ "0.81664073", "0.810052", "0.80503684", "0.80203366", "0.7996954", "0.79826033", "0.7979943", "0.7976209", "0.79708964", "0.7959113", "0.7954191", "0.79157376", "0.7904584", "0.7904584", "0.7897952", "0.7887762", "0.7887762", "0.788602", "0.7858051", "0.78436494", "0.78436494...
0.0
-1
Randomizes the order of data samples and their corresponding labels
def randomize(x, y): permutation = np.random.permutation(y.shape[0]) shuffled_x = x[permutation, :, :, :] shuffled_y = y[permutation] return shuffled_x, shuffled_y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shuffle_labels(self):\n random.shuffle(self.y_train)\n random.shuffle(self.y_test)", "def inlabel_shuffle(data):\n num_zero_data = np.sum(data[:,-1]==0)\n label_zero_data = data[:num_zero_data,:]\n label_one_data = data[num_zero_data:,:]\n np.random.shuffle(label_zero_data)\n np.random.shu...
[ "0.7610801", "0.72624075", "0.71498376", "0.71094793", "0.7101863", "0.70504063", "0.6969117", "0.6969117", "0.6969117", "0.69373816", "0.69088066", "0.6856464", "0.6789744", "0.6737744", "0.6674642", "0.6634555", "0.6630403", "0.6464263", "0.6435945", "0.6421794", "0.6305728...
0.0
-1
Tear down the window session.
def destroy(self): for window in self.windows: try: destroy_window(window) except: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def leave_page(self):\n self.window.destroy()", "def logout(self):\n self.session.disconnect()", "def __onclosing(self):\n self.window.destroy()", "def close(self):\n self.__session.remove()", "def close(self):\n self.__session.remove()", "def close(self):\n self...
[ "0.73034996", "0.7263202", "0.7217267", "0.7154314", "0.7154314", "0.7154314", "0.70164263", "0.6843533", "0.68324625", "0.6829453", "0.67816484", "0.67408234", "0.6740363", "0.6721897", "0.67135805", "0.67056537", "0.67029417", "0.66633534", "0.6647558", "0.6647521", "0.6646...
0.6328118
67
Convert a Queue to a list.
def queue_to_list(queue): result = [] while queue.qsize() != 0: result.append(queue.get()) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def helper_convert_msg_queue_list_to_list_for_output(self):\n result = []\n if self.error_msg_queue_list:\n # this order of reference shuffling ensures that a race condition doesn't result in lost messages in the oddball case these variables are also edited in a different true thread\n ...
[ "0.70222294", "0.6944747", "0.66907656", "0.665576", "0.6544217", "0.638578", "0.63504744", "0.63187265", "0.63187265", "0.62840843", "0.62839043", "0.6254567", "0.61805385", "0.6165609", "0.6155708", "0.61456215", "0.6137522", "0.6112747", "0.6108668", "0.6105196", "0.610191...
0.86860883
0
Fill in default param for a rule given a partial rule definition.
def fill_in_rule(partial_rule): default_rules = { key: val["default"] for key, val in default_flash_param().items() if val["location"] == "any" } for key, value in default_rules.items(): if key not in partial_rule.keys(): partial_rule[key] = value return parti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _autoInitPars(self):\n for p in self._pars:\n setattr(self,p,self.defaultparval)", "def __init__(self, rule):\n Rule.__init__(self)\n self.__rule = Optional(OneOrMore(rule))", "def _merge_with_default_values(self, cr, uid, external_session, ressource, vals, sub_mapping_list,...
[ "0.5781016", "0.5557155", "0.5505991", "0.5500387", "0.5500387", "0.54522306", "0.5444261", "0.54140323", "0.53261024", "0.5317271", "0.5316408", "0.530644", "0.5263163", "0.52280134", "0.52188456", "0.5197475", "0.5196096", "0.5186147", "0.5173087", "0.51632136", "0.515841",...
0.7940189
0
Applies network layers and ops on input image(s) x.
def forward(self, x): sources = list() loc = list() conf = list() # apply vgg up to conv4_3 relu #print('Reached start of vgg') for k in self.vgg._modules.keys(): if int(k) < 23: #print('Reached ' + k + ' ', x.size()) x = self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_network(inputs):\n return apply_layer(tf.sigmoid(apply_layer(inputs, 64)), 1)", "def forward(self, x):\n for task_module_name in self.task_module_name_path[self.task_idx]:\n for layer in self.task_modules[task_module_name]:\n x = layer(x)\n #x = self.task_...
[ "0.65635645", "0.6369926", "0.6366342", "0.6353145", "0.6308525", "0.63080144", "0.6259044", "0.6207936", "0.61983746", "0.6192247", "0.6176785", "0.6163958", "0.61539495", "0.61442596", "0.61295325", "0.61276245", "0.6121304", "0.6115892", "0.61109567", "0.60991436", "0.6084...
0.0
-1
Fluorescence cross section function, `function` Returns a function of energy which returns the elemental cross section in cm2/g
def cs(self): def myfunc(incident_energy): return XrayLibWrap_Energy(self.Z, "cs", incident_energy) return myfunc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_section(E):\n C = cs*np.exp(-0.03*E)\n if E > 400.0:\n C += cs*np.exp(-0.0066*(E-400.0))/10.0\n return C", "def cross_section(eps, E, theta):\n\n def beta_func(eps, E, theta):\n\n \"\"\"\n Return the parameter beta (formula 4 from Gould's article)\n\n Parameters:...
[ "0.65644467", "0.5691869", "0.55853605", "0.5571941", "0.5571941", "0.5555193", "0.53263503", "0.5190169", "0.51374584", "0.513654", "0.5133756", "0.51214474", "0.5094073", "0.5086819", "0.5074784", "0.5039325", "0.50341415", "0.50233346", "0.5006225", "0.50015736", "0.499206...
0.56669295
2
Find elements which have an emission line near an energy This function returns a dict keyed on element type of all elements that have an emission line with in `delta_e` of `line_e` at the given xray energy.
def emission_line_search(line_e, delta_e, incident_energy, element_list=None): if xraylib is None: raise XraylibNotInstalledError(__name__) if element_list is None: element_list = range(1, 101) search_list = [XrfElement(item) for item in element_list] cand_lines = [e.line_near(line_e,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_near(self, energy, delta_e, incident_energy):\n out_dict = dict()\n for k, v in six.iteritems(self.emission_line):\n if self.cs(incident_energy)[k] == 0:\n continue\n if np.abs(v - energy) < delta_e:\n out_dict[k] = v\n return out_di...
[ "0.6890566", "0.51864946", "0.49466994", "0.49238998", "0.47822753", "0.47082967", "0.46743", "0.46268553", "0.45890433", "0.45606878", "0.45431775", "0.4514429", "0.45028222", "0.44868082", "0.44705603", "0.44673014", "0.44085833", "0.4383042", "0.4361299", "0.43463412", "0....
0.8064524
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, DataSource): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Get the time in seconds and microseconds.
def get_timeval(): return convert_timeval(time.time())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timeTime(self):\n return self._micros / 1000000.0", "def microsecond(self):\n return self._microsecond", "def get_time(cls):\n now = rospy.Time.now()\n return now.secs + now.nsecs*(10**-9) # time in seconds", "def get_time_ms():\n return int(round(time.time() * 1000))", "...
[ "0.7895765", "0.75350016", "0.74273354", "0.73904186", "0.7366115", "0.7243987", "0.72425616", "0.71470034", "0.71042734", "0.71008086", "0.7083687", "0.70560974", "0.70560974", "0.70560974", "0.70560974", "0.70560974", "0.70560974", "0.70496255", "0.7018299", "0.70106393", "...
0.6662191
53
Get the appkit event type of the event.
def _get_event_type(event): return event.type()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_type(self) -> int:\n return self.data[\"args\"][\"eventType\"]", "def get_type(self):\n return self.event_type", "def event_type(self) -> str:\n try:\n return _EVENT_TYPE_MAPPINGS.get(self.transaction_event_code[0:3])\n except:\n return None", "def ...
[ "0.84248817", "0.83605343", "0.8161515", "0.8114217", "0.7923565", "0.7861213", "0.7588584", "0.7536384", "0.74696636", "0.74315625", "0.73658353", "0.7169431", "0.7106793", "0.6859244", "0.6796005", "0.6721282", "0.66380686", "0.66108805", "0.66065896", "0.65558887", "0.6545...
0.8807509
1
Get the event type.
def _get_event_type(event): return event.type()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_type(self):\n return self.event_type", "def event_type(self) -> int:\n return self.data[\"args\"][\"eventType\"]", "def type(self) -> str:\n return self._event.get('type')", "def event_type(self) -> str:\n try:\n return _EVENT_TYPE_MAPPINGS.get(self.transaction_...
[ "0.8985169", "0.8467276", "0.8374562", "0.8228404", "0.8068962", "0.802744", "0.7702575", "0.766007", "0.7643432", "0.74538356", "0.7443508", "0.7407904", "0.7091386", "0.69636214", "0.6895881", "0.68893313", "0.6873978", "0.68543404", "0.6805979", "0.680286", "0.6761327", ...
0.89203256
1
Return a zero or one for each bit of a numeric value up to the most significant 1 bit, beginning with the least significant bit.
def __gen_bit_values(number): number = int(number) while number: yield number & 0x1 number >>= 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_least_significant_bits(x, n):\n\n return x & ones(n)", "def get_lowest_set_bit(x):\n\n return x & -x", "def get_lowest_unset_bit(x):\n\n return ~x & (x + 1)", "def replace_lowest_one_with_zero(x):\n return x & (x-1)", "def index_of_least_significant_zero_bit(self, value):\n\n index...
[ "0.7218882", "0.69481397", "0.6945783", "0.6882493", "0.6849647", "0.675651", "0.66885346", "0.6685206", "0.66657835", "0.66390216", "0.65522075", "0.6494297", "0.6474149", "0.6472726", "0.64550006", "0.6412663", "0.6372257", "0.63607484", "0.63521326", "0.63506055", "0.63250...
0.6480956
12
Turn the light off.
def off(self): self._make_event(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_off(self):\n GPIO.output(self.gpio, False) # turn off light", "def lightning_turnoff(self):\n self.turnOff()", "def set_light_off(self):\n self._light = \"OFF\"", "def turn_off(self, **kwargs):\n self._light.set_color(0, 0, 0, 0)", "def set_light_off(self):\r\n ...
[ "0.9158525", "0.88893706", "0.88740003", "0.8852116", "0.8842971", "0.87965184", "0.864986", "0.85981315", "0.85843927", "0.85641575", "0.8526551", "0.8403609", "0.83990663", "0.8292084", "0.8271316", "0.82411224", "0.81950665", "0.8189084", "0.8162265", "0.8066985", "0.80102...
0.0
-1
Get the string name of the event.
def get_event_string(self, evtype, code): if WIN and evtype == 'Key': # If we can map the code to a common one then do it try: code = self.codes['wincodes'][code] except KeyError: pass try: return self.codes[evtype][code] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_name(self):\n return self._event_name", "def event_name(self):\n return dict.get(self, 'event_name', None)", "def getName(self):\n return _libsbml.Event_getName(self)", "def cal_name(self):\n return self.event_name", "def getElementName(self):\n return _libsbml....
[ "0.8904927", "0.8853775", "0.8540532", "0.801993", "0.7489496", "0.7468177", "0.74679106", "0.74555635", "0.73820114", "0.7365086", "0.728913", "0.72624433", "0.7248294", "0.71927416", "0.71927416", "0.7141618", "0.7141618", "0.713293", "0.7107651", "0.7098852", "0.7098852", ...
0.0
-1