query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Return a custom boolean operator. This method is shorthand for calling
def bool_op( self, opstring: str, precedence: int = 0, python_impl: Optional[Callable[..., Any]] = None, ) -> Callable[[Any], Operators]: return self.op( opstring, precedence=precedence, is_comparison=True, python_impl=python_im...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _op_bool(self, op: str, other: t.Any) -> bool:\n if hasattr(self.__members__, op):\n if isinstance(other, InspectableSet):\n other = other.__members__\n return getattr(self.__members__, op)(other)\n return NotImplemented", "def is_binary_operator(oper):\n ...
[ "0.68767655", "0.6805689", "0.6731244", "0.67064416", "0.6659224", "0.66318834", "0.6631672", "0.6612189", "0.66057175", "0.6603681", "0.660212", "0.6572331", "0.654602", "0.6541066", "0.6471177", "0.6452777", "0.6418484", "0.6383299", "0.6374297", "0.6358638", "0.6356275", ...
0.7286612
0
Implement the ``<`` operator. In a column context, produces the clause ``a < b``.
def __lt__(self, other: Any) -> ColumnOperators: return self.operate(lt, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __lt__(self, other):\n self.conds.append((self.name, '<', other))\n return self", "def _builtin_lt(arg1, arg2, engine=None, **kwdargs):\n check_mode((arg1, arg2), ['gg'], functor='<', **kwdargs)\n a_value = arg1.compute_value(engine.functions)\n b_value = arg2.compute_value(engine.func...
[ "0.7481395", "0.7145486", "0.7140174", "0.6991639", "0.68957096", "0.67781824", "0.67484343", "0.6713814", "0.66865134", "0.6664929", "0.6620451", "0.6612124", "0.6578539", "0.65778166", "0.6572301", "0.6556116", "0.65221244", "0.6521315", "0.6477191", "0.64536965", "0.642896...
0.8495016
0
Implement the ``==`` operator. In a column context, produces the clause ``a = b``. If the target is ``None``, produces ``a IS NULL``.
def __eq__(self, other: Any) -> ColumnOperators: # type: ignore[override] return self.operate(eq, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return super(Column, self).__eq__(tuple(other))", "def __eq__(self, other: Any) -> ColumnElement[bool]: # type: ignore[override] # noqa: E501\n if other is None or isinstance(other, expression.Null):\n if self.property.direction in [ONETOMANY, MANYTOM...
[ "0.65228146", "0.62469417", "0.58913606", "0.58078814", "0.5791249", "0.5780802", "0.5736693", "0.5728964", "0.5647626", "0.5644617", "0.5643474", "0.5643474", "0.5619931", "0.5608386", "0.5597904", "0.5576965", "0.5540127", "0.5503248", "0.54818636", "0.5457207", "0.54542685...
0.70723593
0
Implement the ``IS DISTINCT FROM`` operator. Renders "a IS DISTINCT FROM b" on most platforms; on some such as SQLite may render "a IS NOT b".
def is_distinct_from(self, other: Any) -> ColumnOperators: return self.operate(is_distinct_from, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_not_distinct_from(self, other: Any) -> ColumnOperators:\n return self.operate(is_not_distinct_from, other)", "def isdistinct(seq):\n return len(seq) == len(set(seq))", "def isdistinct(token):\n\n # Token is the distinct keyword\n return token and token.lower() in Token.DISTINCT",...
[ "0.6805806", "0.57211715", "0.55256224", "0.5360086", "0.5352851", "0.5322726", "0.5257902", "0.52318513", "0.52310133", "0.5195459", "0.5176963", "0.51325774", "0.5045675", "0.500418", "0.49898845", "0.49424577", "0.4938313", "0.4881698", "0.48579457", "0.48537987", "0.48064...
0.74369556
0
Implement the ``IS NOT DISTINCT FROM`` operator. Renders "a IS NOT DISTINCT FROM b" on most platforms; on some such as SQLite may render "a IS b".
def is_not_distinct_from(self, other: Any) -> ColumnOperators: return self.operate(is_not_distinct_from, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_distinct_from(self, other: Any) -> ColumnOperators:\n return self.operate(is_distinct_from, other)", "def __ne__(self, *args):\n return _ida_hexrays.user_unions_iterator_t___ne__(self, *args)", "def __ne__(self, *args):\n return _ida_hexrays.user_cmts_iterator_t___ne__(self, *args)"...
[ "0.6854851", "0.6271306", "0.60592026", "0.59912914", "0.59556234", "0.5913235", "0.5890726", "0.58651143", "0.5837896", "0.5810431", "0.5760489", "0.574592", "0.57227314", "0.5712382", "0.57120717", "0.5675092", "0.56723475", "0.56513", "0.5647014", "0.5646091", "0.56390554"...
0.78460455
0
Implement the ``>`` operator. In a column context, produces the clause ``a > b``.
def __gt__(self, other: Any) -> ColumnOperators: return self.operate(gt, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def greater_than(self) -> global___Expression:", "def __lt__(self, other: Any) -> ColumnOperators:\n return self.operate(lt, other)", "def __gt__(self, other):\n self.conds.append((self.name, '>', other))\n return self", "def _builtin_gt(arg1, arg2, engine=None, **kwdargs):\n check_mo...
[ "0.7429546", "0.7223679", "0.7069552", "0.6982694", "0.69523406", "0.6771465", "0.66648924", "0.6652993", "0.66101515", "0.660004", "0.65316814", "0.6488499", "0.6462836", "0.645463", "0.64420253", "0.64400244", "0.64123285", "0.6383191", "0.63439715", "0.63205564", "0.629240...
0.8108457
0
implement the >> operator. Not used by SQLAlchemy core, this is provided for custom operator systems which want to use >> as an extension point.
def __rshift__(self, other: Any) -> ColumnOperators: return self.operate(rshift, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __lshift__(self, other: Any) -> ColumnOperators:\n return self.operate(lshift, other)", "def __rshift__(self, other):\n other.set_upstream(self)\n # return other so a >> b >> c works\n return other", "def __and__(self, other):\n return self >> (lambda _: other)", "def _...
[ "0.6102553", "0.58244914", "0.5716298", "0.5712464", "0.5459851", "0.5423245", "0.542072", "0.538608", "0.53498346", "0.53498346", "0.5293768", "0.5293768", "0.52721554", "0.52561367", "0.5249288", "0.52367735", "0.52328104", "0.51850885", "0.5160269", "0.5149386", "0.5122719...
0.610098
1
Implement the 'concat' operator. In a column context, produces the clause ``a || b``, or uses the ``concat()`` operator on MySQL.
def concat(self, other: Any) -> ColumnOperators: return self.operate(concat_op, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _rconcat(self, other: Any) -> ColumnOperators:\n return self.reverse_operate(concat_op, other)", "def concat(cls, c1, c2, op):\r\n if c1.clause and c2.clause:\r\n return cls('({}) {} ({})'.format(c1.clause, op, c2.clause), c1.params + c2.params)\r\n elif c1.clause:...
[ "0.7569585", "0.6719773", "0.66358083", "0.618569", "0.612748", "0.6091729", "0.58711517", "0.5804198", "0.57980394", "0.57886857", "0.5775912", "0.56869364", "0.5638573", "0.5622331", "0.55752325", "0.55752325", "0.55752325", "0.55685467", "0.55000454", "0.54974973", "0.5449...
0.78436726
0
Implement an 'rconcat' operator. this is for internal use at the moment
def _rconcat(self, other: Any) -> ColumnOperators: return self.reverse_operate(concat_op, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __radd__(self, left_arr):\n concat_arr = left_arr.copy() # Create new instance to return\n concat_arr.extend(self)\n return concat_arr", "def concat(self, other: Any) -> ColumnOperators:\n return self.operate(concat_op, other)", "def concat_all(self):\n return self.merge...
[ "0.698876", "0.65194875", "0.63239926", "0.6302908", "0.62483746", "0.6195619", "0.6139364", "0.6137772", "0.61146563", "0.6076295", "0.60584617", "0.5972496", "0.59362096", "0.591057", "0.59061617", "0.58875877", "0.5878507", "0.5878187", "0.5867767", "0.5866643", "0.5865757...
0.83142644
0
r"""Implement the ``like`` operator.
def like( self, other: Any, escape: Optional[str] = None ) -> ColumnOperators: return self.operate(like_op, other, escape=escape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def like(cls, __and=True, __key=None, **kwargs):\r\n return _queries(\"LIKE\", __key, __and, [(k, f\"%{_escape_like(v)}%\") for k, v in kwargs.items()])", "def ilike(\n self, other: Any, escape: Optional[str] = None\n ) -> ColumnOperators:\n return self.operate(ilike_op, other, escape=esc...
[ "0.6908183", "0.6637425", "0.64561987", "0.62338483", "0.61270046", "0.6034408", "0.6034408", "0.60227627", "0.59732383", "0.59676987", "0.591182", "0.5893983", "0.57473695", "0.5668938", "0.56546885", "0.5596868", "0.5439247", "0.5408136", "0.5342852", "0.5329303", "0.530400...
0.72407717
0
Produce a bitwise XOR operation, typically via the ``^`` operator, or ```` for PostgreSQL.
def bitwise_xor(self, other: Any) -> ColumnOperators: return self.operate(bitwise_xor_op, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xor(a, b):", "def logical_xor(a, b):\n return bool(a) ^ bool(b)", "def bitwise_xor(lhs, rhs):\n return _make.bitwise_xor(lhs, rhs)", "def logical_xor(lhs, rhs):\n return _make.logical_xor(lhs, rhs)", "def bitwise_xor(a, b):\n\n result = \"\"\n for i in range(0, len(a)):\n result +...
[ "0.80635536", "0.76373774", "0.7607591", "0.7467922", "0.7443504", "0.7433648", "0.7301684", "0.7291576", "0.72389627", "0.7238131", "0.7196956", "0.71916723", "0.71875733", "0.71541244", "0.7134191", "0.71074146", "0.7057533", "0.7027421", "0.7010324", "0.6973761", "0.695792...
0.7803131
1
Produce a bitwise NOT operation, typically via the ``~`` operator.
def bitwise_not(self) -> ColumnOperators: return self.operate(bitwise_not_op)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bitwise_not(data):\n return _make.bitwise_not(data)", "def logical_not(data):\n return _make.logical_not(data)", "def convert_logical_not(node, **kwargs):\n return create_basic_op_node('Not', node, kwargs)", "def logical_not(x, f=None):\n return _cur_framework(x, f=f).logical_not(x)", "def ...
[ "0.8585514", "0.8135557", "0.78399366", "0.77473474", "0.75731504", "0.7467479", "0.7228365", "0.71585476", "0.7043616", "0.7034654", "0.70159453", "0.6926055", "0.6918478", "0.68926644", "0.6876603", "0.6829226", "0.68107647", "0.67881817", "0.67658967", "0.67029274", "0.667...
0.8449333
1
Produce a bitwise LSHIFT operation, typically via the ``<<`` operator.
def bitwise_lshift(self, other: Any) -> ColumnOperators: return self.operate(bitwise_lshift_op, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lshift(self, value):\n return self.clone().lshift_(value)", "def __lshift__(self, other: Any) -> ColumnOperators:\n return self.operate(lshift, other)", "def lshift(self):\n self.lcd_byte(0x18, LCD_CMD)", "def test_lshift():\n value = 42\n num_a = param.Integer(value=va...
[ "0.7053611", "0.69038886", "0.690206", "0.6857887", "0.6747391", "0.67373693", "0.6708853", "0.6699808", "0.6639052", "0.65725446", "0.64468867", "0.6406199", "0.63805234", "0.6204717", "0.61922", "0.61788565", "0.5997652", "0.5979469", "0.5960854", "0.59601706", "0.5958869",...
0.7435746
0
Produce a bitwise RSHIFT operation, typically via the ``>>`` operator.
def bitwise_rshift(self, other: Any) -> ColumnOperators: return self.operate(bitwise_rshift_op, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def right_shift(lhs, rhs):\n return _make.right_shift(lhs, rhs)", "def test_rshift():\n value = 42\n num_a = param.Integer(value=value)\n assert num_a.value == value\n\n new_value = operator.rshift(value, 1)\n num_a.value >>= 1\n assert num_a.value == new_value", "d...
[ "0.73124385", "0.72767174", "0.7224724", "0.7161987", "0.71405077", "0.71010065", "0.70435566", "0.70038354", "0.70038354", "0.6964151", "0.6928426", "0.682287", "0.679018", "0.67720765", "0.6719027", "0.67159736", "0.6682019", "0.66308916", "0.65880835", "0.65222585", "0.645...
0.7695628
0
Implement the ``in`` operator. In a column context, produces the clause ``column IN ``.
def in_(self, other: Any) -> ColumnOperators: return self.operate(in_op, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def where_in(self, column, wheres=[]):\n if not wheres:\n self._wheres += ((QueryExpression(0, \"=\", 1, \"value_equals\")),)\n\n elif isinstance(wheres, QueryBuilder):\n self._wheres += (\n (QueryExpression(column, \"IN\", SubSelectExpression(wheres))),\n ...
[ "0.7235667", "0.6667996", "0.64266074", "0.62029254", "0.61262214", "0.61216533", "0.6065823", "0.60128945", "0.5977825", "0.5869149", "0.5831549", "0.5813662", "0.5813355", "0.5795436", "0.57192147", "0.5686568", "0.5668566", "0.5650912", "0.5643218", "0.5553692", "0.5506524...
0.70170045
1
implement the ``NOT IN`` operator. This is equivalent to using negation with
def not_in(self, other: Any) -> ColumnOperators: return self.operate(not_in_op, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def not_in_(self, other):\n if hasattr(other, 'cypher'):\n results = other.all()\n t = []\n for x in results:\n t.append(getattr(x, self.label))\n else:\n t = other\n return NotInClauseElement(self, t)", "def notIn(self, value):\n ...
[ "0.762016", "0.7430412", "0.70646805", "0.68484217", "0.68356097", "0.68356097", "0.68356097", "0.68356097", "0.68356097", "0.68231535", "0.67760336", "0.67754763", "0.6743561", "0.6693501", "0.6693501", "0.6693501", "0.66579396", "0.65956944", "0.6590181", "0.6560453", "0.65...
0.84240085
0
implement the ``NOT LIKE`` operator. This is equivalent to using negation with
def not_like( self, other: Any, escape: Optional[str] = None ) -> ColumnOperators: return self.operate(not_like_op, other, escape=escape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_searchNot(self):\n return self._messageSetSearchTest('NOT 3', [1, 2, 4, 5])", "def not_ilike(\n self, other: Any, escape: Optional[str] = None\n ) -> ColumnOperators:\n return self.operate(not_ilike_op, other, escape=escape)", "def RewriteNOT(self, expr):\n return None", "...
[ "0.65409845", "0.6489854", "0.6365467", "0.63564676", "0.627446", "0.610524", "0.60887253", "0.60735446", "0.601609", "0.5970636", "0.59192866", "0.5917322", "0.5914209", "0.5914209", "0.59089214", "0.5901702", "0.5880488", "0.5878728", "0.58678925", "0.5858922", "0.58414394"...
0.73303384
0
implement the ``NOT ILIKE`` operator. This is equivalent to using negation with
def not_ilike( self, other: Any, escape: Optional[str] = None ) -> ColumnOperators: return self.operate(not_ilike_op, other, escape=escape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def not_like(\n self, other: Any, escape: Optional[str] = None\n ) -> ColumnOperators:\n return self.operate(not_like_op, other, escape=escape)", "def test_searchNot(self):\n return self._messageSetSearchTest('NOT 3', [1, 2, 4, 5])", "def RewriteNOT(self, expr):\n return None", "de...
[ "0.70431954", "0.6704028", "0.64000976", "0.63810587", "0.63433325", "0.6245004", "0.6223399", "0.6219486", "0.61507857", "0.61507857", "0.61485255", "0.6127695", "0.6118989", "0.6118989", "0.6118989", "0.6017641", "0.59710455", "0.5954014", "0.59344053", "0.59319", "0.591837...
0.6880071
1
Implements a databasespecific 'match' operator.
def match(self, other: Any, **kwargs: Any) -> ColumnOperators: return self.operate(match_op, other, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_simple_match(self):\n query = Query().match('')\n expected = '\\n'.join((\n 'MATCH (_a)',\n 'RETURN _a',\n ))\n self.assertEqual(str(query), expected)\n\n query = Query().match('SomeLabel')\n expected = '\\n'.join((\n 'MATCH (_a:So...
[ "0.66808915", "0.6366497", "0.6265464", "0.6193781", "0.6153604", "0.59592897", "0.5906559", "0.58791506", "0.58500457", "0.5849632", "0.58387184", "0.58373845", "0.5770488", "0.5739091", "0.5731", "0.5670912", "0.5592207", "0.5586597", "0.5584879", "0.55615056", "0.5538527",...
0.7020061
0
Implements a databasespecific 'regexp match' operator.
def regexp_match( self, pattern: Any, flags: Optional[str] = None ) -> ColumnOperators: return self.operate(regexp_match_op, pattern, flags=flags)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isMatched(expr):\n pass", "def main(self, regex_string):\n sql_sen = regex_string[0][0]\n reg = \"\\$\\w+\"\n if re.search(reg, sql_sen, re.I):\n\n p = re.compile(reg)\n match = p.findall(sql_sen)\n return match\n return None", "def test_regex...
[ "0.66413236", "0.6616442", "0.6545228", "0.6535642", "0.6511754", "0.62631065", "0.6258171", "0.6247489", "0.6175121", "0.6082263", "0.60702616", "0.60619074", "0.5965493", "0.59089625", "0.589825", "0.5823971", "0.5823638", "0.58095807", "0.57967544", "0.5730419", "0.5729448...
0.7697757
0
Implements a databasespecific 'regexp replace' operator.
def regexp_replace( self, pattern: Any, replacement: Any, flags: Optional[str] = None ) -> ColumnOperators: return self.operate( regexp_replace_op, pattern, replacement=replacement, flags=flags, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_re_replace(val: AnyStr, pattern: str, repl: str) -> str:\n return re.sub(pattern, repl, str(val))", "def replace_params(self):\n raw_sql = self.raw_sql\n for placeholder in self.to_replace:\n newreg = re.compile(placeholder)\n repl = self.get_replacement_value(pl...
[ "0.63767254", "0.62250006", "0.6183154", "0.6116867", "0.5989531", "0.59528315", "0.59289795", "0.58843", "0.5872477", "0.5823016", "0.5805267", "0.57211936", "0.56842566", "0.5672672", "0.56666964", "0.56602126", "0.56288123", "0.56245446", "0.5611972", "0.5604826", "0.55877...
0.77711844
0
Implement the ``+`` operator. In a column context, produces the clause ``a + b`` if the parent object has nonstring affinity. If the parent object has a string affinity, produces the concatenation operator, ``a || b``
def __add__(self, other: Any) -> ColumnOperators: return self.operate(add, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __radd__(self, other: Any) -> ColumnOperators:\n return self.reverse_operate(add, other)", "def concat(self, other: Any) -> ColumnOperators:\n return self.operate(concat_op, other)", "def _rconcat(self, other: Any) -> ColumnOperators:\n return self.reverse_operate(concat_op, other)", ...
[ "0.6905442", "0.6812871", "0.63020706", "0.62879044", "0.6166348", "0.6156531", "0.61488134", "0.6112693", "0.601093", "0.58894515", "0.58894515", "0.58422416", "0.58422416", "0.58286184", "0.5785112", "0.57387686", "0.5712233", "0.57024205", "0.569837", "0.5680506", "0.56517...
0.7208119
0
Implement the ``%`` operator. In a column context, produces the clause ``a % b``.
def __mod__(self, other: Any) -> ColumnOperators: return self.operate(mod, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mod(a: Decimal, b: Decimal) -> Decimal:\n return a % b", "def __floordiv__(self, other: Any) -> ColumnOperators:\n return self.operate(floordiv, other)", "def __rmod__(self, other: Any) -> ColumnOperators:\n return self.reverse_operate(mod, other)", "def __mod__(self, other):\r\n ...
[ "0.5719018", "0.5704813", "0.5701771", "0.56699693", "0.55854285", "0.55826694", "0.5576752", "0.5486577", "0.5443312", "0.54423", "0.5435979", "0.5395203", "0.538293", "0.53065777", "0.5273658", "0.5256355", "0.52500427", "0.52453357", "0.51927376", "0.51926243", "0.5174666"...
0.6100919
0
Implement the ``//`` operator. In a column context, produces the clause ``a / b``, which is the same as "truediv", but considers the result type to be integer.
def __floordiv__(self, other: Any) -> ColumnOperators: return self.operate(floordiv, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __rfloordiv__(self, other: Any) -> ColumnOperators:\n return self.reverse_operate(floordiv, other)", "def exquo(self, a, b):\n return a // b", "def __truediv__(self, value):\r\n if isinstance(value, (int, dec.Decimal)):\r\n if value == 0:\r\n if self.is_zero()...
[ "0.65181756", "0.65117353", "0.63063335", "0.6280956", "0.62741816", "0.61978835", "0.6117819", "0.60942596", "0.6050787", "0.6042001", "0.60112303", "0.6004055", "0.5971862", "0.59563917", "0.59391904", "0.59379375", "0.5923627", "0.5915135", "0.58833855", "0.5875041", "0.58...
0.680153
0
Verifies the bot by solving the website's captcha
def solve_captcha(self): # Switch to the Captcha's iframe captcha = CapatchaSolver(self.driver) while True: self.driver.switch_to.frame(self.driver.find_element_by_tag_name("iframe")) captcha.solve_captcha() # Check if we passed the captcha part by checking th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def captcha_validation(token: str):\n url = \"https://www.google.com/recaptcha/api/siteverify\"\n secret = json.loads(get_secret(\"CAPTCHA_SECRET\"))['CAPTCHA_SECRET']\n payload = {\n \"secret\": secret,\n \"response\": token\n }\n response_raw = requests.post(url, data=payload)\n r...
[ "0.66799676", "0.6658235", "0.6610101", "0.6559271", "0.6540222", "0.65375984", "0.64021313", "0.61327654", "0.5926861", "0.5926746", "0.5910555", "0.58881336", "0.58064806", "0.5769368", "0.5726972", "0.5697831", "0.56768423", "0.566876", "0.5651989", "0.56504005", "0.562724...
0.72698504
0
Obtains a generic title for a review for a product
def get_review_title(self, language): comment_generator = CommentGenerator(language) return comment_generator.generateTitle()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def title(self) -> float:\n return self.product.name if self.product else self.name", "def get_title():", "def review_details(product_id):\n\n # Gets the product's specifications from the database\n product = mongo.db.products.find_one({\"_id\": ObjectId(product_id)})\n\n # Sets the page title\...
[ "0.663245", "0.6504558", "0.6229481", "0.6229021", "0.6203045", "0.61636335", "0.6156097", "0.6150632", "0.6149885", "0.60980564", "0.60932887", "0.599226", "0.59651464", "0.59595495", "0.59595495", "0.59595495", "0.5944728", "0.594012", "0.5929832", "0.58571696", "0.584751",...
0.69112676
0
Leaves a review in a product page
def leave_review(self, product_url, review, review_title): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def leave_review(book_id):\n \n if request.method == 'POST':\n mongo.db.books.find_one_and_update(\n {\"_id\": ObjectId(book_id)}, \n {\"$push\": {\"reviews\": request.form.to_dict()['reviews']} }\n )\n return redirect(url_for('library'))\n \n else:\n r...
[ "0.6768317", "0.6521801", "0.6329526", "0.6132767", "0.61207914", "0.59795856", "0.59374976", "0.59345794", "0.590007", "0.58561623", "0.5785104", "0.5780705", "0.5748374", "0.5738451", "0.56478876", "0.56427765", "0.563428", "0.5569598", "0.5549924", "0.5507052", "0.55060875...
0.7806384
0
Wait for the current page to change
def wait_for_page_change(self, current_page): WebDriverWait(self.driver, 5).until(EC.url_changes(current_page))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wati_until_page_change(driver, url):\n while driver.current_url == url:\n time.sleep(10)", "def wait_for_page_load(self):\n pass", "def wait_for_page_load(self):\n # For right now, just wait for 2 seconds since webdriver returns when loaded.\n # TODO: switch to waiting for ne...
[ "0.7532723", "0.73459953", "0.6734942", "0.66200167", "0.655229", "0.65445894", "0.6482647", "0.63733417", "0.63733417", "0.63733417", "0.63733417", "0.63710386", "0.63710386", "0.6363439", "0.6355523", "0.631563", "0.63007927", "0.62691486", "0.6256945", "0.6223538", "0.6220...
0.8245497
0
Verify the mail sent to the mail service
def verify_mail(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sending_mail(self):\n\n appt_date = datetime.date.today() + datetime.timedelta(days=7) # Default for email\n confirmed = self.create_confirmed_notification(self.test_patient, appt_date)\n\n # run email job\n daily_email_callback(self.router)\n\n self.assertEqual(len(mail...
[ "0.7377472", "0.7287148", "0.70876795", "0.7085418", "0.7074369", "0.692471", "0.6871539", "0.6840313", "0.6790432", "0.67411506", "0.6728825", "0.66644526", "0.66644526", "0.66586095", "0.6594762", "0.653111", "0.6484644", "0.6457894", "0.6408082", "0.6403068", "0.63938534",...
0.82257116
0
Returns a list of the positions of all locations that meet the target_func criteria
def get_x_in_range(self, start, target_func, max_distance, sort_func=None): if sort_func is None: targets = [] for x in range(-max_distance, max_distance + 1): for y in range(-max_distance, max_distance + 1): distance = abs(x) + abs(y) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_lists(classes, target):\r\n coords = list()\r\n xs = list()\r\n ys = list()\r\n\r\n for element in classes:\r\n if classes[element] == target:\r\n xs.append(element[0])\r\n ys.append(element[1])\r\n\r\n coords.append(xs)\r\n coords.append(ys)\r\n return...
[ "0.59461826", "0.58725774", "0.58292496", "0.58218", "0.5733502", "0.5714609", "0.56952053", "0.5680164", "0.5623801", "0.5623321", "0.56142974", "0.5596879", "0.5581851", "0.55673", "0.5537235", "0.5523585", "0.55194414", "0.5513604", "0.54883385", "0.542974", "0.5423209", ...
0.6564029
0
Decorator to modify the docstring of an object. For all provided strings, unused empty lines are removed, and the indentation of the first nonempty line is removed from all lines if possible. This allows better indentation when used as a decorator. Unused empty lines means initial enpty lines for ``pre``, and final emp...
def docstring( docstring: str = None, *, pre: str = None, post: str = None ) -> Callable[[U], U]: def edit_docstring(obj: U) -> U: obj.__doc__ = "".join( ( clean_docstring(pre or "", unused="pre"), clean_docstring(docstring or (obj.__doc__ or "")), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_docstring(doc: str, unused: Literal[\"pre\", \"post\"] = None) -> str:\n doc = doc.split(\"\\n\")\n if unused == \"pre\":\n try:\n index = next(i for i, l in enumerate(doc) if l.strip())\n doc = doc[index:]\n except StopIteration:\n doc = []\n elif ...
[ "0.69348717", "0.6336572", "0.61864924", "0.61855805", "0.6176088", "0.6044348", "0.6012267", "0.59857607", "0.59638166", "0.5815031", "0.5807178", "0.5780133", "0.5778427", "0.5748335", "0.57374907", "0.573107", "0.5676643", "0.55951655", "0.55807894", "0.5573089", "0.556119...
0.74438393
0
Class decorator to autoformat string arguments in the __init__ method Modify the class __init__ method in place by wrapping it. The wrapped class will call the format() method of arguments specified in `params` that exist in the original signature, passing all other arguments are dictionary to str.format()
def autoformat( cls: Type[U] = None, /, params: Union[str, Iterable[str]] = ( # pylint: disable=unsubscriptable-object "message", "msg", ), ): if isinstance(params, str): params = (params,) if cls is None: return functools.partial(autoformat, params=params) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __format__(self, *args, **kwargs): # real signature unknown\r\n pass", "def __init__(**params):", "def format(cls, **kwargs):\n def _decorator(obj):\n if inspect.isclass(obj):\n _class_decorator = cls.format_class(**kwargs) \n ret...
[ "0.6549212", "0.6235333", "0.6221562", "0.6095933", "0.59771514", "0.59307534", "0.5884502", "0.5831265", "0.58071184", "0.57440454", "0.57300246", "0.5687825", "0.5687825", "0.5687825", "0.5687825", "0.5687825", "0.5687825", "0.5687825", "0.5687825", "0.5687825", "0.568708",...
0.8336647
0
Removes a parameter from a Signature object If param is an int, remove the parameter at that position, else remove any paramater with that name
def _sig_without(sig: inspect.Signature, param: Union[int, str]) -> inspect.Signature: if isinstance(param, int): params = list(sig.parameters.values()) params.pop(param) else: params = [p for name, p in sig.parameters.items() if name != param] return sig.replace(parameters=params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeParameter(cTag, name): #@NoSelf", "def removeParameter(self, *args):\n return _libsbml.KineticLaw_removeParameter(self, *args)", "def param_remove(params, arg):\n d = params.copy()\n if arg in d:\n del d[arg]\n return d.urlencode()", "def removeParameter(self, *args):\n ...
[ "0.7307341", "0.6964018", "0.694667", "0.6563779", "0.6451144", "0.6374244", "0.6289401", "0.6283459", "0.62516946", "0.6223711", "0.6092202", "0.60898453", "0.60846263", "0.6074248", "0.6055217", "0.5930937", "0.5896282", "0.58926374", "0.58634466", "0.5804568", "0.57228655"...
0.8153545
0
Merges two signature object, dropping the return annotations
def _sig_merge(lsig: inspect.Signature, rsig: inspect.Signature) -> inspect.Signature: return inspect.Signature( sorted( list(lsig.parameters.values()) + list(rsig.parameters.values()), key=lambda param: param.kind, ) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_two_calls(self) -> None:", "def mergeWith(self, others):", "def _merge(self):\n raise NotImplementedError", "def merge(): #Status: WIP\r\n pass", "def merge(a: dict, b: dict) -> dict:\n return __merge(a, b)", "def merge(self, other):\n # todo: Using the return value None ...
[ "0.6488625", "0.6069725", "0.6052872", "0.5887509", "0.587492", "0.5822402", "0.57430786", "0.5727546", "0.5721868", "0.5715418", "0.568721", "0.56440103", "0.56340355", "0.5614331", "0.559623", "0.55736935", "0.5567006", "0.55511916", "0.5545177", "0.55353576", "0.55132633",...
0.7194756
0
Class decorator to automatically support __post_init__() on classes This is useful for .s decorated classes, because __attr_post_init__() doesn't support additional arguments. This decorators wraps the class __init__ in a new function that accept merged arguments, and dispatch them to __init__ and then __post_init__()
def post_init(cls: Type[U]) -> Type[U]: if not isinstance(cls, type): raise TypeError("Can only decorate classes") if not hasattr(cls, "__post_init__"): raise TypeError("The class must have a __post_init__() method") # Ignore the first argument which is the "self" argument sig = init_sig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __post_init__(self, *args, **kwargs) -> None:\n # add other __init__ items here ...\n pass", "def __init_subclass__(cls, **kwargs):\n super().__init_subclass__(**kwargs)\n cls.__init__ = _wrap_init(cls.__init__, cls.__post_init_check)", "def decorate_init(cls, f):\n def w...
[ "0.7525738", "0.7044511", "0.6475061", "0.61861414", "0.61861414", "0.61861414", "0.61847025", "0.6122355", "0.6048974", "0.59707534", "0.5969232", "0.5939027", "0.59256953", "0.59035474", "0.59035474", "0.5886067", "0.58421826", "0.579057", "0.579057", "0.579057", "0.579057"...
0.78774583
0
split an iterable based on the truth value of the function for element Arguments func a callable to apply to each element in the iterable iterable an iterable of element to split Returns falsy, truthy two tuple, the first with element e of the itrable where func(e) return false, the second with element of the iterable ...
def split(func, iterable): falsy, truthy = [], [] for e in iterable: if func(e): truthy.append(e) else: falsy.append(e) return tuple(falsy), tuple(truthy)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_cond(f, iterable):\n split_point = [i for i, e in enumerate(iterable) if f(e)]\n split_point += [len(iterable)]\n return [iterable[i:j] for i, j in zip(split_point[:-1], split_point[1:])]", "def split(iterator, criterion):\n a = []\n b = []\n for x in iterator:\n if criterion(x...
[ "0.72967714", "0.6812678", "0.6628116", "0.6506657", "0.63730377", "0.6313598", "0.6198382", "0.5958652", "0.59502995", "0.59330523", "0.589644", "0.5895313", "0.5894667", "0.58582944", "0.579485", "0.5768882", "0.57654256", "0.570171", "0.5645428", "0.56209177", "0.5508018",...
0.8402982
0
Filter multiple iterable at once, selecting values at index i such that func(iterables[0][i], iterables[1][i], ...) is True
def sync_filter(func, *iterables): return tuple(zip(*tuple(i for i in zip(*iterables) if func(*i)))) or ((),) * len( iterables )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filtern(func: Callable, iterable: Iterable):\n return next(filter(func, iterable))", "def cfilter(func,iterable):\n result = []\n\n for i in iterable:\n\n if func(i) == True:\n result.append(i)\n\n return result", "def filter(function, iterable):\n\n if function is bool:\n ...
[ "0.7254669", "0.70515805", "0.6633785", "0.6542129", "0.65260065", "0.6445253", "0.6422799", "0.6301492", "0.628052", "0.6261402", "0.6222613", "0.62073445", "0.6094451", "0.60292643", "0.60198414", "0.5971072", "0.59694105", "0.5959575", "0.5932348", "0.5888483", "0.5888037"...
0.781177
0
report a runtime error
def runtime_error(self, error: 'LoxRuntimeError'): output = f'{error.get_message()}{os.linesep}[line {error.token.line}]' print(output, file=sys.stderr) self.had_runtime_error = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error():\r\n raise RuntimeError('admin ticket generator at your service')", "def reportError(self):\n self.Q['err'].put(sys.exc_info()[:2])", "def serious_error(self, e):\n pass", "def error(self):\n pass", "def unexpected_error(self, exception):", "def error(error):\n print(...
[ "0.68166107", "0.679111", "0.6713061", "0.64715713", "0.6364697", "0.63401216", "0.6333252", "0.6314151", "0.62917364", "0.6244229", "0.61968243", "0.6178209", "0.6150258", "0.61317104", "0.6127837", "0.6092866", "0.6092197", "0.60902953", "0.60429615", "0.6041189", "0.601885...
0.7311913
0
Note, SMTPTimeoutError vs SMTPConnectError here depends on processing time.
async def test_timeout_error_with_no_server(event_loop): client = SMTP(hostname="127.0.0.1", port=65534, loop=event_loop) with pytest.raises(SMTPTimeoutError): await client.connect(timeout=0.000000001)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _connect_smtp(self):\n smtp = None\n try:\n smtp = smtplib.SMTP(self.servername, timeout = self.timeout)\n except smtplib.SMTPException as err:\n log.critical('smtp service at {} is not currently available'.format(self.servername))\n log.critical(err)\n ...
[ "0.67359835", "0.6189997", "0.6074653", "0.60194963", "0.59302324", "0.58749896", "0.58332354", "0.58151186", "0.58065194", "0.58065194", "0.57931924", "0.57492477", "0.5701048", "0.5651594", "0.56239885", "0.5590371", "0.5548968", "0.54814523", "0.545041", "0.5434488", "0.54...
0.6397967
1
Register the device with the provisioning service. This is a synchronous call, meaning that this function will not return until the registration process has completed successfully or the attempt has resulted in a failure. Before returning the client will also disconnect from the Hub. If a registration attempt is made w...
def register(self): logger.info("Registering with Hub...") register_complete = Event() def on_register_complete(result=None, error=None): # This could be a failed/successful registration result from the HUB # or a error from polling machine. Response should be given appr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_device():\n payload = request.get_json()\n return _register_device(payload)", "def RegisterDeviceAndSendResponse(self, msg, username):\n device_id = self.GetUniqueParam('deviceid')\n if not device_id:\n return (400, 'Missing device identifier')\n\n token_info = self.server.Regist...
[ "0.7048597", "0.6574808", "0.63383627", "0.6312321", "0.6306717", "0.6257553", "0.6199068", "0.61455584", "0.60931623", "0.60073423", "0.5975581", "0.5859668", "0.57837015", "0.57369715", "0.57089573", "0.5657908", "0.5651063", "0.56088966", "0.55459535", "0.5511144", "0.5496...
0.7058231
0
This is a synchronous call, meaning that this function will not return until the cancellation process has completed successfully or the attempt has resulted in a failure. Before returning the client will also disconnect from the Hub. In case there is no registration in process it will throw an error as there is no regi...
def cancel(self): logger.info("Cancelling the current registration process") cancel_complete = Event() def on_cancel_complete(): cancel_complete.set() logger.info("Successfully cancelled the current registration process") self._polling_machine.cancel(callback=on...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disconnect(self):\n if self.is_connected:\n try:\n self.client.unregister()\n finally:\n if self.client.is_running:\n self.client.stop()\n self.hub.disconnect()", "async def async_cancel(self):\n raise NotImpl...
[ "0.561611", "0.53545636", "0.53502023", "0.52480394", "0.5240914", "0.5077308", "0.50643533", "0.49984068", "0.49921355", "0.498722", "0.49676874", "0.49660704", "0.49642637", "0.49493033", "0.49309194", "0.49151906", "0.4906097", "0.4895857", "0.48792404", "0.48342264", "0.4...
0.6079265
0
Ask a yes/no/quit question via raw_input() and return their answer. "question" is a string that is presented to the user. "default" is the presumed answer if the user just hits . It must be "yes" (the default), "no", "quit" or None (meaning an answer is required of the user). The "answer" return value is one of "yes", ...
def query_yes_no_quit(question, default="yes"): valid = {"yes":"yes", "y":"yes", "ye":"yes", "no":"no", "n":"no", "quit":"quit", "qui":"quit", "qu":"quit", "q":"quit"} if default == None: prompt = " [y/n/q] " elif default == "yes": prompt = " [Y/n/q] " elif default == "no": prompt = " [y/N/q...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_yes_no_quit(question, default=\"yes\"):\n valid = {\"yes\":\"yes\", \"y\":\"yes\", \"ye\":\"yes\",\n \"no\":\"no\", \"n\":\"no\",\n \"quit\":\"quit\", \"qui\":\"quit\", \"qu\":\"quit\", \"q\":\"quit\"}\n if default == None:\n prompt = \" [y/n/q] \"\n elif ...
[ "0.8437878", "0.8223772", "0.8212373", "0.8156623", "0.8149691", "0.81355673", "0.81233436", "0.8122114", "0.8120957", "0.8120957", "0.8120957", "0.8120957", "0.8120957", "0.8120957", "0.8120957", "0.8120957", "0.81196237", "0.81192315", "0.81192315", "0.81192315", "0.8119231...
0.834716
1
Compute the mean absolute error on test set given X, y, and model parameter w.
def mean_absolute_error(w, X, y): ##################################################### # TODO 1: Fill in your code here # ##################################################### err = None temp = np.dot(X, w) err = np.mean(np.abs(_error(y, temp))) return err
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_absolute_error(w, X, y):\n #####################################################\n # TODO 1: Fill in your code here #\n #####################################################\n if w is None:\n return None\n\n err = None\n yhat = np.dot(X , w)\n err = np.abs(np.subtract(yhat,y))....
[ "0.77339864", "0.76291317", "0.7148356", "0.7034834", "0.68424296", "0.67941666", "0.66706353", "0.6591392", "0.6557777", "0.6557774", "0.6482599", "0.6372792", "0.63640726", "0.6351532", "0.63476115", "0.63377297", "0.63268167", "0.6277267", "0.6224823", "0.61900854", "0.616...
0.7912273
0
Iterate over modes. Synchronized iterator to iterate the modes in an order.
def modes(self): try: order = self._current_order except AttributeError: raise AttributeError('Cannot iterate over modes without iterating over orders!') from None mode = -order while mode <= order: yield mode mode += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n return iter([v for k, v in sorted(self._modes.items())])", "def get_modes(self):\n return [i for i, j in enumerate(self._modemap._map) if j is not None]", "async def _load_modes(self) -> None:\n modes: List[Dict[str, Any]] = await self._api_request(\"modes\")\n ...
[ "0.7799798", "0.63018954", "0.6299035", "0.62619734", "0.62619734", "0.6169084", "0.61189497", "0.60541093", "0.5993781", "0.5993781", "0.59646934", "0.58745813", "0.58432204", "0.58386713", "0.5829693", "0.57918906", "0.57898873", "0.57819664", "0.5591517", "0.5588966", "0.5...
0.78386045
0
r"""Find the approximate location of a levitation trap. Find an approximate position of a acoustic levitation trap close to a starting point. This is done by following the radiation force in the sound field using an differential equation solver. The differential equation is the unphysical equation
def find_trap(array, start_position, complex_transducer_amplitudes, tolerance=10e-6, time_interval=50, path_points=1, **kwargs): from scipy.integrate import solve_ivp from numpy.linalg import lstsq if 'radius' in kwargs: from .fields import SphericalHarmonicsForce as Force, SphericalHarmonicsForceGr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def anl_solution(self):\r\n\r\n m = float(self.mass) / self.nu_m\r\n qe = 1 / self.nu_m * (self.nu_t * self.nu_t / self.nu_x) * 1.0 \\\r\n / float(self.size_tick * self.size_tick)\r\n print 'qE=', qe\r\n c = self.light_vel\r\n for i in range(0, len(self.obs.obt_g)):\r\...
[ "0.5917251", "0.5454485", "0.53869474", "0.53047276", "0.5189361", "0.51892936", "0.5161829", "0.5157585", "0.51523453", "0.51253486", "0.51195055", "0.5104085", "0.5075305", "0.5061984", "0.50457203", "0.50427437", "0.50212985", "0.49925196", "0.498679", "0.49814695", "0.497...
0.63866895
0
Play a song based on its path.
def play_song(self): path = input('Give path to wanted song: ') # Request path to song path = path.replace('\\', '/') if not self.path_storage_re.match(path): # Check if the wanted song is from the storage directory print("Give a valid path") else: p = vlc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play(path):\n sound = AudioSegment.from_mp3(path)\n playback.play(sound)", "def play(self, songpos=None):\n # TODO: implement songpos !\n if songpos is None:\n resp = yield from self.command('play')\n return True", "def play(song):\n # Show the metadata\n if (ver...
[ "0.79737085", "0.68196875", "0.66903174", "0.66628766", "0.65618736", "0.6544999", "0.648962", "0.64856863", "0.6419521", "0.6384046", "0.6374167", "0.633997", "0.63393456", "0.63371986", "0.63166153", "0.6316028", "0.6295789", "0.6295789", "0.62778527", "0.6240952", "0.62402...
0.8189756
0
Stop the current playing/paused song.
def stop_song(self): if self.isPlaying: self.playSong[0].stop() self.playSong.clear() self.isPlaying = False print("Music stopped") else: print("Play a song first...")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _stop(self, ctx: commands.Context):\n ctx.voice_state.songs.clear()\n\n if ctx.voice_state.is_playing:\n ctx.voice_state.voice.stop()\n return await ctx.send(embed=embed_msg(description=\"🛑 Stopped the music\"))\n\n else:\n return await ctx.send('Can...
[ "0.7680431", "0.76113164", "0.759389", "0.75338066", "0.75338066", "0.7464192", "0.74512273", "0.7417875", "0.7278527", "0.71976995", "0.71916264", "0.7135208", "0.710452", "0.69504833", "0.6907551", "0.68905944", "0.6856153", "0.6830112", "0.68043816", "0.6791049", "0.675709...
0.81801236
0
Pause the current playing song.
def pause_song(self): if self.isPlaying: self.playSong[0].pause() print("Song paused. To continue type Play.") else: print("Play a song first...")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pause(self):\n self.paused = True\n # FIXME?: Why is this not doing anything? Shouldn't it be calling into the player API?", "def pause(self):\n if not self.paused:\n pygame.mixer.music.pause()\n self.paused = True\n else:\n pygame.mixer.music.un...
[ "0.7713319", "0.74910986", "0.74175787", "0.7405902", "0.7326798", "0.72035414", "0.71642816", "0.71472704", "0.7133736", "0.7114518", "0.70905143", "0.7087032", "0.7062801", "0.70473045", "0.70375997", "0.70167387", "0.70167387", "0.6942558", "0.6881331", "0.6881242", "0.683...
0.82099915
0
Add song to the storage directory and to the database. Return ID of the new song / error message.
def add_song(self): path = input("Give file path:\t") # Request file path path = path.replace('\\', '/') if self.path_song_re.match(path) and not self.path_storage_re.match( path): # Check that the path leads to a song that is not already found in Storage copy(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_song():\n options = queue.instantiate_options()\n raw_queue = queue.instantiate_queue()\n track_id = request.args.get('song')\n\n for song in raw_queue:\n if song['track_id'] == track_id[14:]:\n return json.dumps({'error': 'Cannot add a song already in the queue'})\n\n num_...
[ "0.72021145", "0.7178171", "0.68124354", "0.67616093", "0.6730884", "0.661579", "0.6544573", "0.6535995", "0.65308034", "0.6529165", "0.6515031", "0.64952904", "0.64827377", "0.6465418", "0.6454924", "0.64515936", "0.6450223", "0.64397067", "0.64342123", "0.63851374", "0.6346...
0.8322641
0
Remove song from database and from the storage directory based on ID
def delete_song(self): song_id = tuple(input("Give the melody id to be deleted:\t")) sql = "SELECT file_title, form FROM songs WHERE id = %s" # Check existence of song with given ID self.cursor.execute(sql, song_id) result = self.cursor.fetchall() if len(result) > 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_song(_id):\r\n Song.query.filter_by(id=_id).delete()\r\n # filter song by id and delete\r\n db.session.commit() # commiting the new change to our database\r", "def delete_music():\n track_id = request.vars.track_id\n if track_id is None:\n raise HTTP(500)\n db(db....
[ "0.724472", "0.68608385", "0.68424237", "0.6805456", "0.66874766", "0.6629392", "0.65805244", "0.65743804", "0.6480073", "0.6455035", "0.64183515", "0.6390148", "0.63755953", "0.6350693", "0.63068855", "0.6271331", "0.62588185", "0.6248313", "0.62059045", "0.6190672", "0.6164...
0.76542425
0
Modifies song info in the database
def modify_data(self): song_id = tuple(input("Give the id of the song to be modified:\t")) # Request song ID sql = "SELECT song_title, artist, data, tag FROM songs WHERE id = %s" # Find song with given ID self.cursor.execute(sql, song_id) res = self.cursor.fetchall() if le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_db(self):\n songs = self.db.get_all_songs()\n for song in songs:\n if choose_song(song) == ERROR:\n self.db.delete_song(song)\n files = []\n for song in glob.glob(\"songs\\*.wav\"):\n to_append = song.split('\\\\')[ONE][:-4]\n f...
[ "0.7413717", "0.6995219", "0.68380946", "0.6823178", "0.66802067", "0.6608994", "0.6446211", "0.6343561", "0.6318853", "0.6218813", "0.6192342", "0.6175601", "0.6141071", "0.61293864", "0.61132926", "0.60554576", "0.6035266", "0.6034275", "0.5926394", "0.592424", "0.591346", ...
0.70110184
1
Create a Batch from an existing batch id. Notes
def from_batch_id(batch_id: int, *args, **kwargs): b = Batch(*args, **kwargs) assert isinstance(b._backend, _backend.ServiceBackend) b._batch_handle = b._backend._batch_client.get_batch(batch_id) return b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_batch(self, batch_name, priority = 0, comments = '', notifications = []):\n\n url = self._base_url + urlConfig.URLS['Project'] + '/' + self._project_id + '/batch'\n batch = {\n \"batch_name\": batch_name,\n \"priority\": priority,\n \"comments\": comments,\...
[ "0.69767964", "0.69643956", "0.6652114", "0.6631825", "0.61280215", "0.6110446", "0.60883904", "0.60016143", "0.59871805", "0.5886255", "0.5873244", "0.58249927", "0.5809669", "0.57384014", "0.5699515", "0.56257725", "0.56246674", "0.5616465", "0.551616", "0.53761625", "0.537...
0.7599396
0
Create a new input resource file object representing a single file.
def read_input(self, path: str) -> _resource.InputResourceFile: irf = self._new_input_resource_file(path) return irf
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_file_object(inputfile=None):\n if type(inputfile) == str:\n return open(inputfile, 'r')\n return inputfile", "def __init__(__self__,\n resource_name: str,\n opts: Optional[pulumi.ResourceOptions] = None,\n content_type: Optional[pulumi.Input[U...
[ "0.6874475", "0.6812216", "0.65446967", "0.65262955", "0.6509462", "0.6438844", "0.6272451", "0.62469476", "0.61195093", "0.60929656", "0.6091407", "0.60815406", "0.60800767", "0.6025725", "0.5954721", "0.59426826", "0.59278876", "0.59035605", "0.5878973", "0.5866811", "0.585...
0.70438915
0
Create a new resource group representing a mapping of identifier to input resource files.
def read_input_group(self, **kwargs: str) -> _resource.ResourceGroup: root = secret_alnum_string(5) new_resources = {name: self._new_input_resource_file(file, root) for name, file in kwargs.items()} rg = _resource.ResourceGroup(None, root, **new_resources) self._resource_map.update({rg....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_resource_group(self):\n pass", "def load(self):\n self.suite.load()\n self.resource_map = {}\n dirlist = os.listdir(self.resources)\n for resource_name in (name for name in dirlist\n if os.path.isfile(os.path.join(self.resources,name...
[ "0.58438635", "0.5761084", "0.55505747", "0.5540623", "0.5514604", "0.55128634", "0.5483182", "0.54395956", "0.5409617", "0.5397805", "0.5392991", "0.53768927", "0.5376017", "0.5359928", "0.5356735", "0.5327738", "0.52933335", "0.52924156", "0.5286034", "0.52811337", "0.52422...
0.6814466
0
Write resource file or resource file group to an output destination. Examples
def write_output(self, resource: _resource.Resource, dest: str): if not isinstance(resource, _resource.Resource): raise BatchException(f"'write_output' only accepts Resource inputs. Found '{type(resource)}'.") if (isinstance(resource, _resource.JobResourceFile) and isinstanc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, output, resources, **kw):\n\n raise NotImplementedError()", "def write_resources(self, resources):\n for filename, data in list(resources.get('outputs', {}).items()):\n # Determine where to write the file to\n dest = os.path.join(self.output_dir, filename)\n ...
[ "0.7189583", "0.67922026", "0.6485851", "0.6471249", "0.5966388", "0.5966388", "0.5919293", "0.58600813", "0.5827604", "0.5729985", "0.5707116", "0.5665977", "0.55832523", "0.557501", "0.55459183", "0.54772556", "0.5467842", "0.5445758", "0.54371053", "0.54174685", "0.5403804...
0.68054146
1
Select all jobs in the batch whose name matches `pattern`. Examples
def select_jobs(self, pattern: str) -> List[job.Job]: return [job for job in self._jobs if job.name is not None and re.match(pattern, job.name) is not None]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_jobs(jobs, keyword):\n for job in jobs:\n if keyword == \"all\":\n yield job\n elif job[\"name\"].find(keyword) != -1:\n yield job", "def search_by_pattern(self, tl):\n print(\"Search by regex pattern\")\n pattern = input(\"Please enter search patte...
[ "0.6330027", "0.57241905", "0.5717007", "0.5662955", "0.5661944", "0.5415436", "0.5401124", "0.53878415", "0.5367021", "0.5349991", "0.53413725", "0.53162223", "0.5308199", "0.5304073", "0.5292824", "0.5277535", "0.5271562", "0.52473783", "0.52251303", "0.5207287", "0.5199997...
0.7555124
0
Initializes querysets for keyword and headlinekeyword
def __init__(self): self.keyword_queryset = Keyword.objects.all() self.headlinekeyword_queryset = Headlinekeyword.objects.all() self.headline_queryset = Headline.objects.all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keyword_headlines(self):\r\n\t\td = {}\r\n\r\n\t\tfor q in self.keyword_queryset:\r\n\t\t\td[q.content] = self.headlinekeyword_queryset.filter(keywordid = q.id)\r\n\r\n\t\treturn d", "def get_queryset(self):\r\n return Keyword.objects.all()", "def setup_eager_loading(cls, queryset):\n que...
[ "0.62303746", "0.62133765", "0.5979311", "0.59030783", "0.5808249", "0.5781533", "0.5741475", "0.57359666", "0.5595646", "0.55684435", "0.5490495", "0.54874605", "0.54597276", "0.5437996", "0.5390633", "0.5304389", "0.5293679", "0.5290758", "0.5277677", "0.5255377", "0.524341...
0.7972529
0
Returns a dictionary of the keywords and the list of corresponding headlines (ids only)
def keyword_headlines(self): d = {} for q in self.keyword_queryset: d[q.content] = self.headlinekeyword_queryset.filter(keywordid = q.id) return d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_keywords(self):\r\n\t\treturn list(self.keyword_headlines().keys())", "def get_headlines_with_keyword(self, kw):\r\n\t\tkey_head = self.keyword_headlines()\r\n\r\n\t\theadlines = set()\r\n\r\n\t\tfor headlinekw in key_head[kw]:\r\n\t\t\tcontent = headlinekw.headlineid.content\r\n\t\t\theadlines.add(conte...
[ "0.763168", "0.7235824", "0.71703315", "0.65968394", "0.61900103", "0.6189536", "0.609543", "0.60951686", "0.60745686", "0.6041486", "0.6003403", "0.5991974", "0.5966871", "0.5924465", "0.5924083", "0.5896881", "0.5850133", "0.58487964", "0.58361", "0.58255136", "0.5808301", ...
0.81225014
0
Returns a list of keywords
def get_keywords(self): return list(self.keyword_headlines().keys())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keywords(self):\n return list(self._kw)", "def keywords(self):\n return self._keywords", "def keywords(self):\n return self._keywords", "def getKeywords(self):\n return", "def keywords(self):\n return self.__keywords", "def extract_keywords(self):\n keywords ...
[ "0.82068", "0.80030465", "0.80030465", "0.79815817", "0.7965522", "0.795927", "0.79124683", "0.7827855", "0.7802334", "0.7794272", "0.77290803", "0.7597001", "0.7496878", "0.74123514", "0.7399484", "0.73888963", "0.737007", "0.7306008", "0.7305014", "0.73011196", "0.7273646",...
0.8675625
0
Returns a list of headlines if given a keyword
def get_headlines(self, kw = None): if kw: return self.get_headlines_with_keyword(kw) else: return self.get_all_headlines()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_headlines_with_keyword(self, kw):\r\n\t\tkey_head = self.keyword_headlines()\r\n\r\n\t\theadlines = set()\r\n\r\n\t\tfor headlinekw in key_head[kw]:\r\n\t\t\tcontent = headlinekw.headlineid.content\r\n\t\t\theadlines.add(content)\r\n\r\n\t\treturn list(headlines)", "def keyword_headlines(self):\r\n\t\td ...
[ "0.8183849", "0.7191412", "0.7000567", "0.66961074", "0.66491723", "0.66434336", "0.6356157", "0.6131674", "0.61187565", "0.59622735", "0.59542644", "0.5890983", "0.5875384", "0.57926047", "0.57580566", "0.5697247", "0.56422436", "0.5626344", "0.55865705", "0.5584343", "0.556...
0.8182654
1
Returns a list of the headlines with the corresponding keyword
def get_headlines_with_keyword(self, kw): key_head = self.keyword_headlines() headlines = set() for headlinekw in key_head[kw]: content = headlinekw.headlineid.content headlines.add(content) return list(headlines)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_headlines(self, kw = None):\r\n\t\tif kw:\r\n\t\t\treturn self.get_headlines_with_keyword(kw)\r\n\t\telse:\r\n\t\t\treturn self.get_all_headlines()", "def keyword_headlines(self):\r\n\t\td = {}\r\n\r\n\t\tfor q in self.keyword_queryset:\r\n\t\t\td[q.content] = self.headlinekeyword_queryset.filter(keyword...
[ "0.8323906", "0.77197367", "0.746953", "0.7303126", "0.68182117", "0.6805935", "0.66141784", "0.64018786", "0.6364445", "0.63333815", "0.59744793", "0.59658384", "0.59578186", "0.5909768", "0.5894226", "0.58745706", "0.5857797", "0.5850383", "0.58470386", "0.58389264", "0.581...
0.8318916
1
Calculate the min number of refills to reach 'distance'. You start with a full tank.
def compute_min_refills(distance: int, tank: int, stops: List[int]): location: int = 0 n_stops = 0 last_stop = 0 max_drive = location + tank while max_drive < distance: counter = 0 # Handle the case that stops are depleted before we reach distance if len(stops) == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_min_refills(distance, tank, stops):\n\n num_refills = 0\n current_refill = 0\n\n all_stops = []\n all_stops.append(0)\n for stop in stops:\n \tall_stops.append(stop)\n all_stops.append(distance)\n\n num_stops = len(all_stops)\n\n while current_refill < num_stops:\n \tlast_...
[ "0.8302289", "0.6621628", "0.645036", "0.6314632", "0.6262712", "0.61484736", "0.60885", "0.603681", "0.59223753", "0.58915836", "0.5876038", "0.5869804", "0.58609515", "0.58593315", "0.58491707", "0.5815681", "0.5806749", "0.57953686", "0.57733434", "0.5757533", "0.57270324"...
0.7821262
1
Place the vertex v at position, and apply transformation T. Return the grid points that are occupied by the piece.
def place( self, position, v, T): geo = (self.geo - self.geo[v]).dot( T) return position + geo
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(self, v):\n return Position.fromnp(translate(self.tonp(), v))", "def project_vector(u, v):\n u_np = np.array([u.get_x(), u.get_y()])\n v_np = np.array([v.get_x(), v.get_y()])\n proj = (np.dot(u_np, v_np) / np.dot(v_np, v_np)) * v_np\n return Point(proj[0], proj[1])", "def trans...
[ "0.61589414", "0.5887289", "0.56152284", "0.55743974", "0.5553705", "0.55252033", "0.55161303", "0.54971194", "0.5430372", "0.54015726", "0.5349081", "0.5345369", "0.53373307", "0.53254366", "0.5311833", "0.5305778", "0.5302551", "0.53003585", "0.52812153", "0.52796966", "0.5...
0.65050745
0
Generate all nondegenerate placements, with one of the vertices placed at (0,0). Return the placements as [ (v, T) ], where v is the vertex to be placed at (0,0), and T the 2x2 transformation matrix that place the piece according to self.geo[v] + T.dot(self.geo self.geo[v])
def findNondegeneratePlacements( self): # Rotate counterclockwise by 90 degrees around the v'th vertex. r90 = np.array( [ [0,1], [-1,0] ], dtype=int) # Flip the piece along the vertical axis through the v'th vertex. fv = np.array( [ [1,0], [0,-1] ], dtype=int) self.placements = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_all_locations(grid, shape):", "def test_create_new_placements(self):\n subv = SimpleMachineVertex(None, \"\")\n pl = Placement(subv, 0, 0, 1)\n Placements([pl])", "def generate_nearby_cells(self):\n for y in range(len(self.island_map)):\n for x in range(len(s...
[ "0.6300398", "0.59959567", "0.5966825", "0.5925378", "0.58771193", "0.5777176", "0.57712615", "0.57712615", "0.5769345", "0.5725288", "0.5673758", "0.5602161", "0.56021327", "0.56002945", "0.5596927", "0.5585428", "0.5523877", "0.5508298", "0.5461161", "0.546076", "0.5455531"...
0.7902054
0
Count unoccupied neighbors of a point.
def countFreeNeighbors( p, board, occupation): n = 0 for m in [0, 1]: for d in [-1, 1]: pn = [p[0], p[1]] pn[m] += d j = board.grids.get( tuple(pn), None) if (j is None): continue # Not a board point if (occupation.has_key( j)): continue # Occu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_neighboors(self, x: int, y: int) -> int :\n\n cpt : int = 0\n min_x : int = max(0, x - 1)\n max_x : int = min(x + 1, self.width-1)\n min_y : int = max(0, y - 1)\n max_y : int = min(y + 1, self.height-1)\n\n x_tmp : int\n y_tmp : int\n for x_tmp in r...
[ "0.7307373", "0.7237684", "0.7203775", "0.71407646", "0.6955501", "0.68983823", "0.6883159", "0.6826486", "0.6824896", "0.6804748", "0.6788591", "0.67754936", "0.67619663", "0.67619663", "0.67333233", "0.6709194", "0.66639596", "0.66181695", "0.657233", "0.65499747", "0.65250...
0.7302581
1
Find unoccupied positions on the board.
def findUnoccupied( board, occupation): return [ j for j in xrange(len(board.positions)) if not occupation.has_key(j) ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def free_positions(self):\n positions = []\n for i in range(self.grid_size):\n for j in range(self.grid_size):\n if self.grid[i][j] == 0:\n positions.append((i, j))\n if positions == []:\n raise GameException('Game Over. No free position ...
[ "0.74757147", "0.73623365", "0.7305674", "0.72659814", "0.7136726", "0.6983209", "0.6902076", "0.69016534", "0.68626094", "0.6858928", "0.67981094", "0.67022055", "0.66423976", "0.65927297", "0.6580229", "0.6564762", "0.65628403", "0.6559673", "0.654521", "0.65293694", "0.652...
0.77521825
0
Determines whether the model instance has already been selected in a related field (ManyToManyField, OneToOneField).
def available(self): fields = self._meta.get_fields() for field in fields: if isinstance(field, models.ManyToManyRel): attr = field.get_accessor_name() if getattr(self, attr).count() > 0: return False elif isinstance(field, m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relation_exists(cls, model):\n return bool(cls.get_related_field(model)\n or cls.get_reverse_related_field(model))", "def isRelated(self):\n return len(self.user_storage.all()) > 0", "def has_field(self, field):\n return field in self.extra_fields", "def contains(s...
[ "0.6742698", "0.6351571", "0.6249839", "0.6177484", "0.594861", "0.58511186", "0.58348316", "0.5823608", "0.5715787", "0.56835854", "0.5671056", "0.5618836", "0.5598657", "0.5598657", "0.55803764", "0.55689776", "0.5560058", "0.55562407", "0.551438", "0.55038196", "0.54985", ...
0.66686696
1
outputs the noise covariance matrix, R
def getCovarianceNoiseMatrix(self): return np.dot ( self.getB().T, self.getB() )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def covariance_matrix(self):\n\n self._order_observations()\n self.cov_matrix = self._compute_covariance_matrix(\n self.list_observations, self.list_observations)\n\n self.cov_matrix += np.diag(np.array([self.noise] * self.n_observation))\n\n return self.cov_matrix", "def c...
[ "0.71300656", "0.66976005", "0.6629202", "0.6629202", "0.6629202", "0.6622315", "0.6622108", "0.6622073", "0.6570352", "0.6554128", "0.6520113", "0.64823085", "0.64064324", "0.6393191", "0.6317923", "0.62303", "0.6217225", "0.6212507", "0.6195888", "0.6166094", "0.612643", ...
0.7025741
1
Determine if the object has a parent with the supplied name.
def has_parent(obj, parent_name): if obj.parent is None: return False if obj.parent.name is None: return False elif obj.parent.name == parent_name: return True else: return has_parent(obj.parent, parent_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_parent(self):\n return self.parent != None", "def has_parent(self):\n return self._parent_ is not None", "def _contains_in_self_or_parent(self, name: str) -> bool:\n return name in self", "def is_parent(self):\n if self.parent is not None:\n return False\n ...
[ "0.7545343", "0.7435591", "0.73406065", "0.7337848", "0.7336612", "0.7255639", "0.7117234", "0.7116028", "0.70370907", "0.6815638", "0.6784905", "0.67783093", "0.6720416", "0.6667514", "0.6614133", "0.6522801", "0.6410729", "0.640435", "0.63520426", "0.6320416", "0.6236038", ...
0.8476002
0
will simulation PARALLEL_UNIVERSES_COUNT universes then, will return the overall multiverse survival of the player
def compute_player_score(): progress_bar = ProgressBar(label="Computing universes") survivals_count = 0 for i in range(PARALLEL_UNIVERSES_COUNT): if simulate_universe(): survivals_count += 1 progress_bar.set_progression((i + 1) / PARALLEL_UNIVERSES_COUNT) progress_bar.end(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_god_score():\n\n survivals_count = 0\n for _ in range(PARALLEL_UNIVERSES_COUNT):\n best_survival = random.uniform(MIN_DISEASE_SURVIVAL, MAX_DISEASE_SURVIVAL)\n for _ in range(random.randint(MIN_TREATMENTS_COUNT, MAX_TREATMENTS_COUNT)):\n treated_survival = random.uniform(...
[ "0.66658336", "0.5772919", "0.57570714", "0.5285743", "0.52517307", "0.51297843", "0.5128983", "0.51264876", "0.50322986", "0.50084907", "0.4935301", "0.49063638", "0.48907402", "0.48814934", "0.48217684", "0.48150674", "0.48144037", "0.48021117", "0.47568566", "0.4754652", "...
0.73624575
0
simulates a universe and uses playground.choose_trial to take a decision return true in cas of survival in the simulated universe
def simulate_universe(): # untreated_survival is the probability to survive if not treated # this is an exact law of the universe, the player will not have this information untreated_survival = random.uniform(MIN_DISEASE_SURVIVAL, MAX_DISEASE_SURVIVAL) trials: list[Trial] = [] treated_survivals: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_run_sim_1():\n rnd = rand.Arrivals(36, 41)\n sim.run_sim(3, 2, 5, 6, 22, rnd)", "def run_trial():\n env = gym.make('CartPole-v0')\n obs_dim = env.observation_space.shape[0]\n n_actions = env.action_space.n\n\n qnet = QNet(obs_dim, n_actions)\n agent = Sarsa(qnet, n_actions, 0.99, 1....
[ "0.6240639", "0.6103099", "0.60925263", "0.5984078", "0.5937608", "0.5916742", "0.5768528", "0.5740173", "0.5682504", "0.5681896", "0.56587714", "0.56468713", "0.5616107", "0.56043226", "0.5596143", "0.5585067", "0.558289", "0.5577875", "0.5572243", "0.55598336", "0.55593103"...
0.799685
0
Probability grouping of category variables
def probability_categorical(feature, label): assert feature.nunique()>2, 'feature category nums must be greater than 2.' t = pd.DataFrame({'feature':feature, 'label':label}) cat = label.unique() cat = [(cat[i], cat[i+1]) for i in range(len(cat)-1)] prob = label.value_counts(1).to_dict() slope = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ppf(self,x):\n return self.categoricalDist.ppf(x)", "def calc_priors(categories, data):\n counts = np.zeros(categories)\n for val in range(categories):\n counts[val] = np.count_nonzero(data.labels == val)\n return counts / len(data.labels)", "def categorical(pvals: np.ndarray) -> int:\n\...
[ "0.6292472", "0.6147138", "0.60119295", "0.59831697", "0.5894537", "0.5834089", "0.5826", "0.57258606", "0.5708978", "0.5685781", "0.56797826", "0.5673375", "0.5663211", "0.56225026", "0.55870885", "0.5568914", "0.55597067", "0.5559275", "0.5555052", "0.5546693", "0.55196595"...
0.70440626
0
Convert time_offsets to gps timestamps and nanoseconds
def get_gps_timestamp(file, time_offset): reference_date = get_reference_datetime(file) absolute_date = get_absolute_datetime(reference_date, time_offset) timestamp, nanosecond = datetime_to_gpstimestamp_nanoseconds(absolute_date) return timestamp, nanosecond
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_gps_time(self):\n reason = \"[!] GPS timestamps are 10 digits\"\n ts_type = self.ts_types['gpstime']\n try:\n if not len(self.gps) == 10 or not self.gps.isdigit():\n self.in_gpstime = indiv_output = combined_output = False\n pass\n e...
[ "0.6133533", "0.5981217", "0.5839412", "0.5720046", "0.5719699", "0.5716344", "0.5671996", "0.56716424", "0.56283784", "0.5613697", "0.55957836", "0.55948985", "0.55543983", "0.5532485", "0.55197525", "0.54900724", "0.54886615", "0.54784024", "0.5435569", "0.5418071", "0.5407...
0.674219
0
Convert datetime objects to GPS timestamp and nanoseconds
def datetime_to_gpstimestamp_nanoseconds(date): timestamp = gpstime.utc_to_gps(calendar.timegm(date.utctimetuple())) nanosecond = date.microsecond * 1000 return timestamp, nanosecond
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_gps_time(self):\n ts_type = self.ts_types['gpstime']\n try:\n leapseconds = self.leapseconds\n check_date = duparser.parse(self.timestamp)\n if hasattr(check_date.tzinfo, '_offset'):\n dt_tz = check_date.tzinfo._offset.total_seconds()\n ...
[ "0.64110595", "0.6309177", "0.6237445", "0.61667824", "0.61475044", "0.61468357", "0.6086212", "0.606989", "0.6046954", "0.60396606", "0.6038311", "0.60068566", "0.59911877", "0.5953865", "0.59505874", "0.5947502", "0.5941145", "0.5941145", "0.5921453", "0.591261", "0.5876311...
0.7270666
0
Get the reference datetime from the KNMI LGT file as datetime
def get_reference_datetime(file): date_string = file.root.discharge1._f_getAttr('reference_datetime')[0] ref_date = datetime.datetime.strptime(date_string, '%d-%b-%Y;%H:%M:%S.%f') return ref_date
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ref_time(self):\n from datetime import datetime, timedelta\n\n ref_time = datetime(2010, 1, 1, 0, 0, 0)\n ref_time += timedelta(seconds=int(self.fid['/PRODUCT/time'][0]))\n return ref_time", "def get_file_date(self, file: str) -> date:", "def extract_datetime(fpath):\n tr...
[ "0.6449726", "0.6254226", "0.6224529", "0.6155637", "0.6119671", "0.61154586", "0.6110254", "0.5968073", "0.59634435", "0.5960696", "0.59445274", "0.5924622", "0.59102046", "0.5850813", "0.57510024", "0.574005", "0.574005", "0.5737356", "0.57372004", "0.5716487", "0.5684267",...
0.7556686
0
chang the order's status to be "cooking" which is selected by the id of order
def cook_order(request): order_id = request.GET.get('order_id', 0) cs , status = CookStatus.objects.get_or_create(cook_name=request.user) if cs.current_order is None: cs.current_order = Order.objects.get(id=order_id) cs.current_order.status = 'cooking' cs.current_order.tikchen = request.user.username cs.cur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order_ready(request):\n\tcs , status = CookStatus.objects.get_or_create(cook_name=request.user)\n\tif cs.current_order is not None:\n\t\tcs.current_order.status = 'ready-to-serve'\n\t\tcs.current_order.save()\n\t\tcs.current_order = None\n\t\tcs.save()\n\n\treturn HttpResponseRedirect(\"/staff/cook_order_list/...
[ "0.63635933", "0.586669", "0.5858225", "0.58000624", "0.56946445", "0.5581705", "0.55623066", "0.55381656", "0.5464021", "0.5398148", "0.53747994", "0.5373412", "0.53628695", "0.5324506", "0.5319295", "0.52873236", "0.5282698", "0.52594453", "0.5258599", "0.52334434", "0.5232...
0.7182565
0
chang the order's status to be "readytoserve" which is selected by the id of order
def order_ready(request): cs , status = CookStatus.objects.get_or_create(cook_name=request.user) if cs.current_order is not None: cs.current_order.status = 'ready-to-serve' cs.current_order.save() cs.current_order = None cs.save() return HttpResponseRedirect("/staff/cook_order_list/")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def update_order_status():\n symbol = App.config[\"symbol\"]\n\n # Get currently active order and id (if any)\n order = App.order\n order_id = order.get(\"orderId\", 0) if order else 0\n if not order_id:\n log.error(f\"Wrong state or use: check order status cannot find the order id.\")\...
[ "0.67920375", "0.670818", "0.66758204", "0.6641249", "0.65196955", "0.6437769", "0.6087314", "0.6031311", "0.5999321", "0.59882295", "0.5978718", "0.5966084", "0.59375423", "0.59296644", "0.59227234", "0.5900806", "0.58614755", "0.5841006", "0.5841006", "0.58058894", "0.57958...
0.68117625
0
Format trajectory into a list of tuples before they are stored in memory. Trajectory is list of (s,a,r,s,d) tuples
def formatTrajectory(self, trajectory): return self.RLModel.formatTrajectory(trajectory)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_trajectory(path: str) -> Optional[List[Dict[str, tuple]]]:\n lines = _get_lines_from_file(path)\n\n ess_file = False\n if path.split('.')[-1] != 'xyz':\n try:\n log = ess_factory(fullpath=path, check_for_errors=False)\n ess_file = True\n except (InputError, RM...
[ "0.60951096", "0.6015128", "0.5985093", "0.5921288", "0.5903913", "0.5848871", "0.5752752", "0.5743873", "0.5734865", "0.5705948", "0.56735694", "0.5643993", "0.55531675", "0.5550036", "0.55357385", "0.5534374", "0.550818", "0.5483543", "0.5480718", "0.5441098", "0.5439881", ...
0.6233229
0
Whether the environment is batched or not. If the environment supports batched observations and actions, then overwrite this property to True. A batched environment takes in a batched set of actions and returns a batched set of observations. This means for all numpy arrays in the input and output nested structures, the...
def batched(self) -> bool: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_size(self) -> Optional[int]:\n if self.batched:\n raise RuntimeError(\n 'Environment %s marked itself as batched but did not override the '\n 'batch_size property'\n % type(self)\n )\n return None", "def is_batch():\n\n pass", "def _global_batch_size(self...
[ "0.6829763", "0.63745177", "0.6135504", "0.6097213", "0.60270363", "0.59971696", "0.5886409", "0.5588769", "0.5547144", "0.55365115", "0.5511294", "0.55018145", "0.5477585", "0.5467263", "0.54394144", "0.5351245", "0.53225625", "0.53225625", "0.53225625", "0.53225625", "0.529...
0.6470478
1
Whether the Environmet should reset given the current timestep. By default it only resets when all time_steps are `LAST`.
def should_reset(self, current_time_step: ts.TimeStep) -> bool: handle_auto_reset = getattr(self, '_handle_auto_reset', False) return handle_auto_reset and np.all(current_time_step.is_last())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_values(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"reset_values\")", "def reset():\n return True", "def reset_values(self) -> pulumi.Output[Optional[bool]]:\n return pulumi.get(self, \"reset_values\")", "def reset(self, **kwargs):\n if self._backend_ag...
[ "0.6065845", "0.5846722", "0.5738438", "0.57173324", "0.5702698", "0.5700601", "0.56152225", "0.5585178", "0.55754685", "0.5555264", "0.5542493", "0.55404925", "0.5514392", "0.5394026", "0.5376499", "0.5355567", "0.53485197", "0.53262925", "0.5297183", "0.52819175", "0.528191...
0.8290577
0
Returns the current timestep.
def current_time_step(self) -> ts.TimeStep: return self._current_time_step
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_time_step(self):\n return self._time_step", "def time_step(self):\n return self._time_step", "def GetTimeStep(self):\n time_step = None\n\n time_step = self._solver_collection.GetTimeStep()\n \n if not time_step is None:\n\n self.time_step = time_ste...
[ "0.87353057", "0.83974636", "0.81454396", "0.7974334", "0.7622381", "0.75591457", "0.7524713", "0.75237733", "0.75237733", "0.7476018", "0.7327006", "0.7309547", "0.73024344", "0.7277173", "0.7277173", "0.7277173", "0.7277173", "0.72636175", "0.7225894", "0.72174436", "0.7172...
0.9203299
0
Updates the environment according to the action and returns a `TimeStep`. If the environment returned a `TimeStep` with `StepType.LAST` at the previous step the implementation of `_step` in the environment should call `reset` to start a new sequence and ignore `action`. This method will start a new sequence if called a...
def step(self, action: types.NestedArray) -> ts.TimeStep: if self._current_time_step is None or self.should_reset( self._current_time_step ): return self.reset() self._current_time_step = self._step(action) return self._current_time_step
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self, action):\n if self._reset_next_step:\n return self.reset()\n\n # Apply the game_rules\n for rule in self.game_rules:\n rule.step(self._state, self._meta_state)\n\n # Apply the action\n self.action_space.step(self._state, action)\n\n # S...
[ "0.6702035", "0.66238755", "0.64235044", "0.6258338", "0.62385756", "0.6237361", "0.6150759", "0.6134917", "0.61343175", "0.61312205", "0.60947925", "0.5976863", "0.5962188", "0.5953434", "0.59465617", "0.59439987", "0.58978987", "0.58788586", "0.58774835", "0.58655053", "0.5...
0.776358
0
it makes the flow of a given input through the network, all data are stored in the layers "y" and "v"
def flow(input_): global number_of_neurons_by_layer if len(input_) != number_of_neurons_by_layer[0]: raise IndexError( f"\033[91mInput length is incorrect. It must be {number_of_neurons_by_layer[0]}.\033[m") layers[0]["y"][1:] = np.array(input_).flatten().reshape(len(input_), 1) for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trainNet():", "def forward(self, x):\n # sources保存特征图,loc与conf保存所有PriorBox的位置与类别预测特征\n sources = list()\n loc = list()\n conf = list()\n\n # 对输入图像卷积到conv4_3,将特征添加到sources中\n for k in range(23):\n x = self.vgg[k](x)\n\n s = self.L2Norm(x)\n so...
[ "0.6696856", "0.6663844", "0.6572504", "0.6489043", "0.6439873", "0.6390039", "0.63803667", "0.630682", "0.63015246", "0.6280952", "0.6269826", "0.62485385", "0.62225485", "0.62188786", "0.6218298", "0.6182807", "0.61798155", "0.61786693", "0.6172364", "0.61677724", "0.616357...
0.76247156
0
it computes the error vector between desired and obtained output, stored at the last layer
def error(input_, output): global number_of_neurons_by_layer if len(output) != number_of_neurons_by_layer[-1]: raise IndexError( f"\033[91mDesired output length is incorrect. It must be {number_of_neurons_by_layer[-1]}.\033[m") output = np.array(output).reshape(len(output), 1) flow(i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error2(input_, output):\n error(input_, output)\n layers[-1][\"error2\"] = layers[-1][\"error\"].T @ layers[-1][\"error\"]", "def getError(outputVector, targetVector):\r\n return np.sum((outputVector-targetVector)**2)", "def get_error(self, params):\n return self.endog - self.predict(pa...
[ "0.73773164", "0.7060913", "0.69024837", "0.68995315", "0.6740334", "0.66105175", "0.6591121", "0.6574008", "0.65447205", "0.653256", "0.65291804", "0.64597213", "0.6338442", "0.6333448", "0.6331635", "0.6329993", "0.6325577", "0.63097376", "0.63089925", "0.62953514", "0.6232...
0.73490536
1
it gets the list of weigths
def getweigths(): ls = [] for i_lay in range(1, len(layers)): ls.append(layers[i_lay]["weigths"]) return ls
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weights(self) -> List[float]:", "def get_weights(self):", "def show_rel_wt(list_obj):\r\n total = sum_list(list_obj)\r\n wt_list = []\r\n \r\n for num in list_obj:\r\n weight = int((num / total) * 100)\r\n wt_list.append(f\"{weight}%\")\r\n \r\n return wt_list", "def get_w...
[ "0.6625915", "0.62661403", "0.6248362", "0.6228295", "0.6228295", "0.6228295", "0.6188413", "0.61738515", "0.6153207", "0.6063258", "0.5998551", "0.5988195", "0.59823006", "0.59580696", "0.59580696", "0.59547997", "0.59507", "0.5947943", "0.5947943", "0.5919658", "0.58991927"...
0.78056127
0
it gets the list of "Delta_w"
def get_Delta_weigths(): ls = [] for i_lay in range(1, len(layers)): ls.append(layers[i_lay]["Delta_w"]) return ls
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getdelta(self):\n\t\tmyhmag.initializehelmholtz()\n\t\tabar = 13.714285714285715\n\t\tzbar = abar/2.0\n\t\tself.data[\"delta\"] = np.zeros(len(self.data[\"rho\"]))\n\t\tfor i in range(len(self.data[\"rho\"])):\n\t\t\tadgradred,hydrograd,my_nu,my_alpha,self.data[\"delta\"][i],my_gamma1,my_cp,my_cph,my_c_s,failt...
[ "0.6032407", "0.59571075", "0.57902676", "0.5779536", "0.5758633", "0.57385635", "0.56800616", "0.5667207", "0.5647853", "0.56092405", "0.5599284", "0.5591161", "0.55750877", "0.557497", "0.557401", "0.5565431", "0.55429536", "0.552723", "0.54701483", "0.54661304", "0.5458280...
0.79851145
0
Sets/clears a software breakpoint address > the address of the software breakpoint instruction > the instruction to be programmed (either the software breakpoint opcode or the original instruction the software breakopint was replacing). flags > One or more of the SWBPFlags listed below returns the original/old opcode a...
def set_sw_bp(address, instruction, flags): log.info("Debug:: set/remove bp at address 0x%0x, instructions 0x%0x, flags = 0x%0x" % ( address, instruction, flags)) # Accept addressing both from FLASH_START and from 0x0 addr = address & (FLASH_START-1) single_page_access = False buffer_size =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_breakpoint(self, addr: int) -> Optional[Breakpoint]:\n if not self.enabled:\n self.enable()\n\n if not self.can_support_address(addr):\n LOG.error('Breakpoint out of range 0x%X', addr)\n return None\n\n if self.available_breakpoints == 0:\n L...
[ "0.5881102", "0.5785291", "0.5218082", "0.5208455", "0.5201885", "0.51153344", "0.5073578", "0.50049704", "0.49999252", "0.4934474", "0.48571247", "0.4838905", "0.48162797", "0.47711107", "0.47597492", "0.4733747", "0.46354747", "0.46129856", "0.46129563", "0.46084633", "0.45...
0.65059483
0
Change the bearing (angle) of the turtle.
def setbearing(self, bearing): diff = self.bearing - bearing self.b_change = diff self.bearing = bearing self._add_point() self.b_change = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bearing(self, value: int):\n self._bearing = value", "def set_angle(self, ang):\n if ang < 0:\n ang = 0\n elif ang > 180:\n ang = 180\n dutyCycle = 5 + (ang*5/180)\n self.servoPort.ChangeDutyCycle(dutyCycle)", "def setAngle(self,angle = 2.5):\n ...
[ "0.6930348", "0.6852178", "0.6837454", "0.67657924", "0.6641104", "0.66320354", "0.66257477", "0.6583451", "0.65234107", "0.64924616", "0.64834297", "0.64331305", "0.63996845", "0.6354722", "0.6261629", "0.6239155", "0.62279516", "0.62081057", "0.62069297", "0.61839217", "0.6...
0.6944382
0
this method is called by an admin user to approve the lyrics of a song
def approve_lyrics(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_lyrics_approved():", "def approve (self, response) :\n if 'event' in response and 'moderator' in response :\n eventId = response ['event']\n userId = response ['moderator']\n else :\n raise ModerationError (response)\n\n mod_status = 'OK'\n if 'status' in response :\n ...
[ "0.68488747", "0.56438977", "0.55508363", "0.55483466", "0.5504152", "0.5491618", "0.54619044", "0.54378915", "0.54029", "0.5392849", "0.53796095", "0.5319239", "0.52956706", "0.5290236", "0.5269116", "0.52477455", "0.5243103", "0.5234158", "0.52026176", "0.5178342", "0.51669...
0.8136522
0
This method is called to check if a song already has lyrics so as to avoid duplicity of lyrics
def song_has_lyrics(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_existing_lyrics(self, song_id):\n\t\tlyrics = self.db.lyrics.find_one({'song_id': song_id})['lyrics']\n\t\treturn lyrics", "def add_lyrics(self):\n\n conn = self.conn\n conn.text_factory = str\n c = conn.cursor()\n\n c.execute(\"SELECT songs.id, artist, title, url FROM songs L...
[ "0.67191", "0.6461495", "0.64484215", "0.62452585", "0.6116291", "0.6073265", "0.603493", "0.60067284", "0.59900224", "0.59794277", "0.5927802", "0.5798049", "0.56955206", "0.56919104", "0.56533647", "0.5607341", "0.5586889", "0.55832136", "0.553297", "0.5515789", "0.54869497...
0.7237534
0
This is called to compare a lyrics note to the original to ensure they are not the same..if they are , such a lyrics note is rejected
def lyrics_note_is_same_as_original(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_duplicate_notes(self, tokens, curr_note, step) -> bool:\n same_note_cnt = 0\n idx = step - 3\n while idx > 0:\n prev_note = self._get_num(self.tgt_dict.string(tokens[0, idx : idx + 1]))\n if prev_note != curr_note:\n break...
[ "0.6234901", "0.6063626", "0.6018202", "0.59463143", "0.57870716", "0.5715159", "0.57044494", "0.56992126", "0.5657637", "0.5643236", "0.5580238", "0.5577914", "0.5575537", "0.5558365", "0.5553078", "0.5549295", "0.5545337", "0.54852504", "0.54813206", "0.54713225", "0.546813...
0.82412505
0
Checks if the lyrics has been approved or not
def is_lyrics_approved():
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def approve_lyrics():\n pass", "def song_has_lyrics():\n pass", "def is_approved(self) -> bool:\n return self.state == Order.OrderState.APPROVED.choice_value", "def approve_tweet(worker_responses):\n approvals = [len(get_tweet_text(response)) > 0 for response in worker_responses]\n return ...
[ "0.7582891", "0.6132226", "0.5762543", "0.5721694", "0.56735605", "0.5672874", "0.5540766", "0.5498608", "0.54710966", "0.5407162", "0.5385652", "0.53676486", "0.53605825", "0.5347708", "0.53281146", "0.5326186", "0.53110224", "0.5303602", "0.5287871", "0.5286905", "0.5272448...
0.8734696
0
r"""Calculate the cold plasma dispersion surfaces according to equation 2.64 in Plasma Waves by Swanson (2nd ed.)
def disp_surf_calc(kc_x_max, kc_z_max, m_i, wp_e): # Make vectors of the wave numbers kc_z = np.linspace(1e-6, kc_z_max, 35) kc_x = np.linspace(1e-6, kc_x_max, 35) # Turn those vectors into matrices kc_x_mat, kc_z_mat = np.meshgrid(kc_x, kc_z) # Find some of the numbers that appear later in t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_mixing_coefficients_surf(self):\n [Ly,N] = self.b.shape\n z_u_w = self.grid_dict['z_u_w']\n\n # SET UP NEW MIXING COEFFICIENT ARRAYS\n self.Kv_surf = np.zeros([Ly,N+1])\n self.Kt_surf = np.zeros([Ly,N+1])\n \n self.ghat = np.zeros([Ly,N+1])\n \n\n ...
[ "0.6823951", "0.68156433", "0.64645", "0.62532675", "0.5977594", "0.5888927", "0.5858084", "0.5850966", "0.5778458", "0.5767043", "0.5753279", "0.5737354", "0.5723255", "0.5714657", "0.57088953", "0.5705945", "0.56355387", "0.56164163", "0.561608", "0.56118447", "0.5599761", ...
0.7354267
0
Test Restaurant.__check_conditions decorator Test must be passed if functions with this decorator raised error cause of Hall, Delivery or Kitchen was not setted.
def test_open_no_setup(restaurant_only, hall_only, kitchen_only, delivery_only): # Here checks not all variants, cause restaurant_only is not isolated # object. They were previously check and working alongside # but affects result if together. # no setups with pytest.raises(CustomWarning): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_available(self):\n feature_guard = _make_requires(True, \"Error text\")\n results = []\n\n @feature_guard\n def inner():\n results.append(True)\n return True\n\n assert inner() is True\n assert [True] == results", "def test_simple_restauran...
[ "0.62134707", "0.5922159", "0.5859138", "0.57996106", "0.5779631", "0.57793766", "0.5778328", "0.57430685", "0.5736257", "0.5732914", "0.57291234", "0.5714089", "0.5701453", "0.5699153", "0.5698433", "0.5688214", "0.5600252", "0.55860335", "0.55774295", "0.5557103", "0.555048...
0.66464823
0
Test of cooking the same product twice. Test passed if second cooking of same product raise ValueError
def test_cook_twice(cook_not_busy, product_for_cook): cook_not_busy.cook_dish(product_for_cook) with pytest.raises(ValueError): cook_not_busy.cook_dish(product_for_cook)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checker(self, product):\n for item in self.instock:\n if item == product:\n return True\n return False", "def test_buyTicket_AlreadySold():\n assert not testUser2.buyTicket(testTicket1)\n assert testTicket1 in testUser1.inventory\n assert testTicket1 not in te...
[ "0.6690166", "0.63332933", "0.62514263", "0.61649024", "0.6153124", "0.605767", "0.6029322", "0.60229874", "0.6018796", "0.6007936", "0.5988192", "0.5973974", "0.5963615", "0.5908742", "0.58811826", "0.58582234", "0.585461", "0.5827044", "0.5807381", "0.58039653", "0.579343",...
0.7491278
0
Test of cooking by busy cook Test passed if busy cook raise a CustomWarning
def test_busy_cook(cook_busy, product_for_cook): with pytest.raises(CustomWarning): assert cook_busy.cook_dish(product_for_cook)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cook_twice(cook_not_busy, product_for_cook):\n\n cook_not_busy.cook_dish(product_for_cook)\n with pytest.raises(ValueError):\n cook_not_busy.cook_dish(product_for_cook)", "def test_cook_set_free(cook_busy, product_for_cook):\n cook_busy.set_free(True)\n # if product needs to be cooked...
[ "0.65008634", "0.625711", "0.620796", "0.58594835", "0.5785558", "0.5728688", "0.57037574", "0.57026243", "0.5623727", "0.56204015", "0.5618192", "0.56137985", "0.5599557", "0.5592458", "0.5572111", "0.55385923", "0.5527014", "0.551451", "0.551242", "0.55018896", "0.5490242",...
0.7838216
0
Test of changing state of cook. Busy cook set to free and then tries to cook the dish. Cooking should be successful (product.get_need_cook_status should be False)
def test_cook_set_free(cook_busy, product_for_cook): cook_busy.set_free(True) # if product needs to be cooked assert product_for_cook.get_need_cook_status() is True cook_busy.cook_dish(product_for_cook) assert product_for_cook.get_need_cook_status() is False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cook_twice(cook_not_busy, product_for_cook):\n\n cook_not_busy.cook_dish(product_for_cook)\n with pytest.raises(ValueError):\n cook_not_busy.cook_dish(product_for_cook)", "def test_update_state1(self):\n pass", "def test_update_state(self):\n pass", "def test_update_state2...
[ "0.61100876", "0.5935458", "0.59113294", "0.5875447", "0.58063436", "0.57781756", "0.57589597", "0.5701074", "0.5680897", "0.5638473", "0.5637342", "0.56042886", "0.5569046", "0.5534861", "0.5534524", "0.54650354", "0.545623", "0.54499906", "0.542222", "0.5383806", "0.5364995...
0.75115085
0
Formats the output of a transaction receipt to its proper values
def output_transaction_receipt_formatter(receipt): if receipt is None: return None logs_formatter = compose(functools.partial(map, outputLogFormatter), list) formatters = { 'blockNumber': to_decimal, 'transactionIndex': to_decimal, 'cumulativeGasUsed': to_decimal, '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_receipt(self) -> typing.List[str]:\n lines = []\n euro_total=0\n usd_total=0\n gbp_total=0\n\n for item in self._items.items():\n euro_price = self._get_product_price(item[0]) * item[1]\n usd_price = self.get_price_in_currency(euro_price,\"USD\")\n...
[ "0.6561996", "0.6189167", "0.60160506", "0.59889376", "0.5762017", "0.57275635", "0.56979066", "0.5656792", "0.56265295", "0.5626407", "0.55991745", "0.55775195", "0.5537981", "0.55367833", "0.5487953", "0.5431081", "0.5430332", "0.5380763", "0.5369978", "0.53524035", "0.5349...
0.676757
0
Formats the output of a block to its proper values
def outputBlockFormatter(block): # Transform to number block["gasLimit"] = to_decimal(block["gasLimit"]) block["gasUsed"] = to_decimal(block["gasUsed"]) block["size"] = to_decimal(block["size"]) block["timestamp"] = to_decimal(block["timestamp"]) if block.get("number"): block["number"]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reformat_block(specline, values):\n data = reformat_spec_line(specline)\n desc = '\\n'.join(values)\n data.append(desc)\n return data", "def verbose(self, block: Block):\n print('\\n\\n==============================')\n print('Hash:\\t\\t', block.hash.hexdigest())\n print('Pr...
[ "0.64059097", "0.6007487", "0.5995631", "0.5994798", "0.57876045", "0.5775755", "0.5706006", "0.56863886", "0.5680554", "0.5670126", "0.5669903", "0.5630315", "0.5629678", "0.5619763", "0.5568151", "0.55656964", "0.5549295", "0.55125326", "0.5497574", "0.5473819", "0.54342616...
0.7147282
0
Formats the output of a log
def outputLogFormatter(log): if log.get("blockNumber"): log["blockNumber"] = to_decimal(log["blockNumber"]) if log.get("transactionIndex"): log["transactionIndex"] = to_decimal(log["transactionIndex"]) if log.get("logIndex"): log["logIndex"] = to_decimal(log["logIndex"]) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format(self, record):\n msg = logging.Formatter.format(self, record)\n label, color = self.label(record)\n if self.strip:\n return \"{:10s}{}\".format(label, sub(\"\\033\\\\[[0-9]+m\", \"\", msg, 0))\n else:\n return \"\\033[1;{}m{:10s}\\033[0m{}\".format(color...
[ "0.6809159", "0.6568247", "0.6517458", "0.64604336", "0.63606316", "0.63424927", "0.6341781", "0.63280874", "0.6323291", "0.63123155", "0.6245183", "0.6183246", "0.6177255", "0.6145785", "0.61174196", "0.61150354", "0.6070282", "0.60515445", "0.6051452", "0.6049557", "0.60433...
0.71652734
0