query stringlengths 9 3.4k | document stringlengths 9 87.4k | metadata dict | negatives listlengths 4 101 | negative_scores listlengths 4 101 | document_score stringlengths 3 10 | document_rank stringclasses 102 values |
|---|---|---|---|---|---|---|
Decodes and yields each game event from the contents byte string. | def decode_replay_game_events(contents):
decoder = BitPackedDecoder(contents, typeinfos)
for event in _decode_event_stream(decoder,
game_eventid_typeid,
game_event_types,
decode_user_id=True):
yield event | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_replay_message_events(contents):\n decoder = BitPackedDecoder(contents, typeinfos)\n for event in _decode_event_stream(decoder,\n message_eventid_typeid,\n message_event_types,\n decode_u... | [
"0.7527568",
"0.70205873",
"0.6208984",
"0.6139739",
"0.6114342",
"0.60903746",
"0.59156847",
"0.5900353",
"0.5900353",
"0.58041835",
"0.5764921",
"0.5743358",
"0.5727057",
"0.57248867",
"0.57141185",
"0.5698565",
"0.55629605",
"0.55396146",
"0.55039734",
"0.5499922",
"0.5496... | 0.7618051 | 0 |
Decodes and yields each message event from the contents byte string. | def decode_replay_message_events(contents):
decoder = BitPackedDecoder(contents, typeinfos)
for event in _decode_event_stream(decoder,
message_eventid_typeid,
message_event_types,
decode_user_id=True):
yield event | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_replay_game_events(contents):\n decoder = BitPackedDecoder(contents, typeinfos)\n for event in _decode_event_stream(decoder,\n game_eventid_typeid,\n game_event_types,\n decode_user_id=Tr... | [
"0.6809163",
"0.6627737",
"0.65401894",
"0.61294484",
"0.6119063",
"0.60791254",
"0.6045092",
"0.60242575",
"0.6023794",
"0.6023794",
"0.58951175",
"0.58344936",
"0.5778005",
"0.5745545",
"0.571627",
"0.57093483",
"0.57050645",
"0.5697271",
"0.5670528",
"0.56580216",
"0.56567... | 0.78489214 | 0 |
Decodes and yields each tracker event from the contents byte string. | def decode_replay_tracker_events(contents):
decoder = VersionedDecoder(contents, typeinfos)
for event in _decode_event_stream(decoder,
tracker_eventid_typeid,
tracker_event_types,
decode_user_id=False):
yield event | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_replay_message_events(contents):\n decoder = BitPackedDecoder(contents, typeinfos)\n for event in _decode_event_stream(decoder,\n message_eventid_typeid,\n message_event_types,\n decode_u... | [
"0.7260997",
"0.6863218",
"0.60744035",
"0.59773415",
"0.5972554",
"0.58067507",
"0.58067507",
"0.57750344",
"0.5721968",
"0.5715137",
"0.5576841",
"0.55634767",
"0.55306965",
"0.55270785",
"0.5488471",
"0.54650974",
"0.5433999",
"0.5426289",
"0.5408526",
"0.5392383",
"0.5390... | 0.78533643 | 0 |
Decodes and return the replay header from the contents byte string. | def decode_replay_header(contents):
decoder = VersionedDecoder(contents, typeinfos)
return decoder.instance(replay_header_typeid) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_header(byte_iter):\n try:\n return MMSDecoder.decode_mms_header(byte_iter)\n except wsp_pdu.DecodeError:\n return wsp_pdu.Decoder.decode_header(byte_iter)",
"def get_decoded_header(value):\n decoded_header_items = decode_header(value)\n decoded_header_value = ... | [
"0.65073955",
"0.6290337",
"0.61638",
"0.6045373",
"0.6032726",
"0.60009605",
"0.5976727",
"0.59020257",
"0.587665",
"0.58728296",
"0.58578587",
"0.58342755",
"0.57190514",
"0.5715883",
"0.57114273",
"0.5698579",
"0.5698579",
"0.56286454",
"0.56231004",
"0.5622471",
"0.559463... | 0.8301495 | 0 |
Decodes and returns the game details from the contents byte string. | def decode_replay_details(contents):
decoder = VersionedDecoder(contents, typeinfos)
return decoder.instance(game_details_typeid) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_content(raw_content):\n return raw_content",
"def decode(self, s):",
"def decode(self, s):",
"def loads(data):\n return Decoder().decode(data)",
"def decode_replay_header(contents):\n decoder = VersionedDecoder(contents, typeinfos)\n return decoder.instance(replay_header_typeid)"... | [
"0.6129731",
"0.61129194",
"0.61129194",
"0.60414606",
"0.601643",
"0.5972789",
"0.5718805",
"0.57178694",
"0.5708704",
"0.57070786",
"0.5675133",
"0.56692094",
"0.5652299",
"0.56330013",
"0.5612766",
"0.5607002",
"0.55968446",
"0.5579638",
"0.5538174",
"0.55369866",
"0.55223... | 0.7517338 | 0 |
Decodes and return the replay init data from the contents byte string. | def decode_replay_initdata(contents):
decoder = BitPackedDecoder(contents, typeinfos)
return decoder.instance(replay_initdata_typeid) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_replay_header(contents):\n decoder = VersionedDecoder(contents, typeinfos)\n return decoder.instance(replay_header_typeid)",
"def get_protocol_init_data(self):\n\t\tcontents = self.archive.read_file('replay.initData')\n\t\treturn self.protocol.decode_replay_initdata(contents)",
"def decode(sel... | [
"0.68792987",
"0.6816869",
"0.6576485",
"0.6576485",
"0.64634705",
"0.636914",
"0.6290958",
"0.6227351",
"0.6151208",
"0.60679924",
"0.6021028",
"0.6016486",
"0.60010266",
"0.5966884",
"0.5966884",
"0.59334475",
"0.592061",
"0.5876956",
"0.58746934",
"0.5855629",
"0.58289397"... | 0.7790975 | 0 |
Decodes and yields each attribute from the contents byte string. | def decode_replay_attributes_events(contents):
buffer = BitPackedBuffer(contents, 'little')
attributes = {}
if not buffer.done():
attributes['source'] = buffer.read_bits(8)
attributes['mapNamespace'] = buffer.read_bits(32)
count = buffer.read_bits(32)
attributes['scopes'] = {}
while not buffer.done():
value = {}
value['namespace'] = buffer.read_bits(32)
value['attrid'] = attrid = buffer.read_bits(32)
scope = buffer.read_bits(8)
value['value'] = buffer.read_aligned_bytes(4)[::-1].strip(b'\x00')
if not scope in attributes['scopes']:
attributes['scopes'][scope] = {}
if not attrid in attributes['scopes'][scope]:
attributes['scopes'][scope][attrid] = []
attributes['scopes'][scope][attrid].append(value)
return attributes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode(self) -> Iterable:\r\n if self.data[0:1] not in (b'd', b'l'):\r\n return self.__wrap_with_tuple()\r\n return self.__parse()",
"def decode(self, s):",
"def decode(self, s):",
"def decode(data: bytes) -> Iterable:\r\n decoder = Decoder(data)\r\n return decoder.decode()... | [
"0.6104779",
"0.6021927",
"0.6021927",
"0.59359056",
"0.58786607",
"0.57934487",
"0.57358",
"0.5714988",
"0.56852806",
"0.56393176",
"0.56005883",
"0.55895346",
"0.555217",
"0.5540884",
"0.5514059",
"0.549559",
"0.5486493",
"0.54844517",
"0.5476387",
"0.54693216",
"0.5431158"... | 0.60899234 | 1 |
Computes the squareroot Wiener filter (WF) gain function. | def srwf(xi):
return np.sqrt(wienergain(xi)) # SRWF gain function. | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mw_f(mw):\n return np.power(mw, 0.5)",
"def fnutofwave(warr, farr):\n c= 2.99792458e18 #spped of light in Angstroms/s\n return farr*c/warr**2",
"def acWF(self):\n cg = self.surfaceW / self.spanW # mean geometric chord\n A = self.acW / self.cMACW\n B = 1.8 * self.fuselageDiam... | [
"0.6441982",
"0.6433172",
"0.64330995",
"0.6421363",
"0.6408753",
"0.6317383",
"0.62898636",
"0.622086",
"0.62058926",
"0.61769265",
"0.61759466",
"0.60642016",
"0.60255593",
"0.60095376",
"0.60083437",
"0.6006155",
"0.59878665",
"0.5971654",
"0.5965204",
"0.5912926",
"0.5908... | 0.72039974 | 0 |
Returns the xpath to user folder link | def get_user_folder_link_xpath():
return links['users_folder'].get('folder_xpath') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_enrolment_methods_link_xpath():\n return links['users_folder']['enrolment_link'].get('xpath')",
"def get_home_page_link_xpath():\n return links['home_page_link'].get('xpath')",
"def get_home_directory(self, user: str) -> str:\n process = self.run(\n \"/\",\n \... | [
"0.6328082",
"0.6125375",
"0.5475622",
"0.5455934",
"0.5450685",
"0.5408658",
"0.5387829",
"0.5355797",
"0.53383553",
"0.51845807",
"0.5153756",
"0.5123689",
"0.5121326",
"0.51196957",
"0.5119497",
"0.5108499",
"0.5081348",
"0.50647926",
"0.5047986",
"0.5043348",
"0.50315887"... | 0.90168035 | 0 |
Returns the xpath to enrolment methods link | def get_enrolment_methods_link_xpath():
return links['users_folder']['enrolment_link'].get('xpath') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_main_courses_link_xpath():\n return links['main_courses_page_link'].get('xpath')",
"def functionURI(self):\n ret = libxml2mod.xmlXPathGetFunctionURI(self._o)\n return ret",
"def get_xpath_next_button(self) -> str:\n\n return self.__xpath_next_button",
"def getLink(self):",... | [
"0.5303405",
"0.49750277",
"0.49695107",
"0.49531114",
"0.48514926",
"0.47544903",
"0.47476315",
"0.4720942",
"0.47161612",
"0.46954942",
"0.46684697",
"0.46565244",
"0.46222523",
"0.4620573",
"0.45703828",
"0.45701542",
"0.45397356",
"0.4507773",
"0.44758257",
"0.44708025",
... | 0.8597276 | 0 |
Dumps Atom object to dict notation | def dumps(self):
res = {}
for k, v in ALIASES.items():
res[k] = getattr(self, v)
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump(self) -> dict[Any, str]:\r\n ...",
"def to_dict(self):\n return dumpd(self)",
"def dump():\n\t\treturn self.__dict__;",
"def to_dict(self):\n d = OrderedDict()\n d[\"atoms\"] = self._atoms.to_dict()\n if self._defect_structure is not None:\n d[\"defect_s... | [
"0.69321775",
"0.6737612",
"0.66190594",
"0.63922614",
"0.62261814",
"0.6150092",
"0.60819876",
"0.6007592",
"0.59184486",
"0.5905574",
"0.58672726",
"0.5847249",
"0.5833733",
"0.5825348",
"0.58054274",
"0.57967883",
"0.5782834",
"0.578123",
"0.5767542",
"0.5762093",
"0.57488... | 0.0 | -1 |
Implement the ``&`` operator. When used with SQL expressions, results in an AND operation, equivalent to | def __and__(self, other: Any) -> Operators:
return self.operate(and_, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def and_(a, b):",
"def __and__(self, other):\n return self.fam.c_binop('and', self, other)",
"def AND(f, g):\n def _and(x):\n return f(x) & g(x)\n return _and",
"def _and(cls, arg1, arg2):\n return arg1 and arg2",
"def bitwise_and(self):\n register = self.return_middle_reg... | [
"0.720881",
"0.72083956",
"0.7044995",
"0.7044875",
"0.6915896",
"0.6861799",
"0.67927486",
"0.6763072",
"0.6753743",
"0.67318857",
"0.6727805",
"0.6706149",
"0.66897464",
"0.66471213",
"0.6634371",
"0.6612564",
"0.6603412",
"0.6601661",
"0.659582",
"0.6589129",
"0.6570068",
... | 0.67327243 | 9 |
Implement the ``|`` operator. When used with SQL expressions, results in an OR operation, equivalent to | def __or__(self, other: Any) -> Operators:
return self.operate(or_, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __or__(self, other):\n return self.fam.c_binop('or', self, other)",
"def bitwise_or(self, other: Any) -> ColumnOperators:\n\n return self.operate(bitwise_or_op, other)",
"def bitwise_or(self):\n register = self.return_middle_registers(self.opcode)\n self.registers[register[0]] =... | [
"0.7313398",
"0.7240989",
"0.7239503",
"0.72307086",
"0.71776074",
"0.7065337",
"0.70209676",
"0.69877166",
"0.69482714",
"0.68824136",
"0.6862509",
"0.6846659",
"0.6836842",
"0.68335205",
"0.6811549",
"0.6811143",
"0.68069947",
"0.6786309",
"0.6712439",
"0.668451",
"0.667773... | 0.7062119 | 6 |
Implement the ``~`` operator. When used with SQL expressions, results in a NOT operation, equivalent to | def __invert__(self) -> Operators:
return self.operate(inv) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bitwise_not(self) -> ColumnOperators:\n\n return self.operate(bitwise_not_op)",
"def RewriteNOT(self, expr):\n return None",
"def logical_not(data):\n return _make.logical_not(data)",
"def is_not(self, other: Any) -> ColumnOperators:\n return self.operate(is_not, other)",
"def logic... | [
"0.7567885",
"0.7479009",
"0.74299926",
"0.7168203",
"0.70865613",
"0.7055762",
"0.7039744",
"0.6903728",
"0.6772081",
"0.67706734",
"0.67372084",
"0.6721831",
"0.6712843",
"0.6704611",
"0.66389185",
"0.6587068",
"0.6570166",
"0.64484584",
"0.64282507",
"0.6405273",
"0.640519... | 0.0 | -1 |
Produce a generic operator function. | def op(
self,
opstring: str,
precedence: int = 0,
is_comparison: bool = False,
return_type: Optional[
Union[Type[TypeEngine[Any]], TypeEngine[Any]]
] = None,
python_impl: Optional[Callable[..., Any]] = None,
) -> Callable[[Any], Operators]:
operator = custom_op(
opstring,
precedence,
is_comparison,
return_type,
python_impl=python_impl,
)
def against(other: Any) -> Operators:
return operator(self, other) # type: ignore
return against | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def op_to_function(self, op):\n name = op.__class__.__name__.lower()\n name = operator_table.get(name, name)\n return to_attribute(self.operator, name)",
"def op_to_function(self, op):\n name = op.__class__.__name__.lower()\n return to_attribute(self.operator, inplace_operator_... | [
"0.6787511",
"0.6575289",
"0.62609947",
"0.61455697",
"0.5888018",
"0.586",
"0.5776054",
"0.57505804",
"0.5733276",
"0.5698309",
"0.5674514",
"0.56667805",
"0.5635123",
"0.56328183",
"0.56115836",
"0.5605617",
"0.558135",
"0.55762064",
"0.55337465",
"0.5514543",
"0.5497443",
... | 0.58484524 | 6 |
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_impl,
) | {
"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 |
r"""Operate on an argument. This is the lowest level of operation, raises | def operate(
self, op: OperatorType, *other: Any, **kwargs: Any
) -> Operators:
raise NotImplementedError(str(op)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _arg(self, t):\n self.RaiseError(t, \"Arguments should already have been processed\")",
"def f_onearg(self, arg1) :\n pass",
"def testfn(arg):\n if arg == 42:\n raise ValueError('Oh noes')\n return arg",
"def test04(self):\n self.assertRaises(TypeError, robustApply, oneA... | [
"0.6681198",
"0.6133656",
"0.6122572",
"0.60427153",
"0.5963494",
"0.59428406",
"0.5860092",
"0.58518416",
"0.5847448",
"0.58205676",
"0.5814131",
"0.5729934",
"0.5727906",
"0.5703141",
"0.56674135",
"0.56674135",
"0.5666974",
"0.56493413",
"0.5629272",
"0.5624739",
"0.562378... | 0.0 | -1 |
Reverse operate on an argument. | def reverse_operate(
self, op: OperatorType, other: Any, **kwargs: Any
) -> Operators:
raise NotImplementedError(str(op)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse_args(self, /, *args, **kwargs):\n return self._func(*args[::-1], **kwargs)",
"def reverse(a):\n raise NotImplementedError(\n f'Argument reversal not implemented for \"{type(a).__name__}\".'\n )",
"def reverse(x):\n return x[::-1]",
"def reverse(input=''):\n return input[... | [
"0.8178352",
"0.74908274",
"0.7404206",
"0.7294607",
"0.7205608",
"0.71991426",
"0.70520735",
"0.6926771",
"0.68621594",
"0.68621594",
"0.67519224",
"0.6749148",
"0.67388123",
"0.66703975",
"0.6582382",
"0.65158886",
"0.65063083",
"0.6467743",
"0.6458199",
"0.64568996",
"0.63... | 0.62105614 | 35 |
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``. | def __le__(self, other: Any) -> ColumnOperators:
return self.operate(le, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __lt__(self, other: Any) -> ColumnOperators:\n return self.operate(lt, other)",
"def less_than_or_equal(self) -> global___Expression:",
"def __gt__(self, other: Any) -> ColumnOperators:\n return self.operate(gt, other)",
"def less_than(self) -> global___Expression:",
"def greater_than_or_... | [
"0.7165506",
"0.700963",
"0.6988144",
"0.69543487",
"0.68947697",
"0.67446053",
"0.67067516",
"0.6581073",
"0.6538848",
"0.65240955",
"0.6440876",
"0.64279664",
"0.63834345",
"0.6381424",
"0.63487923",
"0.6281411",
"0.62765765",
"0.6259566",
"0.6236621",
"0.62045044",
"0.6171... | 0.6754904 | 5 |
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 ``!=`` operator. In a column context, produces the clause ``a != b``. If the target is ``None``, produces ``a IS NOT NULL``. | def __ne__(self, other: Any) -> ColumnOperators: # type: ignore[override]
return self.operate(ne, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other):\n\n if other is None:\n return sql.and_(*[a != None for a in self.__clause_element__().clauses])\n\n return sql.and_(*[a != b for a, b in\n zip(self.__clause_element__().clauses,\n other.__composite_values__())])",
... | [
"0.7618464",
"0.7285921",
"0.66983044",
"0.64086646",
"0.6396626",
"0.635126",
"0.6348784",
"0.6348784",
"0.6339177",
"0.62864137",
"0.6270455",
"0.6254071",
"0.6230844",
"0.6230444",
"0.62146723",
"0.6183858",
"0.6170356",
"0.6168275",
"0.61671525",
"0.61638814",
"0.6152657"... | 0.71285 | 2 |
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. In a column context, produces the clause ``a >= b``. | def __ge__(self, other: Any) -> ColumnOperators:
return self.operate(ge, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def greater_than(self) -> global___Expression:",
"def __ge__(self, other):\n self.conds.append((self.name, '>=', other))\n return self\n return self.name, '>=', other",
"def __gt__(self, other: Any) -> ColumnOperators:\n return self.operate(gt, other)",
"def greater_than_or_equal(... | [
"0.71336466",
"0.7117476",
"0.70879924",
"0.70800304",
"0.70131147",
"0.6829483",
"0.6803398",
"0.67888474",
"0.67709804",
"0.66918075",
"0.6657688",
"0.6556937",
"0.6369937",
"0.62875986",
"0.62658435",
"0.62490845",
"0.62456995",
"0.6227605",
"0.6217353",
"0.62074333",
"0.6... | 0.6667068 | 10 |
Implement the ```` operator. In a column context, produces the clause ``a``. | def __neg__(self) -> ColumnOperators:
return self.operate(neg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def where(self, value, operator=\"\"):\n return f\"\"\"\nto_tsvector('english', json->>'{sqlq(self.name)}') @@ plainto_tsquery(${{arg}}::text)\"\"\"",
"def column_expression(self, col):\n return getattr(func, self.impl.as_binary)(\n func.ST_Transform(col, self.app_srid),\n typ... | [
"0.57256806",
"0.5626777",
"0.5571533",
"0.55630136",
"0.55192256",
"0.5462437",
"0.54349065",
"0.54272956",
"0.5402271",
"0.5355026",
"0.52496",
"0.5217649",
"0.5192639",
"0.51918894",
"0.5183181",
"0.5177083",
"0.51630044",
"0.5162057",
"0.51399523",
"0.51244396",
"0.511510... | 0.45400453 | 87 |
Implement the [] operator. This can be used by some databasespecific types such as PostgreSQL ARRAY and HSTORE. | def __getitem__(self, index: Any) -> ColumnOperators:
return self.operate(getitem, index) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, key):\n if isinstance(key, slice):\n return [self._to_document(x) for x in self.query[key]]\n elif isinstance(key, int):\n return self._to_document(self.query[key])\n else:\n raise TypeError(\"Indices must be integers or slices!\")",
"def __getitem__(self, idx):\n ... | [
"0.68691176",
"0.6777847",
"0.6777847",
"0.63729215",
"0.63426095",
"0.6338188",
"0.63222003",
"0.6316412",
"0.6306318",
"0.6280029",
"0.62799627",
"0.6273025",
"0.6271119",
"0.62651616",
"0.6232938",
"0.6232938",
"0.6219875",
"0.61254597",
"0.61254597",
"0.61174756",
"0.6113... | 0.6101665 | 25 |
implement the << operator. Not used by SQLAlchemy core, this is provided for custom operator systems which want to use << as an extension point. | def __lshift__(self, other: Any) -> ColumnOperators:
return self.operate(lshift, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _append_operator(self, operator):",
"def append(self):\n return AttributeFunctor(self, lambda a, b: a + b)",
"def __add__(self, other: Any) -> ColumnOperators:\n return self.operate(add, other)",
"def write(self):\n\t\traise NotImplementedError('%s: No write function implemented!' % self.na... | [
"0.6079173",
"0.56106013",
"0.54718524",
"0.5435917",
"0.5336622",
"0.5272847",
"0.5247654",
"0.5219979",
"0.52134037",
"0.5170291",
"0.51603",
"0.51113975",
"0.50615424",
"0.50305885",
"0.50305885",
"0.5030121",
"0.50196373",
"0.50196373",
"0.4992939",
"0.49719447",
"0.49591... | 0.5180292 | 9 |
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 |
r"""Implement the ``ilike`` operator, e.g. case insensitive LIKE. | def ilike(
self, other: Any, escape: Optional[str] = None
) -> ColumnOperators:
return self.operate(ilike_op, other, escape=escape) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def icontains(self, other):",
"def icontains(cls, lhs, rhs):\n lhs, rhs = cls._remove_case(lhs, rhs)\n return cls.contains(lhs, rhs)",
"def icontains(self, other: Any, **kw: Any) -> ColumnOperators:\n return self.operate(icontains_op, other, **kw)",
"def make_query(term):\n def search... | [
"0.674273",
"0.64475894",
"0.61615145",
"0.59167445",
"0.5848779",
"0.5848733",
"0.5725785",
"0.5723373",
"0.5707651",
"0.57039154",
"0.56768",
"0.56768",
"0.56560004",
"0.5628858",
"0.55451804",
"0.5475888",
"0.54319906",
"0.5429301",
"0.53986067",
"0.5390407",
"0.53450644",... | 0.6138492 | 3 |
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 OR operation, typically via the ``|`` operator. | def bitwise_or(self, other: Any) -> ColumnOperators:
return self.operate(bitwise_or_op, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bitwise_or(self):\n register = self.return_middle_registers(self.opcode)\n self.registers[register[0]] = (\n self.registers[register[0]] | self.registers[register[1]])\n logger.info(\"Bitwise OR on V{} and V{} for {}\".format(\n register[0],\n register[1],\... | [
"0.806443",
"0.78686446",
"0.76549655",
"0.73964244",
"0.73867965",
"0.7347052",
"0.7285187",
"0.72554827",
"0.72150797",
"0.7171295",
"0.7134573",
"0.7105541",
"0.7026585",
"0.6992899",
"0.69897884",
"0.6981877",
"0.69809985",
"0.69075745",
"0.68806225",
"0.68671393",
"0.684... | 0.75964063 | 3 |
Produce a bitwise AND operation, typically via the ``&`` operator. | def bitwise_and(self, other: Any) -> ColumnOperators:
return self.operate(bitwise_and_op, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bitwise_and(self):\n register = self.return_middle_registers(self.opcode)\n self.registers[register[0]] = (\n self.registers[register[0]] & self.registers[register[1]])\n logger.info(\"Bitwise AND on V{} and V{} for {}\".format(\n register[0],\n register[1]... | [
"0.8054276",
"0.7892779",
"0.7824612",
"0.7673991",
"0.7639073",
"0.75052357",
"0.7378924",
"0.73738956",
"0.7337138",
"0.72522694",
"0.7191983",
"0.71918356",
"0.7176702",
"0.7158338",
"0.70961595",
"0.70950145",
"0.6978992",
"0.6954905",
"0.68963295",
"0.6865192",
"0.682996... | 0.71558213 | 14 |
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 |
Implement the ``IS`` operator. Normally, ``IS`` is generated automatically when comparing to a value of ``None``, which resolves to ``NULL``. However, explicit usage of ``IS`` may be desirable if comparing to boolean values on certain platforms. | def is_(self, other: Any) -> ColumnOperators:
return self.operate(is_, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ISLOGICAL(value):\n return isinstance(value, bool)",
"def isnone(cls, lhs, rhs):\n if rhs:\n return lhs is None\n else:\n return lhs is not None",
"def is_null(value: Any) -> bool:\n return not value",
"def is_null(val):\n return (val is None)",
"def not_none(va... | [
"0.63818854",
"0.60876524",
"0.60553294",
"0.6003424",
"0.5975343",
"0.58960766",
"0.5872773",
"0.5861925",
"0.5852616",
"0.58156174",
"0.57987595",
"0.5752538",
"0.5725974",
"0.57076395",
"0.5657389",
"0.55969155",
"0.5594129",
"0.5587909",
"0.55664015",
"0.55426466",
"0.554... | 0.5607879 | 15 |
Implement the ``IS NOT`` operator. Normally, ``IS NOT`` is generated automatically when comparing to a value of ``None``, which resolves to ``NULL``. However, explicit usage of ``IS NOT`` may be desirable if comparing to boolean values on certain platforms. | def is_not(self, other: Any) -> ColumnOperators:
return self.operate(is_not, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _logical_not(x):\n x_ = _static_value(x)\n if x_ is None:\n return math_ops.logical_not(x)\n return constant_op.constant(np.logical_not(x_))",
"def logical_not(data):\n return _make.logical_not(data)",
"def logical_not(x, f=None):\n return _cur_framework(x, f=f).logical_not(x)",
"def isNot(se... | [
"0.76711357",
"0.74266714",
"0.7345334",
"0.6967317",
"0.69102806",
"0.6909071",
"0.6847199",
"0.6773558",
"0.6718997",
"0.6715944",
"0.6714019",
"0.6710392",
"0.6697213",
"0.6632623",
"0.6623424",
"0.65454113",
"0.65454113",
"0.652865",
"0.647542",
"0.64731926",
"0.64731926"... | 0.7360673 | 2 |
r"""Implement the ``startswith`` operator. Produces a LIKE expression that tests against a match for the start | def startswith(
self,
other: Any,
escape: Optional[str] = None,
autoescape: bool = False,
) -> ColumnOperators:
return self.operate(
startswith_op, other, escape=escape, autoescape=autoescape
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def startswith(self, prefix, start=0, end=None):\n return startswith(self, prefix, start, end)",
"def starts_with(strn, prefix):\n return strn.startswith(prefix)",
"def starts_with(self, prefix: str) -> bool:\n return self.search(prefix, True)",
"def istartswith(self, other):",
"def starts... | [
"0.76464844",
"0.7515408",
"0.7390195",
"0.73402405",
"0.7320474",
"0.72779983",
"0.727712",
"0.72014445",
"0.7195512",
"0.7177483",
"0.7155215",
"0.70769036",
"0.70643926",
"0.70457613",
"0.7035063",
"0.699385",
"0.699385",
"0.6966345",
"0.69623387",
"0.6958128",
"0.69544315... | 0.67570513 | 28 |
r"""Implement the ``istartswith`` operator, e.g. case insensitive | def istartswith(
self,
other: Any,
escape: Optional[str] = None,
autoescape: bool = False,
) -> ColumnOperators:
return self.operate(
istartswith_op, other, escape=escape, autoescape=autoescape
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def startswith(self, other):",
"def beginswith(self, val):\n\t\treturn BeginsWith(self, val)",
"def endswith(self, other):",
"def startswith(value, s):\n\n if not value: return False\n return value.find(s) == 0",
"def istartswith(self, other):",
"def endswith(self, val):\n\t\treturn EndsWith(self, ... | [
"0.75283283",
"0.714107",
"0.6970065",
"0.6900368",
"0.66086614",
"0.65754944",
"0.65107995",
"0.6459029",
"0.6272044",
"0.6272044",
"0.6236056",
"0.6206314",
"0.6205149",
"0.6183295",
"0.6103853",
"0.6083098",
"0.6058663",
"0.6018545",
"0.60012627",
"0.5996321",
"0.59098667"... | 0.0 | -1 |
r"""Implement the 'endswith' operator. Produces a LIKE expression that tests against a match for the end | def endswith(
self,
other: Any,
escape: Optional[str] = None,
autoescape: bool = False,
) -> ColumnOperators:
return self.operate(
endswith_op, other, escape=escape, autoescape=autoescape
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _iendswith(string, suffix):\n return string.lower().endswith(suffix)",
"def endswith(self, suffix, start=0, end=None):\n return endswith(self, suffix, start, end)",
"def endswith(self, other):",
"def iendswith(self, other):",
"def endswith(a, suffix, start=0, end=None):\n return _vec_strin... | [
"0.7231004",
"0.7094811",
"0.70380664",
"0.6955873",
"0.68575513",
"0.6820186",
"0.6705274",
"0.6695005",
"0.66768295",
"0.661706",
"0.65348804",
"0.6528351",
"0.6528351",
"0.65144676",
"0.63827336",
"0.63179505",
"0.6069412",
"0.5715429",
"0.55279195",
"0.5520873",
"0.548828... | 0.6313194 | 16 |
r"""Implement the ``iendswith`` operator, e.g. case insensitive | def iendswith(
self,
other: Any,
escape: Optional[str] = None,
autoescape: bool = False,
) -> ColumnOperators:
return self.operate(
iendswith_op, other, escape=escape, autoescape=autoescape
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _iendswith(string, suffix):\n return string.lower().endswith(suffix)",
"def iendswith(self, other):",
"def endswith(self, other):",
"def endswith(self, s):\n return self.peek((-len(s), 0)).endswith(s)",
"def endswith(self, s):\n return self.peek((-len(s), 0)).endswith(s)",
"def endsw... | [
"0.8498645",
"0.81309557",
"0.7199173",
"0.6864424",
"0.6864424",
"0.6838914",
"0.6663945",
"0.66301477",
"0.6619726",
"0.65050405",
"0.63127506",
"0.6278626",
"0.58690065",
"0.5805485",
"0.58050025",
"0.5705342",
"0.56596774",
"0.56100124",
"0.5448618",
"0.5389003",
"0.53540... | 0.65328354 | 9 |
r"""Implement the 'contains' operator. Produces a LIKE expression that tests against a match for the middle | def contains(self, other: Any, **kw: Any) -> ColumnOperators:
return self.operate(contains_op, other, **kw) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ILIKE(self, first, second, escape=None):\n if isinstance(second, Expression):\n second = self.expand(second, 'string')\n else:\n second = self.expand(second, 'string').lower()\n if escape is None:\n escape = '\\\\'\n second = second.r... | [
"0.72666806",
"0.72300506",
"0.72300506",
"0.6992988",
"0.6977187",
"0.6963082",
"0.6506734",
"0.6142295",
"0.6129824",
"0.6091203",
"0.60765445",
"0.6067568",
"0.6063189",
"0.60621303",
"0.6043949",
"0.603874",
"0.60154015",
"0.5998586",
"0.5945503",
"0.588312",
"0.58433187"... | 0.5694916 | 27 |
r"""Implement the ``icontains`` operator, e.g. case insensitive | def icontains(self, other: Any, **kw: Any) -> ColumnOperators:
return self.operate(icontains_op, other, **kw) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def icontains(self, other):",
"def icontains(cls, lhs, rhs):\n lhs, rhs = cls._remove_case(lhs, rhs)\n return cls.contains(lhs, rhs)",
"def simple_search(self, pattern):\n query = Q()\n for ptn in pattern.split():\n for field in SEARCH_FIELDS:\n query |= Q(... | [
"0.86574465",
"0.7993747",
"0.67407405",
"0.6590946",
"0.6374053",
"0.632424",
"0.62827694",
"0.61708903",
"0.61417246",
"0.609568",
"0.6054074",
"0.60380536",
"0.60380536",
"0.602451",
"0.6004706",
"0.5967123",
"0.5959144",
"0.59444344",
"0.58741206",
"0.5858656",
"0.5834405... | 0.73884606 | 2 |
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 reverse. | def __radd__(self, other: Any) -> ColumnOperators:
return self.reverse_operate(add, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __radd__(self, other):\n return self + other",
"def __radd__(self, other):\n return self + other",
"def __radd__(self, left):\n return self.value() + left",
"def __radd__(self, other):\n return self.__add__(other)",
"def __radd__(self, other):\n return self.__add__(ot... | [
"0.74343145",
"0.74343145",
"0.7178825",
"0.71471876",
"0.71471876",
"0.71471876",
"0.71471876",
"0.71471876",
"0.71471876",
"0.71471876",
"0.6999289",
"0.68117493",
"0.68117493",
"0.67497504",
"0.67341304",
"0.6684809",
"0.66516006",
"0.6590904",
"0.6582149",
"0.6524442",
"0... | 0.7339563 | 2 |
Implement the ```` operator in reverse. | def __rsub__(self, other: Any) -> ColumnOperators:
return self.reverse_operate(sub, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string_reverser(our_string):\\\\\n\\\n # TODO: Write your solution here\\",
"def reversed(self):\n return LINE(*self.elems,**{'reverse':(not self.reverse)})",
"def __reversed__(self):\n return reverse(self)",
"def unquote():\n def _unquote(quoted):\n return quoted.subex... | [
"0.60112137",
"0.57446754",
"0.5714841",
"0.56417483",
"0.56254095",
"0.56195694",
"0.556191",
"0.556191",
"0.55474424",
"0.5543007",
"0.5522739",
"0.54584384",
"0.5449569",
"0.5446728",
"0.5441396",
"0.54026014",
"0.53824884",
"0.53611344",
"0.53487957",
"0.5339628",
"0.5320... | 0.5176827 | 32 |
Implement the ```` operator in reverse. | def __rmul__(self, other: Any) -> ColumnOperators:
return self.reverse_operate(mul, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string_reverser(our_string):\\\\\n\\\n # TODO: Write your solution here\\",
"def reversed(self):\n return LINE(*self.elems,**{'reverse':(not self.reverse)})",
"def __reversed__(self):\n return reverse(self)",
"def unquote():\n def _unquote(quoted):\n return quoted.subex... | [
"0.60112137",
"0.57446754",
"0.5714841",
"0.56417483",
"0.56254095",
"0.56195694",
"0.556191",
"0.556191",
"0.55474424",
"0.5543007",
"0.5522739",
"0.54584384",
"0.5449569",
"0.5446728",
"0.5441396",
"0.54026014",
"0.53824884",
"0.53611344",
"0.53487957",
"0.5339628",
"0.5320... | 0.0 | -1 |
Implement the ``%`` operator in reverse. | def __rmod__(self, other: Any) -> ColumnOperators:
return self.reverse_operate(mod, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remainder(numbers):\n \n return numbers[0] % numbers[1]",
"def __mod__( self, value ):\r\n\t\tif ( type( value ) == type( self ) ):\r\n\t\t\treturnvalue = fraction( self )\r\n\t\t\tif ( returnvalue < 0 ):\r\n\t\t\t\twhile ( returnvalue < -value ): returnvalue += value\r\n\t\t\telse:\r\n\t\t\t\twhile ( ... | [
"0.6163911",
"0.6065376",
"0.600428",
"0.5994759",
"0.5977425",
"0.5966593",
"0.58146584",
"0.5781853",
"0.5770273",
"0.57603323",
"0.57343507",
"0.57295555",
"0.5691427",
"0.5646028",
"0.5646028",
"0.5619401",
"0.561595",
"0.5607449",
"0.557931",
"0.5577098",
"0.55579674",
... | 0.54985595 | 23 |
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 __sub__(self, other: Any) -> ColumnOperators:
return self.operate(sub, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_(self, other: Any) -> ColumnOperators:\n return self.operate(is_, other)",
"def __mod__(self, other: Any) -> ColumnOperators:\n return self.operate(mod, other)",
"def where(self, value, operator=\"\"):\n return f\"\"\"\nto_tsvector('english', json->>'{sqlq(self.name)}') @@ plainto_t... | [
"0.57185555",
"0.56777227",
"0.55396056",
"0.55313486",
"0.55176455",
"0.5472102",
"0.5433785",
"0.5422519",
"0.5417467",
"0.54079354",
"0.53806454",
"0.5240876",
"0.52386314",
"0.5216314",
"0.5206684",
"0.51834905",
"0.5145413",
"0.51320696",
"0.5113919",
"0.51100814",
"0.51... | 0.5399367 | 10 |
Implement the ```` operator. In a column context, produces the clause ``a b``. | def __mul__(self, other: Any) -> ColumnOperators:
return self.operate(mul, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_(self, other: Any) -> ColumnOperators:\n return self.operate(is_, other)",
"def __mod__(self, other: Any) -> ColumnOperators:\n return self.operate(mod, other)",
"def where(self, value, operator=\"\"):\n return f\"\"\"\nto_tsvector('english', json->>'{sqlq(self.name)}') @@ plainto_t... | [
"0.57185555",
"0.56777227",
"0.55396056",
"0.55313486",
"0.55176455",
"0.5472102",
"0.5433785",
"0.5422519",
"0.5417467",
"0.54079354",
"0.5399367",
"0.53806454",
"0.5240876",
"0.52386314",
"0.5216314",
"0.5206684",
"0.51834905",
"0.5145413",
"0.51320696",
"0.5113919",
"0.511... | 0.5089115 | 25 |
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``, and considers the result type to be numeric. | def __truediv__(self, other: Any) -> ColumnOperators:
return self.operate(truediv, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __floordiv__(self, other: Any) -> ColumnOperators:\n return self.operate(floordiv, other)",
"def exquo(self, a, b):\n return a / b",
"def __rfloordiv__(self, other: Any) -> ColumnOperators:\n return self.reverse_operate(floordiv, other)",
"def __rdiv__(self, other):\n if not (... | [
"0.6453389",
"0.62411934",
"0.6153242",
"0.60202837",
"0.59779483",
"0.58951277",
"0.58729357",
"0.58420694",
"0.58211166",
"0.58077437",
"0.5796711",
"0.5794097",
"0.5785908",
"0.5782081",
"0.5713723",
"0.57040805",
"0.5680108",
"0.56506395",
"0.56506395",
"0.56506395",
"0.5... | 0.0 | -1 |
Implement the ``/`` operator in reverse. | def __rtruediv__(self, other: Any) -> ColumnOperators:
return self.reverse_operate(truediv, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse_args(self, /, *args, **kwargs):\n return self._func(*args[::-1], **kwargs)",
"def __reversed__(self):\n return reverse(self)",
"def reverse(input):\n return input[::-1]",
"def reverse(x):\n return x[::-1]",
"def slashout(value):\n intvalue = value//divisor\n sl... | [
"0.6135369",
"0.5829882",
"0.58086765",
"0.5780163",
"0.57783896",
"0.57658106",
"0.5726366",
"0.569367",
"0.56654996",
"0.5564684",
"0.5559694",
"0.55512697",
"0.554008",
"0.55088603",
"0.5502827",
"0.5501132",
"0.54486424",
"0.5431577",
"0.54143196",
"0.5411853",
"0.5364636... | 0.4908269 | 67 |
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 |
Implement the ``//`` operator in reverse. | def __rfloordiv__(self, other: Any) -> ColumnOperators:
return self.reverse_operate(floordiv, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse(self): # real signature unknown; restored from __doc__\n pass",
"def __reversed__(self):\n return reverse(self)",
"def __reversed__(self): # real signature unknown; restored from __doc__\n pass",
"def reversed(self):\n return LINE(*self.elems,**{'reverse':(not self.rev... | [
"0.6898972",
"0.67280143",
"0.6570183",
"0.64665455",
"0.6435781",
"0.64005893",
"0.6327653",
"0.619489",
"0.61898303",
"0.6143259",
"0.611715",
"0.60120684",
"0.6012058",
"0.5995933",
"0.5922119",
"0.5917446",
"0.5917225",
"0.5885924",
"0.58384603",
"0.58336633",
"0.58315474... | 0.0 | -1 |
rotate a comparison operator 180 degrees. Note this is not the same as negation. | def mirror(op: OperatorType) -> OperatorType:
return _mirror.get(op, op) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate90(self):",
"def __xor__(self, other):\n return self.angle - other.angle",
"def test_rotate_without_moving(controller):\n distance = math.pi / 2 * (DISTANCE_BETWEEN_WHEELS / 2)\n revolution = distance / (2 * math.pi * WHEEL_RADIUS)\n ticks = revolution * TICK_PER_REVOLUTIO... | [
"0.62236845",
"0.57391757",
"0.5727579",
"0.5692595",
"0.5676121",
"0.56031454",
"0.55959946",
"0.5574356",
"0.5564202",
"0.5546044",
"0.5512522",
"0.54624367",
"0.54138476",
"0.539633",
"0.5394146",
"0.5332589",
"0.5311307",
"0.52727157",
"0.52663016",
"0.5263858",
"0.524774... | 0.0 | -1 |
Send a dynamic email to a list of email addresses | def SendDynamic(SENDER_EMAIL_ADDRESS, RECIPIENT_EMAIL_ADDRESS, birth_date, chart_type, chart_for_email): #SENDER_EMAIL_ADDRESS, RECIPIENT_EMAIL_ADDRESS, chart_type, birth_date, chart_for_email
# create Mail object and populate
message = Mail(
from_email=SENDER_EMAIL_ADDRESS,
to_emails=RECIPIENT_EMAIL_ADDRESS)
# pass custom values for our HTML placeholders
message.dynamic_template_data = {
'subject': 'Billboard Chart on Your Birthday!',
'birth_date': birth_date,
'chart_type': chart_type,
'chart_for_email': chart_for_email
}
message.template_id = TEMPLATE_ID
# create our sendgrid client object, pass it our key, then send and return our response objects
try:
sg = SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
response = sg.send(message)
code, body, headers = response.status_code, response.body, response.headers
print("Response code:", code)
print("Response headers:", headers)
print("Response body:", body)
print("Dynamic Messages Sent!")
except Exception as e:
print("Error: {0}".format(e))
#return str(response.status_code) #HERE | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sendMail(listEmailsToSend, title, data):\n if isinstance(listEmailsToSend, str):\n listEmailsToSend = [listEmailsToSend]\n send_mail(\n f'{title}',\n f'{data}',\n settings.EMAIL_HOST_USER,\n listEmailsToSend,\n fail_silently=False,\n )",
"def exec(self): \r\... | [
"0.745837",
"0.73170996",
"0.7106155",
"0.7102021",
"0.70113754",
"0.6933813",
"0.6901406",
"0.68785",
"0.67846227",
"0.6755911",
"0.6713671",
"0.66669184",
"0.66521394",
"0.66179466",
"0.6581322",
"0.65783966",
"0.6565939",
"0.6565939",
"0.6558398",
"0.6553996",
"0.653323",
... | 0.0 | -1 |
Calculate the great circle distance between two points on the earth (specified in decimal degrees) | def haversine(lon1, lat1, lon2, lat2):
# convert decimal degrees to radians
lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])
# haversine formula
dlon = lon2 - lon1
dlat = lat2 - lat1
a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2
c = 2 * asin(sqrt(a))
# Radius of earth in kilometers is 6371
m = 6371000* c #meters
return m | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long... | [
"0.81450045",
"0.7863265",
"0.76322985",
"0.76064754",
"0.75978696",
"0.75965863",
"0.75944835",
"0.75720793",
"0.75630087",
"0.7555095",
"0.7528691",
"0.7517629",
"0.7492963",
"0.7467739",
"0.7452678",
"0.7434477",
"0.73914117",
"0.7357736",
"0.73484355",
"0.73318124",
"0.73... | 0.0 | -1 |
Initializes the class variables | def __init__(self):
self.logged_in = False
self.driver = None
self.mail = ""
self.firstname = ""
self.lastname = "" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init(self):\n pass",
"def initialize(self):\n\t\tpass",
"def initialize(cls):",
"def init(self):\n pass",
"def init(self):\n pass",
"def init(self):\n pass",
"def init(self):\n pass",
"def init(self):\n pass",
"def init(self):\n pass",
"def in... | [
"0.7828898",
"0.78240657",
"0.7823126",
"0.7806967",
"0.7806967",
"0.7806967",
"0.7806967",
"0.7806967",
"0.7806967",
"0.7806967",
"0.7806967",
"0.779783",
"0.779783",
"0.779783",
"0.779783",
"0.779783",
"0.7796556",
"0.7796556",
"0.76626754",
"0.7660067",
"0.76435035",
"0.... | 0.0 | -1 |
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 the page title
wait = WebDriverWait(self.driver, 10)
try:
wait.until_not(EC.title_is(consts.BLOCKED))
break
except TimeoutException:
self.driver.refresh() | {
"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 review for a product | def get_review(self, language):
comment_generator = CommentGenerator(language)
return comment_generator.generateComment() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_review(review_id):\n return get(cls, review_id)",
"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\n page_title = product[\"name\"] + \" Review\"\n\n ... | [
"0.70512813",
"0.6652952",
"0.65892786",
"0.6470037",
"0.6438276",
"0.6387162",
"0.63702464",
"0.634869",
"0.62288064",
"0.622639",
"0.6225318",
"0.62093824",
"0.62093604",
"0.6191605",
"0.61914194",
"0.6172198",
"0.6131665",
"0.6117356",
"0.60899484",
"0.60562116",
"0.595874... | 0.5220318 | 68 |
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 |
Start the bot browser | def start_browser(self):
options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
options.add_experimental_option('w3c', False)
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
options.add_argument("--disable-blink-features");
options.add_argument("--disable-blink-features=AutomationControlled");
self.driver = webdriver.Chrome(options=options)
self.driver.maximize_window()
self.driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {
"source": """
Object.defineProperty(navigator, 'webdriver', {
get: () => undefined
})
"""
})
self.driver.execute_cdp_cmd("Network.enable", {})
self.driver.execute_cdp_cmd("Network.setExtraHTTPHeaders", {"headers": {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36 "}}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_bot(self):\n self.proc = subprocess.Popen(\"./start\", stdin=subprocess.PIPE,\n\t\t\t\t\t\t\t\t\t stdout=subprocess.PIPE,\n\t\t\t\t\t\t\t\t\t cwd=os.path.abspath(self.path))",
"def start_browser_with(self, browser: 'Browserify', url: 'Url') -> 'StartableClient':",
"def start_browser(self):\n ... | [
"0.6901024",
"0.6857704",
"0.6784037",
"0.6756479",
"0.67243356",
"0.67243356",
"0.66978395",
"0.66865844",
"0.66695154",
"0.66478986",
"0.6632718",
"0.6619686",
"0.661729",
"0.65550476",
"0.64688003",
"0.6445323",
"0.6410794",
"0.6350172",
"0.62495875",
"0.6237269",
"0.61898... | 0.6466303 | 15 |
Closes the bot browser | def stop_browser(self):
self.driver.quit() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_browser():\n driver.close()",
"def i_close_the_browser():\n driver.close()\n driver.quit()",
"def closeBrowser(driver):\n driver.quit()",
"def _shutdown_browser(self):\n if self.browser:\n self.browser.close()",
"def close(self):\n\t\tself._client.close_session()",
... | [
"0.76861256",
"0.76587313",
"0.7359893",
"0.71137106",
"0.70755875",
"0.7055244",
"0.7018569",
"0.7002883",
"0.6983394",
"0.6980536",
"0.69637775",
"0.6955943",
"0.68788224",
"0.6864631",
"0.6859781",
"0.6859779",
"0.68597466",
"0.68479276",
"0.68299",
"0.6817339",
"0.6801004... | 0.6546153 | 37 |
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 |
Registers to the marketplace | def register(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def registration_marketplace_id(self, registration_marketplace_id):\n\n self._registration_marketplace_id = registration_marketplace_id",
"def onRegister(self):\n pass",
"def onRegister(self):\n pass",
"def register(self):\n raise NotImplementedError(\"Should have implemented this... | [
"0.6167991",
"0.61246777",
"0.61246777",
"0.6080551",
"0.6068103",
"0.6031579",
"0.59869134",
"0.59817106",
"0.59790593",
"0.5977826",
"0.5970547",
"0.59451747",
"0.5871191",
"0.58024496",
"0.5796847",
"0.57449293",
"0.57118475",
"0.5697246",
"0.56921023",
"0.56275505",
"0.56... | 0.61366606 | 2 |
Creates a new mail account | def create_new_mail(self):
self.driver.get(consts.TEMP_MAIL)
soup = BeautifulSoup(self.driver.page_source)
self.mail = soup.find(id="email_id").attrs["data-value"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self, username, password, email):\n pass",
"def _create_account(self, username, email, password):\r\n resp = self.client.post('/create_account', {\r\n 'username': username,\r\n 'email': email,\r\n 'password': password,\r\n 'location': 'home',\r... | [
"0.75552905",
"0.69742715",
"0.69295764",
"0.686007",
"0.68039113",
"0.67947775",
"0.67659163",
"0.67187315",
"0.6694699",
"0.6690683",
"0.6682159",
"0.6659708",
"0.6566312",
"0.6538577",
"0.65087545",
"0.6507457",
"0.6489166",
"0.64851594",
"0.6482069",
"0.6465149",
"0.64006... | 0.0 | -1 |
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 |
Compute the parallactic angle of a position at a given datetime. Based on parangle.pro by Tim Robishaw Bryan Miller | def parangle(ra, dec, utdate, uttime, site, verbose=False):
# degrees per radian
degrad = 180. * u.deg /(np.pi * u.rad)
l_ra = ra.strip()
l_dec = dec.strip()
if '-' not in l_dec and l_dec[0] != '+':
l_dec = '+' + l_dec
# Coordinate object
coord = SkyCoord(l_ra,l_dec,frame='icrs',unit = (u.hr, u.deg))
# Observation time
obs_time = Time(utdate + 'T' + uttime, format='isot', scale='utc')
# Location
location = EarthLocation.of_site(site)
if verbose:
print('Site: ', location)
altaz = coord.transform_to(AltAz(obstime=obs_time, location=location))
if verbose:
print('Alt/Az: ', altaz.alt.deg, altaz.az.deg)
# Hour angle
ha = np.arcsin(-np.sin(altaz.az) * np.cos(altaz.alt) / np.cos(coord.dec))
if verbose:
print('HA: ', ha)
# Parallactic angle
parang = -degrad * np.arctan2(-np.sin(ha),
np.cos(coord.dec) * np.tan(location.lat) - np.sin(coord.dec) * np.cos(ha))
return parang | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle(self, angle: int, time: int = 0, /) -> None:",
"def angle(self) -> float:\n ...",
"def angle(self) -> int:",
"def getAngle(p1, p2, p3):\n\tv1 = p1 - p2\n\tv2 = p3 - p2\n\tmag = la.norm(v1) * la.norm(v2)\n\tc = np.dot(v1, v2) / mag\n\tcross = np.cross(v1,v2)\n\ts = la.norm(cross)/mag\n\tatang... | [
"0.71314776",
"0.6584772",
"0.65744615",
"0.65488315",
"0.651968",
"0.65085393",
"0.6478713",
"0.64728457",
"0.63703406",
"0.63291866",
"0.6320654",
"0.6274085",
"0.6233721",
"0.62293214",
"0.6220309",
"0.6209988",
"0.62085825",
"0.614576",
"0.6121773",
"0.6114896",
"0.611407... | 0.648334 | 6 |
Determines the color of the traffic light in the image | def get_classification(self, image):
if self.model is not None:
im = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
im = im.astype('float32')
im = preprocess_input(im)
im_array = np.asarray(im)
transformed_im_array = im_array[None, :, :, :]
with self.graph.as_default():
preds = self.model.predict(transformed_im_array, batch_size=1)
return np.argmax(preds[0])
return TrafficLight.UNKNOWN | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lightness(self):\n min_component = min(self.red, self.green, self.blue)\n max_component = max(self.red, self.green, self.blue)\n avg = (max_component + min_component) / 2\n light = avg / 255\n return light",
"def lightness(color):\n\n strongest = max(color.red, color.gre... | [
"0.7198706",
"0.7025889",
"0.70083666",
"0.6910758",
"0.68641305",
"0.6849346",
"0.6840223",
"0.6826582",
"0.68160725",
"0.6730158",
"0.6688403",
"0.66786885",
"0.66235894",
"0.65820056",
"0.6544322",
"0.65343744",
"0.6531804",
"0.6476259",
"0.64725053",
"0.64530194",
"0.6450... | 0.0 | -1 |
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)
if distance > max_distance:
continue
pos = Position(start.x + x, start.y + y)
if target_func(pos, distance):
targets.append(pos)
return targets
else:
targets = PriorityQueue()
for x in range(-max_distance, max_distance + 1):
for y in range(-max_distance, max_distance + 1):
distance = abs(x) + abs(y)
if distance > max_distance:
continue
pos = Position(start.x + x, start.y + y)
if target_func(pos, distance):
targets.enqueue(sort_func(pos, distance), pos)
return targets.to_list() | {
"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 |
function to extract the subject code from the path using reegex | def extract_sub(s: str):
subject = re.search(r'sub-\d+', s)[0]
return subject | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject_id_of(path: Path) -> str:\n\n match = search(pattern=\"[Vv]([0-9][0-9])\", string=str(path))\n return match.group(1)",
"def get_subject(text_file):\n path_name, sf = os.path.splitext(text_file)\n fname = os.path.basename(path_name)\n fname = fname.replace(\"-Left_Handed\", \"\")\n a... | [
"0.67425287",
"0.61780506",
"0.5881349",
"0.5760993",
"0.5687343",
"0.5666367",
"0.56164485",
"0.5563101",
"0.5499973",
"0.5499532",
"0.54629755",
"0.5437044",
"0.53133744",
"0.5307513",
"0.5306485",
"0.53033054",
"0.5277978",
"0.5272841",
"0.52643704",
"0.52599514",
"0.52558... | 0.5744716 | 4 |
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 empty lines for ``post``. | 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 "")),
clean_docstring(post or "", unused="post"),
)
)
return obj
return edit_docstring | {
"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)
orig_init = cls.__init__
signature = inspect.signature(orig_init)
params = signature.parameters.keys() & set(params)
@functools.wraps(orig_init)
def init(*args, **kwargs):
bounds = signature.bind(*args, **kwargs)
bounds.apply_defaults()
pre_formatted = {
name: bounds.arguments.pop(name)
for name in params
if name in bounds.arguments
}
formatted = {
name: string.format(**bounds.arguments)
for name, string in pre_formatted.items()
}
for name, arg in formatted.items():
bounds.arguments[name] = arg
return orig_init(*bounds.args, **bounds.kwargs)
# init.__signature__ = signature
setattr(cls, "__init__", init)
return cls | {
"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 = _sig_without(inspect.signature(cls.__init__), 0)
previous = [(cls, "__init__", sig)]
for parent in reversed(cls.__mro__):
if hasattr(parent, "__post_init__"):
post_sig = _sig_without(
inspect.signature(getattr(parent, "__post_init__")), 0
)
try:
sig = _sig_merge(sig, post_sig)
except Exception as err:
# find the incompatibility
for parent, method, psig in previous:
try:
_sig_merge(psig, post_sig)
except Exception:
break
else:
raise TypeError(
"__post_init__ signature is incompatible with the class"
) from err
raise TypeError(
f"__post_init__() is incompatible with {parent.__qualname__}{method}()"
) from err
# No exception
previous.append((parent, "__post_init__", post_sig))
# handles type annotations and defaults
# inspired by the dataclasses modules
params = list(sig.parameters.values())
localns = (
{
f"__type_{p.name}": p.annotation
for p in params
if p.annotation is not inspect.Parameter.empty
}
| {
f"__default_{p.name}": p.default
for p in params
if p.default is not inspect.Parameter.empty
}
| cls.__dict__
)
for i, p in enumerate(params):
if p.default is not inspect.Parameter.empty:
p = p.replace(default=Variable(f"__default_{p.name}"))
if p.annotation is not inspect.Parameter.empty:
p = p.replace(annotation=f"__type_{p.name}")
params[i] = p
new_sig = inspect.Signature(params)
# Build the new __init__ source code
self_ = "self" if "self" not in sig.parameters else "__post_init_self"
init_lines = [
f"def __init__({self_}, {_sig_to_def(new_sig)}) -> None:",
f"__original_init({self_}, {_sig_to_call(init_sig)})",
]
for parent, method, psig in previous[1:]:
if hasattr(parent, "__post_init__"):
if parent is not cls:
init_lines.append(
f"super({parent.__qualname__}, {self_}).{method}({_sig_to_call(psig)})"
)
else:
init_lines.append(f"{self_}.{method}({_sig_to_call(psig)})")
init_src = "\n ".join(init_lines)
# Build the factory function source code
local_vars = ", ".join(localns.keys())
factory_src = (
f"def __make_init__(__original_init, {local_vars}):\n"
f" {init_src}\n"
" return __init__"
)
# Create new __init__ with the factory
globalns = inspect.getmodule(cls).__dict__
ns: dict[str, Any] = {}
exec(factory_src, globalns, ns)
init = ns["__make_init__"](cls.__init__, **localns)
self_param = inspect.Parameter(self_, inspect.Parameter.POSITIONAL_ONLY)
init.__signature__ = inspect.Signature(
parameters=[self_param] + list(sig.parameters.values()), return_annotation=None
)
setattr(cls, "__init__", init)
return cls | {
"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 |
Context manager that calls a function if the managed code doesn't raise | def on_error(func, *args, yield_=None, **kwargs):
try:
yield yield_
except Exception:
func(*args, **kwargs)
raise | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_call_with_exception(self):\n eclipse_name='p_func'\n def called_from_eclipse(arguments):\n a=a +1 \n return SUCCEED\n addPythonFunction(eclipse_name,called_from_eclipse)\n my_var=Var()\n Compound('call_python_function',Atom(eclipse_name),[1,my_var])... | [
"0.6115875",
"0.60971296",
"0.60971296",
"0.60538036",
"0.5977113",
"0.5934235",
"0.58876014",
"0.5881913",
"0.58582246",
"0.5839776",
"0.58386683",
"0.5754716",
"0.57476044",
"0.57452863",
"0.5742974",
"0.5705461",
"0.5702534",
"0.56842005",
"0.56724226",
"0.56615245",
"0.56... | 0.0 | -1 |
Context manager that calls a function if the managed code raises an Exception | def on_success(func, *args, yield_=None, **kwargs):
try:
yield yield_
except Exception:
raise
else:
func(*args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_call_with_exception(self):\n eclipse_name='p_func'\n def called_from_eclipse(arguments):\n a=a +1 \n return SUCCEED\n addPythonFunction(eclipse_name,called_from_eclipse)\n my_var=Var()\n Compound('call_python_function',Atom(eclipse_name),[1,my_var])... | [
"0.6468355",
"0.62530625",
"0.6059449",
"0.60439676",
"0.6027545",
"0.6024052",
"0.5985571",
"0.5908171",
"0.58841926",
"0.5875956",
"0.5875956",
"0.5858263",
"0.5853891",
"0.5838412",
"0.5820536",
"0.5797396",
"0.57963735",
"0.57873315",
"0.57493687",
"0.5743339",
"0.5738956... | 0.0 | -1 |
Removes initial empty lines and shared indentation | def clean_docstring(doc: str, unused: Literal["pre", "post"] = None) -> str:
doc = doc.split("\n")
if unused == "pre":
try:
index = next(i for i, l in enumerate(doc) if l.strip())
doc = doc[index:]
except StopIteration:
doc = []
elif unused == "post":
try:
index = next(i for i, l in enumerate(reversed(doc)) if l.strip())
doc = doc[: len(doc) - index]
except StopIteration:
doc = []
if doc:
first_line = doc[0]
index = len(first_line) - len(first_line.lstrip())
indent = first_line[:index]
if all(l.startswith(indent) for l in doc if l.strip()):
doc = [(l[index:] if l.strip() else l) for l in doc]
return "\n".join(doc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _removeIndent(self, block, count=1):\n return re.compile(r\"^%s\" % \" \" * count, re.M).sub(\"\", block)",
"def no_blank_line_before_section(): # noqa: D416",
"def cleanup (text) :\n l_idx = 1\n lines = text.split ('\\n')\n\n # count leading non-empty lines\n for line in lines :\n ... | [
"0.680498",
"0.6701334",
"0.66598743",
"0.6605212",
"0.6584745",
"0.6551506",
"0.6515333",
"0.6515333",
"0.6450854",
"0.6432937",
"0.64261633",
"0.63358784",
"0.63047516",
"0.6223274",
"0.61862534",
"0.6178748",
"0.61465275",
"0.6081182",
"0.6075254",
"0.60611284",
"0.6056478... | 0.0 | -1 |
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 that are True | 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 |
Get the globals and locals from the context that called the function calling this utility | def get_outer_namespaces() -> Tuple[Namespace, Namespace]:
frame = inspect.currentframe()
if frame:
frame = frame.f_back
if frame:
frame = frame.f_back
if frame:
return frame.f_globals or {}, frame.f_locals or {}
return {}, {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _globals(self):\n return self.__globals",
"def _globals(self):\n return self.dicts[0]._globals()",
"def get_locals_copy(self): # this function has none of its own testing because of its simplicity\r\n return copy.deepcopy(self.__locals) # a copy is made so no changes propagate after ... | [
"0.7126909",
"0.70749795",
"0.6588599",
"0.64831465",
"0.64696735",
"0.641567",
"0.641567",
"0.6341962",
"0.62831664",
"0.6276137",
"0.6208453",
"0.61867213",
"0.61179805",
"0.60883015",
"0.60871434",
"0.60588765",
"0.6055278",
"0.60106134",
"0.59320796",
"0.59216934",
"0.591... | 0.6058848 | 16 |
Return the repr() of objects, special casing types and tuples | def type_repr(tp) -> str:
from pheres._typing import JSONArray, JSONObject, JSONValue
if isinstance(tp, tuple):
return ", ".join(map(type_repr, tp))
if isinstance(tp, type):
if tp.__module__ == "builtins":
return tp.__qualname__
return f"{tp.__module__}.{tp.__qualname__}"
if tp is Ellipsis:
return "..."
if isinstance(tp, types.FunctionType):
return tp.__name__
if tp is JSONValue:
return "JSONValue"
if tp is JSONArray:
return "JSONArray"
if tp is JSONObject:
return "JSONObject"
return repr(tp) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repr_(object_):\n return repr(object_)",
"def srepr(obj):\n return repr(str(obj))",
"def __repr__(self):\n args = [self.name]\n if self.propertiesstr:\n args.append(self.propertiesstr)\n args = map(repr, args)\n return \"%s(%s)\" % (type(self).__name__, \", \".j... | [
"0.8332784",
"0.78937966",
"0.75630885",
"0.7542184",
"0.7537895",
"0.742508",
"0.74132067",
"0.73905313",
"0.7377104",
"0.7357532",
"0.7354382",
"0.73432785",
"0.7341196",
"0.73410344",
"0.73227936",
"0.72990686",
"0.7280281",
"0.7209942",
"0.72085506",
"0.7170564",
"0.71089... | 0.68930745 | 60 |
Return the module a class is defined in and its internal dictionary | def get_class_namespaces(cls: type) -> tuple[Namespace, Namespace]:
return inspect.getmodule(cls).__dict__, cls.__dict__ | {cls.__name__: cls} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def package(cls):\n packages = get_packages()\n return packages.modules.get(cls.__module__)",
"def get_module(self):\n module = self.__class__.__module__.split('.')\n module = \".\".join(module[:-1])\n module = module + \".\" + self._get_valid_version().module\n return m... | [
"0.69157815",
"0.6773888",
"0.6703994",
"0.65287757",
"0.6518478",
"0.65071523",
"0.6366935",
"0.6342283",
"0.62831765",
"0.6265868",
"0.62570673",
"0.62570673",
"0.62570673",
"0.62570673",
"0.62570673",
"0.6247467",
"0.62180054",
"0.6217983",
"0.6210674",
"0.6206586",
"0.619... | 0.5531724 | 89 |
Output a graph node (either LDPR or LDPRC) as RDF | def get(self):
ldpr_ref = URIRef(self.request.path_url)
response_graph = Graph()
# Retrieve nodes
if not (ldpr_ref, None, None) in self.graph:
return HTTPNotFound('There is no such resource')
# if we are an LDPC, set the required header
if (ldpr_ref, RDF.type, LDP.BasicContainer) in self.graph:
self.request.response.headers.add("Link", "<%s>; rel=\"type\"" % str(LDP.BasicContainer))
response_graph += self.graph.triples((ldpr_ref, None, None))
return ldpr_ref, response_graph | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rdf(self) -> Graph:\n if hasattr(self, '_rdf'):\n return self._rdf\n else:\n self._rdf = RDFConverter.networkx_to_rdf(self.graph)\n return self._rdf",
"def dump(node, ipython=True):\n if not networkx:\n warnings.warn(\"networkx not installed, unable to... | [
"0.5769815",
"0.5593721",
"0.5494644",
"0.5452146",
"0.54517037",
"0.54448456",
"0.5428613",
"0.53601456",
"0.53497463",
"0.5347197",
"0.53324276",
"0.5257516",
"0.52057976",
"0.5201444",
"0.51942897",
"0.51685774",
"0.5153099",
"0.514407",
"0.5123547",
"0.51227194",
"0.51203... | 0.5463999 | 3 |
Here we see if the user is logged in but let them stay on the page if they aren't. | def wrap(request, *args, **kwargs):
# Validates the JWT and returns its payload if valid.
jwt_payload = validate_request(request)
# If user is logged in, make sure they have a valid JWT
if request.user.is_authenticated and jwt_payload is None:
logger.debug('User ' + request.user.email + ' is authenticated but does not have a valid JWT. Logging them out.')
return logout_redirect(request)
# User has a JWT session open but not a Django session. Try to start a Django session and continue the request.
if not request.user.is_authenticated and jwt_payload is not None:
jwt_login(request, jwt_payload)
return function(request, *args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logged_in(request):\n return request.current_user is not None",
"def is_logged_in():\n return 'user' in session",
"def logged_in():\n\n if current_user.is_authenticated:\n return True\n\n return False",
"def logged_in(self):\n return self.auth.get_user_by_session() is not None",
"... | [
"0.7689214",
"0.7677227",
"0.76606345",
"0.75664586",
"0.72604287",
"0.7242234",
"0.7171064",
"0.71589804",
"0.71228325",
"0.7109075",
"0.71022576",
"0.7012894",
"0.6976459",
"0.6975053",
"0.6950378",
"0.69450337",
"0.6913456",
"0.68304163",
"0.68283975",
"0.6783991",
"0.6762... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.