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 the icon set to the button. If the widget is waiting it is not returning the visible icon, but the one requested by the application (the one displayed when the widget is not in waiting state).
def getIcon(self): return self.__icon
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __updateVisibleIcon(self):\n if not self.isWaiting():\n icon = self.__icon\n else:\n icon = self.__waitingIcon.currentIcon()\n if icon is None:\n icon = qt.QIcon()\n qt.QPushButton.setIcon(self, icon)", "def get_icon(self):\n icon = self._wi...
[ "0.7390753", "0.7312438", "0.7035568", "0.69385475", "0.6813322", "0.6786125", "0.6727427", "0.6727427", "0.6726083", "0.67245793", "0.67245793", "0.67245793", "0.67245793", "0.67245793", "0.67245793", "0.67245793", "0.67245793", "0.67245793", "0.67245793", "0.67245793", "0.6...
0.656732
32
Set the enabled state of the widget.
def setEnabled(self, enabled): if self.__enabled == enabled: return self.__enabled = enabled self.__updateVisibleEnabled()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_enabled(self, enabled):\n self.widget.setEnabled(enabled)", "def enable(self):\r\n self.isEnabled = True", "def set_enabled(self, state=None):\n if state is None:\n state = not self.isEnabled\n else:\n self.pbEnable.setChecked(state)\n self.log.d...
[ "0.862211", "0.77725065", "0.77513987", "0.77442396", "0.7708465", "0.7708465", "0.76726854", "0.76726854", "0.758973", "0.7589063", "0.75823504", "0.75823504", "0.75823504", "0.75823504", "0.75823504", "0.75823504", "0.75823504", "0.75800765", "0.75580585", "0.7552032", "0.7...
0.7684415
6
Returns the enabled state of the widget.
def isEnabled(self): return self.__enabled
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getEnabled(self):\r\n return self.isEnabled", "def getEnabled(self):\n return self.isEnabled", "def _getEnabled(self):\n \n return self._enabled.value", "def enabled(self):\n return self._enabled", "def enabled(self):\n return self._enabled", "def enabled(sel...
[ "0.7850769", "0.77898777", "0.7778025", "0.7715891", "0.7715891", "0.7715891", "0.7715891", "0.7715891", "0.7715891", "0.76651174", "0.76651174", "0.76651174", "0.76651174", "0.75618", "0.75618", "0.75618", "0.75618", "0.75618", "0.75618", "0.75618", "0.75618", "0.75618", ...
0.7171766
86
Returns true if the widget is in waiting state.
def isWaiting(self): return self.__waiting
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_waiting(self):\n w = self.__waiting_till-time.time() if self.__waiting_till else 0\n return (w) if w>0 else 0", "def waiting(self):\r\n\r\n return self._serial_object.in_waiting", "def in_waiting(self):\n # not implemented\n return 0", "def inWaiting(self):\n ...
[ "0.77388614", "0.7634339", "0.7302295", "0.7140732", "0.6989416", "0.69803774", "0.69246507", "0.69031274", "0.686646", "0.68508345", "0.68401414", "0.6833945", "0.67783064", "0.6673178", "0.66513044", "0.66469806", "0.6635022", "0.66243887", "0.6620751", "0.658695", "0.65673...
0.8329644
0
Add SOS TOKEN and EOS TOKEN into padded_input
def preprocess(self, padded_input): seq = [y[y != self.vocab.PAD_ID] for y in padded_input] eos = seq[0].new([self.vocab.EOS_ID]) sos = seq[0].new([self.vocab.SOS_ID]) seq_in = [torch.cat([sos, seq[i]], dim=0) for i in range(len(seq))] seq_out = [torch.cat([y, eos], dim=0) for y ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(data, padded_token, device):\n lengths = [len(sent) for sent in data]\n max_len = lengths[0]\n padded_data = []\n for s in data:\n padded_data.append(s + [padded_token] * (max_len - len(s)))\n return torch.tensor(padded_data, device=device), lengths", "def pad(tokens_x, encodings_y,...
[ "0.60750765", "0.5759003", "0.5743133", "0.5742415", "0.5642271", "0.561248", "0.55930483", "0.5588034", "0.5507322", "0.5472101", "0.5432464", "0.53936553", "0.53689784", "0.5349342", "0.5342693", "0.5338642", "0.52846175", "0.5282595", "0.52505964", "0.5244475", "0.5244163"...
0.6677685
0
Buy shares of stock
def buy(): if request.method == "POST": if not request.form.get("symbol"): return apology("No symbol specified", 400) elif not request.form.get("shares"): return apology("No shares specified", 400) try: shares_to_sell = int(request.form.get("shares")) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _buy(self, stock, sig, day):\n\n idx = self.ncs.index(stock)\n # Calculate the maximum possible number of stock unit the current cash can buy\n available_unit = self.state[0] // self.stock_price.loc[day][stock]\n num_share = min(available_unit, int(sig))\n # Deduct the traded...
[ "0.76153445", "0.74124885", "0.7267408", "0.7223713", "0.718933", "0.71885616", "0.7062022", "0.70250934", "0.69889945", "0.6956662", "0.6870458", "0.6861766", "0.68553936", "0.6828792", "0.6827072", "0.68264323", "0.68008643", "0.6792532", "0.67765707", "0.6768273", "0.67630...
0.6875506
10
Sell shares of stock
def sell(): if request.method == "POST": if not request.form.get("symbol"): return apology("No stock name specified", 400) if not request.form.get("shares"): return apology("No shares specified", 400) # cast user's desired amount of shares to sell to int sh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sell(self, stock, sig, day):\n\n # Get the index of the stock\n idx = self.ncs.index(stock)\n\n # Only need to sell the unit recommended by the trading agent, not necessarily all stock unit.\n num_share = min(abs(int(sig)), self.state[idx + 1])\n commission = dp.Trading.comm...
[ "0.7493962", "0.7363704", "0.72457373", "0.7232984", "0.7157004", "0.7102979", "0.70986", "0.7088864", "0.7058037", "0.7032456", "0.7011614", "0.6995602", "0.6966525", "0.69662094", "0.6964375", "0.69479614", "0.6914818", "0.68679184", "0.68611443", "0.6845491", "0.6813046", ...
0.7170457
4
Clone audit and all relevant attributes. Keeps the internals of actual audit cloning and everything that is related to audit itself (auditors, audit firm, context setting, custom attribute values, etc.)
def _clone(self, source_object): from ggrc_basic_permissions import create_audit_context data = { "title": source_object.generate_attribute("title"), "description": source_object.description, "audit_firm": source_object.audit_firm, "start_date": source_object.start_date, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clone_auditors(self, audit):\n from ggrc_basic_permissions.models import Role, UserRole\n\n role = Role.query.filter_by(name=\"Auditor\").first()\n auditors = [ur.person for ur in UserRole.query.filter_by(\n role=role, context=audit.context).all()]\n\n for auditor in auditors:\n user_r...
[ "0.6818911", "0.62203836", "0.6059369", "0.6032767", "0.59604955", "0.59452516", "0.5896033", "0.57951546", "0.5788379", "0.57595056", "0.57521707", "0.57501686", "0.57412755", "0.5734436", "0.5726894", "0.57249266", "0.56752616", "0.565133", "0.56372064", "0.5606796", "0.559...
0.7577672
0
Clone audit with specified whitelisted children. Children that can be cloned should be specified in CLONEABLE_CHILDREN.
def clone(self, source_id, mapped_objects=None): if not mapped_objects: mapped_objects = [] source_object = Audit.query.get(source_id) self._clone(source_object) if any(mapped_objects): related_children = source_object.related_objects(mapped_objects) for obj in related_children: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clone(self):\n return self.with_children([child.clone() for child in self.children()])", "def _clone(self, source_object):\n from ggrc_basic_permissions import create_audit_context\n\n data = {\n \"title\": source_object.generate_attribute(\"title\"),\n \"description\": source_obje...
[ "0.6033833", "0.5886941", "0.5713085", "0.5561226", "0.5525625", "0.5455173", "0.5403635", "0.52772766", "0.52084017", "0.5171388", "0.5110375", "0.5065967", "0.5052923", "0.5020431", "0.50058293", "0.5004255", "0.49845105", "0.49833015", "0.49799117", "0.49589595", "0.495821...
0.51665187
10
check the time string for valid format
def checktime(self, timestr): rfdtregex = "\\d\\d\\d\\d-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\dZ?" if not re.match(rfdtregex, timestr): raise InvalidCommandLineError( "Invalid redfish date-time format. " "Accepted formats: YYYY-MM-DDThh:mm:ss, YYYY-MM-DDThh:mm:ssZ"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_time_in_given_format(time_string, time_format):\n try:\n datetime.strptime(time_string, time_format)\n return True\n except ValueError:\n return False", "def _validate_format(date: str, time: str) -> None:\n\tif \"-\" in date and \":\" not in time and len(time) != 2 or \"-\" not...
[ "0.7943676", "0.78781074", "0.78402543", "0.7805838", "0.7669313", "0.7601425", "0.75174946", "0.7507908", "0.73842657", "0.71417624", "0.70895094", "0.70776564", "0.70622957", "0.7000997", "0.69635844", "0.6947173", "0.6932041", "0.69125116", "0.69017565", "0.68622065", "0.6...
0.8521238
0
Sets the variable name.
def setName(self, name): self.name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_variable_name(self, name):\n self._variable_name = name\n self.lbl_name.setText(name)", "def SetVariableName(self, value):\n self.varName = value", "def setvarname(name):\n global VARNAME\n VARNAME = name", "def set_name(self, _name):\n self.__name = _name", "def s...
[ "0.8882525", "0.7964254", "0.7823231", "0.7791178", "0.77763504", "0.7753824", "0.7728544", "0.7704325", "0.7688285", "0.7687386", "0.76664716", "0.76664716", "0.7649016", "0.7649016", "0.7649016", "0.7649016", "0.7649016", "0.7649016", "0.7649016", "0.7644509", "0.76325345",...
0.0
-1
Appends a description to the ODS.
def with_append_description(self, description) -> "SimpleOpMapping": self.append_description += textwrap.dedent(description) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_description(self, description):\n self.description = description", "def add_description(self, description):\n self.description = description\n return self", "def description(self, description):\r\n\r\n self._description = description", "def description(self, description):\...
[ "0.79873526", "0.7714422", "0.7419002", "0.7358399", "0.7358399", "0.7358399", "0.7358399", "0.7358399", "0.7358399", "0.7358399", "0.73554534", "0.73473233", "0.73473233", "0.73473233", "0.73473233", "0.73473233", "0.73473233", "0.73473233", "0.73473233", "0.73473233", "0.73...
0.7201396
81
Whether the op contains an out parameter that aliases to the result.
def is_outref_form(self) -> bool: return any(isinstance(a, TensorOutRef) for a in self.all_arg_values)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_output_directive_with_name(directive, out_name):\n if not isinstance(directive, DirectiveNode):\n raise AssertionError('Input \"{}\" is not a directive.'.format(directive))\n return (\n directive.name.value == OutputDirective.name\n and directive.arguments[0].value.value == out_n...
[ "0.6367493", "0.6091174", "0.5592427", "0.54576486", "0.5440794", "0.5419403", "0.54108936", "0.53959835", "0.5348858", "0.5336156", "0.53206575", "0.53195006", "0.53139734", "0.5285099", "0.5282687", "0.52389127", "0.5196776", "0.5181184", "0.5173242", "0.5141291", "0.513907...
0.69175076
0
Returns the list of OpMapping.
def mappings(self) -> Sequence[OpMapping]: self._finalize_pending() return self._mappings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def operation_list(self):\n op_list = []\n\n for mode in EVOHOME_STATE_MAP:\n op_list.append(EVOHOME_STATE_MAP.get(mode))\n\n return op_list", "def oplist(self):\n return self._oplist", "def GetCommandMap(self):\r\n\r\n return self.__fCmdMap", "def operation_list(sel...
[ "0.7005265", "0.6967543", "0.65555173", "0.65236795", "0.6397053", "0.6318123", "0.61985654", "0.61985654", "0.61985654", "0.6122278", "0.6055096", "0.60422975", "0.5934118", "0.593317", "0.5926629", "0.5923069", "0.5906381", "0.58494234", "0.58245534", "0.5822336", "0.581287...
0.76318836
0
Generates the random data as a float for a single val and a dict for multiple sub values
def get_value(self): if self.single_val: return self.gen_single_value(self.average_value[0]) else: sensor_dict = {} for sub_value in self.average_value: sub_value_name = sub_value[0] sub_average_value = sub_value[1] if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def goodfloat(population=100, size=10, offset=0.0, mult=1.0):\n z = zip(np.random.randint(population,size=size), mult*np.random.rand(size)+offset)\n return dict(z)", "def make_data():\n number1 = random.randint(1, 2)\n number2 = random.randint(1, 2)\n arithmetic_sign = random.choice([\"+\", \"-\",...
[ "0.67142564", "0.6617645", "0.65312296", "0.61759", "0.6107741", "0.61026716", "0.60779834", "0.6030015", "0.5922161", "0.5911953", "0.5885854", "0.5836075", "0.5834178", "0.58166736", "0.57710147", "0.57643783", "0.576343", "0.5733395", "0.5728145", "0.5669301", "0.5661221",...
0.52243376
96
Validate non tensor input. ``threshold`` has to be a float in the [0,1] range ``ignore_index`` has to be None or int ``normalize`` has to be "true" | "pred" | "all" | "none" | None
def _binary_confusion_matrix_arg_validation( threshold: float = 0.5, ignore_index: Optional[int] = None, normalize: Optional[Literal["true", "pred", "all", "none"]] = None, ) -> None: if not (isinstance(threshold, float) and (0 <= threshold <= 1)): raise ValueError(f"Expected argument `threshold...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_threshold(self, outputs, threshold):\n outputs[outputs < threshold] = 0\n return outputs", "def thresholds(self) -> torch.Tensor:\n pass", "def _check_threshold_value(self, attribute, value):\n if self.measure == self.MeasureType.PROGRESS:\n if self.threshold >...
[ "0.55606663", "0.54343206", "0.53747463", "0.53559595", "0.5339514", "0.5297221", "0.5289721", "0.5246839", "0.5236195", "0.5228038", "0.5228038", "0.5220097", "0.52033365", "0.5181006", "0.51600856", "0.5093216", "0.50197923", "0.5014642", "0.5008656", "0.50076544", "0.50001...
0.68796605
0
Validate tensor input. tensors have to be of same shape all values in target tensor that are not ignored have to be in {0, 1} if pred tensor is not floating point, then all values also have to be in {0, 1}
def _binary_confusion_matrix_tensor_validation( preds: Tensor, target: Tensor, ignore_index: Optional[int] = None ) -> None: # Check that they have same shape _check_same_shape(preds, target) # Check that target only contains {0,1} values or value in ignore_index unique_values = torch.unique(target...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_shape_and_type_consistency(preds: Tensor, target: Tensor) -> None:\n if len(preds.shape) != 3:\n raise ValueError(\n \"Input tensor `preds` is expected to have 3 dimensions, [batch_size, seq_len, vocab_size],\"\n f\" but got {len(preds.shape)}.\"\n )\n if len(ta...
[ "0.7069342", "0.6736492", "0.6736492", "0.6436123", "0.62900925", "0.62531376", "0.6235977", "0.62259585", "0.6220065", "0.62050676", "0.6167814", "0.61412966", "0.60870016", "0.60620743", "0.60530084", "0.603633", "0.59960955", "0.5988873", "0.5950044", "0.59440786", "0.5895...
0.6680305
3
Validate tensor input. if target has one more dimension than preds, then all dimensions except for preds.shape[1] should match exactly. preds.shape[1] should have size equal to number of classes if preds and target have same number of dims, then all dimensions should match all values in target tensor that are not ignor...
def _multiclass_confusion_matrix_tensor_validation( preds: Tensor, target: Tensor, num_classes: int, ignore_index: Optional[int] = None ) -> None: if preds.ndim == target.ndim + 1: if not preds.is_floating_point(): raise ValueError("If `preds` have one dimension more than `target`, `preds` s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_shape_and_type_consistency(preds: Tensor, target: Tensor) -> None:\n if len(preds.shape) != 3:\n raise ValueError(\n \"Input tensor `preds` is expected to have 3 dimensions, [batch_size, seq_len, vocab_size],\"\n f\" but got {len(preds.shape)}.\"\n )\n if len(ta...
[ "0.69818896", "0.67453897", "0.67453897", "0.66937745", "0.662097", "0.6533285", "0.65141064", "0.6438762", "0.62983894", "0.62652856", "0.6189254", "0.6137123", "0.61180824", "0.6092213", "0.6085511", "0.6077333", "0.60702485", "0.602693", "0.60261273", "0.60021996", "0.5974...
0.71073043
0
Validate non tensor input. ``num_labels`` should be an int larger than 1 ``threshold`` has to be a float in the [0,1] range ``ignore_index`` has to be None or int ``normalize`` has to be "true" | "pred" | "all" | "none" | None
def _multilabel_confusion_matrix_arg_validation( num_labels: int, threshold: float = 0.5, ignore_index: Optional[int] = None, normalize: Optional[Literal["true", "pred", "all", "none"]] = None, ) -> None: if not isinstance(num_labels, int) or num_labels < 2: raise ValueError(f"Expected argum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _binary_confusion_matrix_arg_validation(\n threshold: float = 0.5,\n ignore_index: Optional[int] = None,\n normalize: Optional[Literal[\"true\", \"pred\", \"all\", \"none\"]] = None,\n) -> None:\n if not (isinstance(threshold, float) and (0 <= threshold <= 1)):\n raise ValueError(f\"Expected...
[ "0.68199515", "0.57741", "0.57674664", "0.56378096", "0.5611914", "0.5529116", "0.5464412", "0.5445002", "0.54250604", "0.5394769", "0.53423256", "0.53423226", "0.5287817", "0.5279493", "0.52653915", "0.52374715", "0.5227458", "0.522666", "0.52122545", "0.52122545", "0.521225...
0.6560207
1
Validate tensor input. tensors have to be of same shape the second dimension of both tensors need to be equal to the number of labels all values in target tensor that are not ignored have to be in {0, 1} if pred tensor is not floating point, then all values also have to be in {0, 1}
def _multilabel_confusion_matrix_tensor_validation( preds: Tensor, target: Tensor, num_labels: int, ignore_index: Optional[int] = None ) -> None: # Check that they have same shape _check_same_shape(preds, target) if preds.shape[1] != num_labels: raise ValueError( "Expected both `tar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_shape_and_type_consistency(preds: Tensor, target: Tensor) -> None:\n if len(preds.shape) != 3:\n raise ValueError(\n \"Input tensor `preds` is expected to have 3 dimensions, [batch_size, seq_len, vocab_size],\"\n f\" but got {len(preds.shape)}.\"\n )\n if len(ta...
[ "0.7069352", "0.6840995", "0.66971004", "0.66091293", "0.66091293", "0.6432844", "0.62472093", "0.6209393", "0.616245", "0.6136281", "0.612021", "0.61027724", "0.6080511", "0.60785705", "0.6070671", "0.60339475", "0.6025183", "0.60105085", "0.60055894", "0.59998316", "0.59990...
0.6736713
2
Prepare subscription when on subclass creation. This method is invoked by the superclass `__init__subclass__`. It is needed to process class fields, `Meta` and inheritance parameters. This is genuine Graphene approach.
def __init_subclass_with_meta__( cls, subscribe=None, publish=None, unsubscribed=None, output=None, arguments=None, _meta=None, **options, ): # pylint: disable=arguments-differ if not _meta: _meta = SubscriptionOptions(cls) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs):\n # Make it mixin friendly.\n super(EventSubscriber, self).__init__(*args, **kwargs)\n # A hash of lists of event keys to specific event subscriptions.\n self._event_subs = {}", "def __init_subclass__(cls, **kwargs):\n super().__init_subclas...
[ "0.6508736", "0.6354514", "0.6222242", "0.6222242", "0.6222242", "0.6222242", "0.6222242", "0.6222242", "0.6222242", "0.6222242", "0.6222242", "0.6222242", "0.6222242", "0.6222242", "0.6222242", "0.6222242", "0.6222242", "0.6222242", "0.6222242", "0.6222242", "0.6222242", "...
0.7025465
0
Whitens the input matrix X using specified whitening method.
def whitening(X): X = X.reshape((-1, np.prod(X.shape[1:]))) X_mean = np.mean(X,axis=0) X_centered = X - X_mean Sigma = np.dot(X_centered.T, X_centered) / X_centered.shape[0] U, Lambda, V = np.linalg.svd(Sigma) W = np.dot(np.diag(1.0 / np.sqrt(Lambda + 1e-5)), U.T) return U,X_mean,W,np.dot(X_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def whiten(self, X):\n X = np.asarray(X, np.float64)\n\n if X.ndim == 1:\n return X * np.sqrt(self.weights)\n elif X.ndim == 2:\n c = np.sqrt(self.weights)\n v = np.zeros(X.shape, np.float64)\n for i in range(X.shape[1]):\n v[:, i] = X...
[ "0.76888466", "0.7660774", "0.7476824", "0.6830462", "0.67796284", "0.67350334", "0.67282814", "0.65173185", "0.640683", "0.6372726", "0.6303518", "0.627301", "0.62313753", "0.61369467", "0.61058986", "0.60018", "0.5975305", "0.5823118", "0.57586986", "0.57059586", "0.5681267...
0.74452513
3
Sets the if_index of this DeviceIfResultResponse.
def if_index(self, if_index): self._if_index = if_index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ifnum(self, ifnum) :\n\t\ttry :\n\t\t\tself._ifnum = ifnum\n\t\texcept Exception as e:\n\t\t\traise e", "def ifnum(self, ifnum) :\n\t\ttry :\n\t\t\tself._ifnum = ifnum\n\t\texcept Exception as e:\n\t\t\traise e", "def set_iftype(self, index, iftype):\n self.d.set_iftype(index, iftype)", "def set_i...
[ "0.63933396", "0.63933396", "0.5892633", "0.55970514", "0.52720845", "0.52720845", "0.5113595", "0.5096519", "0.50582355", "0.50237983", "0.50181955", "0.5017941", "0.5017941", "0.5011589", "0.49568307", "0.49122357", "0.4856831", "0.4823033", "0.4800283", "0.47797757", "0.47...
0.80088896
0
Sets the ipv4_mask of this DeviceIfResultResponse.
def ipv4_mask(self, ipv4_mask): self._ipv4_mask = ipv4_mask
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ipv4_address(self, ipv4_address):\n\n self._ipv4_address = ipv4_address", "def _set_ipv4(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=yc_ipv4_openconfig_interfaces__interfaces_interface_tunnel_ipv4, is_container='container', yang...
[ "0.57829785", "0.57129586", "0.57122", "0.5514427", "0.5499684", "0.5438092", "0.541591", "0.53407836", "0.518596", "0.5142695", "0.513027", "0.5104104", "0.5104104", "0.50331855", "0.50116366", "0.48966414", "0.48857167", "0.481812", "0.4814347", "0.4802458", "0.47634503", ...
0.8131506
0
Sets the native_vlan_id of this DeviceIfResultResponse.
def native_vlan_id(self, native_vlan_id): self._native_vlan_id = native_vlan_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_native_vlan(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': [u'1..4090']}), is_lea...
[ "0.68739057", "0.5760064", "0.5677483", "0.56322724", "0.55054367", "0.54716694", "0.54716694", "0.5301374", "0.5198108", "0.5198108", "0.51947874", "0.5102988", "0.50153357", "0.48800918", "0.48750442", "0.48717448", "0.48408034", "0.4807637", "0.47563535", "0.47544217", "0....
0.79965913
0
Sets the ipv4_address of this DeviceIfResultResponse.
def ipv4_address(self, ipv4_address): self._ipv4_address = ipv4_address
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ipv4_mask(self, ipv4_mask):\n\n self._ipv4_mask = ipv4_mask", "def set_ipv4_address(self, client: Client, ipv4_address: str, port: int):\n\n if ASSERTS:\n socket.inet_aton(ipv4_address)\n assert port < 2**16\n assert port > 0\n\n # todo: check contract if...
[ "0.7049512", "0.6508009", "0.64379346", "0.642062", "0.6410283", "0.6368729", "0.63471603", "0.62412286", "0.5990773", "0.58801985", "0.58474725", "0.5836719", "0.58346564", "0.58346564", "0.5814227", "0.5582705", "0.5563055", "0.55000055", "0.5401343", "0.5378685", "0.536303...
0.750242
0
Sets the description of this DeviceIfResultResponse.
def description(self, description): self._description = description
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_description(self, description):\n self.__description = description", "def description(self, value):\n self.set_property(\"Description\", value)", "def set_description(self, description):\n self.description = description", "def set_description(self, description):\n self.des...
[ "0.52630407", "0.51946515", "0.5187855", "0.5187855", "0.5178144", "0.51656103", "0.5154939", "0.515011", "0.5126634", "0.5122275", "0.511781", "0.511781", "0.511781", "0.511781", "0.511781", "0.511781", "0.511781", "0.5108312", "0.50768423", "0.5070641", "0.5070013", "0.50...
0.51507545
52
Sets the duplex of this DeviceIfResultResponse.
def duplex(self, duplex): self._duplex = duplex
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def duplex(self) :\n\t\ttry :\n\t\t\treturn self._duplex\n\t\texcept Exception as e:\n\t\t\traise e", "def duplex_mode(self):\n cmd = 'CONFigure:LTE:SIGN:{}:DMODe?'.format(self._bts)\n return self._cmw.send_and_recv(cmd)", "def _set_duplex_mode(self, v, load=False):\n if hasattr(v, \"_utype\")...
[ "0.62332153", "0.56666553", "0.5597803", "0.55937153", "0.55103064", "0.53202254", "0.52505225", "0.5177561", "0.5177561", "0.46227154", "0.44241732", "0.44003662", "0.43901864", "0.43610337", "0.43462178", "0.4326212", "0.42745224", "0.42745224", "0.4245276", "0.4221352", "0...
0.6796863
0
Sets the port_name of this DeviceIfResultResponse.
def port_name(self, port_name): self._port_name = port_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_port_name(self, port, updated_name):\n port_name = port['name']\n # Might need to update the associated interface and vlan names as well\n interface = self.dbapi.iinterface_get(port['interface_id'])\n if interface.ifname == port_name:\n LOG.info(\"Updating interfa...
[ "0.62100685", "0.5998853", "0.5885159", "0.5715739", "0.5701729", "0.5595254", "0.5551361", "0.5534314", "0.5534314", "0.5534314", "0.551592", "0.5496601", "0.5496601", "0.5435631", "0.53814286", "0.53746736", "0.5371793", "0.5365072", "0.5352669", "0.5296275", "0.5281883", ...
0.68207186
0
Sets the interface_type of this DeviceIfResultResponse.
def interface_type(self, interface_type): self._interface_type = interface_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_interface_type_lif(self, v, load=False):\n parent = getattr(self, \"_parent\", None)\n if parent is not None and load is False:\n raise AttributeError(\"Cannot set keys directly when\" +\n \" within an instantiated list\")\n\n if hasattr(v, \"_utype\"):\n v =...
[ "0.65035295", "0.6482835", "0.6373217", "0.6373217", "0.6373217", "0.6373217", "0.62904483", "0.6207036", "0.5998203", "0.597156", "0.59681505", "0.5965153", "0.5965153", "0.5965153", "0.5965153", "0.5964346", "0.5959737", "0.5959737", "0.5954796", "0.5954796", "0.5954796", ...
0.75019646
0
Sets the admin_status of this DeviceIfResultResponse.
def admin_status(self, admin_status): self._admin_status = admin_status
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_admin_status(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type=\"dict_key\", restriction_arg={u'oc-mplst:ADMIN_DOWN': {'@namespace': u'http://openconfig.net/yang/mpls-types', '@modul...
[ "0.7094122", "0.7094122", "0.7094122", "0.7094122", "0.70926833", "0.70926833", "0.70926833", "0.70926833", "0.6791334", "0.6791334", "0.67532283", "0.62644804", "0.62644804", "0.62644804", "0.62644804", "0.62644804", "0.62644804", "0.62644804", "0.62644804", "0.62644804", "0...
0.7992941
1
Sets the id of this DeviceIfResultResponse.
def id(self, id): self._id = id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result_id(self, result_id):\n\n self._result_id = result_id", "def _set_unique_id(self, json_response):\n self.unique_id = json_response.get('id')", "def _set_interface_id(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=uni...
[ "0.56232053", "0.56208146", "0.5603237", "0.5603237", "0.5603237", "0.5603237", "0.55943894", "0.55943894", "0.55943894", "0.55943894", "0.5507809", "0.54366934", "0.5332915", "0.5332915", "0.5332915", "0.5332915", "0.5332915", "0.5332915", "0.5332915", "0.5332915", "0.533291...
0.5231512
79
Sets the media_type of this DeviceIfResultResponse.
def media_type(self, media_type): self._media_type = media_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_media_type(self, media_type: str):\n ok = _api.SciterSetMediaType(self.hwnd, media_type)\n if not ok:\n raise sciter.SciterError(\"Could not set media type \" + str(media_type))\n return self", "def media_type(self):\n return const.MEDIA_TYPE_UNKNOWN", "def media_...
[ "0.621941", "0.577842", "0.57518804", "0.57475555", "0.57475555", "0.5491406", "0.5481601", "0.54125375", "0.536102", "0.53432477", "0.52428824", "0.5230571", "0.5220937", "0.5206175", "0.5178963", "0.51488537", "0.5112188", "0.510569", "0.49726397", "0.49523324", "0.49375847...
0.6687434
1
Sets the port_type of this DeviceIfResultResponse.
def port_type(self, port_type): self._port_type = port_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_port_var(self, port):\r\n self._val_dic[VpnTag.TAG_PORT] = port", "def set_iftype(self, index, iftype):\n self.d.set_iftype(index, iftype)", "def interface_type(self, interface_type):\n\n self._interface_type = interface_type", "def set_port(self, port):\r\n self.set_port_...
[ "0.5548368", "0.55247664", "0.55198354", "0.5451179", "0.54505974", "0.5314603", "0.5259914", "0.5259914", "0.52556354", "0.52397656", "0.515193", "0.5123565", "0.510108", "0.510108", "0.510108", "0.50866777", "0.50735164", "0.5012962", "0.50125575", "0.49994284", "0.4958066"...
0.69233304
0
Returns the string representation of the model
def to_str(self): return pprint.pformat(self.to_dict())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _repr_model_(self):\n return str(self)", "def __str__(self):\n\n return str(self.model)", "def get_model_string(self):\n raise NotImplementedError()", "def __str__(self):\n return self.model", "def serialize_model(self):\n return dill.dumps(self.model)", "def __str_...
[ "0.8602374", "0.85093755", "0.8237104", "0.8050309", "0.80128866", "0.79348034", "0.78766525", "0.77898884", "0.7786461", "0.7745792", "0.7627315", "0.76055235", "0.757999", "0.7514394", "0.75038797", "0.75035286", "0.74850684", "0.7440529", "0.74325883", "0.74239755", "0.740...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n return not self == other", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other):\n return self.__dict__ != other.__dict__", "def __eq__(self, other):\n return not self.__ne__(other)", ...
[ "0.8410264", "0.83913255", "0.81718874", "0.8140831", "0.809181", "0.80886894", "0.8067484" ]
0.0
-1
Get the length of this line segment.
def length(self) -> float: return ((self.p1.x - self.p2.x) ** 2 + (self.p1.y - self.p2.y) ** 2) ** 0.5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_length(self):\n return len(self.line)", "def length(self):\n result = 0\n for seg in self.segments:\n result += seg.length \n return result", "def getLength(self):\n return self.road.getLength()", "def lenLine(self):\n return len(self.TrajectoryLi...
[ "0.7746081", "0.74351054", "0.7232995", "0.7218397", "0.71867925", "0.71053773", "0.71024215", "0.7089291", "0.70620835", "0.70616114", "0.70599705", "0.7034911", "0.702739", "0.702739", "0.7007232", "0.70048577", "0.69904244", "0.69904244", "0.69831884", "0.69831884", "0.698...
0.0
-1
Get the angle of this line.
def angle(self) -> float: dx = self.p2.x - self.p1.x dy = self.p2.y - self.p1.y theta = math.atan2(dy, dx) angle = math.degrees(theta) # angle is in (-180, 180] if angle < 0: angle = FULL_ROTATION + angle return angle
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAngle(self):\n\n return math.atan2(self.y, self.x)", "def angle(self) -> float:\n return math.degrees(math.atan2(self.y, self.x))", "def angle(self):\n return self._angle", "def getAngle(self):\n return self._angle", "def return_angle(self) -> 'number':\n return ar...
[ "0.8147209", "0.81235814", "0.80437624", "0.80096287", "0.79117566", "0.7815466", "0.7728495", "0.77242994", "0.7682184", "0.7682184", "0.76336", "0.76323426", "0.7623333", "0.76128346", "0.7595185", "0.75845957", "0.75730073", "0.7570498", "0.73634255", "0.72300106", "0.7220...
0.7537726
18
Get the bounding box of this line represented by two points. The p1 point is in the lower left corner, the p2 one at the upper right corner.
def bounding_box(self) -> tuple[Point, Point]: result = ( Point(min(self.p1.x, self.p2.x), min(self.p1.y, self.p2.y)), Point(max(self.p1.x, self.p2.x), max(self.p1.y, self.p2.y)), ) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_from_points(point_1, point_2, label=None):\n _p1 = Point.get_top_left(point_1, point_2)\n _p2 = Point.get_top_left(point_1, point_2)\n if BoundingBox.POINT_ORDER == BoundingBox.TL_TO_BR:\n return BoundingBox(label, _p1, _p2) \n return BoundingBox(label, _p2,...
[ "0.7252507", "0.67448914", "0.66794246", "0.6670144", "0.66208607", "0.6536993", "0.651306", "0.65068424", "0.64704704", "0.64302915", "0.64302915", "0.64302915", "0.6425636", "0.64237356", "0.635337", "0.62934256", "0.62664616", "0.6244621", "0.6226425", "0.6192375", "0.6167...
0.82698655
0
Check if bounding boxes do intersect. If one bounding box touches the other, they do intersect.
def do_bounding_boxes_intersect(a: tuple[Point, Point], b: tuple[Point, Point]) -> bool: return ( a[0].x <= b[1].x and a[1].x >= b[0].x and a[0].y <= b[1].y and a[1].y >= b[0].y )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bbox_overlaps(boxes1, boxes2):\n boxes1_repeat = boxes2.size()[0]\n boxes2_repeat = boxes1.size()[0]\n boxes1 = boxes1.repeat(1, boxes1_repeat).view(-1, 4)\n boxes2 = boxes2.repeat(boxes2_repeat, 1)\n b1_y1, b1_x1, b1_y2, b1_x2 = boxes1.chunk(4, dim=1)\n b2_y1, b2_x1, b2_y2, b2_x2 = boxes2.ch...
[ "0.76444966", "0.7474084", "0.74067116", "0.7345785", "0.7305722", "0.71429604", "0.7101605", "0.71000004", "0.7073364", "0.7061349", "0.70288074", "0.70187587", "0.7002621", "0.6995324", "0.69594747", "0.69594747", "0.69469416", "0.6937575", "0.6920444", "0.6890659", "0.6879...
0.7918389
0
Get the cross product of two points.
def crossproduct(a: Point, b: Point) -> float: return a.x * b.y - b.x * a.y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cross_product(x0: float, y0: float, x1: float, y1: float, x2: float, y2: float) -> float:\n\n return (x1 - x0) * (y2 - y0) - (y1 - y0) * (x2 - x0)", "def cross_product(v1, v2):\r\n\r\n return v1.x * v2.y - v2.x * v1.y", "def cross(x, y):\n return x.cross(y)", "def GetCrossProduct(*args, **kwarg...
[ "0.8329649", "0.83045197", "0.824372", "0.79296976", "0.7836087", "0.7805619", "0.77919984", "0.77259123", "0.7672864", "0.7672864", "0.763358", "0.76238704", "0.76002693", "0.76002693", "0.75788194", "0.75629485", "0.75374615", "0.7535409", "0.7535409", "0.7512752", "0.74496...
0.8470532
0
Softmax loss function, naive implementation (with loops) Inputs have dimension D, there are C classes, and we operate on minibatches of N examples.
def softmax_loss_naive(W, X, y, reg): # Initialize the loss and gradient to zero. loss = 0.0 dW = np.zeros_like(W) ############################################################################# # TODO: Compute the softmax loss and its gradient using explicit loops. # # Store the loss in loss and the gra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(input, dim=None):\n return F.softmax(input, dim)", "def softmax_loss_naive(W, X, y, reg):\n # Initialize the loss and gradient to zero.\n D, C = W.shape\n N, D = X.shape\n full_row_idx = np.arange(N)\n loss = 0.0\n dW = np.zeros_like(W)\n\n probas = np.zeros((N, C))\n #####...
[ "0.74079835", "0.73353183", "0.71840364", "0.7171619", "0.71536136", "0.71136814", "0.7106101", "0.708733", "0.7072645", "0.7030977", "0.6996646", "0.69492877", "0.6945761", "0.6916445", "0.69163793", "0.68958503", "0.68462443", "0.6841668", "0.6833336", "0.67997473", "0.6790...
0.69893104
11
Softmax loss function, vectorized version. Inputs and outputs are the same as softmax_loss_naive.
def softmax_loss_vectorized(W, X, y, reg): # Initialize the loss and gradient to zero. loss = 0.0 #1.########################vectorized loss################################### num_train=X.shape[0] #num_classes=W.shape[1] #1.get scores scores=X.dot(W) #(N,C) #2.normalized scores:subtract mean scores=(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax_loss(x, y):\n N = x.shape[0]\n x = np.reshape(x, (N, -1))\n probs = np.exp(x - np.max(x, axis=1, keepdims=True))\n probs /= np.sum(probs, axis=1, keepdims=True)\n loss = -np.sum(np.log(probs[np.arange(N), y])) / N\n dx = probs.copy()\n dx[np.arange(N), y] -= 1\n dx /= N # shape(dx):...
[ "0.7621635", "0.7564091", "0.75561637", "0.75561637", "0.75561637", "0.75372726", "0.7519683", "0.7510306", "0.74502003", "0.7439097", "0.74365574", "0.7430561", "0.7411776", "0.7411148", "0.74076664", "0.7403683", "0.7403205", "0.7401779", "0.7398786", "0.7395938", "0.739539...
0.0
-1
return [line] with any comments removed
def _removeComments(line): if not "#" in line: return line # Find the first instance of a # character that isn't enclosed inside a string for i, c in enumerate(line): if c == "#": if not _isCharEnclosed(i, line): return line[:i]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_line(line):\n\n return _comment_pattern.sub('', line).strip()", "def strip_comments(lines):\n return [line.partition('#')[0].rstrip() for line in lines]", "def remove_comment(lines):\n result = []\n while lines and lines[0].startswith('#'):\n result.append(lines.pop(0))\n return...
[ "0.7874996", "0.7872703", "0.77620083", "0.7749433", "0.7734365", "0.77290106", "0.7718612", "0.7718612", "0.7619762", "0.75760484", "0.757049", "0.756472", "0.7490985", "0.7476251", "0.7412943", "0.737397", "0.73731685", "0.73304594", "0.73280704", "0.7307173", "0.72806233",...
0.8192273
0
split [string] on any delimiters that aren't enclosed in strings. delimiter can only be one character
def _split(string, delimiter): segment = "" segments = [] for i, c in enumerate(string): if c == delimiter and not _isCharEnclosed(i, string): segments.append(segment) segment = "" else: segment += c if segment: segments.append(segment) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multisplit(string, *delimiters):\n pattern = \"|\".join(map(re.escape, delimiters))\n return re.split(pattern, string)", "def split(str_, delimiter):\n str_ = Utils.trimall(str_, delimiter)\n s = str() \n ret = [] # data for storing string arrays - (s) \n i = 0 \n ...
[ "0.769932", "0.7691166", "0.7506819", "0.735146", "0.71760607", "0.7146917", "0.7002599", "0.69086057", "0.6700554", "0.66903996", "0.66536796", "0.6575917", "0.6567442", "0.6526401", "0.6450664", "0.6450206", "0.64072967", "0.638169", "0.6369417", "0.6367708", "0.63458246", ...
0.80246294
0
Setup the app for each test. This seeds the servers and service with data to create an existing session.
def setUp(self) -> None: with open('fixtures/test_servers.p', 'rb') as srv, \ open('fixtures/test_service.p', 'rb') as svc: self.app = cpx.CPX(url='http://localhost:8080', servers=loads(load(srv)), service=loads(load(svc))) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(self):\n self.app = create_app(TEST_SETTINGS)\n self.client = self.app.test_client()\n with self.app.test_request_context():\n db.create_all()\n db.session.commit()", "def set_up(self):\n # Let ConsistencyTestCase set up the datastore testing stub.\n ...
[ "0.7782728", "0.76268446", "0.7546252", "0.741947", "0.7359797", "0.73460597", "0.7345351", "0.7345351", "0.7340919", "0.73320216", "0.73106587", "0.73016846", "0.72889936", "0.72885966", "0.723479", "0.72108257", "0.71943766", "0.7185857", "0.71843815", "0.7177606", "0.71769...
0.0
-1
This method steps the game forward one step and moves the car one step = [x,y]+vector(speed, angle)
def step(self, action): # move the freakin car self.angle, self.car.centerx, self.car.centery = self._move_car(action) reward, done = self._reward_calc() state = self._get_state() surr = state["surround"].reshape(self.state_size,self.state_size)*255 self.surr = pyg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self):\n for i in (0,1):\n vec_component = prepare.DIRECT_DICT[self.direction][i]\n self.exact_position[i] += vec_component*self.speed\n self.steps[i] += abs(vec_component*self.speed)", "def go_forward() -> None:\n set_motors_speed(FULL_SPEED, FULL_SPEED)", "...
[ "0.73088247", "0.7108519", "0.7066166", "0.70451045", "0.70227104", "0.70162433", "0.7000886", "0.6944232", "0.6882509", "0.6851576", "0.6833221", "0.68211687", "0.6789613", "0.67488873", "0.6712701", "0.6702234", "0.6700114", "0.6694532", "0.66807586", "0.66748893", "0.66317...
0.6432981
45
Preprocess state (210, 160, 3) image into a (80, 80, 1) image in grey scale
def greyscale(state): state = np.reshape(state, [210, 160, 3]).astype(np.float32) # grey scale state = state[:, :, 0] * 0.299 + state[:, :, 1] * 0.587 + state[:, :, 2] * 0.114 # karpathy state = state[35:195] # crop state = state[::2,::2] # downsample by factor of 2 state = state[:, :, n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _preprocess_state(self, state):\n # Resize image.\n state = PIL.Image.fromarray(state).resize(self.input_shape[1:], resample=PIL.Image.NEAREST)\n\n # RGB -> grayscale and convert to numpy array.\n state = np.array(state.convert('L'))\n\n return state", "def greyscale(state)...
[ "0.78076005", "0.7744146", "0.768589", "0.7471304", "0.72414166", "0.7195025", "0.7184728", "0.70983744", "0.7063138", "0.70551497", "0.70225143", "0.69315857", "0.6878948", "0.6878948", "0.6877639", "0.6850693", "0.6808541", "0.67809576", "0.6726218", "0.6696967", "0.6679043...
0.77014846
2
Preprocess state (210, 160, 3) image into a (80, 80, 1) image in grey scale
def blackandwhite(state): # erase background state[state==144] = 0 state[state==109] = 0 state[state!=0] = 1 # karpathy state = state[35:195] # crop state = state[::2,::2, 0] # downsample by factor of 2 state = state[:, :, np.newaxis] return state.astype(np.uint8)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _preprocess_state(self, state):\n # Resize image.\n state = PIL.Image.fromarray(state).resize(self.input_shape[1:], resample=PIL.Image.NEAREST)\n\n # RGB -> grayscale and convert to numpy array.\n state = np.array(state.convert('L'))\n\n return state", "def greyscale(state)...
[ "0.7806942", "0.77456456", "0.77032423", "0.76844865", "0.7469934", "0.723962", "0.71944577", "0.7182805", "0.70978147", "0.7061616", "0.7055203", "0.702127", "0.6930048", "0.6877477", "0.6877477", "0.68764484", "0.68509", "0.6806984", "0.6779496", "0.6725572", "0.6695404", ...
0.6312918
59
Create a new connection pool. Any positional or keyword arguments other than the first one and a
def __init__(self, _ignored, *connargs, **connkw): if not self.reactor: from twisted.internet import reactor self.reactor = reactor # for adbapi compatibility, min can be passed in kwargs if 'min' in connkw: self.min = connkw.pop('min') self.connargs =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_pool(auth):\n\n\treturn ConnectionPool(PostgresConnection, auth, database_config.get('max_pool_size'))", "def initialise(**kwargs):\n Database.__connection_pool = pool.SimpleConnectionPool(1, 10, **kwargs)", "def get_new_connection(self, conn_params):\n with pool_container.lock:\n ...
[ "0.7599941", "0.7220474", "0.68406886", "0.6794278", "0.6710126", "0.65797395", "0.6536204", "0.652867", "0.6520708", "0.64800555", "0.64459735", "0.6368354", "0.6358313", "0.6358313", "0.63544387", "0.633425", "0.633425", "0.633425", "0.633425", "0.633425", "0.633425", "0....
0.61818653
27
Start the connection pool.
def start(self): # use DeferredList here, as gatherResults only got a consumeErrors # keyword argument in Twisted 11.1.0 d = defer.DeferredList([c.connect(*self.connargs, **self.connkw) for c in self.connections], fireOnOneErrback=Tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n if self.ownThreadpool:\n self.threadpool.start()", "def start(self):\n self.close()\n if self.threads != 1:\n self.pool = Pool(processes=self.threads)", "def initialise(**kwargs):\n Database.__connection_pool = pool.SimpleConnectionPool(1, 10...
[ "0.71481264", "0.709062", "0.70443505", "0.6925536", "0.68878317", "0.6866886", "0.6729697", "0.6681439", "0.6639009", "0.65488607", "0.6418892", "0.64158684", "0.64145225", "0.6366347", "0.63642955", "0.6356961", "0.6349175", "0.6328905", "0.62194055", "0.6192305", "0.617052...
0.5659217
67
Stop the pool. Disconnects all connections.
def close(self): for c in self.connections: c.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n self.pool.shutdown()", "def stop(self):\n if self.ownThreadpool:\n self.threadpool.stop()\n\n # FIXME: we should probably also close the pool of active connections too", "def stop(self):\n for connection in self.connections.values():\n asyncio...
[ "0.838318", "0.8144897", "0.7601509", "0.74350774", "0.72417", "0.7239919", "0.70515174", "0.70377946", "0.69796675", "0.6948166", "0.6945739", "0.692859", "0.6897399", "0.6886695", "0.686562", "0.68350095", "0.68296987", "0.6824674", "0.6820166", "0.68058157", "0.68054444", ...
0.0
-1
Add a connection to the pool. Provided to be able to extend the pool with new connections.
def add(self, connection): self.connections.add(connection) self._semaphore.limit += 1 self._semaphore.release() # uuuugh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addConnection(self, connection):\n\n self.connections.append(connection)\n self.module_order.append(connection)", "def return_connection_to_pool(pool, conn):\n\n\tpool.put(conn)", "def push(self, conn):\n loop = self.in_use[conn]\n del self.in_use[conn]\n if loop is not None:...
[ "0.6918882", "0.6911789", "0.6619675", "0.6613858", "0.65527654", "0.65356785", "0.6450684", "0.6364429", "0.6354367", "0.6274724", "0.62671566", "0.6243251", "0.62349665", "0.62245417", "0.61442155", "0.6100617", "0.6087673", "0.60858536", "0.60810417", "0.6074149", "0.60657...
0.7257156
0
Matrix (batch) product with the conjugate transpose. This method is included for compatibility with Scipy only. Please use the ``H`` attribute instead.
def rmatmat(self, x): return self.__H.__mul__(x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conjugate (self):\n matrixResult = [[complex.ComplexNumber(0,0) for x in range(self.m)] for y in range(self.n)] \n for i in range (self.m):\n for j in range (self.n):\n matrixResult[i][j] = self.mtx[i][j].conjugate()\n matResult = Matrix(matrixResult)\n ret...
[ "0.73226595", "0.6628069", "0.64365476", "0.6287864", "0.62509394", "0.61360544", "0.6112172", "0.6111658", "0.5970118", "0.59404266", "0.59394854", "0.59394854", "0.59394854", "0.59394854", "0.59394854", "0.59394854", "0.59394854", "0.59394854", "0.59394854", "0.59394854", "...
0.0
-1
Construct a layernorm module in the T5 style no bias and no subtraction of mean.
def __init__(self, hidden_size, eps=1e-6, device=None): super().__init__() self.weight = nn.Parameter(torch.ones(hidden_size)) self.variance_epsilon = eps
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, input_dim, variance_w = 1., mean_w = 0, \n variance_b = 0, mean_b = 0, L=1, name='nn_abs', \n standard_first_layer = False):\n super().__init__(input_dim, variance_w, mean_w, variance_b, mean_b, L,\n name)", "def zero_module(module):\n weight = in...
[ "0.559912", "0.53643167", "0.5226649", "0.52217954", "0.5210316", "0.5175175", "0.5161071", "0.51566386", "0.5137865", "0.5137865", "0.51355743", "0.51287603", "0.50565434", "0.5053594", "0.5052513", "0.5052513", "0.5052513", "0.50464064", "0.49978152", "0.49978152", "0.49919...
0.0
-1
Update your policy. Behavior may differ based on what stage of training your in. If you're in training mode then you should check if you should update your network parameters based on the current step and the value you set for train_freq. Inside, you'll want to sample a minibatch, calculate the target values, update yo...
def update_policy(self, target_q): # Get a mini batch of samples (only index) mini_batch_index = self.memory.sample(self.batch_size) x = [] x_next = [] # For next state for _sample_index in mini_batch_index: x.append(self.stack_frames(_sample_index, self.memory.othe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def policy_update(self):\n mini_batch = random.sample(self.data_buffer, self.batch_size)\n state_batch = [data[0] for data in mini_batch]\n mcts_probs_batch = [data[1] for data in mini_batch]\n winner_batch = [data[2] for data in mini_batch] \n old_probs, old_v = self....
[ "0.732157", "0.72492063", "0.6828449", "0.66874397", "0.66525775", "0.6594609", "0.6531243", "0.6511359", "0.6437979", "0.6428352", "0.6414166", "0.63979524", "0.6397705", "0.639574", "0.6357424", "0.6356316", "0.6356316", "0.63554996", "0.6339811", "0.633908", "0.6337091", ...
0.6073846
40
Returns all headers of the request as a dictionary.
def headers(self): if self._headers is not None: return self._headers self._headers = {} for key, value in self.environ.items(): self._headers[key] = value return self._headers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def headers(self) -> dict:\n if self._headers is None:\n self._headers = {}\n for header_name, header_val in self.raw_request.get('headers', []):\n header_name = header_name.decode('ascii').lower()\n header_val = header_val.decode('ascii')\n ...
[ "0.84991765", "0.8219423", "0.8195755", "0.8133294", "0.8132155", "0.79466766", "0.7886512", "0.782468", "0.7781767", "0.7667615", "0.7600764", "0.75953424", "0.75270504", "0.7525178", "0.74710244", "0.7446521", "0.74392575", "0.74392575", "0.7396479", "0.7396479", "0.7389803...
0.74033827
18
Ask the user for a number. Depending on whether the number is even or odd, print out an appropriate (i.e. "even" or "odd") message to the user.
def part1(num): if num % 2 == 0: print(num, ' is even') else: print(num, ' is odd')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def odd_or_even(give_an_input):\n if give_an_input % 2 == 0:\n print(\"Even Number\")\n else:\n print(\"Odd Number\")", "def odd_and_even():\r\n message = int(input())\r\n while message != 1:\r\n if message % 2 == 0:\r\n print(int(message), end=\" \")\r\n me...
[ "0.80288446", "0.775958", "0.7506093", "0.7131319", "0.7101274", "0.70449334", "0.70211047", "0.69657665", "0.6860938", "0.65166014", "0.6496333", "0.6463385", "0.64631397", "0.6230083", "0.6206189", "0.61954165", "0.6105145", "0.604529", "0.5981389", "0.59752303", "0.5881334...
0.65260494
9
Encrypt your username and password using base64 module Store your encrypted username on the first line and your encrypted password on the second line.
def part4a(filename, username, password): enc_usr = base64.b64encode(username.encode()) enc_pass = base64.b64encode(password.encode()) with open(filename, 'wb') as file: file.write(enc_usr+b'\n') file.write(enc_pass + b'\n') file.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encrypt():\n return Cmd('openssl',\n 'enc','-base64','-aes-256-cbc',\n '-S',salt,'-k',password)", "def encode(self):\n\t\tself.encoded_username = self.username\n\t\tself.encoded_password = self.password\n\t\ttry:\n\t\t\tself.encoded_username = base64.b64encode(self.encode...
[ "0.7178907", "0.71538854", "0.677333", "0.6727704", "0.6676252", "0.66529906", "0.6649846", "0.6629272", "0.6557766", "0.6305231", "0.6298796", "0.6297068", "0.6252498", "0.62138563", "0.61932796", "0.6147494", "0.61312866", "0.6125655", "0.6110864", "0.6100526", "0.60962677"...
0.76946306
0
Changes direction of snake based on 4 directional key presses
def change_direction(self): if self.key_press == "up": self.direction = [0, -20] elif self.key_press == "down": self.direction = [0, 20] elif self.key_press == "left": self.direction = [-20, 0] elif self.key_press == "right": self.direction...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_key_press(self, key, modifiers):\n if key == arcade.key.UP or key == arcade.key.W:\n self.direction = MoveEnum.UP\n elif key == arcade.key.DOWN or key == arcade.key.S:\n self.direction = MoveEnum.DOWN", "def change_direction(self, new_direction: str):\n if new_di...
[ "0.7373351", "0.70772487", "0.69629234", "0.68839794", "0.6728058", "0.66070896", "0.6582418", "0.6578419", "0.6519761", "0.64709246", "0.6459309", "0.6451336", "0.64041656", "0.6367677", "0.63543254", "0.63456976", "0.63359976", "0.63359976", "0.63359976", "0.63327944", "0.6...
0.72129726
1
Convert prior_boxes to (xmin, ymin, xmax, ymax) representation for comparison to point form ground truth data.
def point_form(boxes): return torch.cat((boxes[:, :2] - boxes[:, 2:] / 2, boxes[:, :2] + boxes[:, 2:] / 2), 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def point_to_relative(boxes):\n return K.cat((boxes[:, :2], # xmin, ymin\n boxes[:, 2:] - boxes[:, :2]), 1) # xmax, ymax", "def get_bounding_boxes(self):\n all_mins, all_maxes = [], []\n for points in self.points_list():\n cur_mins = points.min(dim=...
[ "0.6462762", "0.61238015", "0.60884076", "0.60238856", "0.5834104", "0.5819981", "0.5819981", "0.5819981", "0.5753634", "0.5750141", "0.5741691", "0.57316875", "0.56644696", "0.5650252", "0.5639108", "0.5607017", "0.5606607", "0.5606219", "0.5572752", "0.5570364", "0.5564245"...
0.0
-1
Utility function for computing log_sum_exp while determining This will be used to determine unaveraged confidence loss across all examples in a batch.
def log_sum_exp(x): x_max = x.data.max() return torch.log(torch.sum(torch.exp(x - x_max), 1, keepdim=True)) + x_max
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_sum_exp(batch_logit):\n batch_max, _ = batch_logit.max(dim=-1)\n batch_broadcast = batch_max.unsqueeze(-1)\n return batch_max + \\\n torch.log(torch.sum(torch.exp(batch_logit - batch_broadcast), dim=-1))", "def log_sum_exp(arr):\n a = arr.max(axis=1)\n return a + np.log(np.s...
[ "0.7118949", "0.7011162", "0.6963221", "0.6957812", "0.69384205", "0.69243395", "0.6911084", "0.6908476", "0.6859084", "0.6832189", "0.6829621", "0.66999733", "0.66999733", "0.66643804", "0.6659183", "0.66166425", "0.654607", "0.65378016", "0.65203035", "0.65020186", "0.64787...
0.68852776
8
Return True if this trap lies within the specified rectangle.
def isWithin(self, rect): return rect.contains(self.r.toPointF())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains_trap(self, trap):\n points = trap.raw()\n for poly in self.polygons:\n # TODO First check that the bounding boxes overlap to reduce time complexity\n\n contained = np.zeros(len(points)).astype(bool)\n for idx in range(len(poly)):\n edge = m...
[ "0.7108484", "0.7072491", "0.70094687", "0.69667345", "0.69565284", "0.6877913", "0.685788", "0.68577474", "0.68320143", "0.6809826", "0.68051934", "0.6766955", "0.6755702", "0.6720897", "0.6669714", "0.6667422", "0.66642606", "0.66587937", "0.66457075", "0.66310364", "0.6625...
0.8012155
0
Threedimensional position of a trap.
def r(self): return self._r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def t(energy, zpos, center_pitch_angle, rho, trap_profile):\n \n me = 5.10998950e5 # Electron rest mass, in eV\n m = 9.1093837015e-31 # Electron rest mass, in kg\n c = 299792458 # Speed of light in vacuum, in m/s\n JeV = 6.241509074e18 #Joule-ev conversion\n \n gamma = energy / me + 1\n ...
[ "0.6035872", "0.5948916", "0.5782078", "0.57747316", "0.5711787", "0.5685382", "0.56334966", "0.55894274", "0.55246156", "0.54449564", "0.5380211", "0.5366283", "0.536533", "0.53337455", "0.5330396", "0.5309891", "0.52633053", "0.52613384", "0.52509946", "0.52442247", "0.5240...
0.0
-1
! GetHostName This method try to get the hostname of the machine
def GetHostName(self): return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getHostName(self):\n return socket.gethostname()", "def get_hostname():\n return _hostname", "def get_hostname():\n try:\n return socket.gethostbyaddr(socket.gethostname())[0]\n except Exception:\n return None\n return None", "def hostname(self) :\n\t\ttry :\n\t\t\treturn...
[ "0.83302015", "0.794006", "0.784063", "0.7826028", "0.7825377", "0.7798927", "0.77637005", "0.77399945", "0.7657772", "0.76473916", "0.7640163", "0.7523199", "0.75168204", "0.7501603", "0.7437059", "0.73517895", "0.73084176", "0.73084176", "0.73084176", "0.7306289", "0.728718...
0.83811873
0
Build url based on destionation with optional suffix(extra).
def make_url(self, destination, extra=''): return '{}{}{}'.format(self.url, destination, extra)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_suffix(self, url):\n return url", "def build_url(base: str, arg: str=None):\n if not arg:\n return base\n parts = list(\n filter(lambda part: part, base.split('/'))\n )\n parts.append(arg)\n url = \"/\".join(parts)\n if base.startswith('/'):\n return \"/\" + ...
[ "0.67633253", "0.67255217", "0.6374895", "0.6341721", "0.6341721", "0.63129884", "0.6284079", "0.6272303", "0.62693703", "0.6236202", "0.6220566", "0.62197715", "0.6213407", "0.6202319", "0.6196484", "0.6171382", "0.6128118", "0.6128118", "0.6120007", "0.61067176", "0.6098447...
0.7431761
0
slice(array, start, stop, step)
def test_slice(self): self.assertEqual([1,2,3], slice([0,1,2,3,4],1,4))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_slices(my_list, start: int = None, stop: int = None, step: int = None):\n if step is None:\n step = 1\n\n if start is None or stop is None:\n return my_list[start]\n else:\n return my_list[start:stop:step]", "def data_slice(data, start, end):\r\n data = data[start:end]\r\n...
[ "0.72435904", "0.7011265", "0.6686996", "0.6524441", "0.6524441", "0.6521913", "0.6508711", "0.64939857", "0.64425576", "0.6422861", "0.63334924", "0.6332348", "0.63198704", "0.63165635", "0.6304544", "0.63037556", "0.6301448", "0.62638855", "0.6248316", "0.6200111", "0.61889...
0.6764661
2
slice(array, start, stop, step)
def test_slicer(self): self.assertEqual([1,2,3], slicer([0,1,2,3,4,5,6],1,4))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_slices(my_list, start: int = None, stop: int = None, step: int = None):\n if step is None:\n step = 1\n\n if start is None or stop is None:\n return my_list[start]\n else:\n return my_list[start:stop:step]", "def data_slice(data, start, end):\r\n data = data[start:end]\r\n...
[ "0.72416186", "0.70098865", "0.67625684", "0.6686018", "0.6522854", "0.6522854", "0.65222037", "0.65074074", "0.64932555", "0.64425534", "0.64210165", "0.63322777", "0.6331228", "0.63185126", "0.63172764", "0.63041", "0.63024664", "0.6299385", "0.6262653", "0.6247297", "0.619...
0.59777653
40
Bias initialisation with a positive constant, helps to prevent dead neurons.
def biases(shape): return tf.Variable(tf.constant(0.1, shape=shape))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_bias(self, bias: torch.Tensor):\n with torch.no_grad():\n bias.zero_()", "def initialize_bias(self, bias: torch.Tensor):\n assert bias.ndim == 1\n n = bias.shape[0]\n upper_bound = n // 2\n lower_bound = -((n - 1) // 2)\n x = torch.arange(lower_...
[ "0.77613235", "0.73960024", "0.73299736", "0.7189305", "0.7189305", "0.7189305", "0.71555644", "0.7148717", "0.7123141", "0.7027659", "0.7019045", "0.69837475", "0.691235", "0.6908756", "0.6908756", "0.68994004", "0.68994004", "0.6827607", "0.6759474", "0.67166525", "0.670438...
0.0
-1
Reads image as grayscale and normalises and flattens the array.
def read_image(path): img = cv2.imread(path, cv2.IMREAD_GRAYSCALE) # Load as grayscale img = img / 255 # Normalise values return img.flatten() # Flatten to shape [784]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(img):\n if not is_greyscale(img):\n img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\n\n img = util.normalize(img)\n\n return img", "def preprocess(img_arr):\n grey = rgb2grey(img_arr)\n downsized = downsize(grey)\n return normalize(downsized)", "def normalize(array):\n ar...
[ "0.70327395", "0.6885925", "0.6760795", "0.67373407", "0.6706352", "0.6696141", "0.6634019", "0.6631206", "0.6623558", "0.65806645", "0.65635777", "0.65548515", "0.6522919", "0.65196407", "0.6512847", "0.64927804", "0.64846075", "0.6442044", "0.6436023", "0.64259577", "0.6421...
0.6919171
1
Gets a random batch of images and associated labels to use. Tries not to reuse elements until all elements in the set have been used once. This isn't perfect but due to randomisation should still be useful for training.
def next_batch(self, n): # Reset the used array when it is full if len(self.used) + n > self.num_items: self.used = np.array([]) # Restricts to only the unused indices possible = range(self.num_items) possible = np.array(list(filter(lambda x: x not in self.used, possible))) rand = np.random.permutation...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_random_train_batch(self):\n images, _ = self._train_set.get_random_batch()\n\n return images", "def get_random_test_batch(self):\n images, _ = self._test_set.get_random_batch()\n\n return images", "def sample_images(images, labels):\r\n\tlabel_set = list(set(labels))\r\n\tselection = []\r\n...
[ "0.7390966", "0.7212731", "0.7137819", "0.67682755", "0.6748892", "0.6391004", "0.634429", "0.63110477", "0.6292929", "0.62623423", "0.6242571", "0.6226422", "0.6222827", "0.62105334", "0.6197161", "0.6195629", "0.6157825", "0.6154339", "0.6138721", "0.6131001", "0.6121717", ...
0.6303829
8
Remove all entries with values == None
def filtergroupdict(ma): di = filter(lambda x: x[1]!=None and x[0]!='verse', ma.groupdict().items()) if len(di) != 1: return None ret = {} ret['book'] = di[0][0] ret['verse'] = ma.groupdict()['verse'] ret['verse'] = ret['verse'].replace(' ','') return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _remove_none_values(dictionary):\n\n return list(map(dictionary.pop, [i for i in dictionary if dictionary[i] is None]))", "def clean(df):\n return list(filter(lambda r: None not in r.values(), df))", "def remove_none_values(obj):\n return {k: v for k, v in obj.items() if v is not None}", "def re...
[ "0.7923899", "0.7572518", "0.7364494", "0.7321351", "0.7200496", "0.7150673", "0.70579845", "0.69791174", "0.6880161", "0.68053335", "0.6797503", "0.6748143", "0.66586685", "0.6656682", "0.66518146", "0.6528538", "0.65078807", "0.64969337", "0.6452043", "0.64210874", "0.63812...
0.0
-1
Computes the accuracy over the k top predictions for the specified values of k
def accuracy(output, target, topk=(1,)): with torch.no_grad(): maxk = max(topk) batch_size = target.size(0) _, pred = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(target.view(1, -1).expand_as(pred)) res = [] for k in topk: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accuracy(y_pred, y_actual, topk=(1, )):\n maxk = max(topk)\n batch_size = y_actual.size(0)\n\n _, pred = y_pred.topk(maxk, 1, True, True)\n pred = pred.t()\n correct = pred.eq(y_actual.view(1, -1).expand_as(pred))\n\n res = []\n for k in topk:\n correct_k = correct[:k].view(-1).floa...
[ "0.8284662", "0.8263996", "0.8210357", "0.82097954", "0.819159", "0.81795794", "0.8175413", "0.8175173", "0.8170473", "0.81684375", "0.81622064", "0.81622064", "0.81622064", "0.81622064", "0.81622064", "0.81622064", "0.81622064", "0.81622064", "0.81622064", "0.81622064", "0.8...
0.0
-1
Checks if a channel is in a guild using its name
def check_channel_by_name(guild, channel): return channel in [x.name for x in guild.channels]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_channel(name):\n def predicate(ctx):\n if ctx.message.channel.is_private:\n return False\n\n # Adapted from discord.ext.core.has_any_role\n user_roles = functools.partial(discordutils.get, ctx.message.author.roles)\n if any(user_roles(name=role) is not None for role...
[ "0.760897", "0.7220982", "0.713017", "0.6843781", "0.6809696", "0.6765687", "0.6464971", "0.6401072", "0.6347859", "0.62991834", "0.620722", "0.6141588", "0.6133181", "0.6111918", "0.6086412", "0.60827047", "0.60503894", "0.6037834", "0.5995011", "0.5990475", "0.5940365", "...
0.834737
0
Gets the guild from the bots guilds using its id
def get_guild_by_id(bot, gid): guilds = bot.guilds for guild in guilds: if guild.id == gid: return guild ERROR(f'No guild with with id: {gid} exists in my guilds list') return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(cls, id):\n try:\n return cls._guilds[id]\n except KeyError:\n data = db.find_guild(id)\n if data:\n print(\"Guild retrieved from database\")\n return Guild.from_json(data)\n else:\n raise auth.MissingGui...
[ "0.81833494", "0.81715727", "0.76958716", "0.7550222", "0.7502939", "0.7502939", "0.7502939", "0.7286545", "0.6789414", "0.6779153", "0.6680039", "0.65542126", "0.643294", "0.6423583", "0.6391385", "0.6354447", "0.62094444", "0.6186692", "0.6185021", "0.61708766", "0.5976741"...
0.82890207
0
Gets the channel from a guild using its id
def get_channel_by_id(guild, cid): channels = guild.channels for channel in channels: if channel.id == cid: return channel ERROR(f'Unable to find channel: {cid} in guild {guild.name}') return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_channel(self, id: int) -> ClanChannel | None:\n return self._channels.get(id)", "def find_channel(id: str):\n channel_details = MongoDB.channel_db().find_one({\"_id\": ObjectId(id)})\n return channel_details", "def get_channel(self) -> Channel:\n return self.server.master.client.get...
[ "0.75113374", "0.72393495", "0.7233675", "0.7137302", "0.699669", "0.6990781", "0.6975403", "0.68961406", "0.6618556", "0.642895", "0.63645095", "0.62880325", "0.6242196", "0.6234065", "0.6232066", "0.6196298", "0.6174341", "0.6157579", "0.61483866", "0.6127901", "0.61013275"...
0.76418406
0
Gets the channel in a guild using its name
def get_channel_by_name(guild, name): channels = guild.channels for channel in channels: if channel.name == name: return channel ERROR(f'No channel with name {name} exists in guild {guild.name}') return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_channel(self, name):\n for chan in channels.all_channels:\n if chan.name == name:\n return chan\n return None", "def get_channel_by_name(server: Server, name: str) -> Union[Channel, None]:\n for channel in server.channels:\n if channel.name == name:\n ...
[ "0.77059674", "0.7527007", "0.74556375", "0.73401237", "0.7332657", "0.70141137", "0.6886274", "0.68634015", "0.6812235", "0.67659706", "0.6665584", "0.6603112", "0.6593919", "0.65881103", "0.6581107", "0.65709853", "0.6568422", "0.65474594", "0.6542071", "0.6416831", "0.6407...
0.8259865
0
Particles leaving the boundary are placed on the boundary, and 'bounce' backwards.
def apply_bound(xy, vel, xlim, ylim, damp, i): if xy[i, 0] < xlim[0]: vel[i, 0] *= damp xy[i, 0] = xlim[0] elif xy[i, 0] > xlim[1]: vel[i, 0] *= damp xy[i, 0] = xlim[1] if xy[i, 1] < ylim[0]: vel[i, 1] *= damp xy[i, 1] = ylim[0] elif xy[i, 1] > ylim[1]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paddle_bounce(self):\n # TODO: Change this so it will rebound the ball back based on\n # when the ball struck the paddle. Above the center returns the\n # ball with a positive y, below the center returns with a -y.\n # P |/ y=+++\n # A |/ y=++\n # D |/ y=+\n ...
[ "0.7074352", "0.6975359", "0.6879953", "0.681593", "0.6518841", "0.6518118", "0.6392376", "0.6370082", "0.62956077", "0.61853015", "0.6183899", "0.6157798", "0.60867465", "0.60843885", "0.6066519", "0.6038745", "0.60069424", "0.5936743", "0.592226", "0.5888869", "0.5885865", ...
0.5190903
96
Take an list of len number of segments, with a tuple of piston, tip, tilt and convert to a dictionary Seglist is a list of equal length with a single value equal to the segment number for the index in the list. If seglist is None, will assume Iris AO numbering
def create_dict_from_list(ptt_list, seglist=None): if seglist is None: seglist = np.arange(len(ptt_list))+1 # Put surface information in dict command_dict = {seg: tuple(ptt) for seg, ptt in zip(seglist, ptt_list)} return command_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_segment(vcf_tuple, scaffy, beg):\n relevant_keys = [i for i in vcf_tuple[0][scaffy] if i <= beg < i+ARGDICT[\"binsize\"]\n or beg <= i <= beg + ARGDICT[\"window\"]\n or i <= beg + ARGDICT[\"window\"] < i+ARGDICT[\"binsize\"]]\n segment_spls = {}\n for sp...
[ "0.61259115", "0.6103558", "0.6067", "0.5892216", "0.5729381", "0.56551254", "0.5480015", "0.5407034", "0.5398083", "0.53738475", "0.5355774", "0.5351518", "0.53414804", "0.5338507", "0.53344655", "0.5324335", "0.5313733", "0.52916175", "0.52777576", "0.5263501", "0.52632165"...
0.67807376
0
Calculates the euclidean distance between cluster centers.
def intercluster_distances(self): return Euclidean()(self.centers)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _distance(data, centers, metric='euclidean'):\r\n return cdist(data, centers, metric=metric).T", "def cluster_distance(c1, c2): \n \n max_dist = 0 \n for x1 in c1:\n for x2 in c2:\n dist = np.linalg.norm(x1-x2)\n if dist > max_dist:\n max_dist = d...
[ "0.72390234", "0.7237608", "0.7088679", "0.6866486", "0.6866486", "0.68651", "0.6849275", "0.6832598", "0.68056875", "0.67748433", "0.6737388", "0.67312276", "0.6690264", "0.66710204", "0.66675943", "0.6663359", "0.66585594", "0.65894926", "0.65847206", "0.65620035", "0.65267...
0.7622689
0
Calculates the mean distance between data and cluster centers.
def cluster_scatter(self): return np.array( [np.mean(Euclidean()(p, a.reshape(1, -1)), axis=1) for p, a in zip(self.partition, self.centers)]).flatten()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_centroid(self):\n\n num_points = len(self.points)\n # Get list of all co-ordinates of this cluster \n coords = [p.coords for p in self.points]\n # Reformat that so all x's are together, all y's etc.\n unzipped = zip(*coords)\n # Calculate the mean for each di...
[ "0.7307484", "0.7003511", "0.6956668", "0.6894828", "0.68823546", "0.6820711", "0.6789689", "0.67707837", "0.6765241", "0.673613", "0.66998535", "0.6624331", "0.66113603", "0.6610898", "0.65727335", "0.6571825", "0.65523183", "0.6544342", "0.65384704", "0.6529517", "0.6515079...
0.6493971
22
Calculates the mean pairwise distance across a partition.
def mean_pairwise_distances(partition): mpd = [np.mean(Euclidean()(p)) / 2 for p in partition] return np.array(mpd)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_distance_from_mean(partition):\n ds = [np.mean(Euclidean()(p, np.mean(p, axis=0).reshape(1, -1))) for p\n in partition]\n return np.array(ds)", "def average_distance(self):\n avg_dist = 0\n for i in range(0, len(self.x_traj)-1):\n avg_dist += sqrt((sel...
[ "0.83888555", "0.6488679", "0.6371442", "0.6334822", "0.62004167", "0.60943216", "0.6014609", "0.59189385", "0.59166205", "0.59069675", "0.5874567", "0.58658767", "0.58600754", "0.58268744", "0.5788618", "0.57884353", "0.5717142", "0.5715481", "0.57149273", "0.5670857", "0.56...
0.8591994
0
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(BatteryServer2, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.header is None: self.header = std_msgs.msg.Header() if self.id is None: self.id = 0 i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(BasicSafetyMessage, 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.communication_header is ...
[ "0.80601466", "0.80589396", "0.7871491", "0.7871491", "0.7871491", "0.7871491", "0.7601558", "0.7599031", "0.7523821", "0.74991786", "0.74991786", "0.7455687", "0.7448531", "0.7442502", "0.7425306", "0.7390668", "0.7354823", "0.7331141", "0.73234427", "0.7316658", "0.7290331"...
0.6620318
94
serialize message with numpy array types into buffer
def serialize_numpy(self, buff, numpy): try: _x = self buff.write(_get_struct_3I().pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) _x = self.header.frame_id length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') length = len(_x) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize_numpy(self, buff, numpy):\n self.serialize(buff)", "def serialize_numpy(self, buff, numpy):\n try:\n pass\n except struct.error as se: self._check_types(struct.error(\"%s: '%s' when writing '%s'\" % (type(se), str(se), str(locals().get('_x', self)))))\n except TypeError as te: ...
[ "0.7951979", "0.7894134", "0.78557587", "0.7778328", "0.7766659", "0.77637404", "0.77593005", "0.77540714", "0.77539235", "0.7737562", "0.767685", "0.76748276", "0.7668616", "0.7664322", "0.76045257", "0.75880057", "0.7567481", "0.7564311", "0.7557121", "0.7555019", "0.754482...
0.75139
27
Generates random ascii chars of length size bytes by converting a random 8bit integer to a string
def random_data(size): result = "" print("randomizing") for i in range(0, size): ran = random.getrandbits(8) result += chr(ran) sys.stdout.write(result) ## termination string sys.stdout.write('##END##') return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_rand_bytes(self, len):\n #r = ''.join([chr(random.randint(0, 255)) for _x in range(len)])\n r = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(len))\n\n return str(r)", "def generate_random_string():\n chars = string.ascii_uppercase + string.digits\n return ''...
[ "0.80554575", "0.78901637", "0.767244", "0.76689917", "0.75241214", "0.7502572", "0.7461471", "0.7439036", "0.7403599", "0.73030615", "0.7296823", "0.72851133", "0.7259457", "0.72553253", "0.72275925", "0.72057915", "0.719467", "0.7178837", "0.7173058", "0.715283", "0.7122018...
0.7567311
4
Add commandline arguments specifically for this agent.
def add_cmdline_args(cls, argparser): super(AutoencoderAgent, cls).add_cmdline_args(argparser) agent = argparser.add_argument_group('Autoencoder Arguments') agent.add_argument( '-hs', '--hiddensize', type=int, default=128, help='size of...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_cmdline_args(argparser):\n TorchAgent.add_cmdline_args(argparser)\n agent = argparser.add_argument_group('Image Caption Model Arguments')\n agent.add_argument('--word_dim', default=300, type=int,\n help='Dimensionality of the word embedding.')\n agent.a...
[ "0.7488987", "0.74843657", "0.7288426", "0.7268989", "0.7268989", "0.72576", "0.7196642", "0.7196642", "0.7196642", "0.7175585", "0.7035756", "0.70240617", "0.7017458", "0.7008726", "0.6993565", "0.6988684", "0.6964704", "0.69540167", "0.69344527", "0.69335383", "0.6925221", ...
0.7133807
10
Return a boolean indicating whether the stack is empty
def is_empty(self): return len(self.items) == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_stack_empty(self):\n if self.stack.__len__() == 0:\n return True\n else:\n return False", "def empty(self) -> bool:\r\n return self.stack == []", "def is_empty(self):\n return len(self.__stack) == 0", "def is_empty(self):\n return self.stack == []",...
[ "0.9196504", "0.9102246", "0.9099963", "0.90945554", "0.90945554", "0.90945554", "0.90945554", "0.9057218", "0.9056269", "0.9005183", "0.89967185", "0.897227", "0.89503217", "0.8912815", "0.8911844", "0.88993084", "0.88966614", "0.88785803", "0.8844711", "0.87882483", "0.8732...
0.0
-1
Return a boolean indicating whether the cache is full
def is_full(self): return len(self.cache) >= self.capacity
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_full(self):\n return len(self.cache_data) >= self.MAX_ITEMS", "def is_full(self):\n if self.size == len(self.queue):\n return True\n return False", "def __is_full(self):\n with self.__cond:\n return self.__buffer.size == self.__capacity", "def _is_full...
[ "0.8485662", "0.7457448", "0.7452769", "0.7442241", "0.7304053", "0.72510135", "0.715414", "0.71405923", "0.7139908", "0.7136975", "0.7069227", "0.70686686", "0.7061569", "0.70582575", "0.70503294", "0.70270556", "0.70164233", "0.70005536", "0.697473", "0.6886798", "0.6873893...
0.86879045
0
Retrieve an item with the given key from the cache
def get(self, key): if self.contains(key): self.lru.push(key) return self.cache[key] else: return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, key):\n return self.cache_data.get(key, None)", "def get(self, key):\n if key in self.cache_data:\n self.cache_data.move_to_end(key)\n return self.cache_data[key]", "def get(self, key, cache=None):\n if cache is None:\n cache = self.name\n ...
[ "0.8269897", "0.80105376", "0.7970992", "0.79279256", "0.78839266", "0.787162", "0.7763255", "0.7745922", "0.7674769", "0.75412947", "0.75342745", "0.7509857", "0.7496317", "0.7477933", "0.7368884", "0.7357855", "0.73475504", "0.7340775", "0.7320523", "0.72864264", "0.7276146...
0.77250504
8
Computes the l2 distance between two vectors
def euclidean_distance(x1, x2): distance = 0 # Squared distance between each coordinate for i in range(len(x1)): distance += pow((x1[i] - x2[i]), 2) return math.sqrt(distance)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _vector_dist(self, vec1, vec2):\n return sqrt(sum([(float(v1) - float(v2))**2 for v1,v2 in\n zip(vec1,vec2)]))", "def vectorDistance(v1, v2):\n sum = 0\n for i in range(len(v1)):\n sum += (v1[i] - v2[i]) ** 2\n return sum ** 0.5", "def vectorDistance(v1, v2...
[ "0.82347786", "0.80019283", "0.8000621", "0.7921554", "0.7750251", "0.77348244", "0.77259034", "0.7665456", "0.7652603", "0.7604017", "0.7586586", "0.7575085", "0.7574378", "0.7562476", "0.75316715", "0.7485702", "0.7459461", "0.7396468", "0.73924834", "0.7391589", "0.7365591...
0.0
-1
Compute l2 distance between a vector and to an array of vectors
def euclidean_distance_matrix(X, x): distance_matrix = np.sqrt(np.sum((X - x) ** 2, axis=1)) return distance_matrix
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vectorDistance(v1, v2):\n sum = 0\n for i in range(len(v1)):\n sum += (v1[i] - v2[i]) ** 2\n return sum ** 0.5", "def _vector_dist(self, vec1, vec2):\n return sqrt(sum([(float(v1) - float(v2))**2 for v1,v2 in\n zip(vec1,vec2)]))", "def vectorDistance(v1, v2...
[ "0.72537535", "0.7237375", "0.7235428", "0.690398", "0.68422097", "0.68194246", "0.6806914", "0.67815685", "0.67167616", "0.67100114", "0.6660867", "0.6655375", "0.6648432", "0.6600672", "0.65894073", "0.65287066", "0.65045273", "0.6482973", "0.6463753", "0.64632714", "0.6460...
0.0
-1
Pad batched dataset with shape = (batch_size, seq_length(various))
def pad_sequence(sequence, pad_tok=0, max_length=None): if max_length is None: max_length = max([len(seq) for seq in sequence]) sequence_padded, seq_length = [], [] for seq in sequence: seq_ = seq[:max_length] + [pad_tok] * max(max_length - len(seq), 0) sequence_padded.append(seq_) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_examples(x, desired_batch_size):\n batch_pad = desired_batch_size - x.shape[0]\n return np.concatenate([x, np.tile(x[-1], (batch_pad, 1))], axis=0)", "def batch_pad(sequences):\n length = max(len(s) for s in sequences)\n batch = np.zeros((len(sequences), length), dtype=np.int32)\n for i, s in enumer...
[ "0.7593259", "0.73564297", "0.73352224", "0.70015275", "0.69837445", "0.68635106", "0.6800522", "0.67095965", "0.66925067", "0.6600282", "0.6590718", "0.6584564", "0.65670466", "0.6560414", "0.6539735", "0.65106314", "0.64928323", "0.6435283", "0.64301926", "0.639167", "0.632...
0.0
-1
Return the JSON response from the rs API given an item's Runescape ID.
async def get_item_details_by_id(self, item_id:int) -> dict: # Send our web request url = API_BASE_URL + 'api/catalogue/detail.json' params = { 'item': item_id, } headers = { "User-Agent": self.bot.user_agent, } async with aiohttp.ClientSe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_api(item_id):\n item = Item.query.get(item_id)\n return jsonify(item.serialize())", "def itemJSON(item_id):\n try:\n item = session.query(Item).filter_by(id=item_id).one()\n return jsonify(item=item.serialize)\n except:\n response = make_response(json.dumps('No such item...
[ "0.68592715", "0.68279415", "0.64766085", "0.6278059", "0.6154344", "0.6149068", "0.5937836", "0.59198236", "0.5916665", "0.5777672", "0.5699912", "0.5678588", "0.5570698", "0.5555266", "0.54682714", "0.5449221", "0.5435801", "0.54350233", "0.5433574", "0.5385875", "0.5368883...
0.59589314
6
Replace space/comma combo with %2C+ and space with + for city names and replace space/comma combo with %2C%20 for latitude/longitude.
def formatAddr(addr): if addr.find('.') != -1: #lat/long comma_sub = re.sub(",\s", '%2C%20', addr) else: #city addr comma_sub = re.sub(",\s", '%2C+', addr) return re.sub(' ', '+', comma_sub)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_encode(str):\n return str.replace(' ', '%20')", "def urlify(string):\n\treturn string.replace(' ', '%20')", "def format_location(text):\n return text.replace(' ', '+')", "def clean_query_string(string: str) -> str:\n\tstring.replace(' ', '%20')\n\tstring.replace(',', '')\n\treturn string", "d...
[ "0.6341335", "0.6296412", "0.61932886", "0.61208767", "0.5905535", "0.5778834", "0.5719651", "0.56149274", "0.55704445", "0.55673015", "0.5471619", "0.5471619", "0.54400074", "0.5421285", "0.5377398", "0.53584284", "0.53058416", "0.5285228", "0.5285164", "0.5245831", "0.52128...
0.6681552
0
Softmax function for a list or numpy array of logits. Also adjusts temperature.
def softmax(w): e = np.array(w) # adjust temperature e -= e.max() # subtract max to protect from exploding exp values. e = np.exp(e) dist = e / np.sum(e) return dist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(x, temp):\n return np.exp(x/temp) / np.sum((np.exp(x))/temp, axis=0)", "def softmax(x):\n x = list (map (lambda i: np.exp (i), x))\n return x / np.sum (x)", "def softmax(x):\n return np.exp(x - logsumexp(x))", "def softmax(x):\n x = np.asarray(x)\n return np.exp(x)/np.sum(np.exp...
[ "0.7562662", "0.7525026", "0.7514981", "0.7496991", "0.7455932", "0.7438686", "0.7394492", "0.73925847", "0.73761624", "0.7375325", "0.7371462", "0.73708576", "0.7365046", "0.73414713", "0.7337223", "0.7337223", "0.7337223", "0.7337223", "0.7337223", "0.7337223", "0.7337223",...
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(GetWeightedIKRequest, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.pose is None: self.pose = geometry_msgs.msg.PoseStamped() if self.tool_frame is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(BasicSafetyMessage, 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.communication_header is ...
[ "0.8060846", "0.8058693", "0.78722066", "0.78722066", "0.78722066", "0.78722066", "0.76016307", "0.75995", "0.7524539", "0.75002515", "0.75002515", "0.74564135", "0.74490803", "0.7442936", "0.74256986", "0.7390053", "0.7354944", "0.73323137", "0.73247564", "0.7317079", "0.729...
0.6758482
77
serialize message with numpy array types into buffer
def serialize_numpy(self, buff, numpy): try: _x = self buff.write(_struct_3I.pack(_x.pose.header.seq, _x.pose.header.stamp.secs, _x.pose.header.stamp.nsecs)) _x = self.pose.header.frame_id length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') lengt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize_numpy(self, buff, numpy):\n self.serialize(buff)", "def serialize_numpy(self, buff, numpy):\n try:\n pass\n except struct.error as se: self._check_types(struct.error(\"%s: '%s' when writing '%s'\" % (type(se), str(se), str(locals().get('_x', self)))))\n except TypeError as te: ...
[ "0.79519945", "0.7893365", "0.785495", "0.77772063", "0.7765444", "0.77629846", "0.7758146", "0.7753108", "0.7752819", "0.7736317", "0.7675474", "0.7673923", "0.7667761", "0.7663843", "0.760332", "0.7587286", "0.7566181", "0.75634706", "0.7555974", "0.7554196", "0.7543482", ...
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(GetWeightedIKResponse, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.solution is None: self.solution = sensor_msgs.msg.JointState() if self.error_code is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(BasicSafetyMessage, 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.communication_header is ...
[ "0.80601466", "0.80589396", "0.7871491", "0.7871491", "0.7871491", "0.7871491", "0.7601558", "0.7599031", "0.7523821", "0.74991786", "0.74991786", "0.7455687", "0.7448531", "0.7442502", "0.7425306", "0.7390668", "0.7354823", "0.7331141", "0.73234427", "0.7316658", "0.7290331"...
0.0
-1
serialize message with numpy array types into buffer
def serialize_numpy(self, buff, numpy): try: _x = self buff.write(_struct_3I.pack(_x.solution.header.seq, _x.solution.header.stamp.secs, _x.solution.header.stamp.nsecs)) _x = self.solution.header.frame_id length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize_numpy(self, buff, numpy):\n self.serialize(buff)", "def serialize_numpy(self, buff, numpy):\n try:\n pass\n except struct.error as se: self._check_types(struct.error(\"%s: '%s' when writing '%s'\" % (type(se), str(se), str(locals().get('_x', self)))))\n except TypeError as te: ...
[ "0.7951979", "0.7894134", "0.78557587", "0.7778328", "0.7766659", "0.77637404", "0.77593005", "0.77540714", "0.77539235", "0.7737562", "0.767685", "0.76748276", "0.7668616", "0.7664322", "0.76045257", "0.75880057", "0.7567481", "0.7564311", "0.7557121", "0.7555019", "0.754482...
0.0
-1
Create a recurrent decoder. If `bridge` is True, the decoder hidden states are initialized from a projection of the encoder states, else they are initialized with zeros.
def __init__(self, type: str = "gru", emb_size: int = 0, hidden_size: int = 0, encoder: Encoder = None, attention: str = "bahdanau", num_layers: int = 0, vocab_size: int = 0, dropout: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __build_decoder(self):\n batch_size = self.batch_size\n data_type = self.model_config.data_type\n language_fw_rnn_cell = self.__create_rnn_cell()\n language_bw_rnn_cell = self.__create_rnn_cell()\n\n with tf.variable_scope(\"language\", reuse=tf.AUTO_REUSE) as language_scope:...
[ "0.5962822", "0.5929648", "0.5927172", "0.5925291", "0.5729886", "0.5695969", "0.56933874", "0.5593337", "0.5573247", "0.55691886", "0.55669594", "0.55624247", "0.5538601", "0.55212027", "0.5479054", "0.54638314", "0.54542017", "0.5441614", "0.54266673", "0.53797734", "0.5343...
0.578953
4