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
Returns True if the supplied password is correct.
def is_correct(password): test = subprocess.Popen([PROCESS, PASSWORD_FILE, password], stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = test.communicate() if (stdout != 'Ha ha, your password is incorrect!\n'): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_password(self, password):\n return self.PASS == password", "def check_password(self, password):\n return self.password == password", "def verify_password(self, password):\n return self.PASSWORD == password", "def _check_password(self, password):\n if self.password_regex...
[ "0.86042845", "0.85519826", "0.85412", "0.8149082", "0.8109697", "0.8057366", "0.80102503", "0.7988319", "0.79797614", "0.7965086", "0.7951397", "0.7883753", "0.78744227", "0.7846464", "0.78345656", "0.78176284", "0.78143185", "0.78118664", "0.7807318", "0.77756464", "0.77741...
0.8010131
7
Determines if two strings represent dates within minutes_error of each other
def is_iso_date_equal(date1, date2, minutes_error): if type(date1) is str: date1 = iso8601.parse_date(date1) if type(date2) is str: date2 = iso8601.parse_date(date2) tm_delta = abs(date1.replace(tzinfo=None) - date2.replace(tzinfo=None)).seconds if tm_delta > 60 * minutes_error: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simulatedate_checkinput(start, end):\n start_year, start_month, start_day = parse_string_datetime(start)\n end_year, end_month, end_day = parse_string_datetime(end)\n if datetime_checkinput(start_year, start_month, start_day) == 0 and datetime_checkinput(end_year, end_month, end_day) == 0:\n st...
[ "0.6009011", "0.6006243", "0.599261", "0.595104", "0.5888024", "0.58157223", "0.57860774", "0.57618463", "0.5716959", "0.56893915", "0.56841844", "0.5675185", "0.5653391", "0.56300235", "0.5580039", "0.5565157", "0.55413073", "0.5507438", "0.5501124", "0.5499357", "0.54988843...
0.72329783
0
Subtracts the specified number of days from the current date and returned the new date in iso format
def create_past_date(self, days): past_date = datetime.now() - timedelta(days=days) return past_date.isoformat()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def now_minus(days: int):\n return NOW - datetime.timedelta(days=days)", "def get_days_old(days):\n days = int(days)\n current_time = datetime.datetime.today()\n days_after = datetime.timedelta(days)\n new_date = current_time - days_after\n new_date = new_date.strftime(\"%d-%b-%Y\")\n return...
[ "0.68465984", "0.65432125", "0.62382966", "0.6136687", "0.5890135", "0.58130705", "0.56315583", "0.5615061", "0.5514438", "0.5513223", "0.54522896", "0.544584", "0.54347074", "0.5369594", "0.53340554", "0.5305036", "0.5279876", "0.5272937", "0.5243282", "0.5229585", "0.518451...
0.6386691
2
Returns the color of the given piece.
def color(piece): return Color.BLACK if piece in {Piece.BP, Piece.BN, Piece.BB, Piece.BR, Piece.BQ, Piece.BK} else Color.WHITE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def piece_color(self, piece):\n if piece == None:\n return None\n if ord(ChessPiece.W_KING) <= ord(piece) <= ord(ChessPiece.W_PAWN):\n return \"white\"\n return \"black\"", "def piece_colour(self, col, row):\n square = self.get_square(col, row)\n if square...
[ "0.7727806", "0.7010614", "0.6831588", "0.68264544", "0.6823619", "0.6727899", "0.66772866", "0.6639392", "0.6609915", "0.6609915", "0.6609915", "0.6609915", "0.6587161", "0.65675944", "0.65675944", "0.6547726", "0.6502348", "0.6464586", "0.64406997", "0.64313114", "0.6411417...
0.7958122
0
Creates a new instance of LineSegment2D.
def __init__(self, start =None, end =None): self.start = start if start else PositionValue2D() self.end = end if end else PositionValue2D()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createLineSegment(self):\n return _libsbml.Curve_createLineSegment(self)", "def createLineSegment(self):\n return _libsbml.Layout_createLineSegment(self)", "def createLineSegment(self):\n return _libsbml.GeneralGlyph_createLineSegment(self)", "def createLineSegment(self):\n re...
[ "0.7952619", "0.7784021", "0.7486396", "0.7232338", "0.7075861", "0.6633998", "0.65933853", "0.64860857", "0.6476152", "0.6448176", "0.63302076", "0.62881225", "0.6274715", "0.6260725", "0.62390816", "0.61868644", "0.6104404", "0.6091401", "0.60771626", "0.60335773", "0.59847...
0.0
-1
r"""Redefine this object in terms of a polymorphic subclass.
def of_type(self, class_: _EntityType[Any]) -> PropComparator[_PT]: return RelationshipProperty.Comparator( self.prop, self._parententity, adapt_to_entity=self._adapt_to_entity, of_type=class_, extra_criteria=self._extra_criteri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_real_class(self):\r\n if not self.type:\r\n #objects was just created, set type and return\r\n self.type = self.__class__.__name__\r\n return self\r\n if self.type == self.__class__.__name__:\r\n return self\r\n #type is set, we can do act...
[ "0.66450495", "0.647895", "0.6282554", "0.6282554", "0.6251529", "0.59463733", "0.59463733", "0.59396183", "0.58311826", "0.5797998", "0.5770078", "0.5722603", "0.57057625", "0.57057625", "0.57057625", "0.57057625", "0.57057625", "0.57057625", "0.57057625", "0.57057625", "0.5...
0.0
-1
Implement the ``==`` operator.
def __eq__(self, other: Any) -> ColumnElement[bool]: # type: ignore[override] # noqa: E501 if other is None or isinstance(other, expression.Null): if self.property.direction in [ONETOMANY, MANYTOMANY]: return ~self._criterion_exists() else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_equal(self, a, b):\n return a == b", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n...
[ "0.7577839", "0.754695", "0.754695", "0.754695", "0.754695", "0.754695", "0.754695", "0.754695", "0.754695", "0.754695", "0.754695", "0.754695", "0.754695", "0.754695", "0.754695", "0.754695", "0.754695", "0.754695", "0.754695", "0.754695", "0.754695", "0.75230914", "0.75...
0.0
-1
Implement the ``!=`` operator.
def __ne__(self, other: Any) -> ColumnElement[bool]: # type: ignore[override] # noqa: E501 if other is None or isinstance(other, expression.Null): if self.property.direction == MANYTOONE: return _orm_annotate( ~self.property._optimized_compare( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, rhs):\n return not self.__eq__(rhs)", "def __ne__(self, other):\n return not (self == other) # opposite of __eq__", "def __ne__(self, other):\n return not (self == other) # opposite of __eq__", "def __ne__(self, other):\r\n return not self.__eq__...
[ "0.8131875", "0.813035", "0.8097296", "0.8044922", "0.8044922", "0.8044922", "0.8044922", "0.7993965", "0.7993965", "0.7993965", "0.7993965", "0.7993965", "0.7993965", "0.7993965", "0.7993965", "0.7993965", "0.7993965", "0.7993965", "0.7993965", "0.7993965", "0.7993965", "0...
0.0
-1
Return the current cascade setting for this
def cascade(self) -> CascadeOptions: return self._cascade
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cascade(self) -> bool:\n return self.__cascade", "def _deliveryPref(self):\n # If the level of the object is below the Preference level,\n # recursively calls base (super) classes to get preference at specified level\n return self.get_pref_setting_for_level(DELIVERY_PREF, self....
[ "0.62398964", "0.5996407", "0.59223485", "0.5532892", "0.546313", "0.5379583", "0.5373191", "0.5334782", "0.5297686", "0.5256447", "0.5254838", "0.5217079", "0.52049184", "0.52032274", "0.5192825", "0.5165474", "0.5151847", "0.5151847", "0.5115364", "0.5099611", "0.50986856",...
0.69914824
0
Determine the 'primaryjoin' and 'secondaryjoin' attributes, if not passed to the constructor already. This is based on analysis of the foreign key relationships between the parent and target mapped selectables.
def _determine_joins(self) -> None: if self.secondaryjoin is not None and self.secondary is None: raise sa_exc.ArgumentError( "Property %s specified with secondary " "join condition but " "no secondary argument" % self.prop ) # fin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sanitize_joins(self) -> None:\n\n self.primaryjoin = _deep_deannotate(\n self.primaryjoin, values=(\"parententity\", \"proxy_key\")\n )\n if self.secondaryjoin is not None:\n self.secondaryjoin = _deep_deannotate(\n self.secondaryjoin, values=(\"parent...
[ "0.66041225", "0.5642993", "0.560951", "0.5503869", "0.5364311", "0.53290313", "0.5230528", "0.510963", "0.5101557", "0.5100082", "0.5061417", "0.4986111", "0.49158877", "0.4912534", "0.4886254", "0.4874135", "0.48154247", "0.48043394", "0.47967574", "0.47910473", "0.4765576"...
0.68998045
0
Return the distance between two vectors (points) a and b.
def distance(a, b): return (np.sum((a - b)**2))**0.5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_point_point(a, b):\n ab = subtract_vectors(b, a)\n return length_vector(ab)", "def distance_between_points(a: Point, b: Point) -> float:\n return math.sqrt((a.x - b.x)**2 + (a.y - b.y)**2)", "def distance(a: Point, b: Point) -> float:\n return math.sqrt(math.pow(b.x - a.x, 2) + math.po...
[ "0.86715347", "0.8616364", "0.84441304", "0.83756644", "0.8371398", "0.823332", "0.8187501", "0.8154268", "0.8109546", "0.8098349", "0.8075259", "0.8031281", "0.79947484", "0.7973483", "0.7941301", "0.79151124", "0.79084486", "0.7872575", "0.78649306", "0.78467524", "0.782643...
0.8022423
12
Return element for OPLS forcefield atom key.
def opls_notation(atom_key): # warning for Ne, He, Na types overlap conflicts = ['ne', 'he', 'na'] if atom_key in conflicts: raise _AtomKeyConflict(( "One of the OPLS conflicting " "atom_keys has occured '{0}'. " "For how to solve this issue see the manual or " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decipher_atom_key(atom_key, forcefield):\n load_funcs = {\n 'DLF': dlf_notation,\n 'DL_F': dlf_notation,\n 'OPLS': opls_notation,\n 'OPLSAA': opls_notation,\n 'OPLS2005': opls_notation,\n 'OPLS3': opls_notation,\n }\n if forcefield.upper() in load_funcs.keys()...
[ "0.647936", "0.6072593", "0.5716124", "0.5696515", "0.5618556", "0.54787916", "0.54577976", "0.54521745", "0.541226", "0.53432286", "0.5276712", "0.5240947", "0.5212271", "0.5204846", "0.5162872", "0.5162528", "0.51326126", "0.5126425", "0.5117798", "0.50566727", "0.50326836"...
0.47586825
82
Return coordinates translated by some vector.
def shift_com(elements, coordinates, com_adjust=np.zeros(3)): com = center_of_mass(elements, coordinates) com = np.array([com - com_adjust] * coordinates.shape[0]) return coordinates - com
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(self, vect):\n self.apply(lambda c: (vector(c) + vect).coords())", "def project_vector(u, v):\n u_np = np.array([u.get_x(), u.get_y()])\n v_np = np.array([v.get_x(), v.get_y()])\n proj = (np.dot(u_np, v_np) / np.dot(v_np, v_np)) * v_np\n return Point(proj[0], proj[1])", "def tr...
[ "0.7241067", "0.70616233", "0.68880814", "0.67126787", "0.66984373", "0.66591465", "0.6647949", "0.66350734", "0.66073257", "0.65815336", "0.6573129", "0.65546364", "0.65291494", "0.6495735", "0.6491966", "0.6446816", "0.643178", "0.64152926", "0.633437", "0.6319121", "0.6289...
0.0
-1
Return the maximum diameter of a molecule.
def max_dim(elements, coordinates): atom_vdw_vertical = np.matrix( [[atomic_vdw_radius[i.upper()]] for i in elements]) atom_vdw_horizontal = np.matrix( [atomic_vdw_radius[i.upper()] for i in elements]) dist_matrix = euclidean_distances(coordinates, coordinates) vdw_matrix = atom_vdw_vert...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_max_mid_diameter(self):\n max_min_mid_diam = 0\n\n for m in self.components:\n name = m.name\n diam_file = join(\n self.params['molec_dir'],\n name+'_size.csv'\n )\n\n if exists(diam_file.replace('.csv', '.TOOBIG')):\n ...
[ "0.73440206", "0.70124143", "0.70124143", "0.70000744", "0.69783974", "0.6973965", "0.6973965", "0.6764199", "0.6713836", "0.66711", "0.65496194", "0.6366981", "0.63406885", "0.62755233", "0.61532503", "0.6138077", "0.61276484", "0.6081527", "0.5961681", "0.59452295", "0.5937...
0.0
-1
Return pore diameter of a molecule.
def pore_diameter(elements, coordinates, com=None): if com is None: com = center_of_mass(elements, coordinates) atom_vdw = np.array([[atomic_vdw_radius[x.upper()]] for x in elements]) dist_matrix = euclidean_distances(coordinates, com.reshape(1, -1)) re_dist_matrix = dist_matrix - atom_vdw i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diameter(self):\n return self.radius * 2", "def diameter(self):\n return self.radius * 2", "def diameter(self):\n return 2 * self.radius", "def diameter(self):\n return self._diameter", "def diameter(self):\n return self._diameter", "def get_diameter(self):\n\n ...
[ "0.7813025", "0.7813025", "0.7746317", "0.77237886", "0.77237886", "0.75643885", "0.72042197", "0.6998348", "0.6921475", "0.68532515", "0.6552524", "0.654291", "0.6522889", "0.64898187", "0.63664174", "0.63356405", "0.62713647", "0.62500846", "0.61760104", "0.6132093", "0.609...
0.6510015
13
Return the tensor of inertia a molecule.
def get_inertia_tensor(elements, coordinates): pow2 = coordinates**2 molecular_weight = np.array( [[atomic_mass[e.upper()]] for e in elements]) diag_1 = np.sum(molecular_weight * (pow2[:, 1] + pow2[:, 2])) diag_2 = np.sum(molecular_weight * (pow2[:, 0] + pow2[:, 2])) diag_3 = np.sum(molecul...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inertia_tensor(self, masswt=True, zero=ZERO):\n return self.inertia_tensor_partial(range(self.natom()), masswt, zero)", "def test_get_moment_of_inertia_tensor(self):\n symbols = ['O', 'C', 'C', 'H', 'H', 'H', 'H', 'H', 'H']\n coords = np.array([[1.28706525, 0.52121353, 0.04219198],\n ...
[ "0.7472945", "0.69685197", "0.68721485", "0.6313034", "0.6151025", "0.60825884", "0.60791326", "0.6032898", "0.60082936", "0.5994237", "0.5974788", "0.590335", "0.56424326", "0.55367345", "0.55334353", "0.55102557", "0.54874605", "0.5478176", "0.54775226", "0.5450297", "0.543...
0.7030123
1
Normalize a vector. A new vector is returned, the original vector is not modified.
def normalize_vector(vector): v = np.divide(vector, np.linalg.norm(vector)) return np.round(v, decimals=4)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(vector):\n return vector / np.linalg.norm(vector)", "def normalize(v):\n return v / np.linalg.norm(v)", "def normalize(my_vector):\n my_vector = np.array(my_vector)\n size = len(my_vector)\n\n sum_ = sum(my_vector)\n if sum_ != 0.0:\n for i in range(size):\n ...
[ "0.8477098", "0.8179815", "0.8154883", "0.8132331", "0.811961", "0.8102247", "0.8013643", "0.7995203", "0.79204476", "0.7881114", "0.78714997", "0.7844904", "0.781705", "0.78165483", "0.77578795", "0.7695895", "0.76702875", "0.7605905", "0.76034933", "0.7598762", "0.75791216"...
0.79605126
8
Return a rotation matrix of `angle` radians about `axis`.
def rotation_matrix_arbitrary_axis(angle, axis): axis = normalize_vector(axis) a = np.cos(angle / 2) b, c, d = axis * np.sin(angle / 2) e11 = np.square(a) + np.square(b) - np.square(c) - np.square(d) e12 = 2 * (b * c - a * d) e13 = 2 * (b * d + a * c) e21 = 2 * (b * c + a * d) e22 = n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotmat(axis, angle):\n mat = np.eye(3)\n if angle is None or np.isclose(angle, 0.0):\n return mat\n cang = np.cos(angle*radians)\n sang = np.sin(angle*radians)\n if axis == 1:\n mat = np.array(((1, 0, 0), (0, cang, -sang), (0, sang, cang)))\n elif axis == 2:\n mat = np.ar...
[ "0.8325355", "0.82244337", "0.80954194", "0.8087631", "0.8077946", "0.80671155", "0.80524504", "0.8017446", "0.79875976", "0.7875574", "0.7769982", "0.7733289", "0.77294695", "0.7727753", "0.7701123", "0.76489", "0.7626737", "0.7617428", "0.75971276", "0.75840914", "0.7580287...
0.8079773
4
Return normal vector for two vectors with same origin.
def normal_vector(origin, vectors): return np.cross(vectors[0] - origin, vectors[1] - origin)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normal(self) -> Vector:\n return normalize(cross(self.d1, self.d2))", "def normal(self) -> Vec:\n # The three points are in clockwise order, so compute differences\n # in the clockwise direction, then cross to get the normal.\n point_1 = self.planes[1] - self.planes[0]\n po...
[ "0.77509034", "0.7188954", "0.70737475", "0.7069747", "0.69891423", "0.68688506", "0.68466496", "0.6697224", "0.66949904", "0.66299915", "0.6558944", "0.6557302", "0.6544077", "0.6470055", "0.6446671", "0.6440558", "0.6436528", "0.6426443", "0.6425138", "0.6418596", "0.641610...
0.7963069
0
Return negative pore diameter for x and y coordinates optimisation.
def optimise_xy(xy, *args): z, elements, coordinates = args window_com = np.array([xy[0], xy[1], z]) return -pore_diameter(elements, coordinates, com=window_com)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correct_pore_diameter(com, *params):\n elements, coordinates = params\n return (-pore_diameter(elements, coordinates, com)[0])", "def spatial_diameter(self):\n import math\n \n Temp = 0\n for i in range(self.nodenum):\n for j in range(self.nodenum):\n ...
[ "0.6576984", "0.6140043", "0.6076278", "0.6054198", "0.6032383", "0.6032383", "0.5997658", "0.58944535", "0.5869582", "0.58387417", "0.5824006", "0.58183897", "0.58051217", "0.5799735", "0.57492197", "0.5727706", "0.5711593", "0.5682489", "0.5659942", "0.56571573", "0.5652999...
0.6593219
0
Called when the user specifies an intent for this skill
def on_intent(intent_request, session): print("on_intent requestId=" + intent_request['requestId'] + ", sessionId=" + session['sessionId']) intent = intent_request['intent'] intent_name = intent_request['intent']['name'] # Dispatch to your skill's intent handlers if intent_name == "<YOU...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_intent(intent_request, session):\n\n intent = intent_request['intent']\n intent_name = intent_request['intent']['name']\n\n # Dispatch to your skill's intent handlers\n\n if intent_name not in skillmap:\n intent_name = \"NullSkill\"\n\n if intent_name in skillmap:\n try:\n ...
[ "0.7143966", "0.6956116", "0.6949057", "0.6905333", "0.68928874", "0.67641324", "0.6754843", "0.6722764", "0.6720773", "0.67161995", "0.6699252", "0.6691263", "0.6670276", "0.6645522", "0.6642719", "0.6638686", "0.6607724", "0.6594981", "0.6575682", "0.6570076", "0.65620786",...
0.6507446
29
Obtain the mean of tensor on different GPUs.
def reduce_mean(tensor): if not (dist.is_available() and dist.is_initialized()): return tensor tensor = tensor.clone() dist.all_reduce(tensor.div_(dist.get_world_size()), op=dist.ReduceOp.SUM) return tensor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensemble_mean(self):\n return self.mean(dim='mem')", "def mean_IOU_gpu(X, Y):\n \n #X_fl = K.clip(K.batch_flatten(X), K.epsilon(), 1.)\n #Y_fl = K.clip(K.batch_flatten(Y), K.epsilon(), 1.)\n X_fl = K.clip(K.batch_flatten(X), 0., 1.)\n Y_fl = K.clip(K.batch_flatten(Y), 0., 1.)\n X_fl ...
[ "0.6654229", "0.65285", "0.6397626", "0.6391041", "0.6352174", "0.62875104", "0.6232864", "0.61684316", "0.61506623", "0.60967946", "0.60452515", "0.6034307", "0.6011212", "0.59993625", "0.59804404", "0.59767926", "0.5971576", "0.5968883", "0.59596324", "0.5914186", "0.589388...
0.6368563
4
Function to split observations into batches
def _defineBatches(self): # extract all ids all_keys = list(self.data_dict.unique_ids) # randomly shuffle keys if self.random_shuffle_batches: random.shuffle(all_keys) # create batches based on number of batches if self.n_big_batches is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_dataset(x, batch_size):\r\n\tsize_modulo = len(x) % batch_size # hack to ensure data is batches successfully\r\n\tif size_modulo != 0:\r\n\t\tx = x[:-size_modulo]\r\n\tpartitioned = np.split(x, batch_size)\r\n\treturn partitioned", "def batch_split(self) -> np.array:\n pass", "def prepare_bat...
[ "0.75208884", "0.74104977", "0.7167317", "0.7149218", "0.70962197", "0.70683575", "0.70583975", "0.6951565", "0.69227535", "0.6886764", "0.68418866", "0.6834769", "0.6824788", "0.6789284", "0.6763365", "0.67376333", "0.6711341", "0.6674295", "0.6669405", "0.6654877", "0.66434...
0.0
-1
Attach a lot of summaries to a Tensor (for TensorBoard visualization).
def variable_summaries(var, key): with tf.name_scope('summaries' + key): mean = tf.reduce_mean(var) with tf.name_scope('stddev' + key): stddev = tf.sqrt(tf.reduce_mean(tf.square(var - mean)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_summary(self):\n for k, v in self.metrics.items():\n tf.summary.scalar(k, v)\n \n self.summary_op = tf.summary.merge_all()", "def build_summaries(self):\n\n # Loss summary.\n tf.summary.scalar('loss', self.loss)\n\n merged = tf.summary.merge_all()\n self.summary_op = merged\n ...
[ "0.7071791", "0.6970259", "0.6970259", "0.6800256", "0.67872906", "0.67407334", "0.66669947", "0.66576326", "0.66193783", "0.66085786", "0.6595776", "0.65836215", "0.6581151", "0.655297", "0.6500364", "0.6459978", "0.64145213", "0.6294558", "0.62718755", "0.62713677", "0.6265...
0.0
-1
Inserts a new item before the current item.
def add_before ( self ): self.add_item( 0 )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepend(self, item: Any):\n self.insert(0, item)", "def insertFront(self, item):\n self.sentinel.insertAfter(item)\n self.N += 1", "def push(self, item):\n self.list.prepend(item)", "def add_front(self, item):\n\n self.items.insert(0, item)", "def push(self, item):\n ...
[ "0.7810442", "0.77399725", "0.74836224", "0.72167736", "0.72154546", "0.7099744", "0.7072459", "0.69619894", "0.6943991", "0.6929794", "0.6883711", "0.6833439", "0.67886597", "0.6750054", "0.66600233", "0.6658726", "0.66554356", "0.66380084", "0.65904576", "0.6562857", "0.655...
0.7529334
2
Inserts a new item after the current item.
def add_after ( self ): self.add_item( 1 )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insertBack(self, item):\n self.sentinel.prev.insertAfter(item)\n self.N += 1", "def _insert_after(paragraph, item_before, new_item, new_value):\n item_found = False\n for item in paragraph:\n if item_found:\n value = paragraph.pop(item)\n paragraph[item] = val...
[ "0.7718992", "0.72893935", "0.7253527", "0.72009677", "0.7181941", "0.7117858", "0.70004696", "0.6968513", "0.69164413", "0.69089735", "0.6873764", "0.6864672", "0.68522143", "0.68462265", "0.67187935", "0.6702941", "0.66815025", "0.6663886", "0.65853834", "0.65783185", "0.65...
0.7409744
1
Moves the current item to the top of the list.
def move_top ( self ): list, index = self.get_info() self.value = [ list[index] ] + list[:index] + list[index+1:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self):\n active_item = self.stack.pop()\n self.backlog.put(active_item)", "def push(self, item):\n self.list.prepend(item)", "def insertBack(self, item):\n self.sentinel.prev.insertAfter(item)\n self.N += 1", "def insertFront(self, item):\n self.sentinel.ins...
[ "0.6732706", "0.6710863", "0.665428", "0.6544167", "0.64587814", "0.6450401", "0.64417195", "0.642524", "0.6389556", "0.6346277", "0.63371867", "0.62896883", "0.626854", "0.6222588", "0.62213993", "0.6215818", "0.62143147", "0.6173657", "0.6158603", "0.6145177", "0.6094431", ...
0.7394033
0
Moves the current item to the bottom of the list.
def move_bottom ( self ): list, index = self.get_info() self.value = list[:index] + list[index+1:] + [ list[index] ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insertBack(self, item):\n self.sentinel.prev.insertAfter(item)\n self.N += 1", "def bottom(self) -> None:\n # We remove ourselves from the list then insert ourselves to the beggining of the list\n current_index = ALL_WINDOWS.index(self)\n ALL_WINDOWS.pop(current_index)\n ...
[ "0.70042354", "0.69224864", "0.6706943", "0.6561555", "0.64498156", "0.6374985", "0.63043815", "0.6281185", "0.6275059", "0.62343824", "0.6179913", "0.6124046", "0.6057132", "0.6053984", "0.60095143", "0.6002911", "0.5970552", "0.5956061", "0.59434265", "0.59387", "0.59322286...
0.7939771
0
ButtonSprite.__init__ sets the mode to 'normal'.
def testInit(self): my_button = buttonsprite.ButtonSprite() self.assertEquals(my_button._draw_function, my_button._drawNormal)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testSetMode(self):\n my_button = buttonsprite.ButtonSprite()\n my_button.setMode('inactive')\n self.assertEquals(my_button._draw_function, my_button._drawInactive)\n my_button.setMode('highlighted')\n self.assertEquals(my_button._draw_function, my_button._drawHighlighted)\n ...
[ "0.70825535", "0.6698076", "0.6654154", "0.6653036", "0.66452163", "0.658275", "0.65476674", "0.64784324", "0.6337869", "0.6256987", "0.6250166", "0.61834", "0.61571074", "0.6128529", "0.6088623", "0.60418075", "0.60141444", "0.60141444", "0.59898454", "0.5979419", "0.5976342...
0.64240825
8
Convert list of banks pattern into a string.
def make_pattern(current_pattern): pattern = ''.join([str(b) for b in current_pattern]) return pattern
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def banks_signature(banks):\n return ''.join(str(bank) for bank in banks)", "def convert_deck_to_deck_str(deck: Deck):\n main, side = deck\n deck_str = []\n\n for card_name in main:\n for _ in range(main[card_name]):\n deck_str.append(card_name.lower().split(\"(\")[0].strip())\n ...
[ "0.5653121", "0.55265504", "0.55215096", "0.5511485", "0.54258746", "0.54043525", "0.5400457", "0.5369791", "0.5332545", "0.5328099", "0.5311717", "0.52979946", "0.5283668", "0.5264753", "0.5260475", "0.5253269", "0.52519095", "0.5249688", "0.5223962", "0.521081", "0.5178392"...
0.5708928
0
Informal string representation of the Symbol with name.
def info(self, name): if isinstance(self._state[name], dict): attrs = self._state[name]['attrs'] return '{} {}({}), {} records: {}'.format( attrs['type_str'], name, ','.join(attrs['domain']), attrs['records'], attrs['description']) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n s = '{\\n'\n s += 'symbol: \\'' + self.symbol + '\\',\\n'\n s += 'label: \\'' + self.label + '\\',\\n'\n s += 'coords: ' + str(self.coords) + ',\\n'\n s += 'mass: ' + str(self.m) + ',\\n'\n s += 'radius: ' + str(self.radius) + '\\n'\n s += '}\\...
[ "0.7197057", "0.71325547", "0.70115465", "0.6917686", "0.6889842", "0.68760055", "0.68760055", "0.68458986", "0.6774437", "0.67200106", "0.67174745", "0.6676576", "0.66574067", "0.6634755", "0.6618374", "0.6615205", "0.66004884", "0.6570766", "0.65658087", "0.6517456", "0.650...
0.63179165
34
Determines if pull requests should be created
def can_pull(self, initial, scheduled): if not initial and self.config.is_valid_schedule(): # if the config has a valid schedule, return True if this is a scheduled run return scheduled return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_pull_request(issue):\r\n return 'pull_request_url' in issue", "def should_deploy(request):\n\n data = json.loads(request.data.decode())\n\n if not data.get(\"pull_request\"):\n return False\n\n return data[\"action\"] == \"closed\" and data[\"pull_request\"][\"merged\"]", "def test_is...
[ "0.7335337", "0.7116543", "0.6366558", "0.61974764", "0.61482257", "0.60986906", "0.60037565", "0.5898736", "0.5884105", "0.5878111", "0.5831277", "0.58303636", "0.58170223", "0.5802449", "0.5795597", "0.5734363", "0.5724541", "0.5702635", "0.5699232", "0.56882393", "0.567673...
0.5542118
29
Create sort options JSON dump for InvenioSearchJS.
def format_sortoptions(sort_options): return json.dumps({"options": sorted_options(sort_options)})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_sortoptions(sort_options):\n return json.dumps(dict(\n options=sorted_options(sort_options)\n ), sort_keys=True)", "def searchkit_sort_options(sort_options, default_sort):\n return [\n {\n \"text\": v[\"title\"],\n \"sortBy\": k,\n \"sortOrder\":...
[ "0.75585943", "0.6721828", "0.6474501", "0.62434304", "0.6147201", "0.6114072", "0.59847856", "0.585511", "0.5677213", "0.56770813", "0.5661485", "0.5627517", "0.55311555", "0.54182565", "0.5365508", "0.53565365", "0.53188163", "0.5306118", "0.5306118", "0.5284684", "0.525167...
0.7647973
0
Return the tuple of all "safe" noncallable elements of the given class. A "safe" noncallable is one that does not belong to the set ``__leave_alone_properties``. It is known that overwriting these noncallables interferes with the functioning of Proxy objects.
def all_safe_properties(obj): return tuple(set(all_properties(obj)).difference(__leave_alone_properties))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _values(cls):\n assert inspect.isclass(cls)\n vals = tuple(val for val in _public_attributes(cls)\n if not inspect.isclass(val))\n return vals", "def all_safe_methods(obj):\n return tuple(set(all_methods(obj)).difference(__leave_alone_methods))", "def all_safe_methods(obj):\n ...
[ "0.64343446", "0.60697293", "0.60697293", "0.59926355", "0.59926355", "0.5568595", "0.54231024", "0.5401542", "0.5331751", "0.52598006", "0.52534723", "0.5192403", "0.5169223", "0.51664877", "0.5159595", "0.5155884", "0.5131029", "0.5127264", "0.5107341", "0.5089914", "0.5066...
0.60137683
4
Load the configuration as declared by config_cls from environ.
def to_config(config_cls: type[T], environ: dict[str, str] = os.environ) -> T: # The canonical app prefix might be falsey in which case we'll still set # the default prefix for this top level config object app_prefix = tuple(p for p in (_get_prefix(config_cls),) if p) return _to_config_recurse(config_cl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_from_env(cls, config):\n try:\n base64_config = config.decode('base64')\n cls.providers = yaml.safe_load(base64_config)\n return cls\n except binascii.Error:\n cls.providers = yaml.safe_load(config)\n return cls\n except yaml.YAML...
[ "0.6763674", "0.6622897", "0.63174427", "0.63026863", "0.6261402", "0.6246448", "0.6212619", "0.6203426", "0.60821545", "0.60471797", "0.6042855", "0.6004423", "0.5934521", "0.5928023", "0.59177625", "0.58758634", "0.5860724", "0.5836053", "0.58356017", "0.58022505", "0.58016...
0.57283205
32
Function to yield path for my_test.out file(s) by default.
def find(directory, slash='/', pattern=r'.+\.out'): for directory, subdirectories, files in os.walk(directory): for file in files: if re.findall(pattern, str(file)): yield str(directory + slash + file)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_output_files(self, action):\n assert action == \"run\"\n for ext in self.extensions:\n yield ext[1:].replace(\".\", \"_\"), self.base_path_out.format(mapper=self.name, ext=ext)\n for ext in (\".bamstats.html\", \".bamstats.txt\", \".flagstats.txt\", \".idxstats.txt\"):\n ...
[ "0.62072754", "0.6151328", "0.61279637", "0.6040743", "0.603914", "0.598042", "0.5976695", "0.5970517", "0.59435356", "0.5939427", "0.59351355", "0.5905055", "0.5878018", "0.5863175", "0.58405423", "0.58000386", "0.5768819", "0.574062", "0.5699048", "0.56951547", "0.56836843"...
0.516429
92
Function takes path to .out file and return its name
def named(path): return re.findall(r'.*(test\d+)\.out', path)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetOutputFilename(fname):\n return os.path.join(outdir, fname)", "def get_output_name(input_path):\n file_name, file_ext = os.path.splitext(os.path.basename(input_path))\n return os.path.abspath(\"out\" + os.path.sep + file_name + \"_geo\" + file_ext)", "def get_output_file(path):\n root, _ = o...
[ "0.7804124", "0.76314944", "0.75654685", "0.69679534", "0.69469684", "0.6919252", "0.6877913", "0.67262954", "0.6709716", "0.6674695", "0.6663116", "0.6624855", "0.6585896", "0.65827096", "0.6531744", "0.65263826", "0.6517898", "0.6511098", "0.6506584", "0.6499054", "0.649539...
0.7024517
3
Converts a python list of strings into a c array of strings
def _cast_strlist_to_C(py_strlist): c_strarr = (str_t * len(py_strlist))() c_strarr[:] = py_strlist return c_strarr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_of_strings_to_c_string_array(l):\n c_strings = (ctypes.c_char_p*(len(l)))()\n for i, s in enumerate(l):\n if s == None:\n c_strings[i] = None\n else:\n # create_string_buffer() handles conversion\n c_strings[i] = ctypes.create_string_buffer(strtobytes(s...
[ "0.83669525", "0.71451294", "0.7079943", "0.66357106", "0.66065127", "0.6424477", "0.63368136", "0.6243106", "0.6233156", "0.62219334", "0.6188891", "0.6127434", "0.6095838", "0.6067684", "0.6025938", "0.5939768", "0.5888817", "0.5842929", "0.5835014", "0.5831311", "0.5831311...
0.84674436
0
r""" Careful about the way the patches are extracted here.
def extract_desc_from_patches(patch_list): ndims = len(patch_list.shape) if ndims == 4 and patch_list.shape[-1] == 1: print('[pyhesaff] warning need to reshape patch_list') # need to remove grayscale dimension, maybe it should be included patch_list = patch_list.reshape(patch_list.shape[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_patches(self):\n self.get_source_patch_masks()\n self.get_target_patch_masks()\n self.get_source_patches()", "def extract_patches_tumor(self, bounding_boxes):\n mag_factor = pow(2, self.level_used)\n\n print('No. of ROIs to extract patches from: %d' % len(bounding_boxes...
[ "0.7010245", "0.6177478", "0.6082609", "0.60609066", "0.60317343", "0.5968802", "0.5922639", "0.58706933", "0.58402914", "0.5723487", "0.5670332", "0.56376153", "0.56248456", "0.5618232", "0.5612969", "0.55983377", "0.55948174", "0.5587691", "0.5578603", "0.5570871", "0.55634...
0.5528656
25
Add headers to both force latest IE rendering engine or Chrome Frame, and also to cache the rendered page for 10 minutes.
def add_header(response): response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1' response.headers['Cache-Control'] = 'public, max-age=0' return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-age=60'\n return response", "def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, m...
[ "0.8221727", "0.8220911", "0.8220911", "0.8220911", "0.8220911", "0.81940746", "0.81111443", "0.80852413", "0.79712725", "0.78637785", "0.7659569", "0.72363365", "0.71586627", "0.71513546", "0.71513546", "0.71502376", "0.71502376", "0.7140211", "0.7135492", "0.7126684", "0.71...
0.8161616
27
In the constructor we instantiate two nn.Linear modules and assign them as member variables.
def __init__(self, D_in, H1, H2, D_out): super(TwoLayerNet, self).__init__() self.linear1 = torch.nn.Linear(D_in, H1) self.linear2 = torch.nn.Linear(H1, H2) self.linear4 = torch.nn.Linear(H2, D_out)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args):\n super(LinearND, self).__init__()\n self.fc = nn.Linear(*args)", "def __init__(self, linear_args, activation_functions, softmax=False):\n super(NN, self).__init__()\n assert len(activation_functions) == len(linear_args) - 1\n k = len(linear_args)\n ...
[ "0.77401125", "0.75483596", "0.75074446", "0.74346", "0.7366003", "0.7335429", "0.73152226", "0.7273464", "0.72729063", "0.72729063", "0.7268201", "0.72429734", "0.72211164", "0.72030157", "0.7167753", "0.7111596", "0.7077496", "0.7065618", "0.7063983", "0.7053454", "0.701826...
0.7286699
7
In the constructor we instantiate two nn.Linear modules and assign them as member variables.
def __init__(self, D_in, H1, H2,H3, D_out): super(ThreeLayerNet, self).__init__() self.linear1 = torch.nn.Linear(D_in, H1) self.linear2 = torch.nn.Linear(H1, H2) self.linear3 = torch.nn.Linear(H2, H3) self.linear4 = torch.nn.Linear(H3, D_out)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args):\n super(LinearND, self).__init__()\n self.fc = nn.Linear(*args)", "def __init__(self, linear_args, activation_functions, softmax=False):\n super(NN, self).__init__()\n assert len(activation_functions) == len(linear_args) - 1\n k = len(linear_args)\n ...
[ "0.77401125", "0.75483596", "0.75074446", "0.74346", "0.7366003", "0.7335429", "0.73152226", "0.7286699", "0.7273464", "0.72729063", "0.72729063", "0.7268201", "0.72429734", "0.72211164", "0.72030157", "0.7167753", "0.7111596", "0.7077496", "0.7065618", "0.7063983", "0.705345...
0.6994124
23
Return the (first) root name of the Yaml configuration file.
def root(self) -> str: if not hasattr(self, '_root'): root_keys = self.config.keys() self._root = next(iter(root_keys)) return self._root
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root_name(filename: str):\n basename = os.path.basename(filename)\n basename_split = os.path.splitext(basename)\n root = None\n if len(basename_split) == 2:\n root = basename_split[0]\n return root", "def getRootName(self):\n return self.__rootName", "def rootname(filename):\n ...
[ "0.6992208", "0.69299614", "0.67720586", "0.67429405", "0.6680753", "0.66519254", "0.6428924", "0.63107073", "0.62898666", "0.6289316", "0.6232279", "0.61968994", "0.6174486", "0.6141792", "0.61279565", "0.61143935", "0.59910005", "0.5959101", "0.5953279", "0.5925419", "0.591...
0.67999876
2
Returns the physical chip core and compartment id of a compartment group layer.
def getChipCoreAndCxId(layer): core_ids = [] cx_ids = [] chip_ids = [] for id in layer.nodeIds: _, chip_id, core_id, cx_id, _, _ = layer.net.resourceMap.compartment(id) chip_ids.append(chip_id) core_ids.append(core_id) cx_ids.append(cx_id) return np.array(chip_ids), n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCompartmentId(self):\n return _libsbml.CompartmentGlyph_getCompartmentId(self)", "def getId(self):\n return _libsbml.Compartment_getId(self)", "def compartment_id(self):\n return self._compartment_id", "def compartment_id(self):\n return self._compartment_id", "def comm_g...
[ "0.64740443", "0.6228171", "0.62137645", "0.62137645", "0.6093958", "0.58393514", "0.57777226", "0.57210386", "0.57210386", "0.57170624", "0.57045346", "0.56769127", "0.5640896", "0.56135285", "0.5610763", "0.5592916", "0.5592916", "0.5568876", "0.5551997", "0.55487317", "0.5...
0.7145651
0
Generate a MAC for using in registering users with Dendrite.
def generate_dendrite_mac(shared_secret: str, username: str, password: str, admin: bool) -> str: # From: https://github.com/matrix-org/dendrite/blob/master/clientapi/routing/register.go mac = hmac.new( key=shared_secret.encode('utf8'), digestmod=hashlib.sha1, ) mac.update(username.encode('u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_mac():\n rand_str = generate_name(choices=\"0123456789abcdef\", length=12)\n return \":\".join(re.findall(\"..\", rand_str))", "def generate_mac():\n rand_str = generate_name(choices=\"0123456789abcdef\", length=12)\n return \":\".join(re.findall(\"..\", rand_str))", "def generate_mac_...
[ "0.778342", "0.778342", "0.7588938", "0.71439874", "0.71074975", "0.705732", "0.7042369", "0.7023532", "0.69627744", "0.6946268", "0.692597", "0.6896986", "0.68596077", "0.6699002", "0.66857785", "0.66483724", "0.66412544", "0.6614079", "0.6575379", "0.651241", "0.6477066", ...
0.72828203
3
Get the mac address for the `node_id`.
def get_mac(self, node_id): nc = '%02x' % self.node_class nr_iface = '%02x' % self.nr_host_interface node_id = '%08x' % node_id return '%s:%s:%s:%s:%s:%s' % (nc, nr_iface, node_id[0:2], node_id[2:4], node_id[4:6], node_id[6:8])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_mac_address(self):\n str_hex_mac = uuid.UUID(int=uuid.getnode()).hex[-12:]\n return str_hex_mac", "def get_mac_address():\n eth0_interface = 'eth0'\n addresses = netifaces.ifaddresses(eth0_interface)[netifaces.AF_LINK][0]\n mac_address = addresses['addr']\n return mac_address"...
[ "0.7555044", "0.715015", "0.7052081", "0.70433605", "0.68777853", "0.68375474", "0.67563933", "0.67549413", "0.66632843", "0.6654434", "0.6638409", "0.6633408", "0.6537928", "0.6491351", "0.64687127", "0.6391245", "0.6384523", "0.63454926", "0.6332746", "0.6283121", "0.627228...
0.8620345
0
Creates training and test data loaders.
def get_emoji_loader(emoji_type, opts): transform = transforms.Compose([ transforms.Scale(opts.image_size), transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)) ]) train_path = os.path.join('./emojis', emoji_ty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def creates_data_loader():\n dataset_faces = FaceDataset(\n IMG_DIR, transform=transform_train, face=True)\n\n dataset_no_faces = FaceDataset(\n IMG_DIR, transform=transform_train, face=False)\n\n datasets_faces_split = train_val_test(dataset_faces, 0.2, 0.0)\n datasets_no_faces_split = t...
[ "0.8073166", "0.78702134", "0.7795807", "0.77666515", "0.77440345", "0.7710133", "0.7677982", "0.76302284", "0.7481028", "0.7400165", "0.73978406", "0.73897564", "0.7384701", "0.73840946", "0.7372997", "0.73095834", "0.7295253", "0.72453135", "0.722806", "0.72092336", "0.7201...
0.0
-1
Convert keys to a ...multihot... array 0 1 2 3 4 5 6 7 8 [W, S, A, D, WA, WD, SA, SD, NOKEY] boolean values.
def get_keys_output(self): if self.key_w and self.key_a: output = wa elif self.key_w and self.key_d: output = wd elif self.key_s and self.key_a: output = sa elif self.key_s and self.key_d: output = sd elif self.key_w: ou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _one_hot(x, k, dtype=np.float32):\n return np.array(x[:, None] == np.arange(k), dtype)", "def one_hot(x, k, dtype=np.float32):\n return np.array(x[:, None] == np.arange(k), dtype)", "def one_hot(x, k, dtype=np.float32):\n return np.array(x[:, None] == np.arange(k), dtype)", "def transform_multilab...
[ "0.6527595", "0.6383037", "0.6358033", "0.62282354", "0.62282354", "0.6181984", "0.61797774", "0.60993", "0.5907657", "0.58761805", "0.58203703", "0.5810222", "0.5805516", "0.57982177", "0.5781116", "0.5766009", "0.5763717", "0.5745061", "0.5745061", "0.5717316", "0.56871265"...
0.0
-1
Says whether an application is a power on or off
def is_power_onoff(self): return self['application'] == 'ccd201_pon_app'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_on(self):\n if self._power_state == HYSEN_POWERON :\n return True\n else:\n return False", "def is_on(self):\n return self._client.get_power()", "def is_on(self):\n run_state = self._get_run_state()\n return STATE_DISHWASHER_POWER_OFF not in run_s...
[ "0.7460826", "0.73182935", "0.7170314", "0.6976407", "0.6897333", "0.68316686", "0.6745603", "0.6722027", "0.6714776", "0.66649914", "0.6623446", "0.661714", "0.65716326", "0.65039396", "0.6478334", "0.64304286", "0.6353872", "0.6313294", "0.629402", "0.62892276", "0.6265804"...
0.8273765
0
Returns format as a row in an html table
def to_html_table(self): td = '<td>' nwtd = '<td nowrap="true">' ftd = '<td class="format">' ctd = '<td class="cen">' etd = '</td>' if self.is_power_onoff(): out = td + 'Power On/Off' + etd else: out = nwtd + '<strong>' + self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printAsTextTable(self, format_type, text, template=False):\n\n # the order is defined by header list\n col_paddings = []\n message = \"\"\n\n if format_type == \"text\":\n col = rcol = lcol = ecol = tbcol = tecol = bcol = tcol = \"|\"\n row = \"+\"\n ...
[ "0.6985694", "0.69338644", "0.6816777", "0.67203987", "0.6689553", "0.6681644", "0.6654743", "0.66425705", "0.6526222", "0.65071815", "0.64618194", "0.6436058", "0.64076877", "0.63712466", "0.6353909", "0.6341152", "0.6284153", "0.62752116", "0.6275193", "0.62561953", "0.6251...
0.68985707
2
Tokenize a string. The string should be converted to lowercase. If keep_internal_punct is False, then return only the alphanumerics (letters, numbers and underscore). If keep_internal_punct is True, then also retain punctuation that is inside of a word. E.g., in the example below, the token "isn't" is maintained when k...
def tokenize(doc, keep_internal_punct=False): words=doc.lower() if keep_internal_punct: words= re.findall('[\w_][^\s]*[\w_]|[\w_]',words) else: words=re.sub('\W+', ' ', words).split() a1=np.array(words) return a1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(s):\n s = \"\".join(\" \" if x in string.punctuation else x for x in s.lower()) \n return s.split()", "def simple_tokenizer(text):\n re_tok = re.compile(punctuation_string)\n return re_tok.sub(' ', text).split()", "def tokenize_text_string(text_string, sanitize=True, remove_duplicat...
[ "0.5876603", "0.56485736", "0.56228924", "0.5610518", "0.5517469", "0.54633915", "0.54207295", "0.54133415", "0.54033023", "0.53182036", "0.52635604", "0.5260041", "0.52589744", "0.5252644", "0.5237351", "0.522198", "0.52080107", "0.52057374", "0.52000105", "0.51894397", "0.5...
0.63081765
0
Add features for each token. The feature name is prepended with the string "token=". Note that the feats dict is modified in place, so there is no return value.
def token_features(tokens, feats): count = Counter(tokens) for i in count: feats["token="+i] = count[i]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token_features(tokens, feats):\n ###TODO\n \n for token in tokens :\n t = 'token=' + token\n \n if t not in feats.keys() : \n feats.setdefault(t,1)\n else :\n feats[t] += 1", "def featurize(self, tokens):\n features = []\n \n nrc_ha...
[ "0.7464409", "0.6736178", "0.65320635", "0.64451003", "0.60153466", "0.6014374", "0.60038286", "0.597974", "0.5956967", "0.59534806", "0.58739686", "0.58705074", "0.5839172", "0.58216697", "0.5820623", "0.5754651", "0.572076", "0.5712674", "0.5699831", "0.5690192", "0.5684825...
0.7930639
0
Transform sequences to a list of list
def transform_sequences(sequences: list) -> list: transformed = [list(sequence) for sequence in sequences] transformed = list(zip(*transformed)) transformed = [list(s) for s in transformed] return transformed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_sequence_list(self):\n return list(self.iter_sequence())", "def _flatten(x: Sequence) ->list:\n return [item for sublist in x for item in sublist]", "def map(self, seq):\n result = []\n\n for elt in seq:\n if isinstance(elt, list):\n result.append...
[ "0.74738204", "0.71178675", "0.7027287", "0.6752587", "0.64128625", "0.641106", "0.63001436", "0.62865716", "0.6272182", "0.6265744", "0.6257908", "0.6237922", "0.6225582", "0.6212108", "0.61927605", "0.6169944", "0.61434513", "0.61233133", "0.6121576", "0.6120328", "0.611802...
0.75177115
0
Mute/Unmute according to the audio button.
def OnToggleVolume(self, evt): is_mute = self.player.audio_get_mute() self.player.audio_set_mute(not is_mute) # update the volume slider; # since vlc volume range is in [0, 200], # and our volume slider has range [0, 100], just divide by 2. self.volume_var.set(sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mute():\n request_command(tv_command=TVCommand.mute)", "def mute(self, value: bool) -> None:\n self.audio_mixer.setmute(value)\n self.update_status()", "def mute_volume(self, mute):\n mute_numeric = '1' if mute else '0'\n self._lms.query(self._id, 'mixer', 'muting', mute_nume...
[ "0.75320196", "0.71996135", "0.7021743", "0.7007601", "0.693662", "0.6879721", "0.68464535", "0.6790334", "0.6777384", "0.6743596", "0.6736412", "0.6697425", "0.6692569", "0.6675561", "0.6652748", "0.66012526", "0.65992314", "0.65835035", "0.6581183", "0.65794593", "0.6539236...
0.6891501
5
Remove unnecessary spaces, commas Ex. "abc d" > "abc d" "abc, d" > "abc d"
def _standardize_str(s): memory = [] s = s.replace(",", " ") res = "" for c in s: if c != " ": res += c memory = [] elif not memory: res += c memory.append(" ") return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comma_for_space(x):\n x = strip_stoich_wrapper(x)\n x = x.replace(\" \", \",\")\n return x", "def normalize(s):\n # Remove leading/trailing whitespace\n s = s.strip()\n # Remove trailing comma\n if s.endswith(\",\"):\n s = s[:-1]\n\n return s", "def clean_arrangem...
[ "0.7484006", "0.6972547", "0.65819025", "0.6459321", "0.6440741", "0.6431844", "0.6431844", "0.6429508", "0.6411894", "0.6411396", "0.638871", "0.62239605", "0.6119984", "0.6115688", "0.60910755", "0.60759324", "0.60486573", "0.6043605", "0.6008405", "0.59259796", "0.5917257"...
0.6913601
2
calculate the distance of each 2D points from the center (xc, yc)
def calc_R(xc, yc): return sqrt((x-xc)**2 + (y-yc)**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dist(x,y,xc=0.,yc=0.):\n return sqrt((x-xc)**2+(y-yc)**2)", "def _distance2d(x, y, center=None):\n if center is None:\n xc, yc = np.mean(x), np.mean(y)\n else:\n xc, yc = center[0], center[1]\n r = np.sqrt((x-xc)**2 + (y-yc)**2).ravel()\n return r", "def...
[ "0.74404234", "0.7137503", "0.71229076", "0.6839393", "0.67520154", "0.6622933", "0.66085243", "0.65774816", "0.6509382", "0.64701796", "0.6452887", "0.6414572", "0.64142925", "0.63884366", "0.63667786", "0.63655823", "0.6351538", "0.6347358", "0.6333488", "0.63114494", "0.63...
0.0
-1
Remove comment from database.
def delete(self, user): if user.is_authenticated() and self.author == user: post = self.post super(Comment, self).delete() cache_bust([('comments', post.pk)]) return post return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_comment(self, uid: str):\n pass", "async def delete_comment(comment: models.Comment = Depends(resolve_comment_for_comment_owner_or_resub_owner),\n db: Session = Depends(get_db)):\n crud.delete_comment(db, comment.id)", "def delete(id):\n db = core.connect()\n ...
[ "0.75145024", "0.7119937", "0.7032172", "0.6926692", "0.68881935", "0.6627909", "0.6559756", "0.6536061", "0.6532205", "0.6505815", "0.6453236", "0.64493406", "0.6391383", "0.6385975", "0.6310017", "0.6271746", "0.62681675", "0.62681675", "0.6258711", "0.6247763", "0.619915",...
0.5429894
95
fills up primesDict dict with n primes..(starting from 2)
def prmn(n, l=2,primesDict = primesDict): if len(primesDict) <= 1: primesDict[2] = 1 primesDict[3] = 2 u = n psrt = 2 while len(primesDict) <= u: if l > psrt**2: psrt = (l**0.5) for i in primesDict: if i > psrt: # sto...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def factorize(n:int,primesDict:dict = primesDict):\r\n\r\n \r\n if isPrime(n,primesDict):\r\n return {n:1}\r\n\r\n factors = {}\r\n\r\n lastPrime = getLastPrime(primesDict)\r\n print (lastPrime,\"Lastprimes\")\r\n if lastPrime < n:\r\n print (\"Creating DictS\")\r\n\r\n prma(...
[ "0.7772834", "0.7601189", "0.70427656", "0.7039837", "0.6966832", "0.6926844", "0.6914912", "0.6896734", "0.68907714", "0.6882909", "0.6792196", "0.67873055", "0.6738758", "0.66485256", "0.6549214", "0.65458864", "0.65447295", "0.65447295", "0.65302193", "0.65297145", "0.6528...
0.68760896
10
Gets the job of this Tasks.
def job(self) -> str: return self._job
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job(self):\n return self.batch[self.job_id]", "def get_job(self) -> Job:\n return self.jobs_list[self.sel_idx]", "def get_job(self) -> Dict[Text, Text]:\n request = self._client.projects().jobs().get(name=self._job_name)\n return request.execute()", "def get_task(self):\n retur...
[ "0.8234582", "0.8128863", "0.7540882", "0.75301135", "0.7522628", "0.75101054", "0.74274725", "0.73666644", "0.7316368", "0.72628367", "0.72090495", "0.71154034", "0.69892853", "0.69875216", "0.69875216", "0.69875216", "0.69875216", "0.69875216", "0.68346775", "0.6831476", "0...
0.7463665
7
(number) > float Return fahrenheit value converted to celsius >>> convert_to_celsius(32) 0.0 >>> convert_to_celsius(212) 100.0
def convert_to_celsius(fahrenheit): return (fahrenheit - 32) * 5 / 9
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _celsius_to_fahrenheit(self) -> None:\n if self.units == \"celsius\":\n self.value = (((self.value / 5) * 9) + 32).__round__(2)\n self.units = \"fahrenheit\"\n else:\n msg = (\n \"Not a valid unit conversion, expected units to be in 'celsius' but in...
[ "0.8014709", "0.798064", "0.79634243", "0.7721688", "0.75922686", "0.75632954", "0.75371325", "0.75371325", "0.74862766", "0.7466633", "0.74369305", "0.7429872", "0.7419733", "0.73939466", "0.7388114", "0.73426414", "0.72524583", "0.71990496", "0.7152051", "0.71509445", "0.71...
0.8085044
0
The auto kerning option to use.
def autoKerning(self): return self.app.autoKerning
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strike_on(self):\n self._set_print_mode(self.STRIKE_MASK)", "def complete_opt_width(self, *_):\n return [\"auto\"]", "def text_align_mode(self):\n return self._text_align_mode", "def get_font_options(self): # real signature unknown; restored from __doc__\n pass", "def getStr...
[ "0.584097", "0.54385847", "0.5390246", "0.53117126", "0.52974457", "0.52700007", "0.51898175", "0.5174787", "0.51729923", "0.51462173", "0.5093037", "0.5088179", "0.50816303", "0.5056901", "0.5014068", "0.4949751", "0.4917495", "0.48649102", "0.4857976", "0.4854872", "0.48548...
0.63175356
0
The color of textItem.
def color(self, color_value): self.app.color = color_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetItemTextColour(self, item):\r\n\r\n return item.Attr().GetTextColour()", "def get_text_color ( self, object ):\n return self.text_color_", "def SetItemTextColour(self, item, colour):\r\n\r\n item.Attr().SetTextColour(colour)\r\n self.RefreshLine(item)", "def get_text_color ...
[ "0.84848785", "0.7481343", "0.72893417", "0.7168592", "0.69358045", "0.6872424", "0.6835363", "0.66813654", "0.6678597", "0.65763605", "0.6500946", "0.6426966", "0.6385118", "0.63581914", "0.6320604", "0.63040805", "0.626987", "0.623136", "0.62178826", "0.6200645", "0.6152192...
0.0
-1
Split the 8bit byte `bs` into two 4bit integers.
def _split_byte(bs): mask_msb = 0b11110000 mask_lsb = 0b00001111 return (mask_msb & bs[0]) >> 4, mask_lsb & bs[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splitint(ba):\n l = []\n # TODO: Endianness\n for ba in WeirdBytes.split(ba):\n l.append(ba[0] * 256 + ord(ba[1:].tobytes()))\n\n return l", "def bytes_to_int(bs):\n v = 0\n p = 0\n for b in reversed(bs):\n v += b * (2 ** p)\n p += 8\n return v...
[ "0.67547596", "0.6194095", "0.56133896", "0.5537851", "0.55123675", "0.546529", "0.54631114", "0.5410154", "0.54034865", "0.5377376", "0.53755724", "0.5334383", "0.53274816", "0.5250766", "0.5230296", "0.52273303", "0.52145684", "0.5196244", "0.5196005", "0.51807404", "0.5128...
0.79260206
0
Return the bit value at index `ii` of `byte`. Bit index is 0 = MSB, 7 = LSB
def _get_bit(byte, ii): return (byte >> (7 - ii)) & 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bit(byte, bit_num):\n return (byte & (1 << bit_num)) >> bit_num", "def bit(self, idx: int) -> int:\n pos = self.start() + idx\n chunk = self.raw_key()[(pos // 8)]\n bit = pos % 8\n return ((1 << bit) & chunk) >> bit", "def get_bit(self):\n try:\n current...
[ "0.7498306", "0.7172244", "0.6999166", "0.6836977", "0.6812558", "0.6720599", "0.66633904", "0.65758777", "0.6530636", "0.652921", "0.65244067", "0.6424428", "0.6389163", "0.63043004", "0.6301513", "0.62961876", "0.625901", "0.62278", "0.6211305", "0.62027085", "0.611737", ...
0.8853102
0
create current time form "hhmmss"\n [example] 2pm 30minute 55seconds => 143055\n
def make_current(): current = datetime.datetime.now() hour = '{:02d}'.format(current.hour) minute = '{:02d}'.format(current.minute) second = '{:02d}'.format(current.second) current_time = hour + minute + second return current_time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_time():\r\n return datetime.datetime.now().strftime(\"%H\")+\":\"+datetime.datetime.now().strftime(\"%M\")+\":\"+datetime.datetime.now().strftime(\"%S\")", "def get_time(self):\n now = datetime.datetime.now()\n hour = 12 if now.hour % 12 == 0 else now.hour % 12\n meridiem = \"AM\"...
[ "0.7593335", "0.7584779", "0.7497858", "0.73846364", "0.72240615", "0.7163267", "0.7112628", "0.7099626", "0.70285875", "0.7013248", "0.6994396", "0.6975351", "0.69514483", "0.6935457", "0.691405", "0.69138855", "0.6911141", "0.69014776", "0.6888702", "0.6881204", "0.685617",...
0.71120864
7
Extract numbers from a string
def extint(input): num = None try: num = int(''.join([s for s in input if s.isdigit()])) except ValueError: pass return num
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ExtractNumbers(s):\n\n t = s.strip('[]\\n')\n comma_space = r', '\n re_comma_space = re.compile(comma_space)\n z = re_comma_space.split(t)\n #print z\n return z", "def find_numbers(text):\n result = []\n for word in text.split():\n if word.isdigit():\n result.append(...
[ "0.7427389", "0.73048276", "0.72012407", "0.7127625", "0.70389086", "0.70245045", "0.6979355", "0.6896785", "0.6845843", "0.682205", "0.6777609", "0.67094404", "0.6661691", "0.66578484", "0.65808624", "0.657478", "0.6573145", "0.6552609", "0.652795", "0.64834505", "0.64767087...
0.5771097
73
Returns two dimensional array with squares in the grid filled in randomly.
def create_rand_grid(grid_size): return [[randint(0, 1) for x in range(0, grid_size)] for y in range(0, grid_size)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_grid(height, width):\n return [[random.randint(0, 9) for _ in range(width)] for _ in range(height)]", "def random_grid(height, width):\n grid = create_grid(height, width)\n for r in range(1, height - 1):\n for c in range(1, width - 1):\n grid[r][c] = random.choice([0, 1])\...
[ "0.78814983", "0.75956756", "0.74468136", "0.7389157", "0.7368016", "0.7355413", "0.7238124", "0.71906", "0.71704364", "0.7167897", "0.70909816", "0.70510966", "0.70386547", "0.6998125", "0.6939256", "0.69298655", "0.68837416", "0.6825573", "0.6808946", "0.6806989", "0.680230...
0.7759445
1
Get the target renderer class.
def get_target_renderer_class(self): return multiselect2.target_renderer.Target
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_target_renderer(self):\n return self.get_target_renderer_class()(**self.get_target_renderer_kwargs())", "def _get_renderer(self) :\n \n return self._renderer", "def get_renderer ( self, object ):\n return self.renderer", "def GetCurrentRenderer(self):\n renderer = s...
[ "0.85684955", "0.75093037", "0.71997356", "0.71132773", "0.6936093", "0.658286", "0.6512221", "0.64233017", "0.6371557", "0.60499173", "0.59391755", "0.59378207", "0.593404", "0.5912415", "0.5908381", "0.590093", "0.590093", "0.590093", "0.590093", "0.590093", "0.58532083", ...
0.7939732
1
Get the target renderer object.
def get_target_renderer(self): return self.get_target_renderer_class()(**self.get_target_renderer_kwargs())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_renderer ( self, object ):\n return self.renderer", "def _get_renderer(self) :\n \n return self._renderer", "def GetCurrentRenderer(self):\n renderer = str(pm.mel.currentRenderer())\n if renderer == \"_3delight\":\n renderer = \"3delight\"\n\n return...
[ "0.8322631", "0.82370836", "0.7175363", "0.7053949", "0.6887483", "0.6770724", "0.669977", "0.65254533", "0.63881457", "0.62682694", "0.62279564", "0.5997966", "0.5997889", "0.5987735", "0.58710825", "0.58537847", "0.58278024", "0.5796194", "0.57828367", "0.57383466", "0.5738...
0.84062696
0
Get queryset of initially selected items. Defaults to ``self.model.object.none()``, and you should override this if you want to select any objects on load.
def get_inititially_selected_queryset(self): return self.model.objects.none()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n return NoneToEmptyQuerySet(self.model, using=self._db)", "def get_postrequest_selected_queryset(self):\n form_class = self.__make_selected_items_form_class()\n form = form_class(self.request.POST)\n if form.is_valid():\n selected_items_form_attribu...
[ "0.72266227", "0.70488244", "0.70456934", "0.68807644", "0.67969126", "0.67584944", "0.6683807", "0.65130854", "0.65064347", "0.6469639", "0.6410011", "0.6410011", "0.6393219", "0.63402414", "0.6247618", "0.6205139", "0.61843723", "0.61563325", "0.61425054", "0.607643", "0.60...
0.8539866
0
If this returns ``True``, we disable paging. The default implementation disables paging if ``disablePaging=true`` is in the querystring (in ``request.GET``).
def disable_paging_requested(self): return self.request.GET.get('disablePaging', 'false') == 'true'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_paging(self, *args, **kwargs):\n return \"\"", "async def disable_paging(self):\n\n # Display info message\n log.info(\"disable_paging\")\n\n # Send command to the device to disable paging\n await self.send_command(self.cmd_disable_paging)", "def _should_paginate(...
[ "0.7438011", "0.6675522", "0.57408255", "0.56341535", "0.5568453", "0.5538495", "0.5507306", "0.5507306", "0.5507306", "0.5502238", "0.5502238", "0.5502238", "0.5502238", "0.5502238", "0.5502238", "0.5502238", "0.5502238", "0.5502238", "0.5502238", "0.5502238", "0.5502238", ...
0.88248926
0
Order the queryset. We have to order the queryset so that the initially selected items is included on the first page (if pagination is enabled). We do this by annotating the queryset with ``cradmin_multiselect2_ordering``, and inserting that as the first order_by argument.
def __order_queryset(self, queryset): if self.get_paginate_by(queryset) and \ self.request.method == "POST" and self.__has_initially_selected_items(): current_order_by = list(queryset.query.order_by) whenqueries = [] max_index = 0 for index, value ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order_queryset(self, queryset):\n if ordering := self.request.query_params.get(\"ordering\"):\n order_by = []\n regex = re.compile(r\"-?annotations__(?P<field_id>\\d+)\")\n fields = [field.strip() for field in ordering.split(\",\")]\n for match in filter(None,...
[ "0.71560806", "0.7139056", "0.6870863", "0.67922276", "0.6618935", "0.64815897", "0.6468904", "0.6468172", "0.6424951", "0.6369157", "0.63566005", "0.6302232", "0.62188977", "0.6209888", "0.59485453", "0.58073837", "0.57893866", "0.57795686", "0.57714677", "0.5764203", "0.571...
0.87618643
0
Get the total number of items in the queryset.
def get_total_number_of_items_in_queryset(self): if not hasattr(self, '_total_number_of_items_in_queryset'): self._total_number_of_items_in_queryset = self.get_queryset().count() return self._total_number_of_items_in_queryset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _items_count(self, queryset: QuerySet) -> int:\n try:\n # forcing to find queryset.count instead of list.count:\n return queryset.all().count()\n except AttributeError:\n return len(queryset)", "def get_count(self, queryset):\n try:\n return qu...
[ "0.84992784", "0.81072676", "0.79202044", "0.7865455", "0.7650362", "0.7556065", "0.75026304", "0.7426682", "0.7417993", "0.7366579", "0.73543835", "0.72923255", "0.72771627", "0.72594136", "0.7247776", "0.7226183", "0.7176402", "0.71185195", "0.7110108", "0.7072527", "0.7051...
0.88325554
0
The maximum number of items to allow for select all button. If this returns a value other than ``None``, we do not render the "Select all" button, if the number of total items available for "Select all" is more than this number. Defaults to ``1500``.
def get_select_all_max_items(self): return 1500
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_all_is_allowed(self):\n select_all_max_items = self.get_select_all_max_items()\n if select_all_max_items is None:\n return True\n else:\n return select_all_max_items > self.get_total_number_of_items_in_queryset()", "def get_number_of_extra_items_in_page_with_...
[ "0.70252526", "0.6669804", "0.6352397", "0.62527984", "0.61645675", "0.6146156", "0.60088444", "0.5970022", "0.58835614", "0.5859612", "0.58561164", "0.5846463", "0.58151114", "0.57568485", "0.5683218", "0.5667214", "0.5610314", "0.5610293", "0.55904967", "0.5571971", "0.5571...
0.8531771
0
Build an actor (policy) network that maps states to actions
def forward(self, state): x = F.relu(self.fc1(state)) x = F.relu(self.fc2(x)) x = F.tanh(self.fc3(x)) # outputs are in the range [-1, 1] return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_actor_network(states, num_controls, params, scope_name):\n scope_key = scope_name + '/'\n with tf.variable_scope(scope_name):\n hidden_1 = tf.layers.dense(states,\n units=params.actor_hidden_units[0],\n activation=None,\n ...
[ "0.6868248", "0.63714385", "0.6355969", "0.6306923", "0.62955344", "0.62876165", "0.62606454", "0.621367", "0.61390996", "0.61377877", "0.6125878", "0.6112537", "0.6091078", "0.60851556", "0.6040934", "0.603093", "0.5994753", "0.59870267", "0.5982781", "0.5982781", "0.5961733...
0.0
-1
Returns true if instance has a timezone set
def has_timezone(self): if self._meta is not None: if 'timezone' in self.meta: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_timezone_aware(value):\n return value.utcoffset() is not None", "def IsValidTimezone(timezone):\n return timezone in pytz.all_timezones", "def datetime_has_tz(dt):\n\n if type(dt) != datetime.datetime:\n raise TypeError(f\"dt must be type datetime.datetime, not {type(dt)}\")\n\n return...
[ "0.7444149", "0.7135427", "0.70546234", "0.7030556", "0.6700065", "0.66844", "0.660307", "0.660307", "0.660307", "0.660307", "0.660307", "0.660307", "0.660307", "0.660307", "0.660307", "0.660307", "0.660307", "0.660307", "0.660307", "0.660307", "0.660307", "0.660307", "0....
0.8662958
0
Get mean capacity factor (fractional) from SAM. Returns
def cf_mean(self): return self['capacity_factor'] / 100
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cf_mean_ac(self):\n return self['capacity_factor_ac'] / 100", "def mean(self):\r\n\t\treturn sum(self.sample)/len(self.sample)", "def cf_mean(self):\n net_power = self['annual_gross_energy'] \\\n - self['annual_thermal_consumption'] # kW-hr\n # q_pb_des is in MW, convert to...
[ "0.71560514", "0.70726603", "0.6985962", "0.69362396", "0.68049246", "0.67527694", "0.65066373", "0.65066373", "0.6505357", "0.6500548", "0.64635056", "0.6462306", "0.64579767", "0.6431924", "0.6400554", "0.63978046", "0.63866943", "0.63816345", "0.6378895", "0.6376668", "0.6...
0.79056674
0
Get mean capacity factor (fractional) from SAM.
def cf_mean(self): return self['capacity_factor'] / 100
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cf_mean_ac(self):\n return self['capacity_factor_ac'] / 100", "def mean(self):\r\n\t\treturn sum(self.sample)/len(self.sample)", "def cf_mean(self):\n net_power = self['annual_gross_energy'] \\\n - self['annual_thermal_consumption'] # kW-hr\n # q_pb_des is in MW, convert to...
[ "0.70603323", "0.6880034", "0.6835476", "0.6788111", "0.66320205", "0.6573475", "0.6357252", "0.63291466", "0.630093", "0.630093", "0.6288409", "0.6282602", "0.6264149", "0.62637913", "0.6262121", "0.62209433", "0.6219153", "0.6217545", "0.6216831", "0.6216049", "0.620431", ...
0.77862644
1
Get mean AC capacity factor (fractional) from SAM.
def cf_mean_ac(self): return self['capacity_factor_ac'] / 100
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cf_mean(self):\n return self['capacity_factor'] / 100", "def cf_mean(self):\n return self['capacity_factor'] / 100", "def cf_mean(self):\n net_power = self['annual_gross_energy'] \\\n - self['annual_thermal_consumption'] # kW-hr\n # q_pb_des is in MW, convert to kW-h...
[ "0.7853294", "0.7853294", "0.70259345", "0.6967903", "0.6581763", "0.6525784", "0.63488173", "0.6318666", "0.61862814", "0.617366", "0.6144307", "0.61426765", "0.6138489", "0.6138489", "0.6126653", "0.61237496", "0.61065096", "0.61044323", "0.6098781", "0.60962373", "0.608279...
0.7828822
2
Calculate mean capacity factor (fractional) from SAM. Returns
def cf_mean(self): net_power = self['annual_field_energy'] \ - self['annual_thermal_consumption'] # kW-hr # q_pb_des is in MW, convert to kW-hr name_plate = self['q_pb_des'] * 8760 * 1000 return net_power / name_plate
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cf_mean(self):\n return self['capacity_factor'] / 100", "def cf_mean(self):\n return self['capacity_factor'] / 100", "def cf_mean_ac(self):\n return self['capacity_factor_ac'] / 100", "def cf_mean(self):\n net_power = self['annual_gross_energy'] \\\n - self['annual_...
[ "0.78366506", "0.78366506", "0.7213904", "0.70456976", "0.6917432", "0.6641863", "0.6615486", "0.6523352", "0.64893466", "0.64461887", "0.6372658", "0.6330099", "0.6312851", "0.63011444", "0.6298018", "0.62896466", "0.62871885", "0.62563205", "0.62298274", "0.6229226", "0.621...
0.6970181
4
Calculate mean capacity factor (fractional) from SAM. Returns
def cf_mean(self): net_power = self['annual_gross_energy'] \ - self['annual_thermal_consumption'] # kW-hr # q_pb_des is in MW, convert to kW-hr name_plate = self['q_pb_design'] * 8760 * 1000 return net_power / name_plate
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cf_mean(self):\n return self['capacity_factor'] / 100", "def cf_mean(self):\n return self['capacity_factor'] / 100", "def cf_mean_ac(self):\n return self['capacity_factor_ac'] / 100", "def cf_mean(self):\n net_power = self['annual_field_energy'] \\\n - self['annual_...
[ "0.7835761", "0.7835761", "0.72121114", "0.69716626", "0.69202733", "0.66434944", "0.661761", "0.6524638", "0.64901936", "0.6447736", "0.6374489", "0.6330711", "0.63152117", "0.6302836", "0.6299375", "0.6290343", "0.6287353", "0.62576735", "0.62313604", "0.6231122", "0.621915...
0.70470864
3
Set the resource potential input to match the gross generation. If SAM throws an error during the UI calculation of the gross output, the resource_potential is simply set to 1 since SAM will error out for this point regardless of the resource_potential input.
def _set_resource_potential_to_match_gross_output(self): super().assign_inputs() self["ui_calculations_only"] = 1 try: self.execute() except SAMExecutionError: self["ui_calculations_only"] = 0 self.sam_sys_inputs["resource_potential"] = -1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_nameplate_to_match_resource_potential(self, resource):\n\n if \"nameplate\" in self.sam_sys_inputs:\n msg = ('Found \"nameplate\" input in config! Resource potential '\n 'from input data will be ignored. Nameplate capacity is {}'\n .format(self.sam_sys...
[ "0.68326056", "0.5412489", "0.53874344", "0.53221726", "0.51737964", "0.51326996", "0.5069885", "0.50695163", "0.5066166", "0.50587565", "0.48671833", "0.48493335", "0.48359364", "0.47758582", "0.4767348", "0.4732671", "0.46847954", "0.467534", "0.46639857", "0.46516064", "0....
0.8566232
0
Initialize a SAM generation object for windpower with a speed/direction joint probability distribution.
def __init__(self, ws_edges, wd_edges, wind_dist, meta, sam_sys_inputs, site_sys_inputs=None, output_request=None): # make sure timezone and elevation are in the meta data meta = self.tz_elev_check(sam_sys_inputs, site_sys_inputs, meta) # don't pass resource t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, rate):\n super(RandomWander, self).__init__()\n self.iteration = 0\n self.rate = rate\n self.speed = 0\n self.heading = 0", "def __init__(self, world, sensordirections):\n self.world = world\n self.x = random.random() * (self.world.MAX_X - self....
[ "0.6332195", "0.6237088", "0.61326396", "0.6075139", "0.6023743", "0.59707034", "0.5970262", "0.5944246", "0.5943441", "0.5913611", "0.59035134", "0.5891417", "0.58875746", "0.5887228", "0.588296", "0.5853242", "0.5840125", "0.58309287", "0.5802881", "0.5797943", "0.579254", ...
0.0
-1
Maximum number of levels in selector.
def max_levels(self): return self._max_levels
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_levels(cls, selector):\n\n assert cls.is_selector(selector)\n\n # Selector class instances already contain max_levels precomputed:\n if isinstance(selector, Selector):\n return selector.max_levels\n\n # Handle unhashable selectors:\n try:\n hash(sele...
[ "0.7974159", "0.7347969", "0.7333348", "0.7312791", "0.71732306", "0.71352065", "0.69966567", "0.6938813", "0.6826169", "0.68172574", "0.680699", "0.6777176", "0.6757097", "0.6754646", "0.6723986", "0.6669813", "0.66676193", "0.66447777", "0.65538216", "0.6546638", "0.6489273...
0.76065534
1
Collapse a list of identifiers into a selector string.
def _collapse(cls, id_list): # XXX doesn't collapse expanded selectors such as /foo/xxx,/bar/yyy # properly raise NotImplemented('unfinished method - should eventually replace collapse()') # Can only collapse list identifiers that all have the same number of # levels: a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collapse(cls, selector):\n\n if isinstance(selector, basestring):\n return selector\n if isinstance(selector, Selector):\n return selector.str\n assert np.iterable(selector)\n result_list = []\n for tokens in selector:\n result_list.append(cls...
[ "0.71842444", "0.6527768", "0.57019985", "0.5616268", "0.5616268", "0.5616268", "0.5616268", "0.5522595", "0.5419446", "0.5393448", "0.53283936", "0.51215094", "0.5117365", "0.49637046", "0.48963165", "0.48899466", "0.48717144", "0.48507997", "0.4824933", "0.48231006", "0.481...
0.6694933
1
Return maximum number of token levels in selector.
def max_levels(cls, selector): assert cls.is_selector(selector) # Selector class instances already contain max_levels precomputed: if isinstance(selector, Selector): return selector.max_levels # Handle unhashable selectors: try: hash(selector) e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_max_level(self):\n level = 0\n for k, v in self.d.items():\n level = max(level, len(k.split(\":\")))\n return level", "def max_levels(self):\n\n return self._max_levels", "def _max_depth(self):\n max_depth = 0\n for node, data in self.traverse()...
[ "0.6903868", "0.68950474", "0.6471589", "0.6451548", "0.6447976", "0.64432436", "0.63977534", "0.6394667", "0.6356721", "0.63470864", "0.632082", "0.63165414", "0.6268676", "0.6234728", "0.6218457", "0.61940134", "0.6173222", "0.6173167", "0.6143011", "0.612021", "0.6111885",...
0.7570045
0
Return tuples containing index labels selected by specified selector.
def get_tuples(cls, df, selector, start=None, stop=None): assert cls.is_selector(selector) max_levels = cls.max_levels(selector) if isinstance(selector, Selector): parse_list = selector.expanded elif isinstance(selector, basestring): try: parse_li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def indices_of_label(self, label_name):\n return self.indices_of('label', label_name)", "def index_to_selector(cls, idx):\n\n if isinstance(idx, pd.MultiIndex):\n return idx.tolist()\n else:\n return [(i,) for i in idx.tolist()]", "def _get_labels(self, ind):\n pas...
[ "0.6618552", "0.64663917", "0.6265983", "0.6064398", "0.5979378", "0.59158325", "0.5898605", "0.5885748", "0.5850731", "0.584639", "0.58279467", "0.5778771", "0.5769794", "0.57526946", "0.5752021", "0.5741234", "0.57249165", "0.57249165", "0.5713543", "0.5711196", "0.570829",...
0.6172722
3
Expand and pad a selector with blank tokens. Expand a selector and pad those port identifier token sequences that contain fewer tokens than the specified maximum.
def pad_selector(cls, selector, pad_len=float('inf')): if isinstance(selector, Selector): expanded = selector.expanded max_levels = selector.max_levels else: expanded = cls.expand(selector) max_levels = max(map(len, expanded)) if pad_len == float...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand(cls, selector, pad_len=0):\n\n if isinstance(selector, Selector):\n if pad_len == 0:\n return selector.expanded\n elif pad_len == float('inf'):\n return [tuple(x)+('',)*(selector.max_levels-len(x)) \\\n for x in selector.e...
[ "0.65998596", "0.6447237", "0.5498191", "0.5318691", "0.5189652", "0.5043646", "0.4995272", "0.4988535", "0.49279222", "0.46803698", "0.46796274", "0.46796274", "0.46796274", "0.46767324", "0.4636259", "0.46077183", "0.46035454", "0.4594835", "0.4565097", "0.45457155", "0.452...
0.6984434
0
Checks if the two sequences contain the same number of TimeSeries.
def _assert_same_length( list_series_1: Sequence[TimeSeries], list_series_2: Sequence[TimeSeries], ): raise_if_not( len(list_series_1) == len(list_series_2), "Sequences of series must be of the same length, found length:" + f" {len(list_series_1)} and {len(list_series_2)}.", )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sanity_check_two_series(\n series_1: TimeSeries,\n series_2: TimeSeries,\n):\n\n _assert_timeseries(series_1)\n _assert_timeseries(series_2)\n\n # check if the two inputs time series have the same number of components\n raise_if_not(\n series_1.width == series_2.width,\n \"Seri...
[ "0.69349927", "0.68864816", "0.68791413", "0.67404485", "0.6721085", "0.6661048", "0.6595091", "0.6538838", "0.6458738", "0.64328456", "0.6254693", "0.62524045", "0.6194896", "0.6192004", "0.619168", "0.6161026", "0.61454237", "0.6140527", "0.61353713", "0.61353683", "0.61237...
0.795908
0
A view to return the index page
def index(request): return render(request, 'home/index.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\r\n return render_template('index.html')", "def index():\n return render_template('index.html')", "def index(self):\n\t\treturn render_template('index.html')", "def index():\n return render_template('index.html')", "def index():\n return render_template('ind...
[ "0.8632635", "0.86302084", "0.8605048", "0.86032695", "0.86032695", "0.85240084", "0.8507123", "0.85032773", "0.849031", "0.849031", "0.8448634", "0.84106755", "0.8402675", "0.84025085", "0.8389702", "0.83814526", "0.8376994", "0.83681214", "0.8364767", "0.8364767", "0.836476...
0.0
-1
A view to return the index page
def contact(request): if request.method == 'GET': form = ContactForm() else: form = ContactForm(request.POST) if form.is_valid(): messageData = { 'first_name': form.cleaned_data['first_name'].title, 'last_name': form.cleaned_data['last_name']....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\r\n return render_template('index.html')", "def index():\n return render_template('index.html')", "def index(self):\n\t\treturn render_template('index.html')", "def index():\n return render_template('index.html')", "def index():\n return render_template('ind...
[ "0.8632635", "0.86302084", "0.8605048", "0.86032695", "0.86032695", "0.85240084", "0.8507123", "0.85032773", "0.849031", "0.849031", "0.8448634", "0.84106755", "0.8402675", "0.84025085", "0.8389702", "0.83814526", "0.8376994", "0.83681214", "0.8364767", "0.8364767", "0.836476...
0.0
-1
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(ColorRangeHSV, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.h_min is None: self.h_min = 0 if self.h_max is None: self.h_max = 0 if self.s_min is N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ...
[ "0.77939814", "0.7719121", "0.7719121", "0.7685456", "0.7625348", "0.7562436", "0.7438642", "0.74158883", "0.73514146", "0.73079604", "0.72799057", "0.7237518", "0.72273636", "0.7222943", "0.7222943", "0.7218754", "0.72103465", "0.72103465", "0.72103465", "0.72103465", "0.721...
0.0
-1
Return the logistic loss L(x) = 1/N (ln(1 + exp(y (w^Tx + b)))) + 1/2 lambda w^T w
def loss(self, x, y): (N,D) = x.shape k1 = np.matmul(x,np.transpose(self.w)) + self.b y1 = y.reshape((N,1)) c2 = 0 c1 = (np.log(1+np.exp(-1*y1*k1))) for i in range(N): c2 += c1[i][0] l = c2 / N + (0.5 * self.l2_reg * np.dot(self.w,np.transpose(self.w))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_loss_logreg_regl2(y, tx, w, lambda_):\n loss = compute_loss_logreg(y, tx, w)\n penal_loss = loss + lambda_ * w.dot(w)\n\n return penal_loss", "def loss_maxL(y, tx, w):\n # to avoid problems when 0 in log\n epsilon=0.00000001\n sig=sigmoid(tx.dot(w))\n # calculated probability\n ...
[ "0.7673644", "0.7667611", "0.76457655", "0.7536872", "0.7487085", "0.7219662", "0.7191178", "0.7185523", "0.7155361", "0.71262443", "0.7110036", "0.70903665", "0.707757", "0.7060995", "0.69849294", "0.6984508", "0.69724464", "0.6960704", "0.6953363", "0.6952606", "0.687678", ...
0.7517196
4
Gets max value of correlation between `data` and `perm` Excludes diagonal of correlation
def _get_permcorr(data, perm): data, perm = np.asarray(data), np.asarray(perm) # don't include NaN data in the correlation process mask = np.logical_not(np.all(np.isnan(perm), axis=1)) # we want to correlat terms across regions, not vice-versa data, perm = data[mask].T, perm[mask].T out = np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cluster(r: np.ndarray):\n return np.argmax(r, axis=0)", "def correlation(data):\n return corrcoef(np.transpose(np.reshape(data, ((data.shape[0] * data.shape[1]), data.shape[2]))))", "def Max(data):\n return data.max()", "def simple_flatfield_corr(flat, real, Mfaktor, Pfaktor):\n real=real.ast...
[ "0.56098264", "0.5602749", "0.544925", "0.5432573", "0.5428663", "0.5407193", "0.5384165", "0.5377486", "0.53436375", "0.5339485", "0.5335424", "0.5323059", "0.5309252", "0.5280461", "0.5266154", "0.5250505", "0.5229939", "0.5209231", "0.5205071", "0.5201974", "0.5191317", ...
0.8025008
0
Given list (haystack), return index (0based) of needle in the list. Return None if needle is not in haystack. Do this with recursion. You MAY NOT USE A `for` OR `while` LOOP. >>> lst = ["hey", "there", "you"] >>> recursive_search("hey", lst) 0 >>> recursive_search("you", lst) 2 >>> recursive_search("porcupine", lst) is...
def recursive_search(needle, haystack, idx=0): # def _recursive_haystack(needle, haystack, idx=0): # # if the index is equal to len of haystack, then we've gone thru haystack & needle not there # if idx == len(haystack): # return None # # if the haystack item at index is the needle. we found it, return that i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recursive_index(needle, haystack):\n\n def _recursive_index(needle, haystack, idx):\n\n if idx == len(haystack):\n return None\n\n if haystack[idx] == needle:\n return idx\n\n return _recursive_index(needle, haystack, idx + 1)\n\n return _recursive_index(needle,...
[ "0.790782", "0.76973486", "0.7232432", "0.7228944", "0.71306026", "0.70438343", "0.6961806", "0.6928644", "0.6853213", "0.680411", "0.6803073", "0.67641443", "0.6701848", "0.66972595", "0.66448087", "0.6587753", "0.6548974", "0.6548092", "0.65462524", "0.6542683", "0.6499958"...
0.84011865
0
Modify the SOAP_CONNECTOR_ADDRESS attributes.
def modifySoapConnectorAddress( self, hostName='dilabvirt31-v5', port='8886' ): self.debug( __name__ + ".modifySoapConnectorAddress(): hostName=" + str( hostName ) + "\n" ) self.debug( __name__ + ".modifySoapConnectorAddress(): port=" + str( port ) + "\n" ) rVal = False #########...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setAddress(self, addresses):\n self.addr = addresses\n for i in xrange(len(self.addr)):\n if not ':' in self.addr[i]: \n self.addr[i] += ':' + self.port \n self.addr[i] += '/' + self.service", "def set_address(self, address):\n pass", "def _compute_...
[ "0.56529516", "0.55869627", "0.51931524", "0.5116231", "0.506068", "0.50536764", "0.50536764", "0.50536764", "0.50226897", "0.50225097", "0.5004094", "0.49799424", "0.4966009", "0.49572238", "0.4895384", "0.48875633", "0.487927", "0.4869571", "0.48143852", "0.48139822", "0.48...
0.7118542
0
Load a pretrained embedding matrix
def load_embedding_matrix(filepath, word2vec_format = False): if word2vec_format: return gensim.models.KeyedVectors.load_word2vec_format(filepath, binary=True) else: #own pretrained model return gensim.models.Word2Vec.load(filepath)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_emb_matrix(path):\n embedding_matrix = np.load(path + '/emb_matrix.npy')\n print('Embedding matrix load from local sys successful\\n')\n print('Denormalized Shape: ({},{})'.format(np.shape(embedding_matrix)[0], np.shape(embedding_matrix)[1]))\n return embedding_matrix", "def load_pretrained_...
[ "0.79316217", "0.72435796", "0.7226091", "0.7138556", "0.71383315", "0.69717366", "0.6889167", "0.6850099", "0.6846694", "0.68171304", "0.6798442", "0.672381", "0.6612428", "0.66112345", "0.65442795", "0.653562", "0.65150726", "0.6507834", "0.64870524", "0.64121467", "0.64074...
0.7213618
3
The set of arguments for constructing a EventSubscription resource.
def __init__(__self__, *, scope: pulumi.Input[str], advanced_filter: Optional[pulumi.Input['EventSubscriptionAdvancedFilterArgs']] = None, advanced_filtering_on_arrays_enabled: Optional[pulumi.Input[bool]] = None, azure_function_endpoint: Optional[pulu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(__self__,\n resource_name: str,\n args: EventSubscriptionArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...", "def __init__(__self__,\n resource_name: str,\n opts: Optional[pulumi.ResourceOptions] = Non...
[ "0.7666129", "0.7021309", "0.69376934", "0.6563161", "0.64682055", "0.64578974", "0.6195124", "0.6064437", "0.60094434", "0.59945804", "0.59935945", "0.58073026", "0.5709241", "0.5691872", "0.5657461", "0.56559736", "0.5640776", "0.5632642", "0.56252927", "0.5617892", "0.5610...
0.66352946
3
Specifies the id where the Event Hub is located.
def eventhub_endpoint_id(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "eventhub_endpoint_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id(self) -> str:\n return self._event.get('id')", "def setId(self, *args):\n return _libsbml.Event_setId(self, *args)", "def eventhub_endpoint_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"eventhub_endpoint_id\")", "def id(self, id: str):\n self._id = id", "def...
[ "0.69516504", "0.68593204", "0.6687535", "0.64776427", "0.6399978", "0.6325267", "0.62888384", "0.62888384", "0.62888384", "0.6230918", "0.6217564", "0.6217564", "0.6217564", "0.6217564", "0.6217564", "0.6217564", "0.6217564", "0.6217564", "0.6217564", "0.6217564", "0.6217564...
0.6860418
1
Specifies the expiration time of the event subscription (Datetime Format `RFC 3339`).
def expiration_time_utc(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "expiration_time_utc")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expiration_time(self) -> str:\n return pulumi.get(self, \"expiration_time\")", "def expiration_time(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"expiration_time\")", "def set_expiration(self):\n # This is an arbitrary decision setting the expiration time\n #...
[ "0.6938237", "0.6767116", "0.6624807", "0.6600456", "0.65979075", "0.64695776", "0.64277744", "0.64235485", "0.6334567", "0.6334567", "0.6334567", "0.6324719", "0.63217336", "0.63126534", "0.62667197", "0.62667197", "0.6261941", "0.62240297", "0.62067884", "0.62040174", "0.61...
0.66232395
3