query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
r""" Calculate partial derivatives for all mass flow balance equations. Returns
def pressure_equality_deriv(self): deriv = np.zeros(( self.num_i, self.num_i + self.num_o + self.num_vars, self.num_nw_vars)) for i in range(self.num_i): deriv[i, i, 1] = 1 for j in range(self.num_o): deriv[j, j + i + 1, 1] = -1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_partial_derivatives(self) -> List[Callable]:\n return [self.dfdm, self.dfdc]", "def get_partial_derivatives(self) -> List[Callable]:\n return [self.dfda, self.dfdb, self.dfdc]", "def get_partial_derivatives(self) -> List[Callable]:\n pass", "def get_partial_derivatives(self) -> L...
[ "0.69162154", "0.6853647", "0.67594445", "0.6673241", "0.6545024", "0.64935243", "0.62200797", "0.620985", "0.6177202", "0.6167387", "0.61136556", "0.6039098", "0.6008735", "0.59830254", "0.58655566", "0.5859061", "0.5858246", "0.5791166", "0.5747807", "0.57467055", "0.571906...
0.0
-1
r""" Equation for enthalpy equality. Returns
def enthalpy_equality_func(self): residual = [] for i in range(self.num_i): residual += [self.inl[i].h.val_SI - self.outl[i].h.val_SI] return residual
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eq(self, y):\n return 1 - self.ne(y)", "def test_eq():\n x, y = fwd.Variable(), fwd.Variable()\n f = fwd.sin(x) + fwd.cos(y)\n g = fwd.sin(x) + fwd.cos(y)\n h = fwd.sin(y) + fwd.cos(x)\n assert f == g\n assert f != h", "def eq(w, x):\n return (-w[1]*x - w[0]) / w[2]", "def app...
[ "0.72163594", "0.6572929", "0.64220047", "0.6372147", "0.63588005", "0.63034874", "0.63034415", "0.6296396", "0.61809176", "0.61430204", "0.6112071", "0.6105242", "0.6103117", "0.59963846", "0.59832895", "0.5966638", "0.5931339", "0.5931339", "0.59277314", "0.59069747", "0.58...
0.552821
57
r""" Equation for enthalpy equality.
def enthalpy_equality_func_doc(self, label): indices = list(range(1, self.num_i + 1)) if len(indices) > 1: indices = ', '.join(str(idx) for idx in indices) else: indices = str(indices[0]) latex = ( r'0=h_{\mathrm{in,}i}-h_{\mathrm{out,}i}' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eq(self, y):\n return 1 - self.ne(y)", "def test_eq():\n x, y = fwd.Variable(), fwd.Variable()\n f = fwd.sin(x) + fwd.cos(y)\n g = fwd.sin(x) + fwd.cos(y)\n h = fwd.sin(y) + fwd.cos(x)\n assert f == g\n assert f != h", "def approx_eq(a, b):\n return abs(a-b) < approx_eq.eps", "def...
[ "0.7227859", "0.68298554", "0.65850955", "0.6529753", "0.6415574", "0.6413417", "0.6253247", "0.6227349", "0.622424", "0.6195919", "0.61716175", "0.61604255", "0.6095463", "0.6074481", "0.60640705", "0.60602427", "0.6055815", "0.60390425", "0.6030247", "0.5979934", "0.5963339...
0.5910232
27
r""" Calculate partial derivatives for all mass flow balance equations. Returns
def enthalpy_equality_deriv(self): deriv = np.zeros(( self.num_i, self.num_i + self.num_o + self.num_vars, self.num_nw_vars)) for i in range(self.num_i): deriv[i, i, 2] = 1 for j in range(self.num_o): deriv[j, j + i + 1, 2] = -1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_partial_derivatives(self) -> List[Callable]:\n return [self.dfdm, self.dfdc]", "def get_partial_derivatives(self) -> List[Callable]:\n return [self.dfda, self.dfdb, self.dfdc]", "def get_partial_derivatives(self) -> List[Callable]:\n pass", "def get_partial_derivatives(self) -> L...
[ "0.69166714", "0.6854371", "0.67591727", "0.6673994", "0.6546838", "0.6495122", "0.6223377", "0.6213386", "0.61802274", "0.61696965", "0.61169827", "0.603798", "0.60112125", "0.5985211", "0.5868262", "0.5861571", "0.58611006", "0.57943255", "0.57502186", "0.5747824", "0.57195...
0.0
-1
r""" Calculate partial derivative of the function func to dx.
def numeric_deriv(self, func, dx, pos, **kwargs): if dx == 'fluid': d = 1e-5 conns = self.inl + self.outl deriv = [] for f in conns[0].fluid.val.keys(): val = conns[pos].fluid.val[f] if conns[pos].fluid.val[f] + d <= 1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def derivative(func: Callable, x: float, delta: float) -> float:\n return (func(x + delta) - func(x - delta)) / (2.0 * delta)", "def partial ( index , func , x , h = 0 , I = 2 , err = False ) :\n \n if len(x) <= index :\n raise AttributeError(\"Invalid argument length/index %d/%d\" % ( len(x) ,...
[ "0.74434185", "0.7060871", "0.68484694", "0.6697642", "0.668096", "0.6528208", "0.65230405", "0.64844745", "0.6433414", "0.6405804", "0.6405804", "0.6385867", "0.63094604", "0.6278588", "0.6277184", "0.625846", "0.62240064", "0.6217861", "0.6195724", "0.6194013", "0.6184296",...
0.6718723
3
r""" Calculate residual value of pressure ratio function.
def pr_func(self, pr='', inconn=0, outconn=0): pr = self.get_attr(pr) return (self.inl[inconn].p.val_SI * pr.val - self.outl[outconn].p.val_SI)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _residual(function, p, x, y, y_err):\n return (y - function(p, x)) / y_err", "def _residual_edp(self, params):\n data = self.F**2\n model = np.absolute(self._model())**2\n sigma = self.sigma\n return (data[self.mask]-model[self.mask]) / sigma[self.mask] \n \n # The following thre...
[ "0.7320426", "0.7242871", "0.7097744", "0.7031296", "0.6963993", "0.67645216", "0.67397034", "0.67394376", "0.6636221", "0.66181105", "0.65203583", "0.64543605", "0.6426633", "0.6420456", "0.6416985", "0.6415228", "0.6405344", "0.6398041", "0.6379706", "0.63678235", "0.635110...
0.0
-1
r""" Calculate residual value of pressure ratio function.
def pr_func_doc(self, label, pr='', inconn=0, outconn=0): latex = ( r'0=p_\mathrm{in,' + str(inconn + 1) + r'}\cdot ' + pr + r' - p_\mathrm{out,' + str(outconn + 1) + r'}' ) return generate_latex_eq(self, latex, label)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _residual(function, p, x, y, y_err):\n return (y - function(p, x)) / y_err", "def _residual_edp(self, params):\n data = self.F**2\n model = np.absolute(self._model())**2\n sigma = self.sigma\n return (data[self.mask]-model[self.mask]) / sigma[self.mask] \n \n # The following thre...
[ "0.7316333", "0.72417086", "0.7095481", "0.7029726", "0.69612294", "0.6761161", "0.6738927", "0.67381686", "0.6632527", "0.66165334", "0.65197164", "0.64523154", "0.6423218", "0.6419319", "0.6416038", "0.64138085", "0.64055014", "0.63972145", "0.63791317", "0.6365383", "0.634...
0.0
-1
r""" Calculate residual value of pressure ratio function.
def pr_deriv(self, increment_filter, k, pr='', inconn=0, outconn=0): pr = self.get_attr(pr) self.jacobian[k, inconn, 1] = pr.val self.jacobian[k, self.num_i + outconn, 1] = -1 if pr.is_var: pos = self.num_i + self.num_o + pr.var_pos self.jacobian[k, pos, 0] = self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _residual(function, p, x, y, y_err):\n return (y - function(p, x)) / y_err", "def _residual_edp(self, params):\n data = self.F**2\n model = np.absolute(self._model())**2\n sigma = self.sigma\n return (data[self.mask]-model[self.mask]) / sigma[self.mask] \n \n # The following thre...
[ "0.7317166", "0.7241593", "0.7096314", "0.70310277", "0.696248", "0.6761167", "0.67380136", "0.6737368", "0.66329026", "0.66160154", "0.6517937", "0.64518714", "0.64236796", "0.6417426", "0.64142925", "0.6412702", "0.64039814", "0.63953936", "0.6378967", "0.6367071", "0.63486...
0.0
-1
r""" Calculate partial derivatives of zeta function.
def zeta_deriv(self, increment_filter, k, zeta='', inconn=0, outconn=0): data = self.get_attr(zeta) f = self.zeta_func outpos = self.num_i + outconn if not increment_filter[inconn, 0]: self.jacobian[k, inconn, 0] = self.numeric_deriv( f, 'm', inconn, zeta=zeta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zeta_function(s,a = 1,derivative = 0):\n return mp.zeta(s,a,derivative)", "def zeta(z, x, beta2):\n return 3 * (4* z**2 - beta2 * x**2) / 4 / beta2 / (1+x)", "def get_partial_derivatives(self) -> List[Callable]:\n return [self.dfda, self.dfdb, self.dfdc]", "def get_partial_derivatives(self) ...
[ "0.69251996", "0.65251493", "0.6342588", "0.63092345", "0.6277536", "0.62325907", "0.622904", "0.6221183", "0.62180126", "0.6203884", "0.6199135", "0.6153695", "0.61268854", "0.61135817", "0.6100138", "0.60925937", "0.60837436", "0.6048938", "0.60380226", "0.60230154", "0.601...
0.56824744
36
Return the name of the function (by default ``cls.__name__``).
def get_name(cls): return cls.__name__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def function_name(cls):\n function_name = String(cls.__name__).snakecase().lower()\n return function_name", "def name(cls):\n return arg.s()(cls.func).func.__name__", "def name(self) -> str:\n return f\"{self.class_object.__name__}.{self.method_str}\"", "def name(self):\n\t\tretur...
[ "0.8982793", "0.89001125", "0.8251001", "0.81543905", "0.80965793", "0.80046344", "0.79779893", "0.7962162", "0.7913996", "0.77748555", "0.7666854", "0.7648686", "0.76190066", "0.75459355", "0.7543037", "0.7542202", "0.7538365", "0.7538365", "0.7520372", "0.7520372", "0.75094...
0.80846125
5
Return an executable string representation. This method returns a string so that ``eval(cls.vrepr())`` returns a new `BvFunction` object with the same content.
def vrepr(cls): return cls.__name__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self) -> str:\n return f\"<Function[{self.name}](line:{self.line})>\"", "def __repr__(self):\n klass = self.__class__.__qualname__\n cmd = \" \".join(sys.argv)\n cmd_ = f\"$ {cmd}\"\n args = pformat(self.get_args())\n repr_ = \"\\n\".join((klass, cmd_, args)...
[ "0.62824535", "0.6251113", "0.5906001", "0.5871243", "0.58202857", "0.5671611", "0.56357455", "0.5634955", "0.5599026", "0.5592916", "0.5587618", "0.5570723", "0.5525011", "0.5512445", "0.5512445", "0.5512445", "0.5488936", "0.54781395", "0.547464", "0.54700714", "0.5468626",...
0.60587823
2
Evaluate the function (internal method).
def eval(cls, *args): raise NotImplementedError("subclasses need to override this method")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate():\n\t\t\t\tif not hasattr(evaluate, 'value'):\n\t\t\t\t\tevaluate.value = func()\n\t\t\t\treturn evaluate.value", "def evaluate(self):\n\t\t\t\tif not hasattr(evaluate, 'value'):\n\t\t\t\t\tevaluate.value = func(self)\n\t\t\t\treturn evaluate.value", "def evaluateFunction(self):\n self.fun...
[ "0.8363948", "0.78347844", "0.7824756", "0.7722459", "0.7700503", "0.76522034", "0.76522034", "0.7525874", "0.7351423", "0.7336749", "0.72013867", "0.7196898", "0.7179211", "0.70989", "0.708847", "0.70747817", "0.6979192", "0.6976476", "0.692613", "0.68623143", "0.6814982", ...
0.0
-1
Return the `SSA` object of the bitvector function.
def to_ssa(cls, input_names, id_prefix, decompose_sec_ops=False, **ssa_options): assert len(input_names) == len(cls.input_widths), \ f"len({input_names}) != len({cls.input_widths})" for name in input_names: if name.startswith(id_prefix): raise ValueError(f"input_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_function(self):\n return SSAFunction(self.get_graph())", "def get_ssa(self):\n return copy.deepcopy(self.ssa)", "def scalar():\n # noinspection PyUnusedLocal\n def sf(x, params, const_list, const_dict):\n a = params[0]\n return a\n return FitFunction(func=sf, num_fi...
[ "0.59186536", "0.5916549", "0.54296654", "0.54059696", "0.51643413", "0.5145664", "0.5135719", "0.51271075", "0.5097717", "0.5081484", "0.50415355", "0.49774262", "0.49741253", "0.49423516", "0.48969316", "0.4870019", "0.48033428", "0.4800495", "0.4792813", "0.4789164", "0.47...
0.0
-1
Log a message during the evaluation of the bitvector function. This method is meant to be used within `eval` to log the values of internal variables. At the beggining of each evaluation, messages logged from the last evaluation are automatically removed. >>> from cascada.bitvector.ssa import BvFunction
def log_msg(cls, format_string, format_field_objects=None): if cls._logger is None: cls._logger = [] assert isinstance(format_string, str) if format_field_objects is None: format_field_objects = [] elif isinstance(format_field_objects, core.Term): form...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vlog(self, msg, *args):\n if self.verbose:\n self.log(msg, *args)", "def vlog(self, msg, *args):\n if self.verbose:\n self.log(msg, *args)", "def log(self, message):\n if VERBOSE:\n print self, message", "def log(a):", "def _log_bessel_ive_fwd(v, z):\n out...
[ "0.62713313", "0.62713313", "0.6053605", "0.6013692", "0.594068", "0.58749473", "0.5814132", "0.57811236", "0.57482165", "0.5680488", "0.5664882", "0.5664408", "0.56519717", "0.5640365", "0.56122565", "0.556684", "0.5513507", "0.5511428", "0.5496824", "0.546377", "0.54475796"...
0.0
-1
Return the list of logged messages. If the bitvector function includes `log_msg` calls in its ``eval``, this method return the list of messages logged in the last evaluation with the format field objects applied. Otherwise, an exception is raised. See also `log_msg`.
def get_formatted_logged_msgs(cls): if cls._logger is None: raise ValueError("eval must be called before get_formatted_logged_msgs") list_msgs = [] for format_string, format_field_objects in cls._logger: list_msgs.append(format_string.format(*format_field_objects)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetchLogs(self):\n return [record.msg for record in self.handler.buffer]", "def logged_messages(self):\n return self._logged_messages", "def get_log_messages(self, instance):\n return LogMessageSerializer(instance.log_messages, many=True).data", "def getLogs():\n # in flux, it...
[ "0.6443969", "0.6088012", "0.59338963", "0.5926019", "0.5836273", "0.58012664", "0.5783213", "0.5783213", "0.5766307", "0.5717272", "0.57159305", "0.5616483", "0.55946606", "0.5492802", "0.5484665", "0.5484665", "0.5435299", "0.54241", "0.53707105", "0.5340541", "0.5327934", ...
0.7781618
0
Return the DOT description of the expression tree of the function. See also `printing.dotprinting`.
def dotprinting(cls, input_names, repeat=True, vrepr_label=False, **kwargs): from cascada.bitvector.printing import dotprinting from sympy import Tuple assert len(input_names) == len(cls.input_widths), \ f"len({input_names}) != len({cls.input_widths})" input_vars = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _print_dot(_self, expr):\r\n return r'{((%s) \\cdot (%s))}' % (expr.args[0], expr.args[1])", "def get_dot(self):\n return \"digraph G{\\n%s}\" % (\"\" if self.val is None else (\n \"\\t%s;\\n%s\\n\" % (\n self.val,\n \"\\n\".join(self._get_dot())\n ...
[ "0.7274833", "0.6839633", "0.6839633", "0.6806022", "0.6744544", "0.6415222", "0.62801", "0.6089003", "0.6071469", "0.6069807", "0.6057924", "0.60115856", "0.5987226", "0.5931708", "0.59149814", "0.5914613", "0.5905294", "0.5896731", "0.5862462", "0.58334196", "0.5823697", ...
0.0
-1
Return the class name and the current number of rounds.
def get_name(cls): return f"{super().get_name()}_{cls.num_rounds}R"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report_rounds(self):\n return print(f\"Total Rounds played: {sum([self.wins, self.draws, self.losses])}\")", "def vrepr(cls):\n return f\"{super().vrepr()}.set_num_rounds_and_return({cls.num_rounds})\"", "def count_one_round(self):\n\t\tself.round_count+=1\n\t\treturn self.round_count", "de...
[ "0.6289936", "0.6277111", "0.61140394", "0.59419346", "0.585802", "0.5823698", "0.58067185", "0.57185745", "0.5677853", "0.5667394", "0.56487215", "0.559757", "0.5528206", "0.54875326", "0.5471102", "0.5463627", "0.5463372", "0.5451482", "0.5443987", "0.54125917", "0.54034907...
0.72071
0
Return the `SSA` object of the roundbased bitvector function. This method calls `BvFunction.to_ssa` with the same argument list, and stores the round outputs in the `SSA` object if `add_round_outputs` calls were added in ``eval``.
def to_ssa(cls, input_names, id_prefix, decompose_sec_ops=False, **ssa_options): my_ssa = super().to_ssa(input_names, id_prefix, decompose_sec_ops=decompose_sec_ops, **ssa_options) if cls._rounds_outputs is not None: my_ssa._rounds_outputs = cls._rounds_outputs[:] return my_ssa
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_bvfunction(self):\n _input_widths = [v.width for v in self.input_vars]\n _output_widths = [v.width for v in self.output_vars]\n\n class MyBvFunction(BvFunction):\n input_widths = _input_widths\n output_widths = _output_widths\n _ssa = self\n\n ...
[ "0.5443392", "0.4841223", "0.48364985", "0.48349917", "0.4701788", "0.4483575", "0.44465578", "0.44207594", "0.4366836", "0.43557042", "0.4316889", "0.43090743", "0.42799342", "0.4275801", "0.42707747", "0.4246866", "0.42396498", "0.41845697", "0.41824216", "0.4165671", "0.41...
0.5147074
1
Set `RoundBasedFunction.num_rounds` and update `input_widths` and ``output_widths`` if necessary.
def set_num_rounds(cls, new_num_rounds): raise NotImplementedError("subclasses need to override this method")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_num_rounds_and_return(cls, new_num_rounds):\n cls.set_num_rounds(new_num_rounds)\n return cls", "def roundParameters(self, roundNum):\n ruleName = random.choice(self.state.ruleNames)\n return SupportedRules[ruleName].makeRoundParameters(self, roundNum)", "def _refresh_width(...
[ "0.5804964", "0.5515761", "0.5343894", "0.5200584", "0.5151792", "0.49409455", "0.49409455", "0.49409455", "0.49409455", "0.49409455", "0.49409455", "0.49409455", "0.49409455", "0.49409455", "0.49409455", "0.49409455", "0.4925701", "0.4892504", "0.48858312", "0.48690236", "0....
0.66365224
0
Call `set_num_rounds` and return ``cls``.
def set_num_rounds_and_return(cls, new_num_rounds): cls.set_num_rounds(new_num_rounds) return cls
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_num_rounds(cls, new_num_rounds):\n raise NotImplementedError(\"subclasses need to override this method\")", "def vrepr(cls):\n return f\"{super().vrepr()}.set_num_rounds_and_return({cls.num_rounds})\"", "def newRound():\r\n pass", "def rounds(self):\n if self.round_number > 0:...
[ "0.7139906", "0.58930886", "0.5714936", "0.53902805", "0.5324967", "0.52531534", "0.5185726", "0.50927013", "0.4869179", "0.48575476", "0.485736", "0.48567307", "0.4828904", "0.48038808", "0.47967023", "0.4774418", "0.47364053", "0.47306034", "0.47172225", "0.47037777", "0.46...
0.728035
0
Return an executable string representation. This method returns a string so that ``eval(cls.vrepr())`` returns a new `RoundBasedFunction` object with the same content.
def vrepr(cls): return f"{super().vrepr()}.set_num_rounds_and_return({cls.num_rounds})"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self) -> str:\n return f\"<Function[{self.name}](line:{self.line})>\"", "def __repr__(self):\n klass = self.__class__.__qualname__\n cmd = \" \".join(sys.argv)\n cmd_ = f\"$ {cmd}\"\n args = pformat(self.get_args())\n repr_ = \"\\n\".join((klass, cmd_, args)...
[ "0.6381232", "0.62576866", "0.6033041", "0.5931942", "0.5882333", "0.5824581", "0.5792414", "0.5779144", "0.5772641", "0.5750893", "0.5713249", "0.57122695", "0.56870997", "0.56870997", "0.56870997", "0.5680717", "0.56408143", "0.56408143", "0.5618542", "0.56091654", "0.55859...
0.53370327
50
Store the current round outputs in the evaluation of the roundbased function. This method is meant to be used within ``eval`` to store the outputs of each round. At the beggining of each evaluation, round ouputs stored in the last evaluation are automatically removed. >>> from cascada.bitvector.core import Variable >>>...
def add_round_outputs(cls, *args): if len(args) == 1 and isinstance(args[0], collections.abc.Sequence): args = args[0] if not all(isinstance(bv, core.Term) for bv in args): raise ValueError("the arguments of add_round_outputs must be a bit-vectors") if cls._rounds_outputs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rounds_outputs(cls):\n if cls._rounds_outputs is None:\n raise ValueError(\"eval must be called before get_rounds_outputs\")\n return cls._rounds_outputs", "def finish_online_evaluation_extended(self, task):\n # -- Get current True-Positive, False-Positive and False-Negati...
[ "0.59688175", "0.50948775", "0.50851893", "0.5033911", "0.5004858", "0.49138117", "0.49109364", "0.4891425", "0.48766336", "0.48639855", "0.4859146", "0.4850809", "0.48478952", "0.48452222", "0.48435432", "0.4841556", "0.48407587", "0.48317122", "0.48224238", "0.48160973", "0...
0.49290508
5
Return the list of round outputs obtained in the last evaluation. See also `add_round_outputs`.
def get_rounds_outputs(cls): if cls._rounds_outputs is None: raise ValueError("eval must be called before get_rounds_outputs") return cls._rounds_outputs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_round_separators(self):\n if getattr(self, \"_rounds_outputs\", None) is None:\n return None\n if len(self._rounds_outputs) == 0:\n return None\n return self._rounds_outputs[:-1]", "def outputs(self):\n return self._outputs if self._outputs else [self.uto...
[ "0.6637656", "0.6438899", "0.62058717", "0.61304086", "0.61035067", "0.6090151", "0.6051942", "0.600966", "0.59717953", "0.59507537", "0.59507537", "0.59088373", "0.59074545", "0.5906354", "0.5867009", "0.57934654", "0.57923913", "0.5694699", "0.5679354", "0.5678499", "0.5628...
0.77957076
0
Check whether the last assignments are SSAReturn of the output variables.
def _are_last_assignments_valid(assignments, output_vars, ignore_exception=True): assert isinstance(assignments, collections.OrderedDict) if len(assignments) == 0: return False last_assignments = [] for assign_outvar in reversed(assignments): last_assignments.appe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_return(\n ret_type: None | IntType | ReferenceType, returned: Sequence[BitString]\n) -> None:\n if len(returned) > 1:\n raise ValueError(\"code block returns multiple values\")\n\n if ret_type is None:\n if len(returned) != 0:\n raise ValueError(\n 'funct...
[ "0.5993794", "0.5920944", "0.5595559", "0.5568826", "0.55436", "0.54635245", "0.5395138", "0.5378417", "0.53685534", "0.5290771", "0.52233475", "0.5216341", "0.5209409", "0.5198429", "0.5192773", "0.51814836", "0.5171536", "0.51640624", "0.51598394", "0.5133761", "0.51216966"...
0.751274
0
Return an executable string representation. This method returns a string so that ``eval(self.vrepr())`` returns a new `SSA` object with the same content. >>> from cascada.bitvector.core import Variable >>> from cascada.bitvector.operation import BvXor, BvIdentity >>> from cascada.bitvector.ssa import BvFunction >>> z =...
def vrepr(self): return "{}(input_vars={}, output_vars={}, assignments={}{})".format( type(self).__name__, f"[{', '.join([v.vrepr() for v in self.input_vars])}]", f"[{', '.join([v.vrepr() for v in self.output_vars])}]", f"[{', '.join([f'({v.vrepr()}, {e.vrepr()})'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _repr_(self):\n s = 'An equation '\n have_A = not self.A().is_zero()\n if have_A:\n s += repr(self.A()) + ' x '\n if self.b()>=0:\n if have_A:\n s += '+'\n else:\n s += '-'\n if have_A:\n s += ' '\n s +=...
[ "0.61188376", "0.61188376", "0.60854304", "0.6069777", "0.6012829", "0.5928467", "0.5817199", "0.58145636", "0.5814443", "0.5811863", "0.57879734", "0.5767751", "0.57263815", "0.5706116", "0.5697784", "0.5687782", "0.5685565", "0.56687975", "0.5661975", "0.56314254", "0.56243...
0.6500199
0
Return two strings (header and body) of a C function evalauting the SSA. This method returns two strings (the function header and the function body) of a function in the C programming language that computes the SSA. The C function is of ``void`` type and its list of arguments consists of the input variables, the extern...
def get_C_code(self, C_function_name): from cascada.bitvector.printing import BvCCodePrinter width2type = BvCCodePrinter._width2C_type # in C, * binds to the declarator, not the type specifier input_vars_c = ', '.join(["{} {}".format(width2type(v.width), v.name) for v in self.input_var...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_func_body(func_name, arg_dict, return_type):\n body = \"\"\n arg_list = \"\"\n\n # the following are pointers to scalar outputs\n # Note: pBufferSize was renamed pBufferSizeInBytes in v6.5\n scalar_ptr_outputs = ['nnzTotalDevHostPtr',\n 'pBufferSize',\n ...
[ "0.6069087", "0.5914765", "0.57788587", "0.562777", "0.56116414", "0.56074697", "0.56074697", "0.5592773", "0.5562327", "0.55166125", "0.5506797", "0.5430662", "0.53873694", "0.5343953", "0.5333583", "0.5295312", "0.5277339", "0.527095", "0.5228903", "0.522377", "0.51906025",...
0.67547506
0
Evaluate the SSA with `Constant` inputs and return the `Constant` outputs. If some external variable is not given, it is replaced by the zero bitvector. >>> from cascada.bitvector.core import Variable, Constant >>> from cascada.bitvector.ssa import BvFunction >>> z = Variable("z", 8)
def eval(self, input_vals, external_var2val=None, C_code=False, **kwargs): if external_var2val is None: external_var2val = {} if C_code: # avoid extra asserts in C_code header, body = self.get_C_code("eval_ssa") pymod, tmpdir = _compile_C_code(header, bod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_constant_as_input():\n\n def get_graph():\n dtype = \"uint8\"\n ifm = relay.var(\"ifm\", shape=(1, 16, 16, 32), dtype=dtype)\n conv1 = make_ethosu_conv2d(\n ifm,\n 32,\n 16,\n (1, 1),\n (0, 0),\n (1, 1),\n ...
[ "0.6012145", "0.5996732", "0.55745286", "0.53239137", "0.53122634", "0.52333456", "0.515926", "0.51506853", "0.5062008", "0.50229603", "0.49808976", "0.4980357", "0.49650252", "0.4947497", "0.4945761", "0.49244228", "0.48902893", "0.4867831", "0.48487085", "0.48447675", "0.48...
0.546965
3
Return a `BvFunction` that evaluates ``self``. The returned `BvFunction` stores ``self`` in the ``_ssa`` attribute. Moreover, the method `BvFunction.to_ssa` of the returned `BvFunction` raises an exception unless it is called with the same arguments that were used to create ``_ssa`` (in this case ``_ssa`` is returned)....
def to_bvfunction(self): _input_widths = [v.width for v in self.input_vars] _output_widths = [v.width for v in self.output_vars] class MyBvFunction(BvFunction): input_widths = _input_widths output_widths = _output_widths _ssa = self @classmethod ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_function(self):\n return SSAFunction(self.get_graph())", "def get_ssa(self, name='main'):\n\n ssa = NetworkEnsemble()\n ssa.add_function(name, self.get_function())\n return ssa", "def Avv_func(f):\n\n def Avv(x, v):\n def F(s):\n return f(x + v * s)\n\n ...
[ "0.6440057", "0.57623315", "0.54604423", "0.52078617", "0.50013286", "0.47485492", "0.46421528", "0.46381408", "0.46227366", "0.46155635", "0.46057883", "0.4594721", "0.4532908", "0.45137742", "0.45113122", "0.45107594", "0.45080462", "0.45050156", "0.44994885", "0.4497978", ...
0.75143814
0
Return a deep copy of ``self``. >>> from cascada.bitvector.ssa import BvFunction
def copy(self): import copy as python_copy my_ssa = python_copy.copy(self) # fast shallow copy (avoid __init__) my_ssa.input_vars = my_ssa.input_vars[:] my_ssa.output_vars = my_ssa.output_vars[:] my_ssa.assignments = my_ssa.assignments.copy() return my_ssa
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Copy(self) -> BaseVector:", "def to_bvfunction(self):\n _input_widths = [v.width for v in self.input_vars]\n _output_widths = [v.width for v in self.output_vars]\n\n class MyBvFunction(BvFunction):\n input_widths = _input_widths\n output_widths = _output_widths\n ...
[ "0.6680502", "0.6603158", "0.63798916", "0.6298044", "0.6291777", "0.62572414", "0.62291664", "0.62118846", "0.61597526", "0.6136885", "0.6132493", "0.61314845", "0.6107561", "0.6104375", "0.6088346", "0.6081889", "0.6073604", "0.60660833", "0.60660833", "0.60359776", "0.6012...
0.63188934
3
Split into multiple `SSA` objects given the list of variable separators.
def split(self, var_separators): assert len(var_separators) >= 1 _listify = lambda s: list(s) if isinstance(s, collections.abc.Sequence) else [s] input_vars_set = set(self.input_vars) external_vars_set = set(self.external_vars) # remove input and external vars from var_separat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multi_split(text, seps):\n if not seps: # split by whitespaces\n return text.split()\n else: # split by separators in `seps`\n\n ##### Topics on Stack Overflow\n # http://stackoverflow.com/questions/1059559/python-strings-split-with-multiple-separators\n\n ## Method 1: use `re...
[ "0.58263", "0.5815856", "0.57184464", "0.5663677", "0.5640506", "0.5351031", "0.53371066", "0.530127", "0.52853507", "0.526529", "0.5252852", "0.52451015", "0.52377874", "0.5202907", "0.52014166", "0.5190723", "0.5180124", "0.5155712", "0.51366144", "0.51366144", "0.51365817"...
0.623241
0
Return the round separators if the SSA was obtained from a `RoundBasedFunction`. If the `SSA` object was obtained from `RoundBasedFunction.to_ssa` of a `RoundBasedFunction` including `add_round_outputs` calls in its ``eval``, this method returns a list with the round outputs delimiting the rounds. Otherwise, ``None`` i...
def get_round_separators(self): if getattr(self, "_rounds_outputs", None) is None: return None if len(self._rounds_outputs) == 0: return None return self._rounds_outputs[:-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rounds(self) -> List[Round]:\n return self._rounds", "def get_rounds_outputs(cls):\n if cls._rounds_outputs is None:\n raise ValueError(\"eval must be called before get_rounds_outputs\")\n return cls._rounds_outputs", "def roundParameters(self, roundNum):\n ruleName =...
[ "0.5567383", "0.5464221", "0.5120953", "0.511039", "0.5052884", "0.48159716", "0.46500137", "0.46258867", "0.45040205", "0.44882062", "0.4462644", "0.4399613", "0.43700054", "0.43601322", "0.43520933", "0.42661065", "0.42626894", "0.4245764", "0.42430812", "0.42364082", "0.42...
0.6987893
0
Return the DOT description of the expression tree of the assignments. See also `printing.dotprinting`.
def dotprinting(self, repeat=True, vrepr_label=False, **kwargs): from cascada.bitvector.printing import dotprinting from sympy.core.containers import Tuple expr = Tuple(*self.assignments.items()) return dotprinting(expr, repeat=repeat, vrepr_label=vrepr_label, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dot(self):\n return \"digraph G{\\n%s}\" % (\"\" if self.val is None else (\n \"\\t%s;\\n%s\\n\" % (\n self.val,\n \"\\n\".join(self._get_dot())\n )\n ))", "def get_dot(self):\n return \"digraph G{\\n%s}\" % (\"\" if self.val is Non...
[ "0.684507", "0.684507", "0.676799", "0.67229974", "0.66039073", "0.64485973", "0.6420611", "0.6315337", "0.62731916", "0.6222227", "0.6212272", "0.61359996", "0.6120097", "0.6057643", "0.6020347", "0.5955078", "0.5942951", "0.5939027", "0.593326", "0.59245104", "0.587527", ...
0.62478375
9
Return a random `BvFunction` with given shape.
def get_random_bvfunction(width, num_inputs, num_outputs, num_assignments, seed, external_variable_prefix=None, operation_set_index=0, num_rounds=None, extra_operations=None): assert num_inputs + num_assignments >= num_outputs import random import functoo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def b_init(shape, name=None):\n values = np.random.normal(loc=0.5, scale=1e-2, size=shape)\n return K.variable(values, name=name)", "def __call__(self, shape):\n return np.random.uniform(low=self.minval, high=self.maxval, size=shape)", "def b_init(shape, name=None):\n values = rng.norma...
[ "0.60691446", "0.6022296", "0.5954505", "0.57499504", "0.57022244", "0.5671044", "0.5671044", "0.5621131", "0.56195396", "0.5616216", "0.5603668", "0.55633956", "0.5560976", "0.5538763", "0.55148214", "0.5467586", "0.54356635", "0.54152143", "0.53970236", "0.53505164", "0.532...
0.5444272
16
Compile a C function given its C code as two strings (function header and body).
def _compile_C_code(header, body, return_unloaded=False, verbose=False): import importlib import tempfile import uuid import cffi module_name = "module_" + uuid.uuid4().hex if "__uint128" in header: raise ValueError("_compile_C_code does not support bit-vector widths " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compile(self, filename, source):\n \n if source and source[-1] != '\\n':\n source = source + '\\n'\n code = __builtin__.compile(source, filename.cStr(), 'exec')\n\n # try to cache the compiled code\n pycFilename = Filename(filename)\n pycFilename.setExtensi...
[ "0.7229262", "0.6958879", "0.68127483", "0.663641", "0.6623606", "0.6555563", "0.6529795", "0.63210225", "0.6301976", "0.6199189", "0.61737925", "0.61382604", "0.60743004", "0.60626096", "0.6054126", "0.60315853", "0.60043836", "0.59953725", "0.59876066", "0.59520745", "0.592...
0.71571857
1
A modification of the Dijkstra algorithm
def solution(map): # length[i][j] = the length of the shortest path from (i,j) to (w-1,h-1). # Modify the current location to -1 and continue searching from adjacent spaces. return Maze(map).shortest_length()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def djikstra(nodes,links,source,dest):\n route = []\n vertexes = []\n for v in nodes:\n v.set_dist(float(\"inf\"))\n v.set_prev(None)\n heappush(vertexes, v)\n source.set_dist(0)\n heapify(vertexes)\n while vertexes:\n unsorted = False\n u = heappop(vertexes)\n ...
[ "0.7872492", "0.7555279", "0.7497173", "0.7463082", "0.7290284", "0.7236829", "0.7224564", "0.72027636", "0.7160234", "0.7055264", "0.7048513", "0.7043256", "0.704258", "0.70190734", "0.70090604", "0.6993872", "0.6993811", "0.69754803", "0.69566625", "0.69531214", "0.69526106...
0.0
-1
direct print statement that can be overritten to silence output
def printc(txt): sys.stdout.write(txt) sys.stdout.write('\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blockPrint():\n sys.stdout = open(os.devnull, 'w')", "def hook_print():\n sys.stdout = PrintHook()", "def disable_print_statements_on_console(func):\n\n @wraps(func)\n def wrap(*args, **kw):\n suppress_text = io.StringIO()\n sys.stdout = suppress_text\n result = func(*args,...
[ "0.733117", "0.70476305", "0.7041148", "0.6995482", "0.6975923", "0.6964246", "0.6914346", "0.6895462", "0.6827461", "0.6757986", "0.666872", "0.65437067", "0.65259236", "0.65141696", "0.6512715", "0.6506051", "0.6505484", "0.64867496", "0.6480485", "0.6461684", "0.64198947",...
0.0
-1
returns progress as a number between 0 and 100
def progress(self): return self.progressValue
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def progress(self) -> int:\n return int(round(100 * self.somme() / self.finances))", "def percentage_progress(self):\n\n if self.total_progress != 0:\n return float(self.progress) / self.total_progress\n return self.progress", "def percentage_progress(self):\n\n if self.t...
[ "0.79426646", "0.7889467", "0.7889467", "0.7813299", "0.7813299", "0.7813299", "0.7813299", "0.7616806", "0.755221", "0.74852914", "0.74636984", "0.73992074", "0.7360572", "0.73133385", "0.7295597", "0.726702", "0.7258826", "0.71958226", "0.71958226", "0.71958226", "0.7195822...
0.79399526
1
Parse a file from Dunbrack's PICSE server. This will iterate all lines in the file and extract the list of proteins that match the resolution criteria.
def parse_file(self, path, max_resolution, threshold, proteins={}): """ create regex pattern here so it is not done repeatedly while parsing file groups: 0 - Protein ID 1 - Chain ID 2 - Length of protein chain 3 - Exptl. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_protenn_matches(file: str):\n with open(file, \"rt\") as fh:\n for line in fh:\n sequence_id, pfam_acc, start, end = line.rstrip().split(\"\\t\")\n if re.fullmatch(r\"PF\\d+\", pfam_acc):\n yield sequence_id, pfam_acc, int(start), int(end)", "def read(read_...
[ "0.5723123", "0.5713342", "0.56971914", "0.5693488", "0.5667087", "0.56034213", "0.5589402", "0.5556643", "0.55423754", "0.55163777", "0.54881227", "0.5454614", "0.5442599", "0.5424246", "0.542282", "0.5417614", "0.5411043", "0.5402362", "0.539387", "0.53841794", "0.5367232",...
0.5888745
0
Download files from the given url that match the input properties.
def get_files(url, thresholds, resolution, r_factor): selection_page = urllib.urlopen(url).read() threshold = '|'.join(['%s'% t for t in thresholds]) pattern = '\s(cullpdb_pc(%s)_res%s_R%s_.*\d\.gz)' % (threshold, resolution, r_factor) files = re.findall(pattern, selection_page) output = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _download_from_url(self, url):\n target_file_name = self.dir + \"/\" + url.split('/')[-1].split('?')[0]\n urllib.urlretrieve (url, target_file_name)", "def download_file():\n for lines in urls:\n try:\n req.urlretrieve(lines, '{0}/{1}'.format(folder_path, lines.split('/')[-...
[ "0.72419274", "0.6964805", "0.6902224", "0.687781", "0.68698674", "0.6854977", "0.6767678", "0.66414696", "0.6622179", "0.66141295", "0.6612454", "0.6584942", "0.657195", "0.6559492", "0.6533447", "0.65309846", "0.65219647", "0.6515233", "0.6503059", "0.6503059", "0.6498818",...
0.0
-1
Create an instance by evaluating all constraints in the problem. The ``problem`` is a DnaChisel DnaOptimizationProblem.
def from_problem(problem, autopass_constraints=True): def evaluate(constraint): if ( autopass_constraints and constraint.enforced_by_nucleotide_restrictions ): return SpecEvaluation( constraint, prob...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def phase_I_problem_from(cls, problem: LinearConstraintsProblem) -> LinearProblem:\n n = problem.n\n m = len(problem.constraints)\n\n e_x = np.zeros(shape=n)\n e_z = np.ones(shape=m)\n e = np.concatenate((e_x, e_z))\n\n x0 = np.zeros(n)\n # we dont need to look at s...
[ "0.6295126", "0.60471386", "0.5886922", "0.5765422", "0.5730006", "0.5707503", "0.565367", "0.5576092", "0.5528963", "0.54968774", "0.5491965", "0.54807454", "0.5393297", "0.53774476", "0.53702635", "0.5276206", "0.52658254", "0.5262188", "0.5253071", "0.5241584", "0.52301854...
0.6974452
0
Return color 60f979 if evaluation.passes else f96c60.
def success_failure_color(self, evaluation): return "#60f979" if evaluation.passes else "#f96c60"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_color(self):\r\n if self.color:\r\n return \"RED\"\r\n else:\r\n return \"BLACK\"", "def color(self):\n return 0x2f3136", "def color_negative_red_positive_green(val):\n if val < 0:\n color = 'red'\n elif val > 0:\n color = '...
[ "0.7141954", "0.6812762", "0.6681384", "0.66602385", "0.66393065", "0.65938675", "0.65505564", "0.64515567", "0.64472324", "0.6438781", "0.6421074", "0.6412371", "0.6412371", "0.6412371", "0.6412371", "0.64005363", "0.6387426", "0.63748986", "0.6365186", "0.6347126", "0.63348...
0.722408
0
Return a global SUCCESS or FAILURE message for all evaluations.
def text_summary_message(self): failed = [e for e in self.evaluations if not e.passes] if failed == []: return "SUCCESS - all constraints evaluations pass" else: return "FAILURE: %d constraints evaluations failed" % len(failed)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def success_failure_color(self, evaluation):\n return \"#60f979\" if evaluation.passes else \"#f96c60\"", "def get_error_message(self):\n msg = 'Test case: ' + self.benchmark + '.yaml + ' + self.producer + '.yaml failed. '\n info = ''\n if not self.directory:\n info = 'No r...
[ "0.602707", "0.6026309", "0.575857", "0.57070476", "0.56101066", "0.55959904", "0.5554432", "0.5525771", "0.55251604", "0.54986006", "0.54985416", "0.5497898", "0.54954153", "0.5488641", "0.54584396", "0.5451354", "0.5448297", "0.54367286", "0.54192775", "0.5412327", "0.53970...
0.73922765
0
Returns a Collection of Opportunities.
def index(self): args = index_reqparse.parse_args() args.api_key = "8l3xbEmsQMq7AG7mXoSy3IuJAqehmWGRC754Otx7" url = 'http://api.data.gov/gsa/fbopen/v0/opps?%s' % urlencode(query=args) return json.loads(urlopen(url=url).read())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_all(self):\n return self.opportunities.find()", "def get_opportunities_for_maintenance(self, limit=None,\n batch_size=None):\n cursor = self.iter_all()\n\n if limit:\n limit = int(limit)\n cursor = cursor.limit(limit)\n\...
[ "0.75928587", "0.6055248", "0.56843185", "0.5382803", "0.5341676", "0.52663434", "0.5257113", "0.5237074", "0.51992303", "0.5176973", "0.5175872", "0.51342726", "0.51293606", "0.5111544", "0.50776553", "0.50687754", "0.5067086", "0.5067079", "0.5047134", "0.5043661", "0.50391...
0.0
-1
Synchronously sends a button one time.
def send_one(self, remote, button): if lirc_client.lirc_send_one(self.fd, remote, button) == -1: raise RuntimeError("Error while communicating with LIRC daemon!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_one(self, button):\n self.client.send_one(self.name, button)", "def background_thread():\n state = True\n while True:\n newstate = False if GPIO.input(18) else True\n if state != newstate:\n state = newstate \n print('Button', state)\n socketio...
[ "0.7280409", "0.62338156", "0.60761607", "0.605578", "0.5945966", "0.59420735", "0.5936507", "0.58793426", "0.5785086", "0.5780414", "0.57774216", "0.5766327", "0.558829", "0.55684954", "0.55346733", "0.55283284", "0.55037683", "0.54426235", "0.54423636", "0.5441076", "0.5415...
0.61962545
2
Synchronously sends a button one time.
def send_one(self, button): self.client.send_one(self.name, button)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def background_thread():\n state = True\n while True:\n newstate = False if GPIO.input(18) else True\n if state != newstate:\n state = newstate \n print('Button', state)\n socketio.emit('button', {'state': state}, namespace='/test')\n time.sleep(.1)", "...
[ "0.62327343", "0.6195085", "0.6072948", "0.60537666", "0.59465384", "0.59400034", "0.5935611", "0.5875449", "0.578244", "0.57768023", "0.57764006", "0.5765144", "0.5585602", "0.55646986", "0.55332255", "0.5523995", "0.5501173", "0.5440503", "0.5439348", "0.5438772", "0.541685...
0.72782546
0
initializes id and title
def __init__(self, id = 'abbrev', title = "Abbreviation Bibliography ID Cooker"): self.id = id self.title = title
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, id=\"\", title=\"\", arguments=\"\"):\n\t\tself.id= id\n\t\tself.title= title\n\t\tself.arguments= arguments", "def __init__(self, id_, name):\n self._id = id_\n\n self._name = name\n self._name = self._name.title()", "def __init__(self, title):\n self._title = ti...
[ "0.78083724", "0.73984087", "0.7277978", "0.7061586", "0.686914", "0.6863247", "0.6813077", "0.6807725", "0.67897606", "0.666484", "0.666484", "0.666484", "0.666484", "0.66423106", "0.6562245", "0.6524675", "0.6524675", "0.6489632", "0.64539367", "0.64539367", "0.642176", "...
0.7662275
1
cooks a bibref id for one reference entry dict
def _cookIdCore(self, ref, **kwargs): # AUTHORS namepart='nobody' if self._refHasAuthorNames(ref): lastnames = [] for each in ref['authors']: if each.get('lastname', None): lastnames.append(each['lastname']) if len(lastnam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_cff_reference(bib_entry: pybtex.database.Entry) -> dict:\n\n def _cff_transform(cff_field, bib_value):\n if cff_field == \"type\":\n if bib_value == \"inproceedings\":\n return \"article\"\n elif bib_value == \"incollection\":\n return \"article\...
[ "0.6515439", "0.59412706", "0.5690313", "0.5684403", "0.56685394", "0.56310415", "0.5598006", "0.5590219", "0.55857784", "0.5583656", "0.55488837", "0.55436593", "0.54998034", "0.54959476", "0.54939634", "0.5449776", "0.5437612", "0.5418777", "0.5413845", "0.5396753", "0.5389...
0.61811495
1
Test for when clone lun is not passed a block count.
def test_clone_lun_zero_block_count(self): lun = netapp_api.NaElement.create_node_with_children( 'lun-info', **{'alignment': 'indeterminate', 'block-size': '512', 'comment': '', 'creation-timestamp': '1354536362', 'is-space-all...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def corrected_clump_tester(clump):\n tester = True\n for block in clump:\n if len(block) >= 3: # Fixed block!\n tester = False\n break\n return tester", "def org_clump_tester(clump):\n tester = True\n for block in clump:\n if len(clump) >= 3: # clump should be...
[ "0.5885451", "0.5682751", "0.56746435", "0.5612983", "0.5546021", "0.5530416", "0.55098057", "0.5433039", "0.54293126", "0.5397168", "0.536836", "0.5333882", "0.53137195", "0.530228", "0.52823144", "0.5272673", "0.52483624", "0.5217936", "0.5197577", "0.51798713", "0.5166777"...
0.7056724
0
Initialize modified GRU cell.
def __init__(self, input_size, input_dim, hidden_dim, kernel_size, bias): super(ModGRUCell, self).__init__() self.height, self.width = input_size self.input_dim = input_dim self.hidden_dim = hidden_dim self.kernel_size = kernel_size self.padding = kernel_size[0] //...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_gru_cell(self, num_units):\n return gru_cell.LayerNormGRUCell(\n num_units,\n w_initializer=self.uniform_initializer,\n u_initializer=random_orthonormal_initializer,\n b_initializer=tf.constant_initializer(0.0))", "def initialize_cell_cycles(self,g_av=1,g_sig=0.2):\...
[ "0.7468389", "0.62160295", "0.61595106", "0.61388946", "0.6088923", "0.6070395", "0.595316", "0.59318763", "0.59082144", "0.5905371", "0.585891", "0.58529335", "0.5845387", "0.58402777", "0.5813198", "0.5757071", "0.5716906", "0.56996626", "0.5678049", "0.5640501", "0.5639719...
0.5497019
39
Parse the circuit definition file.
def parse_network(self): self._check_fixed_start() self._check_fixed_others(self.scanner.DEVICES_ID) self._check_devicelist() self._check_fixed_others(self.scanner.DEVICES_ID) self._check_fixed_start() self._check_fixed_others(self.scanner.CONNECTIONS_ID) self._ch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_file(self):\n for num, line in enumerate(self._text):\n if \"CRYSTAL STRUCTURE SOLUTION\" in line:\n line = line.strip().strip('+').strip()\n if 'SHELXTL' in line:\n self.version = 'SHELXT ' + line.split()[-1]\n if line.strip()...
[ "0.6225297", "0.61288214", "0.6015567", "0.6008988", "0.5940226", "0.59268165", "0.5896686", "0.58951074", "0.58671474", "0.58663946", "0.58653283", "0.58582795", "0.58579344", "0.5810102", "0.5686838", "0.56725323", "0.56548876", "0.56428576", "0.56192803", "0.55996054", "0....
0.0
-1
Checks if device name is valid
def _check_name(self, symbol): if symbol.type == self.scanner.NAME: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_dev_name_valid(self):\n return self._name_re.match(self.dev_name) is not None", "def _validate_name(name):\r\n\tif HOST_NAME != name and len(name) > 0 and ZOOM_PHRASES[0] not in name and name not in WAITING_ROOM:\r\n\t\treturn True\r\n\treturn False", "def validname(name):\r\n return len(n...
[ "0.8281383", "0.7181085", "0.7058277", "0.6907663", "0.68601716", "0.6770678", "0.6747763", "0.6730695", "0.6681097", "0.6627635", "0.6570866", "0.65404034", "0.6518061", "0.65087", "0.6499738", "0.64887094", "0.6470892", "0.6418953", "0.64112616", "0.6360881", "0.6354566", ...
0.6163687
33
Checks if symbol is a valid device
def _check_validdevice(self, symbol): if symbol.type == self.scanner.KEYWORD and \ symbol.id in self.validdeviceids: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_deviceline(self):\n # Check if device name is valid\n if self._check_name(self.symbol):\n self.device_name = self.symbol\n self.symbol = self.scanner.get_symbol()\n # Check if '=' is used\n if self._is_equal(self.symbol):\n # Get n...
[ "0.75342447", "0.6746497", "0.65169084", "0.64804757", "0.63896406", "0.63296634", "0.6282044", "0.6268811", "0.62086785", "0.6193023", "0.61705214", "0.6164332", "0.615052", "0.6144333", "0.61336094", "0.6121036", "0.6086974", "0.6019076", "0.6016493", "0.59963256", "0.59561...
0.8153207
0
Checks if symbol is a valid parameter
def _check_validparam(self, symbol): if symbol.type == self.scanner.KEYWORD and \ symbol.id in self.validparamids: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_name(self, symbol):\n if symbol.type == self.scanner.NAME:\n return True\n else:\n return False", "def _is_valid_input(self, parameter_name):\n raise NotImplementedError()", "def _check_paramindevice(self):\n if self._check_validparam(self.symbol):\n...
[ "0.6862855", "0.6799891", "0.6653889", "0.65039194", "0.64729655", "0.64628637", "0.6461699", "0.64211375", "0.6384333", "0.6335811", "0.63166904", "0.6274853", "0.62189996", "0.62188965", "0.61966276", "0.6187289", "0.6160707", "0.6061646", "0.6057763", "0.60409635", "0.6040...
0.82193774
0
Check correctness of the symbol START
def _check_fixed_start(self): self.symbol = self.scanner.get_symbol() if self.symbol.type == self.scanner.KEYWORD and \ self.symbol.id == self.scanner.START_ID: pass elif self._is_eof(self.symbol): # In case file ends prematurely pass e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_start(start, lines):\r\n if start.isalpha(): # start word must be alphabetic\r\n if len(start) > 1: # start word must be larger than 1 character\r\n if start in lines: # start word must be in the list of words\r\n return \"0\"\r\n else:\r\n ...
[ "0.71219003", "0.6362785", "0.63464314", "0.63366246", "0.6255174", "0.6188901", "0.6157201", "0.6143468", "0.60610247", "0.6050532", "0.5992676", "0.59828264", "0.59446603", "0.59429526", "0.5934591", "0.59285474", "0.5921997", "0.5911821", "0.5889964", "0.5861589", "0.58428...
0.77844435
0
Check correctness of other fixed symbols, e.g. DEVICES
def _check_fixed_others(self, symbol_id): # Get the next symbol self.symbol = self.scanner.get_symbol() if self.symbol.type == self.scanner.KEYWORD and \ self.symbol.id == symbol_id: self.symbol = self.scanner.get_symbol() self._check_semicolon_else_skip(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_kyc_get_validation_legal(self):\n pass", "def validate_entered_symbol(self, existing_symbols):\n print(\"Consultando símbolo\")\n if self.symbol in existing_symbols:\n print(\"Símbolo validado\")\n validated_symbol = self.symbol\n return validated_sy...
[ "0.6116707", "0.6059896", "0.6044129", "0.5927608", "0.586123", "0.5858872", "0.58061266", "0.5715343", "0.57108855", "0.5709121", "0.56695735", "0.5662229", "0.5651855", "0.56507117", "0.5647858", "0.5638892", "0.56259936", "0.5609222", "0.55763483", "0.55747074", "0.5555086...
0.0
-1
Check if symbol is a valid DType input
def _check_validdtypeinput(self, symbol): if symbol.type == self.scanner.KEYWORD and \ symbol.id in self.validdtypeinputs: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_validdtypeoutput(self, symbol):\n if symbol.type == self.scanner.KEYWORD and \\\n symbol.id in self.validdtypeoutputs:\n return True\n else:\n return False", "def is_symbol(obj):\n return isinstance(obj, Symbol)", "def isValidDataTypeName(name: u...
[ "0.7286696", "0.66887015", "0.6577127", "0.6570027", "0.64245325", "0.6364817", "0.6271129", "0.6229207", "0.6214596", "0.61741644", "0.6168954", "0.6150034", "0.6127641", "0.607109", "0.60133564", "0.59820586", "0.5958963", "0.5928896", "0.59214616", "0.5874561", "0.5868875"...
0.7812703
0
Check if symbol is a valid DType output
def _check_validdtypeoutput(self, symbol): if symbol.type == self.scanner.KEYWORD and \ symbol.id in self.validdtypeoutputs: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_validdtypeinput(self, symbol):\n if symbol.type == self.scanner.KEYWORD and \\\n symbol.id in self.validdtypeinputs:\n return True\n else:\n return False", "def is_symbol(obj):\n return isinstance(obj, Symbol)", "def _want_sym(sym):\n if s...
[ "0.7144111", "0.62963384", "0.612206", "0.60689634", "0.6064693", "0.5982979", "0.5965407", "0.5920263", "0.5882332", "0.58719504", "0.58253753", "0.5759133", "0.57490194", "0.5722805", "0.57056916", "0.5703249", "0.5655178", "0.56458294", "0.5625231", "0.56242913", "0.562355...
0.7976685
0
Checks for a semicolon
def _is_semicolon(self, symbol): if symbol.type == self.scanner.SEMICOLON: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_semicolon_else_skip(self, symbol):\n if symbol.type == self.scanner.SEMICOLON:\n pass\n else:\n self._display_syntax_error(\"semicolon\")\n # Skip to semicolon at end of line\n self._semicolon_skipper()", "def _check_semicolon(line_index, input...
[ "0.77693564", "0.7576656", "0.73017335", "0.7250093", "0.67261046", "0.63885087", "0.63797534", "0.635322", "0.6284039", "0.615116", "0.6051766", "0.6046793", "0.60242265", "0.58955777", "0.5878949", "0.585406", "0.58402747", "0.57678705", "0.5749202", "0.5675741", "0.5645079...
0.7972013
0
When error found, skips to end of line by identifying semicolon
def _semicolon_skipper(self): while ( not self._is_semicolon( self.symbol)) and ( not self._is_eof( self.symbol)): self.symbol = self.scanner.get_symbol() if self._is_eof(self.symbol): # In case file ends prematurely ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_semicolon_else_skip(self, symbol):\n if symbol.type == self.scanner.SEMICOLON:\n pass\n else:\n self._display_syntax_error(\"semicolon\")\n # Skip to semicolon at end of line\n self._semicolon_skipper()", "def _check_semicolon(line_index, input...
[ "0.7086357", "0.66036904", "0.64966756", "0.6311523", "0.6219263", "0.60868347", "0.6043285", "0.60312366", "0.59458333", "0.5931774", "0.5893653", "0.58929294", "0.58747315", "0.5836142", "0.57985604", "0.5744275", "0.57366985", "0.5712483", "0.56762767", "0.56374615", "0.56...
0.64809066
3
Check for a semicolon, otherwise skip to end of line
def _check_semicolon_else_skip(self, symbol): if symbol.type == self.scanner.SEMICOLON: pass else: self._display_syntax_error("semicolon") # Skip to semicolon at end of line self._semicolon_skipper()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _semicolon_skipper(self):\n while (\n not self._is_semicolon(\n self.symbol)) and (\n not self._is_eof(\n self.symbol)):\n self.symbol = self.scanner.get_symbol()\n if self._is_eof(self.symbol):\n # In case file ends premat...
[ "0.78582406", "0.76281416", "0.73624676", "0.7034011", "0.6740908", "0.65985113", "0.6566954", "0.649407", "0.62372047", "0.60137314", "0.60137314", "0.60137314", "0.5960441", "0.5945319", "0.58354354", "0.5831994", "0.58205914", "0.5817536", "0.5817003", "0.5816331", "0.5751...
0.7773585
1
Checks for a comma
def _is_comma(self, symbol): if symbol.type == self.scanner.COMMA: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_comma(text):\n err = \"style-guide.serial-comma\"\n msg = \"Use serial comma after penultimate item.\"\n regex = \"\\,\\s[a-zA-Z0-9]*\\sand\\s\"\n\n return existence_check(text, [regex], err, msg, require_padding=False)", "def contains_comma(self, *args):\n return _ida_hexrays.cexpr_...
[ "0.78176993", "0.7652777", "0.75575286", "0.739962", "0.6958344", "0.68487954", "0.67709404", "0.6737014", "0.654276", "0.6426066", "0.6025317", "0.60239697", "0.590207", "0.5873435", "0.5853992", "0.58382696", "0.5835906", "0.579905", "0.579905", "0.5768135", "0.5726377", ...
0.78183836
0
Checks if symbol is =
def _is_equal(self, symbol): if symbol.type == self.scanner.EQUALS: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_equality(s):\n return s == \"=\"", "def have_equal_symbol(l):\r\n if \"=\" in str(l):\r\n return 1\r\n else:\r\n return 0", "def __eq__(self, other):\n if isinstance(other, Symbol):\n return self.arg == other.arg\n else:\n return False", "def ...
[ "0.7069563", "0.7053939", "0.6365846", "0.6041129", "0.6032814", "0.6008303", "0.5979109", "0.5968912", "0.59604686", "0.5947024", "0.5919421", "0.5879708", "0.5776344", "0.56683415", "0.5635651", "0.5520605", "0.5435992", "0.5415546", "0.54125285", "0.5401831", "0.5359267", ...
0.7887802
0
Checks if symbol is a number
def _is_number(self, symbol): if symbol.type == self.scanner.NUMBER: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_numeral(self, symbol: str) -> bool:\n return symbol in self.numerals", "def is_number(symbol):\n return isa(symbol, complex) or is_rational(symbol)", "def is_int(symbol):\n return isa(symbol, int)", "def _is_num(w):\n symbols = list(w)\n for s in symbols:\n ...
[ "0.7981778", "0.796459", "0.7456952", "0.71271473", "0.7109606", "0.7074188", "0.7070969", "0.70643014", "0.7049879", "0.70249534", "0.7018031", "0.701756", "0.701756", "0.701756", "0.7005208", "0.69720167", "0.6957312", "0.69454503", "0.69375134", "0.6913471", "0.6888762", ...
0.87825435
0
Checks if symbol is END
def _is_end(self, symbol): if symbol.id == self.scanner.END_ID: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_eof(self, symbol):\n if symbol.type == self.scanner.EOF:\n return True\n else:\n return False", "def is_eof(eof):\n return eof == Symbol('#!eof')", "def _is_at_end(self):\n return self._peek().token_type == scanner.TokenType.EOF", "def end_marker(data...
[ "0.7342705", "0.7149009", "0.70896596", "0.70774", "0.67542297", "0.6487307", "0.63351965", "0.6282967", "0.6278268", "0.6223454", "0.6220154", "0.6128539", "0.6115099", "0.6088857", "0.60728556", "0.60151976", "0.5978687", "0.5965214", "0.5928278", "0.5921364", "0.5912482", ...
0.8258185
0
Checks if symbol is period
def _is_period(self, symbol): if symbol.type == self.scanner.PERIOD: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_dot(f):\n return f.startswith('.')", "def contains_only_digit_period(cell):\n # Check if empty\n if check_empty(cell):\n return True\n return not bool(re.match(\"^[\\d\\.]+$\", str(cell)))", "def test_assert_does_not_contain_period(self):\n\n with self.assertRaisesRegexp(Except...
[ "0.67990226", "0.66136557", "0.6595603", "0.6524375", "0.65057904", "0.62380713", "0.6233876", "0.61981905", "0.6056237", "0.6032704", "0.5983063", "0.59301597", "0.5924762", "0.57949024", "0.57834405", "0.5684264", "0.5677624", "0.56559867", "0.5553411", "0.55044025", "0.549...
0.84950036
0
Checks if symbol is arrow
def _is_arrow(self, symbol): if symbol.type == self.scanner.ARROW: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_arrow(arrow):\r\n if arrow == '->':\r\n return u'\\u2192'\r\n if arrow == '<->':\r\n return u'\\u2194'\r\n\r\n # this won't be reached unless we add more arrow types, but keep it to avoid explosions when\r\n # that happens.\r\n return arrow", "d...
[ "0.6579438", "0.62176615", "0.6158133", "0.61140186", "0.56991667", "0.56856215", "0.5675952", "0.56478024", "0.56177944", "0.56067", "0.5604297", "0.55857825", "0.5528179", "0.549328", "0.549197", "0.5484557", "0.54716647", "0.5453517", "0.54349774", "0.54213643", "0.5419489...
0.8980897
0
Checks if symbol is EOF
def _is_eof(self, symbol): if symbol.type == self.scanner.EOF: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_eof(eof):\n return eof == Symbol('#!eof')", "def _is_end(self, symbol):\n if symbol.id == self.scanner.END_ID:\n return True\n else:\n return False", "def isEOF(self):\n return _libsbml.XMLToken_isEOF(self)", "def is_eof(self) -> bool:\n ...", "de...
[ "0.81757635", "0.75523627", "0.72510964", "0.7247274", "0.72082675", "0.6746605", "0.6746605", "0.6746605", "0.6746605", "0.6720954", "0.6688368", "0.6590599", "0.6573672", "0.6370021", "0.62316614", "0.62316614", "0.62316614", "0.6191076", "0.61427915", "0.6137312", "0.61229...
0.89874196
0
Returns the correct device type to input into Devices module.
def _device_type_returner(self, symbol): if self.names.get_name_string(symbol.id) == "AND": return self.devices.AND if self.names.get_name_string(symbol.id) == "OR": return self.devices.OR if self.names.get_name_string(symbol.id) == "NAND": return self.devices...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_type(self):\n return Context.devtype2str[self.device_typeid]", "def device_type(self):\n return Context.devtype2str[self.device_typeid]", "def device_type(self):\n return self._meta['device_type']", "def device_type(self):\r\n return self._arm.device_type", "def devic...
[ "0.8152535", "0.8152535", "0.81299514", "0.8082578", "0.79667145", "0.7923392", "0.78032374", "0.78032374", "0.78032374", "0.7714159", "0.7676494", "0.7660527", "0.75814134", "0.7581327", "0.7559037", "0.7544125", "0.75318646", "0.747006", "0.7458651", "0.7447082", "0.7422269...
0.76428765
12
Checks the entire devices list until END DEVICE is reached
def _check_devicelist(self): self.symbol = self.scanner.get_symbol() # Repeatedly call _check_deviceline() until END DEVICE while ( not self._is_end( self.symbol)) and ( not self._is_eof( self.symbol)): self._check_deviceline() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scan_devices(self):\n _LOGGER.debug(\"Scan_devices invoked.\")\n if self._update_info() == False:\n # self.hass.data[DOMAIN]['devices'] = None\n self.hass.data[DOMAIN]['scanning'] = False\n _LOGGER.warning(\"Can't update device list\")\n return []\n ...
[ "0.6879687", "0.660112", "0.65719104", "0.6563505", "0.6508826", "0.6344587", "0.62265825", "0.6206864", "0.6176136", "0.61714685", "0.61622983", "0.61597127", "0.61597127", "0.6158857", "0.61501837", "0.6118743", "0.6103006", "0.6098765", "0.60909706", "0.6088176", "0.606403...
0.7390407
0
Checks validity of each line in the devices list
def _check_deviceline(self): # Check if device name is valid if self._check_name(self.symbol): self.device_name = self.symbol self.symbol = self.scanner.get_symbol() # Check if '=' is used if self._is_equal(self.symbol): # Get next symbol ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_devicelist(self):\n self.symbol = self.scanner.get_symbol()\n # Repeatedly call _check_deviceline() until END DEVICE\n while (\n not self._is_end(\n self.symbol)) and (\n not self._is_eof(\n self.symbol)):\n self._check_...
[ "0.6986171", "0.6586238", "0.65168226", "0.62669855", "0.62519085", "0.6203432", "0.6027403", "0.60036016", "0.59288603", "0.5895239", "0.5868172", "0.5850635", "0.58464867", "0.5836811", "0.5769996", "0.5757243", "0.5722997", "0.57227445", "0.5712627", "0.56969523", "0.56966...
0.6070535
6
Returns the parameter of a device
def _check_paramindevice(self): if self._check_validparam(self.symbol): param = self.symbol self.symbol = self.scanner.get_symbol() # Check if '=' is used if self._is_equal(self.symbol): self.symbol = self.scanner.get_symbol() # Che...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device(self):\n return self._vars[0].device", "def device(self):\n return next(self.parameters()).device", "def device(self):\n return next(self.parameters()).device", "def device(self):\n return next(self.parameters()).device", "def device(self):\n return next(self.param...
[ "0.7553473", "0.75376445", "0.75376445", "0.75376445", "0.75376445", "0.75376445", "0.6938174", "0.6857107", "0.6755491", "0.671194", "0.66910404", "0.66624725", "0.665847", "0.6608585", "0.65402085", "0.6533321", "0.6515314", "0.64927495", "0.64355874", "0.6423849", "0.64109...
0.0
-1
Checks the entire connections list until END CONNECTIONS is reached
def _check_connectionlist(self): self.symbol = self.scanner.get_symbol() # Repeatedly call _check_connectionline() until END CONNECTIONS while ( not self._is_end( self.symbol)) and ( not self._is_eof( self.symbol)): self._check_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def check_connection_status(self):\n while True:\n if not self.connected:\n self.log.error(\"Lost connection to spa, attempting reconnect.\")\n await self.connect()\n await asyncio.sleep(10)\n continue\n if (self.lastupd...
[ "0.6651885", "0.66485655", "0.658435", "0.65760034", "0.65238696", "0.65040714", "0.645094", "0.63097805", "0.63036615", "0.628794", "0.6277836", "0.6257548", "0.6239977", "0.62278676", "0.6214399", "0.61141676", "0.61134064", "0.6110468", "0.6097771", "0.60918623", "0.606363...
0.7198108
0
Checks validity of each line in the connections list
def _check_connectionline(self): self.connection_first_device, \ self.connection_first_port \ = self._check_validconnectionoutput() if self._is_arrow(self.symbol): # Get next symbol self.symbol = self.scanner.get_symbol() self.connection_second...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_connectionlist(self):\n self.symbol = self.scanner.get_symbol()\n # Repeatedly call _check_connectionline() until END CONNECTIONS\n while (\n not self._is_end(\n self.symbol)) and (\n not self._is_eof(\n self.symbol)):\n ...
[ "0.68231344", "0.6541388", "0.62784106", "0.6260675", "0.60896343", "0.60538226", "0.60501355", "0.597213", "0.59351665", "0.5903994", "0.58946735", "0.58336484", "0.5699847", "0.5687605", "0.567442", "0.5646546", "0.56359893", "0.56153196", "0.56123793", "0.5572138", "0.5549...
0.6729478
1
Return device and port for input in connections
def _check_validconnectioninput(self): # Check if name is valid if self._check_name(self.symbol): second_device = self.symbol self.symbol = self.scanner.get_symbol() # Check if '.' is used: if self._is_period(self.symbol): self.symbol = sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def port(self) -> int:", "def Port(self) -> int:", "def port():", "def _get_port(self):\n return self.__port", "def port(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"port\")", "def port(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"port\")", "def get_connection_par...
[ "0.6928063", "0.687995", "0.6807471", "0.67646015", "0.6670902", "0.6670902", "0.6477284", "0.6463667", "0.643938", "0.6325044", "0.6325044", "0.6325044", "0.63062704", "0.6298597", "0.6233679", "0.6232649", "0.62299055", "0.62299055", "0.62299055", "0.62299055", "0.62299055"...
0.0
-1
Return device and port for output in connections
def _check_validconnectionoutput(self): # Check if name is valid and has been initialised if self._check_name(self.symbol): first_device = self.symbol self.symbol = self.scanner.get_symbol() # Check if '->' is used if self._is_arrow(self.symbol): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_port(self):\n return self.__port", "def Port(self) -> int:", "def port(self) -> int:", "def port():", "def port(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"port\")", "def port(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"port\")", "def port(self) -> pu...
[ "0.6802253", "0.67266244", "0.6721623", "0.6662639", "0.65889335", "0.65889335", "0.65889335", "0.645466", "0.645466", "0.6440994", "0.6411583", "0.63504773", "0.63436085", "0.6334871", "0.63180554", "0.6315307", "0.62884665", "0.62757933", "0.62696934", "0.62477916", "0.6229...
0.0
-1
Create own make_connection to handle the fact that first device may sometimes not have a port specified.
def _connection_maker( self, first_device, first_port, second_device, second_port): if first_port is None: return self.network.make_connection( first_device.id, None, second_device.id, second_port.id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_connection( hostname, port = 4663 ):\n \tconnection = socket.socket();", "def connect(self, device_ip, device_port=DEFAULT_PORT):\n return", "def init_tcp_conn(target: str, port: int) -> socket.socket:\n conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n conn.settimeout(5)...
[ "0.6627861", "0.6501172", "0.63174254", "0.6263077", "0.6138852", "0.6062171", "0.6033618", "0.6004392", "0.59724677", "0.59683317", "0.5954122", "0.5947945", "0.59181684", "0.59173775", "0.58790517", "0.58762664", "0.58634245", "0.58634245", "0.5857357", "0.5852349", "0.5844...
0.79061735
0
Use network's check_network() to test all connections.
def _check_whole_network(self): if not self.network.check_network(): # check_network has failed, issue error self._display_semantic_error("network")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_network(network_with_devices):\n network = network_with_devices\n devices = network.devices\n names = devices.names\n\n [SW1_ID, SW2_ID, OR1_ID, I1, I2] = names.lookup([\"Sw1\", \"Sw2\", \"Or1\", \"I1\",\n \"I2\"])\n\n # Inputs are u...
[ "0.77178425", "0.6734853", "0.67199486", "0.66826373", "0.6626964", "0.6584825", "0.65507597", "0.649634", "0.6491266", "0.6462607", "0.6385012", "0.6379867", "0.6345907", "0.6305116", "0.6298622", "0.6279326", "0.6273643", "0.62547606", "0.62362325", "0.6226283", "0.62199765...
0.7808896
0
Checks the entire monitors list until END MONITORS is reached
def _check_monitorlist(self): self.symbol = self.scanner.get_symbol() # Repeatedly call _check_monitorline() until END MONITORS while ( not self._is_end( self.symbol)) and ( not self._is_eof( self.symbol)): self._check_monitorli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reDetectMonitors(self):\n if self.os_type == 'Windows8':\n try:\n self.notifyPut('Running a quick monitor detect')\n self.checkMetrics()\n pythoncom.CoInitialize() # Initialize COM lib on thread\n ...
[ "0.64343464", "0.64005023", "0.636382", "0.6222358", "0.61567485", "0.61138576", "0.6028731", "0.590527", "0.5892099", "0.58482844", "0.58335686", "0.57457507", "0.5730217", "0.56420094", "0.56305265", "0.5628375", "0.55960834", "0.5589741", "0.5579765", "0.5569071", "0.55687...
0.68545663
0
Checks validity of each line in the monitors list
def _check_monitorline(self): # Check if device name is valid if self._check_name(self.symbol): self.monitor_device = self.symbol self.symbol = self.scanner.get_symbol() # Check if ';' is used if self._is_semicolon(self.symbol): # End of li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_monitorlist(self):\n self.symbol = self.scanner.get_symbol()\n # Repeatedly call _check_monitorline() until END MONITORS\n while (\n not self._is_end(\n self.symbol)) and (\n not self._is_eof(\n self.symbol)):\n self._ch...
[ "0.6970177", "0.63498", "0.6320208", "0.6103991", "0.5746999", "0.57255924", "0.57018095", "0.5678772", "0.5599603", "0.5562899", "0.5547567", "0.55106187", "0.5462433", "0.5437228", "0.5424427", "0.5421003", "0.54081196", "0.5394835", "0.5394079", "0.53939563", "0.5375676", ...
0.59255034
4
Handles syntax error reporting
def _display_syntax_error(self, errorid): # For total error count self.syntax_errors_list.append(errorid) if errorid == "start": self.scanner.print_error(self.symbol, self.symbol) print("Expected START.") elif errorid == self.scanner.END_ID: self.sca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def syntaxError (self, s) :\r\n report = self.generateReport() + s\r\n raise Exception, report", "def _syntax_error(self, msg, thing):\n raise TempliteSyntaxError(f\"{msg}: {thing!r}\")", "def handle_syntax_error(self, resp, main_line):\r\n errline = '\\n'.join(resp.splitlines()[:])...
[ "0.7382525", "0.7190607", "0.69247794", "0.6854462", "0.67530197", "0.65800965", "0.6368778", "0.62244797", "0.61815715", "0.61032015", "0.6100613", "0.6045247", "0.5933183", "0.5931459", "0.59106696", "0.5896602", "0.5807411", "0.5796591", "0.5784517", "0.5777859", "0.574586...
0.6147594
9
Handles semantic error reporting
def _display_semantic_error(self, errorid): # For total error count self.semantic_errors_list.append(errorid) if errorid == self.devices.NO_ERROR: self.semantic_errors_list.pop() elif errorid == self.devices.INVALID_QUALIFIER: self.scanner.print_error( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unexpected_error(self, exception):", "def error(self):\n ...", "def handle_err(self):\n pass", "def indicate_error(self):\n pass", "def error(self):\n pass", "def error(self, message):\r\n self._construct_partial_parser().error(message)", "def parse_error(self, messag...
[ "0.6544442", "0.65083706", "0.6467027", "0.6352676", "0.6273643", "0.620587", "0.6178558", "0.61727536", "0.60975116", "0.6053544", "0.60504293", "0.60452014", "0.6009354", "0.5986167", "0.59670675", "0.59147745", "0.5870487", "0.5786879", "0.5768157", "0.57681406", "0.572763...
0.56756324
23
Processes the work for the given job. If the job fails and should be retried, this method should raise a WorkerUnhealthyException. If the job should be marked as permanently failed, it should raise a JobException. Otherwise, a successful return of this method will remove the job from the queue as completed.
def process_queue_item(self, job_details): raise NotImplementedError("Workers must implement run.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kill_job(self, job):\n\n if job.status == Job.STATUS_QUEUED:\n # case 1: job is in QUEUED state\n # remove it from the queue and mark as killed\n\n job_queue = job_queue_name(job.model)\n logger.info(\n \"killing job {} by removing fro...
[ "0.69394755", "0.6466214", "0.63333684", "0.61836", "0.6147585", "0.6133385", "0.6098039", "0.608371", "0.6065368", "0.6055274", "0.59466046", "0.5915261", "0.59074247", "0.58784455", "0.5871675", "0.5847603", "0.58380884", "0.58358115", "0.583498", "0.58286256", "0.5812824",...
0.63801795
2
Function that gets run once every watchdog_period_seconds.
def watchdog(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AutonomousPeriodic(self):\n Scheduler.GetInstance().Run()", "def reset_timer(self, *_) -> \"ALL\":\n self.last = time.time()\n delta = time.time() - self.last\n if delta > 180:\n print(\n \"!!! Warning: Watchdog failure detected, spawning a fallback \"\n ...
[ "0.64125323", "0.63243026", "0.62250376", "0.61276174", "0.60985696", "0.6009293", "0.59422404", "0.58473533", "0.57617235", "0.5760029", "0.563189", "0.56076306", "0.55893135", "0.5549261", "0.5547748", "0.5533392", "0.5522406", "0.551928", "0.54789424", "0.54440325", "0.542...
0.69782615
0
... expliquer l'utilisation du foo
def encode_details(*trees): def single_tree_function(tree): tree_indexes = tree.tree_nodes.keys() for index_parent in tree_indexes: if not tree.nisleaf[index_parent]: tree.nnorm_details[index_parent] = 0 foo = [] for index_chil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def util():\n pass", "def util():\n pass", "def builtin_utility(func):\n func.is_utility = True\n return func", "def fptoui(self, typ):", "def fptosi(self, typ):", "def foo(x, y):", "def foo(x, y):", "def foo(x, y):", "def ustvari(self):\n raise NotImplementedError", "def uitof...
[ "0.593064", "0.593064", "0.5369165", "0.50348413", "0.49899554", "0.49625203", "0.49625203", "0.49625203", "0.48502257", "0.47876418", "0.4764313", "0.47458068", "0.47448164", "0.47011545", "0.46468446", "0.46424177", "0.4555988", "0.454327", "0.45408794", "0.45337006", "0.45...
0.0
-1
Computes the L2 error of the adapted solution compared to the solution on the finest grid. The tree_adapted must have been projected to the finest grid first.
def global_error_to_finest_grid(tree_adapted, tree_finest): error = 0 for index in tree_finest.tree_leaves: error += (tree_finest.nvalue[index] - tree_adapted.nvalue[index])**2 error = math.sqrt(error) if tree_finest.dimension == 1: dx = mesh.space_step(tree_finest, tree_fine...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def potentialSolver2(self, max_it, tol):\n\n dx2 = 1.0/(self.dh[0]*self.dh[0]); # dx^2\n dy2 = 1.0/(self.dh[1]*self.dh[1]); # dy^2\n dz2 = 1.0/(self.dh[2]*self.dh[2]); # dz^2\n \n L2 = 0.0 # norm\n \n converged = False\n \n \n # solve potential\n ...
[ "0.5702751", "0.56921744", "0.564493", "0.5359636", "0.5309151", "0.5170774", "0.51317436", "0.51264113", "0.50781935", "0.50201297", "0.49748135", "0.49748135", "0.4940611", "0.48971447", "0.48584917", "0.48562384", "0.48285002", "0.48250198", "0.48124108", "0.48025668", "0....
0.6766839
0
Retrieves an updated list of tickers for companies included in the S&P 500. Saves to a pickle file.
def retrieve_sp500(): source = 'https://en.wikipedia.org/wiki/List_of_S%26P_500_companies' resp = requests.get(source) soup = bs.BeautifulSoup(resp.text, 'lxml') table = soup.find('table', {'class': 'wikitable sortable'}) tickers = [] for row in table.findAll('tr')[1:]: ticker = r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_company_data(self):\n self.set_stock_sym_append_str('')\n self.set_stock_retrieval_type('all') #'all', watcher\n self.load_stock_symbol_fr_file()", "def Save(self, filename = 'tickers.dat'):\n if not self.changed:\n if not self.silent:\n print('n...
[ "0.6478883", "0.64458394", "0.6418934", "0.63052785", "0.6192895", "0.61889976", "0.6067577", "0.5903302", "0.58534765", "0.5844709", "0.5843255", "0.5743359", "0.56932896", "0.55991876", "0.55669063", "0.5554215", "0.5516616", "0.5503813", "0.5497355", "0.5488232", "0.544957...
0.74970037
0
Uses the most recent pickle file of stock tickers and retrieves the stock data for each ticker via the pandasdatreader get_yahoo_data() method. It saves each stock ticker as it's own csv file. The default time period
def get_data(retrieve = False, start='2019-01-01', comp = False): if retrieve == True: tickers = retrieve_sp500() else: with open('sp500_tickers.pickle', 'rb') as file: tickers = pickle.load(file) if not os.path.exists('sp500_data'): os.mkdir('sp500_data') exc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gather_stock_data(tickers, save=True):\n prices = pd.DataFrame()\n ts = TimeSeries(key='EY2QBMV6MD9FX9CP', output_format='pandas')\n\n for ticker in tickers:\n successful_grab = False\n ticker_daily_adj = None\n\n while successful_grab is not True:\n try:\n ...
[ "0.76792085", "0.72361547", "0.7161389", "0.7098405", "0.7028392", "0.69908875", "0.6981615", "0.6946397", "0.693942", "0.6844427", "0.6666727", "0.6640161", "0.66182846", "0.6592676", "0.65387475", "0.65368146", "0.64699507", "0.64421386", "0.64387715", "0.6434986", "0.63859...
0.6820036
10
Formats and joins each individual stock's csv file into one large dataframe and writes it to a csv file. This can be automatically done during the initial data downloaded of the stock data within the
def compile_data(): with open('sp500_tickers.pickle', 'rb') as file: tickers = pickle.load(file) metasp = pd.DataFrame() for count, ticker in enumerate(tickers): df = pd.read_csv('sp500_data\{}.csv'.format(ticker)) df.set_index('Date', inplace=True) df.rename(columns={'A...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_all_stocks():\n stocks = get_stocklist()\n dfs = {}\n for i, r in stocks.iterrows():\n start = time.time()\n s = r['Ticker']\n stockfile = '../stockdata/' + s + '.csv.gz'\n print('downloading', s)\n stock = quandl.get('EOD/' + s)\n stock.to_csv(stockf...
[ "0.6775382", "0.6692272", "0.6692215", "0.6538182", "0.6466794", "0.6376456", "0.6124688", "0.6119177", "0.6101064", "0.6098649", "0.6085523", "0.60598516", "0.60460734", "0.60454655", "0.59980625", "0.5981653", "0.59612113", "0.59581226", "0.592608", "0.5909132", "0.5907462"...
0.6518698
4
add department data to database
def populate_db(): logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) database = SqliteDatabase('../data/personjob.db') # navigate relative path to the db logger.info('Working with Department class') logger.info('Creating department records') department_number = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _insert_department(self):\n # Insert\n if db_department.idx_department_exists(1) is False:\n record = Department(\n code=general.encode(self.reserved),\n name=general.encode(self.reserved))\n database = db.Database()\n database.add(re...
[ "0.7858063", "0.72022516", "0.7131679", "0.71278006", "0.7065719", "0.7033584", "0.7022429", "0.68791884", "0.6771128", "0.6763694", "0.646529", "0.6310322", "0.62592626", "0.62209487", "0.6152551", "0.61301434", "0.6085409", "0.5994632", "0.5987936", "0.5961638", "0.5939347"...
0.6361228
11
Test if values that are set, then the configuration is saved and then loaded again, are the same.
def test_save_and_load(self, tmpdir, create_configuration): global example_data tmp_file = tmpdir.join("configuration.ini") # create the configuration configuration, load_args, save_args = create_configuration(tmp_file) # set the values for group, key, value, args in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_config_save_restore1(self):\n\n config_filename_initial = 'test_configuration2'\n config_filename_save = 'save_configuration2'\n\n # Get config path\n local_dir = os.path.dirname(__file__)\n config_path_initial = os.path.join(local_dir, config_filename_initial)\n ...
[ "0.68488896", "0.68204504", "0.6643299", "0.6561894", "0.607547", "0.6073705", "0.602699", "0.6008925", "0.6005509", "0.5995862", "0.5968074", "0.59674597", "0.59479654", "0.59245145", "0.59239125", "0.59189326", "0.5917647", "0.586907", "0.58660805", "0.58637446", "0.584079"...
0.5517543
55
Test if values that are set, then the configuration is saved and then loaded again, are the same.
def test_save_and_define_after_load(self, tmpdir, create_configuration): global example_data tmp_file = tmpdir.join("configuration.ini") # create the configuration configuration, load_args, save_args = create_configuration(tmp_file) # set the values for group, key, va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_config_save_restore1(self):\n\n config_filename_initial = 'test_configuration2'\n config_filename_save = 'save_configuration2'\n\n # Get config path\n local_dir = os.path.dirname(__file__)\n config_path_initial = os.path.join(local_dir, config_filename_initial)\n ...
[ "0.6851151", "0.68228287", "0.6642664", "0.65643656", "0.6075316", "0.6074868", "0.602789", "0.600922", "0.60063636", "0.5997755", "0.59690094", "0.5968977", "0.59498835", "0.59260166", "0.5925142", "0.59219694", "0.5869016", "0.58666855", "0.5864089", "0.5841494", "0.5834879...
0.5920246
16
Given the RNN outputs (presoftmax) at each time step and a target labeling, compute the negative of the CTC loss for one example, where the loss itself can be defined as the negative of the probability p(target | logits) as defined in equations 3 & 8
def compute_ctc_loss(self, logits, target): num_time_steps = logits.shape[0] num_labels = logits.shape[1] - 1 num_labels_with_blank = num_labels + 1 # sanity check to ensure targets are all right assert (target < num_labels).all() ###################### ### YOUR CODE HERE ### ##############...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CELOSS(output,label,delay = 0):\n if delay > 0:\n label.data[delay:,:] = label.data[0:-delay,:]\n label.data[0:delay, :] = -1\n _,predict = torch.max(output,1)\n correct = (predict.data == label.view(-1).data).sum()\n\n #correct = np.sum(predict_data == yt.reshape(-1))\n \n mask...
[ "0.7144969", "0.6606015", "0.6490216", "0.64216244", "0.6363278", "0.63588995", "0.63528866", "0.63436717", "0.63401145", "0.633253", "0.63303226", "0.631504", "0.6300099", "0.6297033", "0.6292471", "0.6279375", "0.62720025", "0.6260915", "0.62449986", "0.6224692", "0.6217328...
0.7510228
0
Given the normalized RNN outputs (postsoftmax) at each time step and a target labeling, compute the forward variables alpha_t(s) as defined in equation 5 in the paper
def compute_forward_variables(self, normalized_logits, target): target_length = target.shape[0] num_time_steps = normalized_logits.shape[0] ###################### ### YOUR CODE HERE ### ###################### blank_label = normalized_logits.shape[1] - 1 l = add_blanks(target, blank_label) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calculate_alpha(self, feats):\n \n init_alphas = torch.Tensor(1, self.tagset_size).fill_(-10000.)\n init_alphas[0][self.tag_to_ix[START_TAG]] = 0.\n\n forward_var = autograd.Variable(init_alphas)\n\n for feat in feats:\n alphas_t = [] # The forward variables at t...
[ "0.6556268", "0.6452523", "0.6378413", "0.62199193", "0.6107131", "0.6078645", "0.60783464", "0.6060503", "0.6053484", "0.6044611", "0.6033897", "0.60004437", "0.5989006", "0.59869456", "0.5968317", "0.5951192", "0.5950084", "0.5944599", "0.5943287", "0.5917645", "0.5909624",...
0.73559594
0
Given the normalized RNN outputs (postsoftmax) at each time step and a target labeling, compute the backward variables beta_t(s) as defined in equation 9 in the paper
def compute_backward_variables(self, normalized_logits, target): target_length = target.shape[0] num_time_steps = normalized_logits.shape[0] ###################### ### YOUR CODE HERE ### ###################### blank_label = normalized_logits.shape[1] - 1 l = add_blanks(target, blank_label) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backwardVariableGeneration(self):\n self.beta = zeros((self.noOfEmmittingStates+2, self.T + 1))\n\n # initialisation\n for j in range(self.noOfEmmittingStates+1):\n self.beta[j,-1] = self.transitionMatrix[j,-1]\n self.beta[-1,-1] = 1.0\n\n # main recursion\n for t in range(self.T, 1, -1)...
[ "0.69956106", "0.64794415", "0.64426166", "0.6405609", "0.6382755", "0.62425697", "0.6233701", "0.62206537", "0.6206972", "0.6171835", "0.6160794", "0.6156567", "0.6151788", "0.614928", "0.6116877", "0.61009604", "0.61001897", "0.60951155", "0.609498", "0.6073558", "0.6066956...
0.7704807
0
Given the RNN outputs (presoftmax) at each time step and a target labeling, compute the gradients of the CTC loss w.r.t. the unnormalized logits
def compute_gradients(self, logits, target): target_length = target.shape[0] num_time_steps = logits.shape[0] ###################### ### YOUR CODE HERE ### ###################### # expand labels by inserting a blank between each pair normalized_logits = softmax(logits) blank_label = normali...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_ctc_loss(self, logits, target):\n\n num_time_steps = logits.shape[0]\n num_labels = logits.shape[1] - 1\n num_labels_with_blank = num_labels + 1\n\n # sanity check to ensure targets are all right\n assert (target < num_labels).all()\n\n\t\t######################\n\t\t### YOUR CODE HERE #...
[ "0.70471126", "0.6771997", "0.6501649", "0.6481051", "0.6475507", "0.64638615", "0.645722", "0.644719", "0.6429101", "0.6332298", "0.6330999", "0.6292698", "0.622307", "0.6192175", "0.6190752", "0.61711174", "0.6128896", "0.61129713", "0.6112532", "0.6099241", "0.60904557", ...
0.7260533
0
would this part be timecomsuming?
def __call__(self, rgbd_img_batch, color_id): color = vis.id2color[color_id] lower, upper = np.array(hsv_range[color]) #print('debug: rgbd_img_batch shape: ', rgbd_img_batch.shape) color_imgs, depth_imgs = rgbd_img_batch[:, :3, :, :], rgbd_img_batch[:, 3, :, :] color_imgs = colo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _optimise(self):\n pass", "def process():", "def apply(self) -> None:", "def apply(self) -> None:", "def process(self):", "def process(self):", "def process(self):", "def apply(self):", "def task4_1(self):\n\n pass", "def task4(self):\n\n pass", "def reduce_run():", "...
[ "0.6332494", "0.57432336", "0.56503594", "0.56503594", "0.55950046", "0.55950046", "0.55950046", "0.5529664", "0.5525137", "0.5439686", "0.54379976", "0.53378075", "0.5307097", "0.5272914", "0.5244519", "0.52339005", "0.52292556", "0.52130395", "0.5194305", "0.51748556", "0.5...
0.0
-1
Deletes text object file, database records and any keywords in the graph.
def TextDelete(texttitle): path = app.config['UPLOAD_FOLDER'] + \ '/objects/' + texttitle + '.txt' with Database() as database: database.deleteText(texttitle, session['id']) # Loads in the file to be deleted and the keyword graph with open(path, "rb") as objectfile: current_fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete():", "def clear_db():\n humans = Human4j.nodes.all()\n for h in humans:\n h.delete()\n binomes = Binome4j.nodes.all()\n for b in binomes:\n b.delete()\n projects = Project4j.nodes.all()\n for p in projects:\n p.delete()\n sherpas = Sherpa4j.nodes.all()\n fo...
[ "0.66543853", "0.6603808", "0.6559491", "0.6447322", "0.64100724", "0.6389136", "0.6299942", "0.62388057", "0.6218455", "0.6199544", "0.6175071", "0.61286473", "0.6114", "0.6112866", "0.6111774", "0.6104314", "0.60767096", "0.6068975", "0.60340655", "0.6027067", "0.60106134",...
0.78041196
0
Formats the texts recived from a database search to the format used to display them in the users profile page.
def formatTexts(owned, shared): owned_texts = [] shared_texts = [] # Catches error if there is no score from the databse search try: for text in range(len(owned)): owned_texts.append( {'title': owned[text][0], 'body': owned[text][1], 'score': owned[text][2]}) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_search_content(self):\n words = [\",\".join(self.__get_property_from_all_views(\"resource_id\")),\n \",\".join(self.__get_property_from_all_views(\"text\"))]\n return \"\\n\".join(words)", "def get_person_text(self, uid):\n words = \"\"\n\n query = \"\"\"\nSE...
[ "0.62584585", "0.57925856", "0.56610876", "0.5613524", "0.55420005", "0.55332226", "0.5522507", "0.55062926", "0.54419696", "0.54157835", "0.54024386", "0.5361505", "0.53395677", "0.52929306", "0.5253612", "0.52431804", "0.52359235", "0.5234747", "0.523413", "0.5231484", "0.5...
0.55189323
7
Gets the extension of the submitted file
def check_extension(f): parts = f.split('.') last = parts[len(parts) - 1] return last in allowed_extensions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extension(self):\n return os.path.splitext(self.fname)[1]", "def extension(self):\n name, ext = os.path.splitext(self.original_filename)\n return ext", "def extension(self):\n #type: ()->Text\n return os.path.splitext(os.path.basename(self.fileName))[1]", "def get_file_...
[ "0.85816354", "0.8499633", "0.84875196", "0.8477434", "0.8317361", "0.82983124", "0.7956723", "0.79486096", "0.79430157", "0.79303133", "0.786467", "0.78199774", "0.7804541", "0.77982265", "0.77892864", "0.7778937", "0.7774032", "0.77076656", "0.769469", "0.7674665", "0.76132...
0.0
-1
Wrapper for function that require the user to be logged in to access the function
def login_required(f): @wraps(f) def wrap(*args, **kwargs): if 'logged_in' in session: return f(*args, **kwargs) else: flash("You need to login first") return redirect(url_for('login_page')) return wrap
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dnzo_login_required(fn):\n def logged_in_wrapper(self, *args):\n from google.appengine.api.users import get_current_user\n dnzo_user = get_dnzo_user()\n \n if not dnzo_user and get_current_user():\n from tasks_data.users import create_user\n dnzo_user = create_user(get_current_user())\n ...
[ "0.79133797", "0.7734768", "0.77311295", "0.7664327", "0.76305085", "0.75790405", "0.7569456", "0.7517191", "0.75057024", "0.74649686", "0.7450219", "0.7421285", "0.7417829", "0.74123853", "0.7400424", "0.73878455", "0.73771745", "0.7367976", "0.7355343", "0.7328803", "0.7320...
0.68923974
91