query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Create a `cls` instance from an XML element. | def from_xml(cls, element):
# pylint: disable=E0213
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fromxml(cls, element):\n part_number = findtext(element, \"PartNumber\", True)\n etag = findtext(element, \"ETag\", True)\n etag = etag.replace('\"', \"\")\n tag = findtext(element, \"LastModified\")\n last_modified = None if tag is None else from_iso8601utc(tag)\n siz... | [
"0.71629417",
"0.70546263",
"0.6987409",
"0.6948026",
"0.6946067",
"0.6788164",
"0.6755769",
"0.6663605",
"0.65917945",
"0.6541199",
"0.6503784",
"0.63925076",
"0.6311076",
"0.62759715",
"0.62551534",
"0.6254706",
"0.61619365",
"0.6120973",
"0.6105214",
"0.60672516",
"0.60390... | 0.821316 | 0 |
Return the XML representation of the payload. | def as_xml(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_xml(self):\n return self.to_xml()",
"def XML(self):\n retval = ElementTree.tostring(self._root, \"UTF-8\")\n return retval.decode(\"utf-8\")",
"def to_xml(self):\n try:\n encoder = myapp[\"encoder\"][\"xml\"]\n return encoder.dumps(self.to_dict(), root=... | [
"0.7284809",
"0.69685256",
"0.69345564",
"0.6929446",
"0.688344",
"0.6867682",
"0.68518645",
"0.68144155",
"0.6756822",
"0.6504547",
"0.6500114",
"0.64205045",
"0.6413463",
"0.63951945",
"0.63906485",
"0.63848627",
"0.6316147",
"0.6305835",
"0.6255054",
"0.62436944",
"0.62421... | 0.691014 | 4 |
Return a deep copy of self. | def copy(self):
return deepcopy(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deepcopy(self):\n return copy.deepcopy(self)",
"def deepcopy(self):\n return self.clone()",
"def deepcopy(self):\n return deepcopy(self)",
"def deepcopy(self):\n return self.__copy__()",
"def Copy(self):\r\n\r\n return copy.deepcopy(self)",
"def copy(self):\r\n ... | [
"0.9053097",
"0.9012441",
"0.8998539",
"0.897203",
"0.8967435",
"0.8935903",
"0.89329165",
"0.89329165",
"0.89329165",
"0.89329165",
"0.89329165",
"0.89329165",
"0.89329165",
"0.89329165",
"0.89329165",
"0.89329165",
"0.89329165",
"0.89329165",
"0.89329165",
"0.89083886",
"0.... | 0.89028245 | 22 |
Initialize an `Iq` object. | def __init__(self, element = None, from_jid = None, to_jid = None,
stanza_type = None, stanza_id = None,
error = None, error_cond=None, return_path = None,
language = None):
# pylint: disable-msg=R0913
if stanza_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self._q = []",
"def __init__(self, iq, oq, *args, **kw):\n Process.__init__(self, *args, **kw)\n self.iq, self.oq = iq, oq",
"def __init__(self,q=None):\n if q is None:\n self.__q = np.zeros(4)\n self.__q[0] = 1.0;\n elif type(q) is... | [
"0.63485175",
"0.63072664",
"0.62139976",
"0.6205428",
"0.6124468",
"0.6088462",
"0.5980408",
"0.59666866",
"0.5948335",
"0.59470135",
"0.5942797",
"0.5893928",
"0.57990235",
"0.5790753",
"0.5761127",
"0.57297987",
"0.57164574",
"0.5690746",
"0.56885743",
"0.56746507",
"0.565... | 0.587749 | 12 |
Add an I/O handler to the loop. | def _add_io_handler(self, handler):
self._unprepared_handlers[handler] = None
self._configure_io_handler(handler) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_io_handler(self, handler):\r\n self._handlers.append(handler)",
"def _add_io_handler(self, handler):\r\n self.io_handlers.append(handler)\r\n if self.event_thread is None:\r\n return",
"def _add_io_handler(self, handler):\r\n raise NotImplementedError",
"def _a... | [
"0.7796812",
"0.76072687",
"0.74748707",
"0.7260224",
"0.67918897",
"0.6570407",
"0.6416844",
"0.63019097",
"0.63019097",
"0.6265556",
"0.6195804",
"0.6152603",
"0.6146711",
"0.6061227",
"0.6059251",
"0.58548915",
"0.5829751",
"0.57921815",
"0.5729095",
"0.57263845",
"0.56913... | 0.69120586 | 5 |
Add an I/O handler to the loop. | def _add_io_handler(self, handler):
self._unprepared_handlers[handler] = None
self._configure_io_handler(handler) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_io_handler(self, handler):\r\n self._handlers.append(handler)",
"def _add_io_handler(self, handler):\r\n self.io_handlers.append(handler)\r\n if self.event_thread is None:\r\n return",
"def _add_io_handler(self, handler):\r\n raise NotImplementedError",
"def _a... | [
"0.7796812",
"0.76072687",
"0.74748707",
"0.7260224",
"0.67918897",
"0.6570407",
"0.6416844",
"0.63019097",
"0.63019097",
"0.6265556",
"0.6195804",
"0.6152603",
"0.6146711",
"0.6061227",
"0.6059251",
"0.58548915",
"0.5829751",
"0.57921815",
"0.5729095",
"0.57263845",
"0.56913... | 0.69120586 | 4 |
Add an I/O handler to the loop. | def _add_io_handler(self, handler):
self._handlers.append(handler) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_io_handler(self, handler):\r\n self.io_handlers.append(handler)\r\n if self.event_thread is None:\r\n return",
"def _add_io_handler(self, handler):\r\n raise NotImplementedError",
"def _add_io_handler(self, handler):\r\n logger.debug('adding io handler: %r', hand... | [
"0.76072687",
"0.74748707",
"0.7260224",
"0.69120586",
"0.69120586",
"0.67918897",
"0.6570407",
"0.6416844",
"0.63019097",
"0.63019097",
"0.6265556",
"0.6195804",
"0.6152603",
"0.6146711",
"0.6061227",
"0.6059251",
"0.58548915",
"0.5829751",
"0.57921815",
"0.5729095",
"0.5726... | 0.7796812 | 0 |
Add an I/O handler to the loop. | def _add_io_handler(self, handler):
logger.debug('adding io handler: %r', handler)
self._unprepared_handlers[handler] = None
self._configure_io_handler(handler) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_io_handler(self, handler):\r\n self._handlers.append(handler)",
"def _add_io_handler(self, handler):\r\n self.io_handlers.append(handler)\r\n if self.event_thread is None:\r\n return",
"def _add_io_handler(self, handler):\r\n raise NotImplementedError",
"def _a... | [
"0.7796812",
"0.76072687",
"0.74748707",
"0.69120586",
"0.69120586",
"0.67918897",
"0.6570407",
"0.6416844",
"0.63019097",
"0.63019097",
"0.6265556",
"0.6195804",
"0.6152603",
"0.6146711",
"0.6061227",
"0.6059251",
"0.58548915",
"0.5829751",
"0.57921815",
"0.5729095",
"0.5726... | 0.7260224 | 3 |
Initialize a `Message` object. | def __init__(self, element = None, from_jid = None, to_jid = None,
stanza_type = None, stanza_id = None,
error = None, error_cond = None, return_path = None,
language = None,
subject = None, body = None, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, message=None):\n if isinstance(message, email.message.Message):\n self._become_message(copy.deepcopy(message))\n if isinstance(message, Message):\n message._explain_to(self)\n elif isinstance(message, bytes):\n self._become_message(em... | [
"0.77826244",
"0.766338",
"0.75096804",
"0.74071485",
"0.74071485",
"0.73935366",
"0.7363883",
"0.7333098",
"0.72804826",
"0.72804826",
"0.72804826",
"0.72804826",
"0.7149149",
"0.7071611",
"0.70590526",
"0.69592327",
"0.689895",
"0.689895",
"0.6886713",
"0.68715274",
"0.6871... | 0.67300755 | 34 |
Return the XML stanza representation. Always return an independent copy of the stanza XML representation, which can be freely modified without affecting the stanza. | def as_xml(self):
result = Stanza.as_xml(self)
if self._subject:
child = ElementTree.SubElement(result, self._subject_tag)
child.text = self._subject
if self._body:
child = ElementTree.SubElement(result, self._body_tag)
child.text = self._bo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_xml(self):\r\n result = Stanza.as_xml(self)\r\n if self._show:\r\n child = ElementTree.SubElement(result, self._show_tag)\r\n child.text = self._show\r\n if self._status:\r\n child = ElementTree.SubElement(result, self._status_tag)\r\n child.t... | [
"0.778164",
"0.72783905",
"0.7033873",
"0.6988454",
"0.69360745",
"0.681778",
"0.6636809",
"0.66172636",
"0.6589658",
"0.6584373",
"0.6523066",
"0.6370079",
"0.630986",
"0.61498964",
"0.61431605",
"0.6130844",
"0.6099465",
"0.60694265",
"0.6068434",
"0.60469735",
"0.6043545",... | 0.77953124 | 0 |
Return the XML stanza representation. Always return an independent copy of the stanza XML representation, which can be freely modified without affecting the stanza. | def as_xml(self):
result = Stanza.as_xml(self)
if self._show:
child = ElementTree.SubElement(result, self._show_tag)
child.text = self._show
if self._status:
child = ElementTree.SubElement(result, self._status_tag)
child.text = self._status
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_xml(self):\r\n result = Stanza.as_xml(self)\r\n if self._subject:\r\n child = ElementTree.SubElement(result, self._subject_tag)\r\n child.text = self._subject\r\n if self._body:\r\n child = ElementTree.SubElement(result, self._body_tag)\r\n ch... | [
"0.7794833",
"0.72778684",
"0.7032492",
"0.69882786",
"0.6935864",
"0.6816925",
"0.66350794",
"0.6614773",
"0.65879595",
"0.6582978",
"0.6521861",
"0.63668233",
"0.630915",
"0.61496264",
"0.6143114",
"0.6129317",
"0.60990155",
"0.6068373",
"0.60675627",
"0.604661",
"0.6042938... | 0.77811396 | 1 |
Get the password for user authentication. By default returns (None, None) providing no password. Should be overridden in derived classes unless only `check_password` functionality is available. | def get_password(self, username, acceptable_formats, properties):
# pylint: disable-msg=W0613
return None, None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_password(self) -> str:\n password = self.get_as_nullable_string(\"password\")\n password = password if not (password is None) else self.get_as_nullable_string(\"pass\")\n return password",
"def _get_password(self):\n return self._password",
"def get_password(self):\n ... | [
"0.7714081",
"0.764814",
"0.75506616",
"0.7518802",
"0.7420508",
"0.7420508",
"0.7420508",
"0.7420508",
"0.7420508",
"0.7420508",
"0.7420508",
"0.7420508",
"0.7420508",
"0.7420508",
"0.7420508",
"0.7420508",
"0.7420508",
"0.7420508",
"0.7420508",
"0.7420508",
"0.7420508",
"... | 0.6847253 | 70 |
Generate a random string for digest authentication challenges. The string should be cryptographicaly secure random pattern. | def default_nonce_factory():
return uuid.uuid4().hex.encode("us-ascii") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rand_str(self, string_len):\n return binascii.hexlify(os.urandom(string_len))",
"def random_password():\n return sha(urandom(40)).hexdigest()",
"def generateSecureRandomString(stringLength=50):\n password_characters = string.ascii_letters + string.digits\n return ''.join(secrets.choice(pas... | [
"0.7481696",
"0.7399529",
"0.7326121",
"0.72377354",
"0.72375065",
"0.7219344",
"0.71811956",
"0.7125243",
"0.7092424",
"0.7086328",
"0.70707446",
"0.7065956",
"0.70631313",
"0.7033004",
"0.7024341",
"0.7018969",
"0.70075226",
"0.69985276",
"0.69899863",
"0.6982911",
"0.69683... | 0.0 | -1 |
Initialize the `Reply` object. | def __init__(self, data = None):
self.data = data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, reply):\r\n super().__init__()\r\n self.reply = reply",
"def __init__(self, data):\r\n Reply.__init__(self, data)",
"def __init__(self, data):\r\n Reply.__init__(self, data)",
"def __init__(self, reason):\r\n Reply.__init__(self, None)\r\n self.rea... | [
"0.8057442",
"0.7809276",
"0.7809276",
"0.7532533",
"0.75269926",
"0.67951566",
"0.6291378",
"0.6213826",
"0.6145981",
"0.6100538",
"0.60491425",
"0.6048859",
"0.6042917",
"0.60231054",
"0.6018357",
"0.6007759",
"0.59252876",
"0.59190196",
"0.5904817",
"0.5890172",
"0.5854412... | 0.0 | -1 |
Initialize the `Success` object. | def __init__(self, properties = None, data = None):
# pylint: disable-msg=R0913
Reply.__init__(self, data)
if properties:
self.properties = properties
else:
self.properties = {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, success: str, error: str, no_result: str) -> None:\n self.success = success\n self.error = error\n self.no_result = no_result",
"def success_obj():\n return {\n 'success': True\n }",
"def __init__(self):\n self.success = 0\n self.failure = 0",
"def s... | [
"0.7342434",
"0.6742942",
"0.6650018",
"0.6504057",
"0.6502365",
"0.6174489",
"0.6174489",
"0.6174489",
"0.61642313",
"0.60983413",
"0.60774755",
"0.6066376",
"0.60232884",
"0.6016365",
"0.5971923",
"0.5952991",
"0.5946404",
"0.5935856",
"0.59064406",
"0.58893263",
"0.5809541... | 0.0 | -1 |
Initialize a `ClientAuthenticator` object. | def __init__(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\r\n ClientAuthenticator.__init__(self)\r\n self.username = None\r\n self.rspauth_checked = None\r\n self.response_auth = None\r\n self.authzid = None\r\n self.realm = None\r\n self.nonce_count = None\r\n self.in_properties = None",
"def ... | [
"0.74276584",
"0.69402266",
"0.6505786",
"0.64969105",
"0.634479",
"0.6282303",
"0.6217385",
"0.6202131",
"0.60683614",
"0.60468894",
"0.6008544",
"0.600455",
"0.5998414",
"0.5971519",
"0.5971519",
"0.5971519",
"0.5971519",
"0.5966774",
"0.5950823",
"0.5950823",
"0.59300786",... | 0.0 | -1 |
Prepare a string for quoting for DIGESTMD5 challenge or response. Don't add the quotes, only escape '"' and "\\" with backslashes. | def _quote(data):
data = data.replace(b'\\', b'\\\\')
data = data.replace(b'"', b'\\"')
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_quoted_string(string: str) -> str:\n return \"\\'{}\\'\".format(string)",
"def quote_and_escape(string):\n if ' ' in string or '\\n' in string:\n string = '\"%s\"' % string.replace('\"', '\\\\\"')\n return string",
"def escape_quotes(string):\n return string.replace(... | [
"0.7195315",
"0.6912759",
"0.6594256",
"0.65670997",
"0.6500204",
"0.6412781",
"0.64029956",
"0.63689315",
"0.63682425",
"0.6350406",
"0.634973",
"0.6325981",
"0.6309996",
"0.62857044",
"0.62666893",
"0.6218397",
"0.6178115",
"0.61632377",
"0.6154948",
"0.61224556",
"0.612215... | 0.6531623 | 4 |
The Normalize(str) function. This one also accepts Unicode string input (in the RFC only UTF8 strings are used). | def Normalize(str_):
# pylint: disable=C0103
if isinstance(str_, bytes):
str_ = str_.decode("utf-8")
return SASLPREP.prepare(str_).encode("utf-8") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(str_):\n if not str_:\n return \"\"\n\n translate_table = str_.maketrans(UNICODE)\n return str_.translate(translate_table).strip().casefold()",
"def normalize(unicode_str):\n # http://stackoverflow.com/a/1207479/358804\n # http://unicode.org/faq/normalization.html#2\n retur... | [
"0.8076808",
"0.79705817",
"0.75370204",
"0.75370204",
"0.7230666",
"0.721433",
"0.7089441",
"0.703894",
"0.7021863",
"0.6975122",
"0.6972857",
"0.6941876",
"0.6919027",
"0.6908992",
"0.6888369",
"0.6886621",
"0.6752221",
"0.6725511",
"0.6680581",
"0.6644561",
"0.6643167",
... | 0.7788397 | 2 |
Escape the ',' and '=' characters for 'a=' and 'n=' attributes. Replaces '=' with '=3D' and ',' with '=2C'. | def escape(data):
return data.replace(b'=', b'=3D').replace(b',', b'=2C') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def escapeAttr(text):\n\treturn '\"%s\"' % escapeText(text).replace('\"', r'"')",
"def escapeAttribute(data):\n return (saxutils.quoteattr(data))",
"def xml_esc_attr(text):\n\treturn '\"%s\"' % xml_esc_text(text).replace('\"', r'"')",
"def make_attributes_safe_sql_quotes(attrs):\n if attrs is n... | [
"0.62263715",
"0.62100136",
"0.60227036",
"0.5806653",
"0.576031",
"0.57354224",
"0.57156754",
"0.56648165",
"0.565084",
"0.5640626",
"0.5550708",
"0.5499478",
"0.5426724",
"0.54144096",
"0.5272438",
"0.52404124",
"0.51661587",
"0.51640886",
"0.5121102",
"0.50990206",
"0.5098... | 0.692618 | 0 |
Initialize a `SCRAMClientAuthenticator` object. | def __init__(self, hash_name, channel_binding):
ClientAuthenticator.__init__(self)
SCRAMOperations.__init__(self, hash_name)
self.name = "SCRAM-{0}".format(hash_name)
if channel_binding:
self.name += "-PLUS"
self.channel_binding = channel_binding
self.u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,password_manager):\n ClientAuthenticator.__init__(self,password_manager)\n self.username=None\n self.finished=None\n self.password=None\n self.authzid=None\n self.__logger=logging.getLogger(\"pyxmpp.sasl.PlainClientAuthenticator\")",
"def __init__(self)... | [
"0.69089264",
"0.68296415",
"0.63643044",
"0.6141606",
"0.606751",
"0.6049783",
"0.5979162",
"0.5936121",
"0.5904718",
"0.5806964",
"0.57495767",
"0.5714468",
"0.57099074",
"0.5707393",
"0.56985915",
"0.5681114",
"0.5678299",
"0.5649424",
"0.5637729",
"0.5628848",
"0.5621755"... | 0.6720763 | 2 |
Initialize a `SCRAMClientAuthenticator` object. | def __init__(self, hash_name, channel_binding, password_database):
ServerAuthenticator.__init__(self, password_database)
SCRAMOperations.__init__(self, hash_name)
self.name = "SCRAM-{0}".format(hash_name)
if channel_binding:
self.name += "-PLUS"
self.channel_bin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,password_manager):\n ClientAuthenticator.__init__(self,password_manager)\n self.username=None\n self.finished=None\n self.password=None\n self.authzid=None\n self.__logger=logging.getLogger(\"pyxmpp.sasl.PlainClientAuthenticator\")",
"def __init__(self)... | [
"0.69089264",
"0.68296415",
"0.6720763",
"0.63643044",
"0.6141606",
"0.606751",
"0.5979162",
"0.5936121",
"0.5904718",
"0.5806964",
"0.57495767",
"0.5714468",
"0.57099074",
"0.5707393",
"0.56985915",
"0.5681114",
"0.5678299",
"0.5649424",
"0.5637729",
"0.5628848",
"0.5621755"... | 0.6049783 | 6 |
Make a commandline option parser. The returned parser may be used as a parent parser for application argument parser. | def get_arg_parser(cls, settings = None, option_prefix = u'--',
add_help = False):
# pylint: disable-msg=R0914,R0912
parser = argparse.ArgumentParser(add_help = add_help,
prefix_chars = option_pre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_option_parser(parser):\n return parser",
"def make_parser():\n parser = argparse.ArgumentParser(\n description='Command and control software for the Sparkfun AVC.'\n )\n\n parser.add_argument(\n '--control-socket',\n dest='control_socket',\n help='The Unix domain... | [
"0.7835699",
"0.7569159",
"0.7528376",
"0.7425006",
"0.741406",
"0.74077964",
"0.7372862",
"0.7369556",
"0.7358634",
"0.73025876",
"0.72916555",
"0.728048",
"0.726114",
"0.7255367",
"0.7225123",
"0.7216682",
"0.7203094",
"0.717903",
"0.7155457",
"0.7130062",
"0.71102834",
"... | 0.6992053 | 44 |
Serialize the stanza into a Unicode XML string. | def serialize(self):
return serialize(self.get_xml()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_xml_string(self):\n binary = Etree.tostring(self._xml, encoding='utf8', method='xml')\n return binary.decode('utf-8')",
"def as_xml(self):\r\n result = Stanza.as_xml(self)\r\n if self._show:\r\n child = ElementTree.SubElement(result, self._show_tag)\r\n ch... | [
"0.6861126",
"0.67105246",
"0.6488491",
"0.6454883",
"0.633381",
"0.6288272",
"0.6240395",
"0.6238313",
"0.62094206",
"0.61780787",
"0.6136681",
"0.61294377",
"0.60978276",
"0.6041683",
"0.6020301",
"0.6005353",
"0.59933794",
"0.59809315",
"0.5931383",
"0.58900297",
"0.588375... | 0.60724616 | 13 |
Return the XML stanza representation. Always return an independent copy of the stanza XML representation, which can be freely modified without affecting the stanza. | def as_xml(self):
attrs = {}
if self._from_jid:
attrs['from'] = unicode(self._from_jid)
if self._to_jid:
attrs['to'] = unicode(self._to_jid)
if self._stanza_type:
attrs['type'] = self._stanza_type
if self._stanza_id:
attrs[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_xml(self):\r\n result = Stanza.as_xml(self)\r\n if self._subject:\r\n child = ElementTree.SubElement(result, self._subject_tag)\r\n child.text = self._subject\r\n if self._body:\r\n child = ElementTree.SubElement(result, self._body_tag)\r\n ch... | [
"0.7794833",
"0.77811396",
"0.7032492",
"0.69882786",
"0.6935864",
"0.6816925",
"0.66350794",
"0.6614773",
"0.65879595",
"0.6582978",
"0.6521861",
"0.63668233",
"0.630915",
"0.61496264",
"0.6143114",
"0.6129317",
"0.60990155",
"0.6068373",
"0.60675627",
"0.604661",
"0.6042938... | 0.72778684 | 2 |
Source JID of the stanza. | def from_jid(self): # pylint: disable-msg=E0202
return self._from_jid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_id(self):\n return self._source_id",
"def source_id(self):\n return self._source_id",
"def source_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"source_id\")",
"def source_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"source_id\")",
"def sour... | [
"0.6825135",
"0.6825135",
"0.6767661",
"0.6646331",
"0.6573294",
"0.6328691",
"0.6326963",
"0.62155867",
"0.62127036",
"0.6196658",
"0.61445457",
"0.61001617",
"0.6096522",
"0.6096522",
"0.6096522",
"0.6096522",
"0.6096522",
"0.6096522",
"0.6096522",
"0.60383135",
"0.6028181"... | 0.52515 | 75 |
Destination JID of the stanza. | def to_jid(self): # pylint: disable-msg=E0202
return self._to_jid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDestinationUid( self ):\n return self.dest_uid",
"def destination_arn(self) -> Optional[str]:\n return pulumi.get(self, \"destination_arn\")",
"def getDestination(self):\n return self.__destination",
"def get_destination(self):\n return self._destination",
"def destinatio... | [
"0.6459423",
"0.61723536",
"0.6129285",
"0.6096707",
"0.60863787",
"0.607986",
"0.6035301",
"0.5970603",
"0.595733",
"0.5953832",
"0.58692354",
"0.57775635",
"0.5744404",
"0.57195425",
"0.57195425",
"0.57033336",
"0.5702782",
"0.5696294",
"0.5631135",
"0.5598786",
"0.5576592"... | 0.5857682 | 11 |
Forcibly close the connection and clear the stream state. | def close(self):
self.transport.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n quiet_close(self.stream)\n quiet_shutdown(self.socket)\n quiet_close(self.socket)\n self.is_connected = False",
"def _close_stream(self):\r\n self.stream.close()\r\n if self.stream.transport in self._ml_handlers:\r\n self._ml_handlers.remove... | [
"0.8190199",
"0.7648749",
"0.7618388",
"0.7488816",
"0.744148",
"0.74231994",
"0.742091",
"0.74005175",
"0.73843414",
"0.7377109",
"0.73754054",
"0.7373276",
"0.7370141",
"0.7364372",
"0.73437935",
"0.73175186",
"0.7309884",
"0.73065937",
"0.7303243",
"0.7285463",
"0.72757775... | 0.0 | -1 |
Stop the server and client connections started. | def tearDown(self):
if self.server:
self.server.close()
if self.client:
self.client.close()
# pylint: disable=W0212
# reset the event queue
XMPPSettings._defs['event_queue'].default = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop(self):\n self.__stop_server()",
"def stop(self):\n for clients in self.client_list():\n clients.sock.close()\n self.server_socket.close()",
"def stop(self):\n if self.terminal:\n self.terminal.stop()\n if self.server:\n self.server.st... | [
"0.79069644",
"0.78491676",
"0.7829791",
"0.78288573",
"0.7823641",
"0.7802079",
"0.7724418",
"0.7724418",
"0.7709576",
"0.751072",
"0.7498649",
"0.74962616",
"0.73621213",
"0.7359998",
"0.7323121",
"0.72954464",
"0.7293695",
"0.7270499",
"0.727023",
"0.7196361",
"0.7175792",... | 0.0 | -1 |
Return the peer certificate. | def getpeercert(self):
with self.lock:
if not self._socket or self._tls_state != "connected":
raise ValueError("Not TLS-connected")
return get_certificate_from_ssl_socket(self._socket) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ssl_certificate(self):\n try:\n return self.connection.stream.socket.getpeercert()\n except ssl.SSLError:\n return None",
"def get_certificate(self, sock):\n certificate_binary_form = sock.getpeercert(True)\n return DER_cert_to_PEM_cert(certificate_binary... | [
"0.7992479",
"0.79499567",
"0.77959937",
"0.7536257",
"0.748386",
"0.73547125",
"0.73547125",
"0.7308444",
"0.7230954",
"0.7076733",
"0.69617283",
"0.671873",
"0.67080265",
"0.67080265",
"0.6651918",
"0.6651918",
"0.65270174",
"0.6501333",
"0.64653665",
"0.64561695",
"0.64561... | 0.829574 | 0 |
Return the end tag of the stream root element. | def emit_tail(self):
return u"</{0}:stream>".format(self._root_prefixes[STREAM_NS]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end(self, tag):\r\n self._level -= 1\r\n if self._level < 0:\r\n self._handler.stream_parse_error(u\"Unexpected end tag for: {0!r}\"\r\n .format(tag))\r\n return\r\n if self._level == 0:\r\n if ... | [
"0.72781754",
"0.70498824",
"0.68404704",
"0.6814382",
"0.6559069",
"0.64463305",
"0.6355991",
"0.6264945",
"0.61963284",
"0.6128222",
"0.60792947",
"0.60458773",
"0.6025308",
"0.6025095",
"0.6025095",
"0.6025095",
"0.6025095",
"0.6025095",
"0.59911644",
"0.5977467",
"0.59615... | 0.70475376 | 2 |
Split an element of attribute qname into namespace and local name. | def _split_qname(self, name, is_element):
if name.startswith(u"{"):
namespace, name = name[1:].split(u"}", 1)
if namespace in STANZA_NAMESPACES:
namespace = self.stanza_namespace
elif is_element:
raise ValueError(u"Element with no namespace: {0!r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_namespace(element):\n tag = element.tag\n match = re.match(r\"^{.*}\", tag)\n namespace = match.group(0)\n return namespace",
"def func_namespace_split(func_name):\n if math_namespace_separator not in func_name:\n return None, func_name\n\n toks = func_name.split(math_namespace_s... | [
"0.5419569",
"0.531835",
"0.5189261",
"0.51757854",
"0.5127663",
"0.50967157",
"0.50260997",
"0.49796194",
"0.49607098",
"0.4956887",
"0.49433973",
"0.49385607",
"0.49357304",
"0.49258482",
"0.48842773",
"0.4813308",
"0.47700134",
"0.47552633",
"0.47550535",
"0.47523144",
"0.... | 0.72561926 | 0 |
Do mapping of RFC 3454 C.1.2 space characters to ' '. | def c12_mapping(char):
if stringprep.in_table_c12(char):
return u" "
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_spaces(a):\n return a.translate({ord(c): None for c in \"\\n \"})",
"def _2space(value):\n return value.replace('_', ' ')",
"def space2_(value):\n return value.replace(' ', '_')",
"def text_normalize(text):\n return RE_SPACES.sub(\" \", text).strip()",
"def _prepstr(s):\n\n return ... | [
"0.67235684",
"0.67016405",
"0.664419",
"0.6370859",
"0.6344816",
"0.6324504",
"0.6311951",
"0.6259003",
"0.6256205",
"0.62122136",
"0.61978436",
"0.61810267",
"0.6153848",
"0.6153848",
"0.61492985",
"0.6146854",
"0.610808",
"0.60707855",
"0.6033596",
"0.6024557",
"0.60143584... | 0.6648086 | 2 |
This function computes the normalization constant psi. | def psi_mm(n, theta=None, phi=None):
rnge = np.array(range(2,n+1))
if theta is not None:
return np.prod((1-np.exp(-theta*rnge))/(1-np.exp(-theta)))
if phi is not None:
return np.prod((1-np.power(phi,rnge))/(1-phi))
theta, phi = mm.check_theta_phi(theta, phi) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(psi, x):\r\n N = len(x)\r\n s = sum([(psi[i][0][0] ** 2 + psi[i][1][0] ** 2) *\r\n (x[i + 1] - x[i]) for i in range(N - 1)])\r\n psi /= np.sqrt(s)",
"def normalise_x(self):\n x_s = self.mod_square_x(r=True) # Getting the mod square of the wave function\n norm = s... | [
"0.7517204",
"0.6879381",
"0.669918",
"0.6683363",
"0.6662619",
"0.66023296",
"0.6593201",
"0.62607914",
"0.62196064",
"0.6171999",
"0.6079477",
"0.6045278",
"0.6025385",
"0.6007326",
"0.60012996",
"0.59934086",
"0.5988193",
"0.5962655",
"0.5951041",
"0.593671",
"0.58956635",... | 0.0 | -1 |
Preprocess certain special keys to convert them from None values into empty containers, and to turn strings into arrays of strings. | def _preprocess(project_dict):
handlers = {
('on-run-start',): _list_if_none_or_string,
('on-run-end',): _list_if_none_or_string,
}
for k in ('models', 'seeds', 'snapshots'):
handlers[(k,)] = _dict_if_none
handlers[(k, 'vars')] = _dict_if_none
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_empty_values(raw):\n if isinstance(raw, dict):\n for k, v in raw.items():\n raw[k] = convert_empty_values(v)\n elif isinstance(raw, list):\n for i in range(len(raw)):\n raw[i] = convert_empty_values(raw[i])\n elif raw == \"\":\n raw = None\n\n retu... | [
"0.67300767",
"0.6273054",
"0.61621135",
"0.5975688",
"0.58788115",
"0.5866993",
"0.5849307",
"0.5792982",
"0.5727254",
"0.5702992",
"0.57021487",
"0.5686683",
"0.5684924",
"0.5663269",
"0.5626338",
"0.56250846",
"0.5607905",
"0.55811214",
"0.5578209",
"0.5485187",
"0.5480879... | 0.4903219 | 100 |
Returns Variable buffers of decorated layers. If set `include_sublayer` True, the Variable buffers created in sub layers will be added. | def buffers(self, include_sublayer=True):
buffers = collections.OrderedDict()
if self.is_method():
layer_instance = self._args[0]
if include_sublayer:
buffers = layer_instance.buffers()
names = [buffer.name for buffer in buffers]
bu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pc_output_buffers_full_var(self, *args):\n return _ncofdm_swig.add_cp_underlay_sptr_pc_output_buffers_full_var(self, *args)",
"def pc_output_buffers_full_var(self, *args):\n return _limesdr_swig.sink_sptr_pc_output_buffers_full_var(self, *args)",
"def pc_output_buffers_full_var(self, *args):\... | [
"0.56000656",
"0.5566768",
"0.55487204",
"0.5471422",
"0.5434114",
"0.5420403",
"0.5393174",
"0.5369774",
"0.5316252",
"0.53046817",
"0.5304037",
"0.53025705",
"0.5282859",
"0.52747583",
"0.5267983",
"0.5266305",
"0.5248074",
"0.5208904",
"0.5206087",
"0.52022666",
"0.5179454... | 0.7012323 | 0 |
Get the full order book. | def order_book(self, symbol):
res = self._get('/v1/book/{}'.format(symbol))
return res.json() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def get_orderbook(self, symbol, params={}):\n self.orderbook[symbol] = await self._fetch_orderbook(symbol, params=params)\n return self.orderbook[symbol]",
"def book(self):\n if self._book is None:\n self._book = self._load_book()\n return self._book",
"def get_book... | [
"0.7056522",
"0.7015114",
"0.6997101",
"0.6980318",
"0.6794848",
"0.6793609",
"0.66822255",
"0.6649289",
"0.659375",
"0.65848094",
"0.65268",
"0.65268",
"0.64695835",
"0.63729393",
"0.6341651",
"0.63222396",
"0.63099784",
"0.62540096",
"0.62493545",
"0.6241371",
"0.6104364",
... | 0.7146876 | 0 |
View your active orders. Returns | def active_orders(self):
payload = {
'request': '/v1/orders',
'nonce': self._nonce()
}
return self._post('/v1/orders', payload) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_orders(self):\n return self._post(\"open_orders/\", return_json=True)",
"def list(self, request):\n orders = Order.objects.all()\n customer = Customer.objects.get(user=request.auth.user)\n\n # Either send back all closed orders for the order history view, or the single open o... | [
"0.7443695",
"0.7189959",
"0.7114377",
"0.69183564",
"0.6823161",
"0.6742207",
"0.67066526",
"0.67006683",
"0.66370624",
"0.66185653",
"0.6566056",
"0.65615773",
"0.65486914",
"0.65486914",
"0.65481603",
"0.65112597",
"0.6463759",
"0.6454252",
"0.64422756",
"0.64206374",
"0.6... | 0.7778654 | 0 |
generate an initial random population of popSize numpy arrays of popDim dimensions which coordinates belong to [lowerBound,upperBound] population will be returned as a 2D numpy array, a line of which being the coordinates of one population member | def generateInitialPopulation(popSize,popDim,upperBound,lowerBound):
popRange = upperBound-lowerBound
pop2DArray = np.random.rand(popSize,popDim)
pop2DArray *= popRange
pop2DArray -= np.round(popRange/2) # to work on zero centered interval - COCO works on [-5;5] ?
return(pop2DArray) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_pop(pop_size, chrom_size):\n\n return np.random.randint(1, chrom_size + 1, (pop_size, chrom_size))",
"def gen_initial_population(sampleSpace, pop_size=100):\n i = [random.randrange(0, len(sampleSpace)) for _ in range(pop_size)]\n return [sampleSpace[0][i[x]] for x in range(pop_size - 1)] + [samp... | [
"0.72524136",
"0.7147152",
"0.67462367",
"0.6741831",
"0.6673304",
"0.6668335",
"0.6625607",
"0.6591838",
"0.65323406",
"0.6506432",
"0.6506432",
"0.6436362",
"0.64307",
"0.64286566",
"0.63675207",
"0.63624597",
"0.6320192",
"0.6234532",
"0.623331",
"0.62279624",
"0.61860096"... | 0.8063232 | 0 |
The recombination operator takes a certain number of parents and creates a predefined number of children by combining parts of the parents. To mimic the stochastic nature of evolution, a crossover probability is associated with this operator. | def recombination(P_,recom_rate=1.0,mu=1):
recom_Pop = np.zeros((0,P_.shape[1]))
size_recom = P_.shape[0]*recom_rate
sample = np.random.randint(P_.shape[0],size=int(size_recom)) #Permutation
for i in range(0,sample.shape[0]-1,2):
#Pick two individuals to recombine to generate offspring
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crossover(parents: list, recomb_prob: float, n: int) -> list:\n rnd = random.random() # picking a random number between 0 and 1\n index = random.randint(0, n-1)\n children = []\n if rnd <= recomb_prob:\n for i in range(0, 2):\n temp_children = []\n if index == 0:\n ... | [
"0.7197378",
"0.68263096",
"0.6610936",
"0.6423489",
"0.641853",
"0.6271675",
"0.6255599",
"0.62391055",
"0.6219841",
"0.6127003",
"0.6109825",
"0.60241497",
"0.59936327",
"0.5982473",
"0.59779507",
"0.596647",
"0.5966412",
"0.5959893",
"0.59269613",
"0.5919288",
"0.5902854",... | 0.6644292 | 2 |
Return colors for color map. Forget grey, since this is used for plotting things that dont count | def mikl2():
# List of all
allcls = [
mklcls['blue'],
mklcls['green'],
#mklcls['grey'],
mklcls['red'],
mklcls['purple'],
mklcls['dark blue'],
mklcls['orange'],
mklcls['pink'],
mklcls['light blue'],
mklcls['light green'],
mkl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_color_map():\n color_map = {\n 0: (255, 255, 255), # White\n 1: (0, 0, 255), # Blue\n 2: (0, 255, 255), # Turquoise\n 3: (0, 255, 0), # Green\n 4: (255, 255, 0), # Yellow\n ## 5: (255, 0, 0), # Red\n }\n return color_map",
"def get_colors():\n r... | [
"0.7714987",
"0.75866455",
"0.72730464",
"0.72498804",
"0.71987385",
"0.71476305",
"0.71067184",
"0.70957136",
"0.7073202",
"0.70242685",
"0.69645125",
"0.6893561",
"0.686516",
"0.6839429",
"0.6836933",
"0.6825293",
"0.6691538",
"0.6690065",
"0.6689418",
"0.6684051",
"0.66784... | 0.0 | -1 |
Return the previous clip in the track, or None if not found. wrap If set, will wrap from (N1) to 0 and vice versa. allow_gaps If unset, requires that clip slots must be contiguous. | def get_prev_clip(self, wrap=False, allow_gaps=True):
clips = self.track.clips
index = clips.index(self)
clip_range = []
for n in range(index, len(clips)):
if clips[n] is None:
if not allow_gaps:
break
else:
clip... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_next_clip(self, wrap=False, allow_gaps=True):\n clips = self.track.clips\n index = clips.index(self)\n clip_range = []\n for n in range(index, len(clips)):\n if clips[n] is None:\n if not allow_gaps:\n break\n else:\n ... | [
"0.7348537",
"0.5964371",
"0.5696197",
"0.54655683",
"0.5459049",
"0.5448376",
"0.5403463",
"0.52674603",
"0.52227086",
"0.52019227",
"0.51324564",
"0.5121793",
"0.5121052",
"0.5081472",
"0.50780344",
"0.5055455",
"0.50412786",
"0.5029571",
"0.5026602",
"0.5015063",
"0.500492... | 0.8659221 | 0 |
Return a JSON representation of this RegionPoolEntry | def to_json(self):
json_blob = {'address': self._address, 'label': self._label,
'weight': self._weight, 'serve_mode': self._serve_mode}
return json_blob | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _json(self):\n json_blob = {'region_code': self._region_code,\n 'pool': [entry.to_json() for entry in self._pool]}\n if self._autopopulate:\n json_blob['autopopulate'] = self._autopopulate\n if self._ep:\n json_blob['ep'] = self._ep\n if sel... | [
"0.7331331",
"0.6258348",
"0.62464094",
"0.62464094",
"0.62464094",
"0.62464094",
"0.62464094",
"0.62464094",
"0.62464094",
"0.62268955",
"0.61528194",
"0.6131658",
"0.6131658",
"0.6127381",
"0.61263496",
"0.6124879",
"0.61227816",
"0.6092199",
"0.6056229",
"0.6050605",
"0.60... | 0.624811 | 2 |
The current state of the region. | def status(self):
self._get()
return self._status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state(self):\r\n return self._state.state()",
"def state(self):\n return self._current_state",
"def state(self):\n\t\treturn self._state",
"def state(self):\n\t\treturn self._state",
"def state(self):\n\t\treturn self._state",
"def state(self):\n\t\treturn self._state",
"def state(sel... | [
"0.7608684",
"0.7608652",
"0.75289744",
"0.75289744",
"0.75289744",
"0.75289744",
"0.75190055",
"0.7474806",
"0.7466309",
"0.7462162",
"0.74355525",
"0.74355525",
"0.7434653",
"0.7433029",
"0.74325615",
"0.74325615",
"0.74325615",
"0.74211884",
"0.7420534",
"0.7407797",
"0.73... | 0.0 | -1 |
Indicates whether or not the service should automatically come out of failover when the IP addresses resume active status or if the service should remain in failover until manually reset. Must be one of 'Y' or 'N' | def auto_recover(self):
return self._auto_recover | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_autofailover(self):\n self.enable_autofailover_and_validate()\n self.sleep(5)\n self.failover_actions[self.failover_action](self)\n try:\n self.disable_autofailover_and_validate()\n except:\n pass",
"def should_scale_down_non_service_tasks(self) -... | [
"0.62751734",
"0.6124977",
"0.59693795",
"0.59693795",
"0.5952843",
"0.5910292",
"0.57269675",
"0.57169116",
"0.55631584",
"0.55607927",
"0.5522277",
"0.55103743",
"0.5466656",
"0.5466656",
"0.5441968",
"0.5438145",
"0.54325867",
"0.53906953",
"0.5384115",
"0.5384115",
"0.537... | 0.0 | -1 |
Time To Live in seconds of records in the service. Must be less than 1/2 of the Health Probe's monitoring interval. Must be one of 30, 60, 150, 300, or 450. | def ttl(self):
return self._ttl | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seconds_to_live(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"seconds_to_live\")",
"def seconds_to_live(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"seconds_to_live\")",
"def seconds_to_live(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"seconds... | [
"0.7368383",
"0.71538323",
"0.69402087",
"0.66214377",
"0.597174",
"0.59292024",
"0.5835444",
"0.57611674",
"0.5755632",
"0.5692636",
"0.56892854",
"0.5604728",
"0.56015015",
"0.56015015",
"0.5537166",
"0.55258745",
"0.5518095",
"0.5508126",
"0.5499195",
"0.548732",
"0.545806... | 0.0 | -1 |
Decodes a sequence given an initial state. Yields (1, 1, vocab_len) array with next predicted item from sequence. | def decode_sequence(self, state_value, target_seq, transform=lambda x: x,
maxlen=20):
yield transform(target_seq)
for i in range(maxlen):
output, h = self.infer_decoder_model.predict(
[target_seq, state_value])
sampled = transform(output)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _predict_from_seq(self, seq):\n # reformat input seq\n input_seq = np.zeros((1, self.encoder_seq_length))\n input_seq[0, :] = seq\n flag = 0\n prob = 1\n ans_partial = np.zeros((1, self.decoder_seq_length))\n # Add start token integer to end of ans_partial input... | [
"0.66349196",
"0.5861599",
"0.585964",
"0.5779995",
"0.57667595",
"0.5745393",
"0.56201863",
"0.5521515",
"0.5516747",
"0.545641",
"0.54508156",
"0.5446003",
"0.54390156",
"0.5431152",
"0.54192287",
"0.5405251",
"0.5397665",
"0.53745145",
"0.5310467",
"0.531001",
"0.52905446"... | 0.6925405 | 0 |
Converts (1, maxlen, src_vocab_len) array to list of lists of src_vocab items where the corresponding index is greater than zero. | def to_src_vocab(self, arr, maxlen):
out = []
for timestep in arr[0]:
out.append([self.src_vocab[i] for i in np.where(timestep > 0)[0]])
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_target_vocab(self, arr, maxlen):\n out = []\n for timestep in arr[0]:\n out.append(\n [self.target_vocab[i] for i in np.where(timestep > 0)[0]])\n return out",
"def vectorize_src(self, t, maxlen):\n\n seq = np.zeros((1, maxlen, len(self.src_vocab))... | [
"0.74023676",
"0.6227502",
"0.5652981",
"0.5606195",
"0.55824715",
"0.55483633",
"0.5510991",
"0.543828",
"0.54320025",
"0.5355912",
"0.53174615",
"0.53160185",
"0.5289677",
"0.52637935",
"0.5212626",
"0.52126086",
"0.51796246",
"0.5154427",
"0.51339835",
"0.5093711",
"0.5084... | 0.8381338 | 0 |
Converts (1, maxlen, src_vocab_len) array to list of lists of src_vocab items where the corresponding index is greater than zero. | def to_target_vocab(self, arr, maxlen):
out = []
for timestep in arr[0]:
out.append(
[self.target_vocab[i] for i in np.where(timestep > 0)[0]])
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_src_vocab(self, arr, maxlen):\n out = []\n for timestep in arr[0]:\n out.append([self.src_vocab[i] for i in np.where(timestep > 0)[0]])\n return out",
"def vectorize_src(self, t, maxlen):\n\n seq = np.zeros((1, maxlen, len(self.src_vocab)))\n for i, item in en... | [
"0.8380876",
"0.6227972",
"0.5656077",
"0.5608137",
"0.55838615",
"0.5549549",
"0.55113673",
"0.5439854",
"0.5432665",
"0.53572613",
"0.53198135",
"0.53180945",
"0.5290263",
"0.52654797",
"0.521488",
"0.52137357",
"0.5179711",
"0.5156377",
"0.5135098",
"0.5095969",
"0.508585"... | 0.7402328 | 1 |
Returns Redis client instance. | async def redis_client(create_redis_client, loop):
redis = await create_redis_client()
yield redis
redis.close()
await redis.wait_closed() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client(self) -> Redis:\n if self.__client__ is None:\n raise RuntimeError(\"Redis Plugin should be started\")\n\n return self.__client__",
"def getRedisClient(self) -> Redis:\n if self.redisClient is not None:\n self.logger.info(\"getting existing redis client\")\n ... | [
"0.8757167",
"0.87108254",
"0.83471197",
"0.83062714",
"0.8274346",
"0.80251217",
"0.801417",
"0.77957606",
"0.7707934",
"0.76743245",
"0.7576493",
"0.7480863",
"0.74183714",
"0.7276744",
"0.71836644",
"0.7059207",
"0.70008814",
"0.6926391",
"0.6837426",
"0.68213874",
"0.6815... | 0.6465029 | 35 |
Shows notification that no seasons be found | def show_no_seasons_notify(self):
dlg = xbmcgui.Dialog()
dialog = dlg.notification(
heading=self.get_local_string(string_id=30010),
message=self.get_local_string(string_id=30012),
icon=xbmcgui.NOTIFICATION_INFO,
time=self.notify_time)
return dialog | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def season_exists (self, title, season):\n title=re.sub(r'[?|$|!|:|#]',r'',title)\n if self.show_exists(title) == False:\n return False\n show_entry = self.db[self.series_label][title]\n return season in show_entry['seasons']",
"def get_season_game_stats(self):\n pas... | [
"0.64262974",
"0.6056678",
"0.5988311",
"0.58860713",
"0.58773744",
"0.5857466",
"0.5850264",
"0.58462685",
"0.58444893",
"0.571846",
"0.5684751",
"0.5672838",
"0.55089223",
"0.549776",
"0.54788107",
"0.5450211",
"0.5414654",
"0.53867716",
"0.5384338",
"0.53814894",
"0.534185... | 0.6817212 | 0 |
quantize image range to 0255 | def quantize(img, rgb_range):
pixel_range = 255 / rgb_range
img = np.multiply(img, pixel_range)
img = np.clip(img, 0, 255)
img = np.round(img) / pixel_range
return img | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(pix):\n return pix/255",
"def quantize_8(image):\n q8 = tf.image.convert_image_dtype(image, tf.uint8, saturate=True)\n return tf.cast(q8, tf.float32) * (1.0 / 255.0)",
"def normalize(img):\n return 2*img / 255 - 1",
"def scale255(sample):\n min = np.min(sample)\n max = np.max(samp... | [
"0.6870525",
"0.68155545",
"0.67959976",
"0.6769801",
"0.67604345",
"0.67265934",
"0.6675361",
"0.6638546",
"0.663388",
"0.6617494",
"0.65986305",
"0.65986305",
"0.6586041",
"0.65816945",
"0.6551318",
"0.655051",
"0.65437216",
"0.6537331",
"0.65078235",
"0.6455451",
"0.645014... | 0.81137615 | 0 |
Print, but to STDERR | def printe(*args):
print(*args, file=sys.stderr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def printToStderr(err):\r\n print(err, file=sys.stderr)",
"def StderrPrinter():\n return Printer(open_file=sys.stderr, closing=False)",
"def stderr_print (*args):\n sys.stderr.write(\" \".join(str(a) for a in args))\n sys.stderr.flush()",
"def errprint(msg):\n sys.stderr.write(msg)\n sys.st... | [
"0.8052095",
"0.7658578",
"0.7501537",
"0.74725246",
"0.7462673",
"0.7462673",
"0.7462673",
"0.7402737",
"0.7345976",
"0.72739345",
"0.7260366",
"0.7245286",
"0.722982",
"0.71405154",
"0.711515",
"0.70893216",
"0.7077812",
"0.7072047",
"0.70162076",
"0.70162076",
"0.701346",
... | 0.74271053 | 7 |
Returns the character length of the serialized elements of the given line. | def _line_length(line_elements):
return sum(len(e.serialized()) for e in line_elements) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_length(self):\n return len(self.line)",
"def buf_line_length(self):\n return len(self.buf_line)",
"def line_length(line, ellipsoid='WGS-84'):\n if line.geometryType() == 'MultiLineString':\n return sum(line_length(segment) for segment in line)\n\n return sum(\n vincen... | [
"0.7406211",
"0.6708577",
"0.6584101",
"0.6528748",
"0.6418195",
"0.6390377",
"0.6361263",
"0.6337405",
"0.6277107",
"0.6242903",
"0.6208753",
"0.61825305",
"0.6160599",
"0.61487323",
"0.6138705",
"0.6083721",
"0.6081321",
"0.6044085",
"0.6032181",
"0.6032181",
"0.6032181",
... | 0.8421798 | 0 |
Returns the ContentTypeRegistration for the passed object or type. Returns None if the content type registry is not found. | def get_info(obj_or_type):
if isinstance(obj_or_type, BaseContent):
type = obj_or_type.__class__.__name__.lower()
else:
type = obj_or_type
# CACHE
cache_key = "%s-info-%s" % (settings.CACHE_MIDDLEWARE_KEY_PREFIX, type)
result = cache.get(cache_key)
if result:
return resu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_content_object(self):\n from django.core.exceptions import ObjectDoesNotExist\n try:\n return self.get_content_type().get_object_for_this_type(pk=self.object_id)\n except ObjectDoesNotExist:\n return None",
"def get_content_object(self):\n from django.cor... | [
"0.60920846",
"0.60920846",
"0.5788202",
"0.5703761",
"0.56596637",
"0.56596637",
"0.5607598",
"0.55122036",
"0.54777133",
"0.5418269",
"0.5418269",
"0.53440976",
"0.53309506",
"0.52375036",
"0.52375036",
"0.52375036",
"0.5222685",
"0.5219006",
"0.51501733",
"0.5147886",
"0.5... | 0.6506279 | 0 |
Get the bucket name and key from the given path. | def get_bucket_and_key(s3_path):
s3_path = s3_path.replace('s3://', '')
s3_path = s3_path.replace('S3://', '') #Both cases
bucket, key = s3_path.split('/', 1)
return bucket, key | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bucket_and_key(s3_path):\n split_path = s3_path.replace('s3://', '').lstrip('/').split('/')\n bucket = split_path.pop(0)\n key = '/'.join(split_path)\n return bucket, key",
"def get_bucket_for_file_key(key):\n return S3.get_prefixed_bucket(key[0])",
"def get_bucket_and_path_from(full... | [
"0.8369398",
"0.7355212",
"0.7323273",
"0.71187294",
"0.70612156",
"0.69569516",
"0.69456875",
"0.66631985",
"0.65945935",
"0.6503301",
"0.6495474",
"0.6473295",
"0.6366807",
"0.6344928",
"0.6337907",
"0.63323563",
"0.63122314",
"0.62918293",
"0.62873876",
"0.62816143",
"0.62... | 0.82449776 | 1 |
Compute the Hausdorff distance. | def getHausdorff(testImage, resultImage):
# Hausdorff distance is only defined when something is detected
resultStatistics = sitk.StatisticsImageFilter()
resultStatistics.Execute(resultImage)
if resultStatistics.GetSum() == 0:
return float('nan')
# Edge detection is done by ORI... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetDirectedHausdorffDistance(self) -> \"double\":\n return _itkDirectedHausdorffDistanceImageFilterPython.itkDirectedHausdorffDistanceImageFilterIUC2IF2_GetDirectedHausdorffDistance(self)",
"def GetDirectedHausdorffDistance(self) -> \"double\":\n return _itkDirectedHausdorffDistanceImageFilterP... | [
"0.7496967",
"0.7426182",
"0.7421516",
"0.7400832",
"0.73971444",
"0.73798245",
"0.7354469",
"0.73528904",
"0.71148765",
"0.7089274",
"0.7052272",
"0.6934118",
"0.69198245",
"0.6885903",
"0.6883743",
"0.68795466",
"0.68186146",
"0.67731",
"0.67233396",
"0.65154827",
"0.647503... | 0.7045845 | 11 |
Draw the board on the canvas | def drawBoard( self ):
self.p2cup.create_oval(self.PAD, self.PAD, self.CUPW, 0.9*self.HEIGHT, width=2 )
binW = self.BOARDW/self.game.NCUPS
binH = self.HEIGHT/2
for j in [0, 1]:
for i in range(self.game.NCUPS):
self.cups[j][i].create_rectangle(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _draw_board(self) -> None:\r\n\t\tdisplay_width = self._display.winfo_width()\r\n\t\tdisplay_height = self._display.winfo_height()\r\n\t\t\r\n\t\tfor vertical in range(1, self._width + 1):\r\n\t\t\tself._display.create_line(\r\n\t\t\t\t(vertical / self._width) * display_width, \r\n\t\t\t\t0,\r\n\t\t\t\t(vertic... | [
"0.8223244",
"0.81682503",
"0.7988184",
"0.79777807",
"0.78614867",
"0.78069526",
"0.77929",
"0.7764194",
"0.77635974",
"0.7728534",
"0.7715318",
"0.77130765",
"0.7705157",
"0.76575834",
"0.76324624",
"0.76038027",
"0.7590333",
"0.75143236",
"0.7488885",
"0.74213964",
"0.7384... | 0.7155949 | 25 |
returns time in desired format | def format_time():
now = str(datetime.datetime.now())[:19]
today = str(date.today().strftime('%A %d %B %Y'))
return today + now[4:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_time():\n return datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')",
"def get_time(digits: list) -> str:\n return f\"{digits[0]}{digits[1]}:{digits[2]}{digits[3]}\"",
"def get_time(): \n now = datetime.datetime.now()\n time = now.strftime(\"%H:%M:%p\")\n return time",
"... | [
"0.80172086",
"0.7969704",
"0.7806815",
"0.78062725",
"0.771698",
"0.76793325",
"0.7645558",
"0.7644993",
"0.7644266",
"0.76178956",
"0.7616198",
"0.7593094",
"0.75845444",
"0.7547025",
"0.7533534",
"0.74394095",
"0.74324197",
"0.74290353",
"0.74194926",
"0.74138314",
"0.7408... | 0.69814277 | 59 |
Computes a gradient clipping coefficient based on gradient norm. | def clip_gradient(model, clip):
totalnorm = 0
for p in model.parameters():
modulenorm = p.grad.data.norm()
totalnorm += modulenorm ** 2
totalnorm = math.sqrt(totalnorm)
return min(1, GRADIENT_CLIP / (totalnorm + 1e-6)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clip_gradient(model, clip_norm):\n totalnorm = 0\n for p in model.parameters():\n if p.requires_grad:\n modulenorm = p.grad.data.norm()\n totalnorm += modulenorm ** 2\n totalnorm = np.sqrt(totalnorm)\n\n norm = clip_norm / max(totalnorm, clip_norm)\n for p in model.p... | [
"0.7836212",
"0.7804319",
"0.77903944",
"0.7747205",
"0.77204895",
"0.7684024",
"0.764317",
"0.694546",
"0.69100773",
"0.688157",
"0.68501526",
"0.66711706",
"0.6665553",
"0.65998656",
"0.6591527",
"0.6585156",
"0.65286523",
"0.65286523",
"0.65286523",
"0.65286523",
"0.651966... | 0.7734069 | 4 |
Set up test fixtures, if any. | def setUp(self):
self.synmd_model = MarkovGenerator(
transition_matrix=simple_model.transition_matrix,
backmapper=simple_model.backmapper
)
self.access_key = os.environ.get('MINIO_ACCESSKEY')
self.secret_key = os.environ.get('MINIO_SECRETKEY')
self.test... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self): #pylint: disable=invalid-name\n self.fixtures = '/test_graph/fixtures/hb_graph'",
"def setUp(self):\n self.create_test_users()\n self.create_test_task()",
"def add_fixtures(self, ctest):\n \n def test_setup(funct, fixtures):\n \... | [
"0.7820282",
"0.7730263",
"0.76256365",
"0.7492276",
"0.7426421",
"0.74075687",
"0.73904026",
"0.73814005",
"0.73814005",
"0.737521",
"0.73522615",
"0.7350451",
"0.7350451",
"0.734602",
"0.7304671",
"0.7287192",
"0.7269717",
"0.7251475",
"0.7251475",
"0.7248396",
"0.7230889",... | 0.0 | -1 |
Returns the User model that is active in this project. | def _get_user_model():
try:
return django_apps.get_model(appsettings.DEFAULT_CHILD_MODEL)
except ValueError:
raise ImproperlyConfigured(
"DEFAULT_CHILD_MODEL must be of the form 'app_label.model_name'")
except LookupError:
raise ImproperlyConfigured(
"DEFAULT_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_model(self):\n return self.auth.store.user_model",
"def user_model(self):\n return self.auth.store.user_model",
"def user(self):\n return User.get(self.user_id)",
"def user(self):\n u = self.user_info\n return self.user_model.get_by_id(u['user_id']) if u else None"... | [
"0.7588742",
"0.7588742",
"0.74332523",
"0.74299675",
"0.7358575",
"0.7224141",
"0.7153005",
"0.706975",
"0.70097864",
"0.69654673",
"0.6890928",
"0.68532395",
"0.6849263",
"0.68325156",
"0.6831588",
"0.6789088",
"0.6725618",
"0.6671305",
"0.6652773",
"0.6633488",
"0.66303813... | 0.6129819 | 68 |
Get the polymorphic `DEFAULT_CHILD_MODEL` instead of the `AUTH_USER_MODEL`. | def patch_get_user_model():
auth.get_user_model = _get_user_model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_user_model():\n try:\n return django_apps.get_model(appsettings.DEFAULT_CHILD_MODEL)\n except ValueError:\n raise ImproperlyConfigured(\n \"DEFAULT_CHILD_MODEL must be of the form 'app_label.model_name'\")\n except LookupError:\n raise ImproperlyConfigured(\n ... | [
"0.7697005",
"0.63872397",
"0.6284109",
"0.61935043",
"0.61935043",
"0.5797918",
"0.5732324",
"0.56712466",
"0.56712466",
"0.55966127",
"0.554249",
"0.55412525",
"0.55205786",
"0.54873115",
"0.54267216",
"0.5370964",
"0.5353486",
"0.5324158",
"0.5276239",
"0.5273899",
"0.5253... | 0.5204141 | 26 |
Returns True if and only if the list is full. | def is_full(self):
return self.length == len(self.the_array) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isFull(self) -> bool:\n if len(self.items) == self.size:\n return True\n return False",
"def full(self):\r\n return self.maxsize and len(self.list) >= self.maxsize or False",
"def is_full(self):\n return self.list_length >= len(self.the_array)",
"def is_full(self):\... | [
"0.860083",
"0.8560462",
"0.85539967",
"0.8195553",
"0.8158382",
"0.81294185",
"0.8090067",
"0.8083042",
"0.80144024",
"0.7999697",
"0.79816455",
"0.79445755",
"0.79387736",
"0.7908378",
"0.7907744",
"0.790554",
"0.79016155",
"0.78982985",
"0.7873758",
"0.7870561",
"0.7870253... | 0.7589422 | 41 |
Returns a list of language codes that can be used as a fallback to the given language | def get_fallback_languages(lang_code):
possible_lang_codes = []
# Check if this is a special-case
try:
possible_lang_codes.extend(LANG_INFO[lang_code]["fallback"])
except (KeyError, IndexError):
pass
# Convert region specific language codes into generic (eg fr-ca => fr)
generic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_supported_languages():\n return [code.replace(\"-\", \"_\") for code, name in settings.SUPPORTED_LANGUAGES]",
"def get_supported_languages():\n return [code.replace('-', '_') for code, name in settings.SUPPORTED_LANGUAGES]",
"def check_language(language):\n if isinstance(language, (list, tuple... | [
"0.74437904",
"0.7373921",
"0.72563297",
"0.7156904",
"0.7083243",
"0.70210826",
"0.6752997",
"0.674282",
"0.67389053",
"0.67186326",
"0.660518",
"0.65731484",
"0.6572232",
"0.65594614",
"0.65594614",
"0.64722735",
"0.64482",
"0.6394085",
"0.63323236",
"0.63067794",
"0.626258... | 0.82575065 | 0 |
Encodes a tree to a single string. | def serialize(self):
def serializeHelper(node):
if node.value is not None:
vals.append(str(node.label)+'<'+str(int(np.floor(node.value) + 1)))
serializeHelper(node.left)
serializeHelper(node.right)
else:
vals.append(s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encodeTree(self, tree, key):\n return self.encode(pickle.dumps(tree), key)",
"def serialize(self, root):\n if not root:\n return \"n\"\n s = \"\"\n stack = [root]\n while (stack):\n root = stack.pop(0)\n if root:\n s += str(ro... | [
"0.78278124",
"0.7515946",
"0.71304095",
"0.7053364",
"0.7031874",
"0.6999469",
"0.6999095",
"0.69672054",
"0.69332165",
"0.68838483",
"0.68657243",
"0.68548083",
"0.6809354",
"0.6801677",
"0.67984694",
"0.6773517",
"0.6766546",
"0.6754318",
"0.67507386",
"0.6745785",
"0.6664... | 0.6290921 | 52 |
Initialize an element view. | def __init__(
self,
*,
branding: Optional[Branding] = None,
styles: Optional[Styles] = None,
theme: Optional[str] = None,
terminology: Optional[Terminology] = None,
default_view: Optional[str] = None,
last_saved_view: Optional[str] = None,
view_sor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, view):\n self.view = view",
"def __init__(self):\n self.view = QtGui.QWidget()\n self.window = Ui_DetailsView()\n self.window.setupUi(self.view)\n self.extra_customization()\n self.view.resizeEvent = self.resize_elements",
"def __init__(self, model, ... | [
"0.6525687",
"0.6135648",
"0.6080955",
"0.60137886",
"0.5940239",
"0.5900303",
"0.58877885",
"0.5879866",
"0.57593924",
"0.5675229",
"0.56702185",
"0.5633039",
"0.5621923",
"0.5615857",
"0.55839115",
"0.55805707",
"0.55716604",
"0.5566366",
"0.55553716",
"0.55310357",
"0.5511... | 0.0 | -1 |
Calculate the circumradius and circumcenter of a triangle in R^3 | def _circumcircle(coords):
A, B, C = coords
a = A - C
b = B - C
def mag(x):
return (np.sqrt(x.dot(x)))
ab_diff = a - b
ab_cross = np.cross(a, b)
norm_ab_cross = mag(ab_cross)
r = (mag(a) * mag(b) * mag(ab_diff)) / (2 * norm_ab_cross)
centre = (np.cross(np.square(mag(a)) * b - np.square(mag(b)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _circumcircle(self):\n ax, ay = self.p1\n bx, by = self.p2\n cx, cy = self.p3\n d = (ax * (by - cy) + bx * (cy - ay) + cx * (ay - by)) * 2\n x = ((ax**2 + ay**2)*(by - cy) +\n (bx**2 + by**2)*(cy - ay) +\n (cx**2 + cy**2)*(ay - by)) / d\n y = ((... | [
"0.77017325",
"0.70718426",
"0.70180625",
"0.70180625",
"0.70180625",
"0.6880571",
"0.66574943",
"0.6629738",
"0.66064197",
"0.64930767",
"0.64618975",
"0.64119303",
"0.6299247",
"0.62516904",
"0.61901665",
"0.61735827",
"0.6151646",
"0.6124978",
"0.6119722",
"0.6106885",
"0.... | 0.6538828 | 9 |
The type of the resource. | def type(self) -> str:
return pulumi.get(self, "type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Type(self):\n return self.Resource.Type",
"def resource_type(self):\n return self._resource_type",
"def type(self) -> str:\n if len(self._resource_types) != 1:\n raise TypeError('Type needs to be specified manually, use .set or .add')\n return self._resource_types[0]"... | [
"0.906893",
"0.9009653",
"0.8694059",
"0.867721",
"0.85939527",
"0.8571768",
"0.8426089",
"0.8426089",
"0.8426089",
"0.8426089",
"0.81875676",
"0.7961872"
] | 0.0 | -1 |
Applies a binary threshold and converts all pixels to 0 or 1. | def ThresholdPixels(pixels, threshold=0.0001):
pixels[pixels < threshold] = 0
pixels[pixels >= threshold] = 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def binary(raw, threshold, positive=1, negative=None):\n if negative is None and negative != 0:\n _, result = cv2.threshold(raw, threshold, positive, cv2.THRESH_BINARY)\n else:\n temp = 2 if negative == 1 else 1\n _, result = cv2.threshold(raw, threshold, temp, cv2.THRESH_BINARY)\n ... | [
"0.7685123",
"0.7245233",
"0.71843314",
"0.7183434",
"0.7123349",
"0.7088655",
"0.69994706",
"0.6968079",
"0.69581026",
"0.69342965",
"0.6872673",
"0.6834237",
"0.68219656",
"0.6804983",
"0.6798122",
"0.6753377",
"0.6670101",
"0.6587696",
"0.65710276",
"0.65440696",
"0.653844... | 0.7071644 | 6 |
Return Palete for chosen colour scheme | def get_palette(self) -> Palette:
return Palette[self.colour_scheme.upper()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_peirce_colour_scheme():\n\n this_colour_map_object = pyplot.get_cmap('Blues')\n this_colour_norm_object = matplotlib.colors.BoundaryNorm(\n PEIRCE_SCORE_LEVELS, this_colour_map_object.N\n )\n\n rgba_matrix = this_colour_map_object(this_colour_norm_object(\n PEIRCE_SCORE_LEVELS\n ... | [
"0.6590326",
"0.6480379",
"0.6361726",
"0.6326573",
"0.6317559",
"0.6313446",
"0.630578",
"0.62124586",
"0.6209394",
"0.6169505",
"0.61610085",
"0.61267567",
"0.60805875",
"0.6080152",
"0.60427916",
"0.6040909",
"0.6023958",
"0.6015136",
"0.60098505",
"0.60060275",
"0.6001041... | 0.6293279 | 7 |
Set the colour palette name | def set_palette(self, palette: Palette) -> None:
self.colour_scheme = palette.name.lower() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_palette_name(self, palette):\n self.get_widget('palette_name').set_active(4)\n for i in range(len(PALETTES)):\n if palette == PALETTES[i]:\n self.get_widget('palette_name').set_active(i)",
"def on_palette_name_changed(self, combo):\n palette_index = combo.ge... | [
"0.7965564",
"0.7762254",
"0.72265756",
"0.6789006",
"0.67059225",
"0.6628395",
"0.65956104",
"0.6565819",
"0.6540578",
"0.6497098",
"0.64840883",
"0.6459816",
"0.61575747",
"0.60784745",
"0.60328037",
"0.59394854",
"0.59179324",
"0.5910753",
"0.5910148",
"0.59056747",
"0.587... | 0.73856163 | 2 |
Return a string representation of the model. | def __str__(self):
return self.title | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repr_model_(self):\n return str(self)",
"def __str__(self):\n\n return str(self.model)",
"def get_model_string(self):\n raise NotImplementedError()",
"def __repr__(self):\n s = '' \n s += 'Model Name: ' + self._name + '\\n'\n s += 'Machine Learning Model: ' + st... | [
"0.8600095",
"0.8424294",
"0.81065446",
"0.7959115",
"0.7924134",
"0.7875908",
"0.78395176",
"0.7820475",
"0.7746134",
"0.773111",
"0.7717091",
"0.7653143",
"0.7650092",
"0.7566454",
"0.7557256",
"0.7534633",
"0.75327915",
"0.7512848",
"0.7504779",
"0.74992156",
"0.7495425",
... | 0.0 | -1 |
Tests if Job persistence is working properly when manager is restarted | def test_persistence_works(manager_container_id):
# This test is here to ensure there will be more than 0 jobs registered
jobs = get_jobs(MANAGER_URL)
n_jobs = len(jobs)
assert n_jobs > 0
restart_container(manager_container_id)
assert n_jobs == len(get_jobs(MANAGER_URL))
delete_job(MANAGER... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_jut_kill_on_persistent_job(self):\n with temp_jut_tools_home():\n configuration = config.get_default()\n app_url = configuration['app_url']\n\n process = jut('config',\n 'add',\n '-u', 'jut-tools-user02',\n ... | [
"0.630606",
"0.618908",
"0.60248226",
"0.59804",
"0.590247",
"0.5898937",
"0.5840055",
"0.5784324",
"0.57743096",
"0.5766722",
"0.57498884",
"0.57293403",
"0.572623",
"0.57209843",
"0.5714742",
"0.5711773",
"0.5692063",
"0.5692063",
"0.5691958",
"0.5690394",
"0.5677461",
"0... | 0.8421915 | 0 |
The link to prioritized measurements for this GeneratingUnit. | def getAltGeneratingUnitMeas(self):
return self._AltGeneratingUnitMeas | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link(self):\n # type: () -> SrtStatisticLink\n return self._link",
"def _get_min_links(self):\n return self.__min_links",
"def _get_min_links(self):\n return self.__min_links",
"def unit_of_measurement(self):\n if self._state is None or self._attrs is None:\n return ... | [
"0.6556185",
"0.5516198",
"0.5516198",
"0.5479275",
"0.5453194",
"0.53676796",
"0.53601575",
"0.5358622",
"0.5298693",
"0.52890444",
"0.5207529",
"0.51975787",
"0.519054",
"0.5177244",
"0.51613027",
"0.51455164",
"0.51418966",
"0.51022476",
"0.5100287",
"0.5088189",
"0.507428... | 0.5594281 | 1 |
The generating unit specified for this control area. Note that a control area should include a GeneratingUnit only once. | def getGeneratingUnit(self):
return self._GeneratingUnit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getUnit(self):\n return self.__unit",
"def getUnit(self):\n return self._Unit",
"def unit(self):\n return self._unit",
"def unit(self):\n return self._unit",
"def unit(self):\n return self._unit",
"def unit(self) :\n\t\ttry :\n\t\t\treturn self._unit\n\t\texcept Exc... | [
"0.717516",
"0.70843136",
"0.7001416",
"0.7001416",
"0.7001416",
"0.67912704",
"0.6741134",
"0.6741134",
"0.6669892",
"0.6669892",
"0.65675974",
"0.6534624",
"0.64823645",
"0.646518",
"0.646518",
"0.6401286",
"0.63813406",
"0.6367131",
"0.6337258",
"0.62800854",
"0.6194829",
... | 0.8558766 | 0 |
Generate a shader set dictionary | def serialise_shaders(nodes):
valid_nodes = cmds.ls(
nodes,
long=True,
recursive=True,
showType=True,
objectsOnly=True,
type="transform"
)
meshes_by_id = {}
for mesh in valid_nodes:
shapes = cmds.listRelatives(valid_nodes[0],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setShaders(self):\n return []",
"def _setupShaders(self):\r\n if not haveShaders:\r\n return\r\n self._shaders={}\r\n self._shaders['mono++'] = shaders.compileProgram(shaders.vertSimple,\r\n shaders.bitsMonoModeFrag)\r\n self._shaders['color++'] = shad... | [
"0.64411986",
"0.6106591",
"0.56004256",
"0.55965424",
"0.5582288",
"0.5579794",
"0.55755657",
"0.54830825",
"0.54212266",
"0.53398454",
"0.5301982",
"0.53009194",
"0.5280473",
"0.52341896",
"0.52324116",
"0.52320004",
"0.5223066",
"0.5216237",
"0.51755637",
"0.5172778",
"0.5... | 0.65615994 | 0 |
Given a dictionary of `relationships`, apply shaders to meshes | def apply_shaders(relationships, namespace=None):
if namespace is not None:
# Append namespace to shader group identifier.
# E.g. `blinn1SG` -> `Bruce_:blinn1SG`
relationships = {
"%s:%s" % (namespace, shader): relationships[shader]
for shader in relationships
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialise_shaders(nodes):\n\n valid_nodes = cmds.ls(\n nodes,\n long=True,\n recursive=True,\n showType=True,\n objectsOnly=True,\n type=\"transform\"\n )\n\n meshes_by_id = {}\n for mesh in valid_nodes:\n shapes = cmds.listRelatives(valid_nodes[0],\... | [
"0.6449421",
"0.56670207",
"0.52863306",
"0.5285152",
"0.51868933",
"0.5184336",
"0.5167793",
"0.5160918",
"0.51111037",
"0.5011573",
"0.50039655",
"0.49594414",
"0.49406874",
"0.4901274",
"0.486846",
"0.48176372",
"0.48128375",
"0.47839206",
"0.47712752",
"0.4761187",
"0.472... | 0.82403237 | 0 |
In the backward pass we receive a Tensor containing the gradient of the loss with respect to the output, and we need to compute the gradient of the loss with respect to the input. | def backward(self, grad_output):
# TODO manually implement a backwards pass
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grad_backward(self, loss):\n raise NotImplementedError",
"def backward(self, loss_gradient: np.ndarray):\n\n delta_o = loss_gradient\n delta_h = (delta_o @ self.params[\"w_o\"]) * \\\n self.state[\"a_h\"] * (1. - self.state[\"a_h\"])\n delta_e = delta_h @ self.par... | [
"0.8026438",
"0.80105805",
"0.8009578",
"0.79289055",
"0.7897736",
"0.7815038",
"0.7810172",
"0.78011763",
"0.77996415",
"0.7792229",
"0.7777464",
"0.77574426",
"0.7647653",
"0.76465446",
"0.7623805",
"0.7612639",
"0.7564216",
"0.75615156",
"0.7543871",
"0.75285596",
"0.75127... | 0.70368993 | 74 |
r"""relu(input, inplace=False) > Tensor Applies the rectified linear unit function elementwise. | def p3relu(input, inplace=False):
# TODO Implement me
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relu(input, inplace=False):\n # type: (Tensor, bool) -> Tensor\n if not input.is_quantized:\n raise ValueError(\"Input to 'quantized.relu' must be quantized!\")\n if inplace:\n return torch.relu_(input)\n else:\n return torch.relu(input)",
"def ReLU(x):\n return tf.nn.relu(x... | [
"0.7436174",
"0.735809",
"0.7084679",
"0.686452",
"0.67918944",
"0.67866886",
"0.6690389",
"0.66896856",
"0.66520584",
"0.65456176",
"0.6497854",
"0.643792",
"0.63383615",
"0.62911665",
"0.6279818",
"0.6279761",
"0.62769717",
"0.6269987",
"0.625064",
"0.62364566",
"0.6184567"... | 0.72803026 | 2 |
In the backward pass we receive a Tensor containing the gradient of the loss with respect to the output, and we need to compute the gradient of the loss with respect to the input. | def backward(self, grad_output):
# TODO manually implement a backwards pass
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grad_backward(self, loss):\n raise NotImplementedError",
"def backward(self, loss_gradient: np.ndarray):\n\n delta_o = loss_gradient\n delta_h = (delta_o @ self.params[\"w_o\"]) * \\\n self.state[\"a_h\"] * (1. - self.state[\"a_h\"])\n delta_e = delta_h @ self.par... | [
"0.8026669",
"0.801048",
"0.80095613",
"0.792796",
"0.7897365",
"0.78142107",
"0.7809518",
"0.7800318",
"0.77974373",
"0.779163",
"0.7777049",
"0.7756648",
"0.76470226",
"0.76440537",
"0.762236",
"0.7612517",
"0.7563799",
"0.7560033",
"0.75435674",
"0.75283456",
"0.7511071",
... | 0.703636 | 75 |
Extract the labels into a vector of int64 label IDs. | def extract_labels(filename, num_images):
print('Extracting', filename)
with gzip.open(filename) as bytestream:
bytestream.read(8)
buf = bytestream.read(1 * num_images)
labels = np.frombuffer(buf, dtype=np.uint8).astype(np.int64)
return labels | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_label_ids(self, label: Union[str, List[str]]) -> List[int]:\n\n if not isinstance(label, list):\n label = list(label)\n\n for l in label:\n if l not in self.labels:\n raise ValueError(\n f\"{l} does not exist. Please make sure to select ... | [
"0.73698014",
"0.73419154",
"0.72276765",
"0.69705486",
"0.69696486",
"0.6937819",
"0.68297106",
"0.67489505",
"0.6719689",
"0.6534713",
"0.64945245",
"0.64776546",
"0.6472547",
"0.64319766",
"0.6431241",
"0.64216673",
"0.6397361",
"0.6387345",
"0.6356879",
"0.63131785",
"0.6... | 0.0 | -1 |
Test the check_default_rel_flag_on_entity method. | def test_check_default_rel_flag_on_entity(self):
self.parser._check_default_rel_flag_on_entity(
"relationshipB",
self.ontology_doc["relationshipB"]
)
self.assertEqual(list(self.graph), [])
self.parser._check_default_rel_flag_on_entity(
"relationshipA",... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_no_default(self):\n nd = NoDefault()\n self.assertEqual(bool(nd), False)",
"def test_user_data_current_employee_default_is_true(self):\n self.assertTrue(self.regular_user.user_data.current_employee)",
"def test_everything_is_default_manager(self):\r\n self.assertIs(\r\n ... | [
"0.5863228",
"0.5714065",
"0.5696896",
"0.56231076",
"0.56196237",
"0.5563246",
"0.5563246",
"0.55413413",
"0.55224",
"0.5443154",
"0.54395497",
"0.5436628",
"0.54293054",
"0.54023236",
"0.5372156",
"0.5358344",
"0.53460306",
"0.5336223",
"0.5335388",
"0.532662",
"0.53180075"... | 0.8198805 | 0 |
Test the set_inverse method of the YAML parser. | def test_set_inverse(self):
self.parser._set_inverse("relationshipA",
self.ontology_doc["relationshipA"])
self.parser._set_inverse("relationshipB",
self.ontology_doc["relationshipB"])
self.assertEqual(list(self.graph), [])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_deserialize_compound_user_inverse(tmpdir):\n\n yaml = \"\"\"\nmodel: !transform/concatenate-1.2.0\n forward:\n - !transform/shift-1.2.0\n inverse: !transform/shift-1.2.0 {offset: 5.0}\n offset: -10.0\n - !transform/shift-1.2.0 {offset: -20.0}\n \"\"\"\n buff = yaml_to_asdf(yaml)\n with ... | [
"0.67397124",
"0.63137555",
"0.60170346",
"0.59464705",
"0.5928202",
"0.5913128",
"0.58933276",
"0.5843095",
"0.5821505",
"0.5788467",
"0.57477045",
"0.5650653",
"0.55919063",
"0.55919063",
"0.5541579",
"0.5537553",
"0.55044675",
"0.54346406",
"0.534983",
"0.5343138",
"0.5296... | 0.7068988 | 0 |
Test the load_entity method of the YAML parser. | def test_load_entity(self):
# load class
name = "ClassA"
self.graph.parse(CUBA_FILE, format="ttl")
pre = set(self.graph)
self.parser._load_entity(name, self.ontology_doc[name])
iri = self.parser._get_iri(name)
self.assertEqual(set(self.graph) - pre, {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_yaml_loader(self):\n self.loader_test('obo_sample.yaml', Package, yaml_loader)",
"def test_parse_yaml(self) -> None:\n pass",
"async def test_load_entry(\n hass: HomeAssistant,\n load_int: ConfigEntry,\n) -> None:\n # 2 units times 4 entities (climate, binary_sensor, sensor, but... | [
"0.7055788",
"0.68661386",
"0.66346526",
"0.6358071",
"0.62895447",
"0.61949956",
"0.6141663",
"0.6081581",
"0.606741",
"0.60651433",
"0.6064641",
"0.5934626",
"0.5925849",
"0.58974683",
"0.58491355",
"0.5845411",
"0.5831735",
"0.58313775",
"0.5804561",
"0.57669574",
"0.57482... | 0.5416953 | 48 |
Test the split_name method of the YAML parser. | def test_split_name(self):
self.assertEqual(("a", "B"), self.parser.split_name("A.B"))
self.assertEqual(("a", "b"), self.parser.split_name("a.b"))
self.assertRaises(ValueError, self.parser.split_name, "B") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_split_run_name(self):\n self.assertEqual(split_run_name('140210_M00879_0031_000000000-A69NA'),\n ('140210','M00879','0031'))\n self.assertEqual(split_run_name('/mnt/data/140210_M00879_0031_000000000-A69NA'),\n ('140210','M00879','0031'))",
"d... | [
"0.656879",
"0.6050151",
"0.6002956",
"0.5901789",
"0.5891306",
"0.58420265",
"0.58221895",
"0.5810318",
"0.5778778",
"0.5698381",
"0.56880593",
"0.5669462",
"0.5567242",
"0.55543524",
"0.55335087",
"0.55227876",
"0.55227876",
"0.54745215",
"0.5456161",
"0.5404696",
"0.539001... | 0.7758913 | 0 |
Starting from the simplified example, I just need to check also the position of the two elements I am comparing. To do that I need to bring with me, in the sorted array, the original index. | def find_duplicates(alist, T, D):
# create array with (val,pos)
a = [(i[1], i[0]) for i in enumerate(l)]
# sort by val (lucky for us default look at the first element of the tuple)
# best sorting array are O(NlogN)
a.sort()
# traverse the array only one O(N), and compare both value and original ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _index(self):\n def index_cmp(a, b):\n if self._data[a][0] < self._data[b][0]:\n return -1\n if self._data[b][0] < self._data[a][0]:\n return 1\n if self._data[a][1] < self._data[b][1]:\n return -1\n if self._data[b... | [
"0.6893028",
"0.6629851",
"0.623646",
"0.6195421",
"0.61135584",
"0.6107629",
"0.6052549",
"0.601965",
"0.6004836",
"0.59671474",
"0.59506595",
"0.59474796",
"0.59364784",
"0.5933353",
"0.59312475",
"0.5902334",
"0.5890835",
"0.5858538",
"0.58568364",
"0.5844344",
"0.5836577"... | 0.0 | -1 |
Create an OFFFood instance from a dict or return updated existing instance. Does not save it | def load(cls, data, create=False):
treated_fields = cls.parse_api_fields(data)
# instance, created = cls.objects.update_or_create(code=code, defaults=treated_fields)
if create:
instance = cls.objects.create(**treated_fields)
else:
instances = cls.objects.filter(c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(cls, **dictionary):\n\n dummy_instance = cls(1, 1)\n dummy_instance.update(**dictionary)\n\n return dummy_instance",
"def create(cls, dictionary):\n return cls(**dictionary)",
"def create(cls, dictionary):\n return cls(**dictionary)",
"def from_dict(cls, data):\n... | [
"0.7484346",
"0.717682",
"0.717682",
"0.70960534",
"0.70850873",
"0.7068637",
"0.70601356",
"0.70398086",
"0.6892918",
"0.6795932",
"0.6785121",
"0.6776728",
"0.66744244",
"0.66478455",
"0.664486",
"0.66363895",
"0.66331285",
"0.66331285",
"0.66331285",
"0.66331285",
"0.66331... | 0.0 | -1 |
Return (json compliant) dict representation of the object ready for post to OFF API | def serialize_for_off_api(self):
serialized = {}
for field in self._meta.get_fields():
if getattr(self, field.name) is None:
continue
key = field.name
if "_100g" in key:
key = ("nutriment_%s" % key.replace("_100g", "").replace("_", "-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_representation(self):\n # convert object into parsable data\n self.setup_header()\n return {\n \"url\": self._url,\n \"method\": self._method,\n \"data\": self._payload,\n \"headers\": self._header,\n \"timeout\": self.timeout,\n ... | [
"0.74011326",
"0.71693337",
"0.7057705",
"0.705071",
"0.7008125",
"0.69888353",
"0.69371396",
"0.69128764",
"0.6898887",
"0.68879455",
"0.688075",
"0.6878248",
"0.68706584",
"0.68676424",
"0.68672085",
"0.68668383",
"0.68593043",
"0.6847754",
"0.6846168",
"0.68421406",
"0.682... | 0.0 | -1 |
Convert Python UTC datetime.datetime to Zope DateTime.DateTime | def datetime_tz(self, dt):
to_tz = tz.gettz(TZ)
dt = dt.replace(tzinfo=tz.gettz('UTC'))
return dt.astimezone(to_tz).strftime('%d.%m.%Y %H:%M:%Sh') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DateTime_to_datetime(Zope_DateTime):\n from DateTime.DateTime import DateTime\n naive = DateTime(str(Zope_DateTime).rsplit(' ', 1)[0])\n return naive.asdatetime()",
"def _toDateTime(dt):\n if dt is None:\n return None\n if type(dt) in [str, unicode]:\n # string\n dt = Date... | [
"0.73801786",
"0.6916388",
"0.68732166",
"0.67920715",
"0.66767836",
"0.66620326",
"0.664146",
"0.66339606",
"0.6632308",
"0.6628624",
"0.6606857",
"0.6596327",
"0.65905523",
"0.6588355",
"0.6534069",
"0.65237445",
"0.64845645",
"0.6476285",
"0.642093",
"0.6409946",
"0.640994... | 0.0 | -1 |
Convert with `dt` datetime string into a human readable representation using humanize module. | def human_readable_datetime(self, dt):
diff = datetime.datetime.utcnow() - dt
return humanize.naturaltime(diff) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def humanize_dt(dtime):\n return dtime.astimezone(LOCAL_TZ).strftime(HUMAN_FORMAT)",
"def dt_parser(dt):\n if isinstance(dt, datetime):\n return dt.isoformat()",
"def humanize_dt_ago(dtime):\n # and here we went through all the trouble to make everything\n # UTC and offset-aware. Le sigh. Th... | [
"0.72855026",
"0.64732015",
"0.64453465",
"0.6378065",
"0.62685376",
"0.61825657",
"0.6168263",
"0.60482824",
"0.5978011",
"0.5952457",
"0.59318763",
"0.5921399",
"0.5920116",
"0.5900642",
"0.58953667",
"0.58837545",
"0.58120143",
"0.5802569",
"0.57889706",
"0.5780737",
"0.57... | 0.7172423 | 1 |
Clear connector persistent log | def log_clear(self):
IPersistentLogger(self.context).clear()
msg = u'Log entries cleared'
self.context.plone_utils.addPortalMessage(msg)
return self.request.response.redirect(
'{}/connector-log'.format(self.context.absolute_url())) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_logs(self):\n self.out.clear_output()",
"def clear_logs(self):\n self.out.clear_output()",
"def clear():\n logs_buffer().clear()",
"def clear_logs():\n os.remove('logs/application.log')",
"def clear_log():\n date_reset = datetime.datetime.now() - timedelta(days=10)\n date_... | [
"0.7015235",
"0.7015235",
"0.68904984",
"0.6875501",
"0.6812915",
"0.6684815",
"0.6509235",
"0.6498989",
"0.64813405",
"0.64765704",
"0.64427185",
"0.64409894",
"0.63257843",
"0.6284923",
"0.6255255",
"0.6236442",
"0.62189096",
"0.62128305",
"0.6197391",
"0.6164229",
"0.61447... | 0.7458778 | 0 |
Calculate a Hermitte Gaussian Beam and return the complex amplitude. | def Hermitte_GaussianBeam(self, l=0, m=0, z=0, polar=False):
if not polar:
x = np.linspace(-self.WindowSize/2,self.WindowSize/2,self.N)
y = np.linspace(-self.WindowSize/2,self.WindowSize/2,self.N)
x,y = np.meshgrid(x,y)
r = np.sqrt(x**... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussian_flux(amplitude,sigma):\n\n flux = np.sqrt(2*np.pi) * sigma * amplitude\n\n return flux",
"def gaussian(x,amp,cen,wid):\n \n z = (x-cen)/wid \n return amp*np.exp(-z**2/2.)",
"def gaussian(x, xmean, sigma, amplitude):\r\n return amplitude * util.np.exp(-(x - xmean) ** 2. / (2. *... | [
"0.6730989",
"0.67271477",
"0.66315335",
"0.63341373",
"0.62640923",
"0.61718285",
"0.6165101",
"0.6157653",
"0.6120229",
"0.6104748",
"0.60187864",
"0.59492993",
"0.5920516",
"0.5899633",
"0.5866492",
"0.5861474",
"0.58562905",
"0.58270514",
"0.5813739",
"0.58071727",
"0.580... | 0.626972 | 4 |
Calculate a Laguerre Gaussian Beam in the z = 0 plane and return the complex amplitude. | def Laguerre_GaussianBeam(self, l=1, p=0, simple=True, polar = False):
if simple:
if not polar:
x = np.linspace(-self.WindowSize/2,self.WindowSize/2,self.N)
y = np.linspace(-self.WindowSize/2,self.WindowSize/2,self.N)
x... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussian(z,z0,s0):\n return ((z-z0)/s0)**2",
"def Glorz(x,mu,sig):\r\n return sig/((2*np.pi)*((x-mu)**2+(sig/2)**2))",
"def Hermitte_GaussianBeam(self, l=0, m=0, z=0, polar=False):\r\n \r\n if not polar:\r\n \r\n x = np.linspace(-self.WindowSize/2,self.WindowSi... | [
"0.6659478",
"0.65315825",
"0.6485569",
"0.64571446",
"0.631412",
"0.61907786",
"0.61579514",
"0.61134887",
"0.610492",
"0.6054432",
"0.6032774",
"0.6003102",
"0.59674406",
"0.5967264",
"0.59522027",
"0.59522027",
"0.5885346",
"0.58488035",
"0.583444",
"0.58169186",
"0.581575... | 0.5819109 | 19 |
Calculate a Airy gaussian beam and return the complex amplitude. | def Airy_Gaussian_beam(self, r0, a=0.05, b=0.3, TC=1, polar=False):
if not polar:
x = np.linspace(-self.WindowSize/2,self.WindowSize/2,self.N)
y = np.linspace(-self.WindowSize/2,self.WindowSize/2,self.N)
x,y = np.meshgrid(x,y)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussian(x,amp,cen,wid):\n \n z = (x-cen)/wid \n return amp*np.exp(-z**2/2.)",
"def gaussian(x, amp, cen, wid):\n return(amp/(np.sqrt(2*np.pi)*wid)) * np.exp(-(x-cen)**2 /(2*wid**2))",
"def test_GaussianBeamParams():\n gw=fresnel.FresnelWavefront(100*u.um,wavelength=830e-9)\n gw.propag... | [
"0.6960748",
"0.654563",
"0.65328205",
"0.6476031",
"0.64424264",
"0.63412416",
"0.62995684",
"0.6248348",
"0.6192699",
"0.61615413",
"0.6122943",
"0.6052391",
"0.604668",
"0.6045051",
"0.60170984",
"0.60061985",
"0.5995354",
"0.5955987",
"0.5921597",
"0.58918947",
"0.5865549... | 0.5987279 | 17 |
Calculate a single vorticity vortex beam and return the complex amplitude. | def single_vorticity(self, m=1, xn=0, yn=0, polar=False):
if not polar:
x = np.linspace(-self.WindowSize/2,self.WindowSize/2,self.N)
y = np.linspace(-self.WindowSize/2,self.WindowSize/2,self.N)
x,y = np.meshgrid(x,y)
r = np.sqrt(x**2+y... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plane_wave_energy_in_volume(volume, refractive_index, amplitude=1.0):\n return refractive_index**2*constants.epsilon_0*amplitude**2*volume/4.0\n #Z0 = np.sqrt( constants.mu_0 / constants.epsilon_0 )\n #print(volume,refractive_index,Z0)\n #poynting_constant = 0.5*refractive_index/(Z0)\n #return p... | [
"0.6374931",
"0.6050345",
"0.60273856",
"0.5981641",
"0.5926755",
"0.58976156",
"0.58146936",
"0.57226723",
"0.57002693",
"0.56901485",
"0.56732446",
"0.56599414",
"0.56235814",
"0.5619982",
"0.5604073",
"0.55933243",
"0.55918014",
"0.553301",
"0.5521225",
"0.55026567",
"0.54... | 0.0 | -1 |
3x3 convolution with padding | def conv3x3(in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv3x3(in_planes, out_planes, stride=1, padding=1, groups=1, dilation=1, zero_init=False):\n conv = nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=padding, groups=groups, bias=False, dilation=dilation)\n if zero_init:\n conv.weight.data.zero_()\n return conv",
"def co... | [
"0.73706514",
"0.7335249",
"0.7216377",
"0.72037584",
"0.72037584",
"0.7199952",
"0.7192902",
"0.7183875",
"0.7178802",
"0.7172082",
"0.71645725",
"0.71645725",
"0.716185",
"0.7156602",
"0.7156602",
"0.7156602",
"0.7156602",
"0.7156602",
"0.7156602",
"0.7156602",
"0.7156602",... | 0.7081058 | 60 |
returns 'saturation' and 'value' for i) normal HSV and ii) modified HSV | def saturation_value(r,g,b):
saturation = []
value = []
for i in range(len(b)):
# normal HSV
HSV = colorsys.rgb_to_hsv(r[i],g[i],b[i])
# modified SV
sv = modified_HSV(r[i],g[i])
# jobs a goodun
saturation.append((HSV[1],sv[0]))
value.append((HSV[2],sv[1]))
return(saturation, valu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_saturation_hsv(self, change):\n return self.__change_sat(change, self.to_hsv, self.from_hsv)",
"def TintImageSaturation(saturation):\n\t\t\ttemp = image_file_dict['image_file']\n\n\t\t\tprint(temp)\n\n\t\t\tif len(temp.shape) == 3:\n\n\t\t\t\thsv = rgb2hsv(temp)\n\t\t\t\thsv[:, :, 1] = saturati... | [
"0.7154518",
"0.70735246",
"0.69123673",
"0.69027257",
"0.68190306",
"0.64484245",
"0.6400444",
"0.6388021",
"0.6370953",
"0.6365688",
"0.6318016",
"0.6276992",
"0.6260603",
"0.6251361",
"0.6224957",
"0.6146321",
"0.6134959",
"0.6105162",
"0.6095383",
"0.6088155",
"0.60444254... | 0.73713696 | 0 |
Downsample layer support `max`, `avg`, `conv` | def downsample_block(
nc, downs_factor=2, pool_type='max',
bias=False, pad_type='reflect',
norm_type=None, act_type=None):
conv = conv_block(nc, nc, 3, bias=bias,
pad_type=pad_type, norm_type=norm_type, act_type=act_type)
if pool_type == 'max':
p = nn.MaxPoo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _downsample(self, net: Tensor) -> Tensor:\n\n return MaxPooling2D(pool_size=(2, 2))(net)",
"def _downsampling(\n args,\n input_layer, \n filter_size, \n dropout, \n max_pool\n ):\n conv = tf.keras.layers.Conv2D(filter_size, kernel_size = 3, padding = 's... | [
"0.70218563",
"0.6807103",
"0.64779073",
"0.6461096",
"0.62203133",
"0.6165216",
"0.6165216",
"0.6159216",
"0.61143583",
"0.60779417",
"0.6045065",
"0.6045065",
"0.60169894",
"0.6014621",
"0.59841615",
"0.5984052",
"0.5975552",
"0.59356964",
"0.5916846",
"0.5913407",
"0.58482... | 0.58820224 | 20 |
Determine if a basic authorization header is valid | def basic_auth(request):
auth_header = request.headers.get("Authorization")
if not auth_header or not auth_header.startswith("Basic "):
return None
auth_decoded = base64.b64decode(auth_header[6:]).decode()
username, password = auth_decoded.split(":")
try:
principal = Principal.obje... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_basic_auth(req, user, passwd):\n\n auth = req.authorization\n return auth and auth.username == user and auth.password == passwd",
"def check_auth_header_secret():\n return True\n # bearer_header = request.headers.get('Authorization')\n # return 'bearer ' + app.config.get('SECRET_KEY') ==... | [
"0.7207748",
"0.70527124",
"0.6973976",
"0.6852004",
"0.6836625",
"0.6813186",
"0.6788343",
"0.67824864",
"0.6778127",
"0.67377365",
"0.6718519",
"0.6659104",
"0.6651629",
"0.6605953",
"0.6601217",
"0.6561836",
"0.65516233",
"0.6466453",
"0.64580864",
"0.6453744",
"0.6410113"... | 0.0 | -1 |
Get the color of the shape. | def get_color(self) -> str:
return self._color | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_color(self):\n return self._color",
"def get_color(self):\n return self._color",
"def get_color(self):\n return self._color",
"def get_color(self):\n return self.color",
"def get_color(self):\n\n return self._color;",
"def get_color(self) -> tuple:\n retu... | [
"0.8009849",
"0.8009849",
"0.8009849",
"0.7938529",
"0.7887889",
"0.7772893",
"0.7708929",
"0.7708929",
"0.7708651",
"0.7676137",
"0.7673057",
"0.7669546",
"0.7669546",
"0.7610319",
"0.75444925",
"0.75444925",
"0.75444925",
"0.75444925",
"0.7426827",
"0.73225886",
"0.73107105... | 0.7466423 | 19 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.