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 |
|---|---|---|---|---|---|---|
check if article is added by the session user | def can_modify(article):
return authenticated() and article.adder_id == session['user_id'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_func(self):\r\n post = self.get_object()\r\n if self.request.user == post.author:\r\n return True\r\n return False",
"def test_func(self):\r\n post = self.get_object()\r\n if self.request.user == post.author:\r\n return True\r\n return Fals... | [
"0.65675294",
"0.65675294",
"0.65675294",
"0.6563369",
"0.6560343",
"0.6532734",
"0.6337611",
"0.63197154",
"0.63197154",
"0.6307368",
"0.6291594",
"0.6291594",
"0.6236001",
"0.6236001",
"0.61765856",
"0.6123823",
"0.6075838",
"0.6058549",
"0.6052112",
"0.603839",
"0.60289055... | 0.67515343 | 0 |
JSON route return all articles | def get_articles():
_, articles = base_query(db_session)
return jsonify([p.serialize for p in articles]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, request):\n query = Article.objects.exclude(in_menu=True)\n\n article_filter = Q()\n searchable_paths = {}\n\n search_terms = [term for term in request.GET.get(\"query\").split(\" \")]\n for term in search_terms:\n searchable_paths[term] = Q(headline__ico... | [
"0.76428914",
"0.73714584",
"0.730595",
"0.7252955",
"0.7145002",
"0.71417636",
"0.71103233",
"0.7039124",
"0.7034439",
"0.69309026",
"0.69119483",
"0.68383425",
"0.6713291",
"0.6712339",
"0.6666729",
"0.66575736",
"0.6650189",
"0.66353476",
"0.6623531",
"0.66136116",
"0.6601... | 0.72775084 | 3 |
Make a TVM array from a numpy array. | def convert_array(self, v, t): # pragma: no cover
return relay.const(tvm.ndarray.array(v, self.context)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_array(self, v, t):\n return interpreter.TensorValue(tvm.ndarray.array(v, self.context))",
"def numpyTovtkDataArray(array, name=\"numpy_array\", array_type=None):\n vtkarray = numpy_support.numpy_to_vtk(array, array_type=array_type)\n vtkarray.SetName(name)\n return vtkarray",
"def n... | [
"0.71418154",
"0.67676306",
"0.67488146",
"0.6744",
"0.67353344",
"0.6666639",
"0.654026",
"0.64258605",
"0.6314872",
"0.62857133",
"0.62700635",
"0.6207249",
"0.6197825",
"0.61536616",
"0.61488956",
"0.6125124",
"0.61029273",
"0.60561687",
"0.6054449",
"0.6029422",
"0.602725... | 0.6758016 | 2 |
Convert the scalar to a TVM array. | def convert_scalar(self, v, t):
return relay.const(v, type_to_np_dtype(t)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_array(self, v, t):\n return interpreter.TensorValue(tvm.ndarray.array(v, self.context))",
"def convert_array(self, v, t):\n return v.asnumpy()",
"def convert_array(self, v, t): # pragma: no cover\n return relay.const(tvm.ndarray.array(v, self.context))",
"def t2np(v):\n ... | [
"0.7701706",
"0.7496901",
"0.7442912",
"0.7051381",
"0.69589496",
"0.679737",
"0.64386696",
"0.643446",
"0.63496083",
"0.6335184",
"0.63239425",
"0.63034874",
"0.6299254",
"0.62725425",
"0.6254344",
"0.6245925",
"0.62162405",
"0.6200133",
"0.61681616",
"0.6161573",
"0.6142880... | 0.5685143 | 67 |
Convert the scalar to a TVM array. | def convert_bool(self, v, t):
return relay.const(v, type_to_np_dtype(t)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_array(self, v, t):\n return interpreter.TensorValue(tvm.ndarray.array(v, self.context))",
"def convert_array(self, v, t):\n return v.asnumpy()",
"def convert_array(self, v, t): # pragma: no cover\n return relay.const(tvm.ndarray.array(v, self.context))",
"def t2np(v):\n ... | [
"0.770447",
"0.7498832",
"0.74453515",
"0.7054694",
"0.6960214",
"0.67985827",
"0.64379007",
"0.6432308",
"0.6348519",
"0.6334958",
"0.63245773",
"0.6303826",
"0.629935",
"0.6271294",
"0.6254539",
"0.6245002",
"0.6214389",
"0.6200251",
"0.6170424",
"0.6160929",
"0.6141828",
... | 0.0 | -1 |
Return the value for a node. | def ref(self, node):
return self.node_map[node] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value(self):\n return self.node_value",
"def get_node_value(self, n):\n node = self.get_node(n)\n if node:\n return node.value",
"def get_node_value(node: Node):\n if node.type != 'Const':\n raise Exception('Can\\'t get value for non-constant node {}'.format(node.n... | [
"0.8601973",
"0.8556735",
"0.80245584",
"0.77859634",
"0.77855194",
"0.7752846",
"0.7722371",
"0.7722371",
"0.7512131",
"0.72803754",
"0.722555",
"0.722555",
"0.7175926",
"0.7140032",
"0.71315473",
"0.7055834",
"0.7049485",
"0.70054674",
"0.6980659",
"0.69745415",
"0.69719213... | 0.0 | -1 |
Make a TVM array from a numpy array. | def convert_array(self, v, t):
return interpreter.TensorValue(tvm.ndarray.array(v, self.context)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def numpyTovtkDataArray(array, name=\"numpy_array\", array_type=None):\n vtkarray = numpy_support.numpy_to_vtk(array, array_type=array_type)\n vtkarray.SetName(name)\n return vtkarray",
"def convert_array(self, v, t): # pragma: no cover\n return relay.const(tvm.ndarray.array(v, self.context))",
... | [
"0.67676306",
"0.6758016",
"0.67488146",
"0.6744",
"0.67353344",
"0.6666639",
"0.654026",
"0.64258605",
"0.6314872",
"0.62857133",
"0.62700635",
"0.6207249",
"0.6197825",
"0.61536616",
"0.61488956",
"0.6125124",
"0.61029273",
"0.60561687",
"0.6054449",
"0.6029422",
"0.6027257... | 0.71418154 | 0 |
Convert the scalar to a TVM array. | def convert_scalar(self, v, t):
return relay_from_scalar(v, type_to_np_dtype(t)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_array(self, v, t):\n return interpreter.TensorValue(tvm.ndarray.array(v, self.context))",
"def convert_array(self, v, t):\n return v.asnumpy()",
"def convert_array(self, v, t): # pragma: no cover\n return relay.const(tvm.ndarray.array(v, self.context))",
"def t2np(v):\n ... | [
"0.77028644",
"0.7498151",
"0.7444269",
"0.7053144",
"0.6959375",
"0.67976755",
"0.6440333",
"0.64342535",
"0.6350386",
"0.63362974",
"0.63252753",
"0.6303845",
"0.63004553",
"0.6273109",
"0.6253934",
"0.62466145",
"0.6216596",
"0.62015337",
"0.61696815",
"0.61627567",
"0.614... | 0.61184096 | 24 |
Convert the scalar to a TVM array. | def convert_bool(self, v, t):
return relay_from_scalar(v, type_to_np_dtype(t)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_array(self, v, t):\n return interpreter.TensorValue(tvm.ndarray.array(v, self.context))",
"def convert_array(self, v, t):\n return v.asnumpy()",
"def convert_array(self, v, t): # pragma: no cover\n return relay.const(tvm.ndarray.array(v, self.context))",
"def t2np(v):\n ... | [
"0.7701706",
"0.7496901",
"0.7442912",
"0.7051381",
"0.69589496",
"0.679737",
"0.64386696",
"0.643446",
"0.63496083",
"0.6335184",
"0.63239425",
"0.63034874",
"0.6299254",
"0.62725425",
"0.6254344",
"0.6245925",
"0.62162405",
"0.6200133",
"0.61681616",
"0.6161573",
"0.6142880... | 0.0 | -1 |
Returns the Domain Constraints property. | def properties(self, gid, sid, did, scid, doid, coid):
SQL = render_template("/".join([self.template_path,
self._PROPERTIES_SQL]),
doid=doid, coid=coid)
status, res = self.conn.execute_dict(SQL)
if not status:
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_constraints(self):\n return self.constraints",
"def constraints(self):\n return self._constraints",
"def constraints(self):\n return self._constraints",
"def get_constraint_list(self):\n constraints = []\n for i in xrange(self.num_repeats):\n # Using star... | [
"0.7092082",
"0.7061821",
"0.7061821",
"0.63417745",
"0.6274486",
"0.615007",
"0.6133616",
"0.61052185",
"0.61004084",
"0.6094774",
"0.60611075",
"0.6055215",
"0.6030728",
"0.6020534",
"0.5930369",
"0.5877718",
"0.586928",
"0.5865302",
"0.577572",
"0.577349",
"0.5773422",
"... | 0.0 | -1 |
Returns the SQL for the Domain Constraint object. | def sql(self, gid, sid, did, scid, doid, coid=None):
# Get Schema and Domain.
schema, domain = self._get_domain(doid)
SQL = render_template("/".join([self.template_path,
self._PROPERTIES_SQL]),
doid=doid, coid=coid)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_sql(self) -> str:\n sql = self.name + ' ' + self.value_type + ' '\n\n if self.primary:\n sql += 'PRIMARY KEY' + ' '\n\n if self.unique:\n sql += 'UNIQUE' + ' '\n\n if self.autoincrement:\n sql += 'AUTOINCREMENT' + ' '\n\n if self.not_null:\... | [
"0.5898487",
"0.5889723",
"0.5774924",
"0.5704873",
"0.5668311",
"0.565452",
"0.5583689",
"0.5520103",
"0.5482173",
"0.5370367",
"0.5329105",
"0.5315439",
"0.5312143",
"0.52056015",
"0.5153131",
"0.5081607",
"0.5070313",
"0.5047414",
"0.5036086",
"0.5035124",
"0.49911228",
... | 0.5458322 | 9 |
Compute the dot product of two iterables. | def dot(lhs: typing.Iterable, rhs: typing.Iterable) -> float:
return sum(ls * rs for ls, rs in zip(lhs, rhs)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dotproduct(x, y):\n return sum(imap(operator.mul, x, y))",
"def dotproduct(v1, v2):\n\treturn sum(imap(operator.mul, v1, v2))",
"def dot( v1, v2 ):\n return sum( x*y for x,y in izip(v1,v2) )",
"def dotProduct(v1, v2):\n return sum((a * b) for a, b in zip(v1, v2))",
"def dot_product(a, b):\n ... | [
"0.82072806",
"0.8138062",
"0.7880936",
"0.7869606",
"0.78574634",
"0.7854296",
"0.78125775",
"0.77786505",
"0.7770841",
"0.7738633",
"0.77320033",
"0.7590197",
"0.75651634",
"0.75444365",
"0.753875",
"0.7533884",
"0.7527918",
"0.74607277",
"0.7424749",
"0.7417901",
"0.739386... | 0.7950844 | 2 |
Creates an instance of this model from a dictionary | def from_dictionary(cls,
dictionary):
if dictionary is None:
return None
# Extract variables from the dictionary
broadcast_threshold = dictionary.get('broadcastThreshold')
multicast_threshold = dictionary.get('multicastThreshold')
unkn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction... | [
"0.83181584",
"0.8168118",
"0.8168118",
"0.8118749",
"0.8089047",
"0.79787344",
"0.7949278",
"0.79231393",
"0.7898951",
"0.78923255",
"0.788838",
"0.7882321",
"0.7882212",
"0.7876749",
"0.78585315",
"0.7836853",
"0.7801407",
"0.7801407",
"0.7801407",
"0.7801407",
"0.7801407",... | 0.0 | -1 |
Format string as camelcase. | def camelize(string):
# NOTE(retr0h): Taken from jpvanhal/inflection
# https://github.com/jpvanhal/inflection
return re.sub(r"(?:^|_)(.)", lambda m: m.group(1).upper(), string) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def camel(s):\n return s[0].upper() + s[1:]",
"def format_camel(text):\r\n\toutput = \"\"\r\n\tfor i,w in enumerate(text.split(\" \")):\r\n\t\tif i > 0:\r\n\t\t\toutput += w[0].upper() + w[1:]\r\n\t\telse:\r\n\t\t\toutput += w\r\n\treturn output",
"def camel_case(value: str, **kwargs: Any) -> str:\n resu... | [
"0.78673756",
"0.7861403",
"0.7572935",
"0.7519646",
"0.74611413",
"0.7451193",
"0.7394029",
"0.73724234",
"0.730702",
"0.7302507",
"0.7297997",
"0.7264715",
"0.72641236",
"0.7224937",
"0.7201934",
"0.7197974",
"0.7195071",
"0.7164117",
"0.71289766",
"0.71140176",
"0.71105266... | 0.6253222 | 79 |
Remove any training spaces from string. | def chomp(text: str) -> str:
return "\n".join([x.rstrip() for x in text.splitlines()]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_space(string):\n return string.replace(' ', '')",
"def _clean(s):\n return re.sub(r'\\s+', ' ', s.strip())",
"def _clean(self, string):\n return re.sub('\\s+', ' ', string).strip()",
"def normalize_space (text):\n return RE_WS.sub (' ', text.strip ())",
"def space_strip(string):\n... | [
"0.7711076",
"0.76351744",
"0.7633882",
"0.75421613",
"0.75235146",
"0.752332",
"0.750592",
"0.74749476",
"0.7447301",
"0.7378563",
"0.73471797",
"0.73429734",
"0.73429734",
"0.73087466",
"0.7268787",
"0.72381085",
"0.72100747",
"0.7196451",
"0.7178571",
"0.7146372",
"0.71421... | 0.0 | -1 |
Remove all ANSI escapes from string or bytes. If bytes is passed instead of string, it will be converted to string using UTF8. | def strip_ansi_escape(data):
if isinstance(data, bytes):
data = data.decode("utf-8")
return re.sub(r"\x1b[^m]*m", "", data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _strip_ansi(s):\n if isinstance(s, str):\n return _ansi_codes.sub(r\"\\4\", s)\n else: # a bytestring\n return _ansi_codes_bytes.sub(r\"\\4\", s)",
"def strip_ansi(text):\n return ANSI_ESCAPE_RE.sub('', text)",
"def strip_ansi(content):\n return ANSI_ESCAPES_REGEX.sub('', content... | [
"0.8098004",
"0.7803283",
"0.7787631",
"0.75544477",
"0.71860015",
"0.71570224",
"0.71421677",
"0.70792705",
"0.70498973",
"0.6949454",
"0.69469595",
"0.69127864",
"0.69034964",
"0.68224865",
"0.6782713",
"0.6756653",
"0.6751193",
"0.6721633",
"0.67195314",
"0.66588444",
"0.6... | 0.7642829 | 3 |
Remove ANSI colors from string or bytes. | def strip_ansi_color(data):
if isinstance(data, bytes):
data = data.decode("utf-8")
# Taken from tabulate
invisible_codes = re.compile(r"\x1b\[\d*m")
return re.sub(invisible_codes, "", data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _strip_ansi(s):\n if isinstance(s, str):\n return _ansi_codes.sub(r\"\\4\", s)\n else: # a bytestring\n return _ansi_codes_bytes.sub(r\"\\4\", s)",
"def strip_ansi(string, parser=ANSI_PARSER):\n string = string or \"\"\n return parser.parse_ansi(string, strip_ansi=True)",
"def st... | [
"0.81363213",
"0.78119075",
"0.77925724",
"0.7654249",
"0.75995886",
"0.7557216",
"0.7292949",
"0.72734857",
"0.71964836",
"0.7161154",
"0.7160186",
"0.6984052",
"0.6925755",
"0.6781745",
"0.6755757",
"0.6619914",
"0.6534531",
"0.6412453",
"0.637948",
"0.62836486",
"0.6251108... | 0.8091831 | 1 |
The Dispersy database singleton. | def database(self):
return self._database | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _database(self):\n ...",
"def db(self):\r\n return self._db",
"def __init__(self) -> None:\n self.Database = Database()",
"def __init__(self):\n self._connection = get_db_connection()",
"def db(self) -> Database:\n return self.impl.db",
"def _db_connection(self):\n ... | [
"0.7026949",
"0.6708901",
"0.66980237",
"0.64360684",
"0.6435411",
"0.6414717",
"0.63987094",
"0.637299",
"0.63264066",
"0.6319736",
"0.6288225",
"0.6288225",
"0.6257615",
"0.62390304",
"0.6231716",
"0.6230113",
"0.6223236",
"0.620247",
"0.619697",
"0.61620003",
"0.61315477",... | 0.6064697 | 25 |
Add a community to the Dispersy instance. Each community must be known to Dispersy, otherwise an incoming message will not be able to be passed along to it's associated community. In general this method is called from the Community.__init__(...) method. | def attach_community(self, community):
if __debug__:
from .community import Community
assert isinstance(community, Community)
if __debug__: dprint(community.cid.encode("HEX"), " ", community.get_classification())
assert not community.cid in self._communities
assert no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def community(self, community):\n\n self._community = community",
"def set_community(self, community):\n assert community is None or isinstance(community, Community), type(community)\n self._community = community\n if community:\n self._dispersy = community.dispersy",
"de... | [
"0.66487974",
"0.6411453",
"0.60780495",
"0.59311634",
"0.5903593",
"0.57783663",
"0.5659524",
"0.5643145",
"0.5609838",
"0.5570506",
"0.5549704",
"0.5501872",
"0.54274434",
"0.52420706",
"0.52355367",
"0.51256007",
"0.5091495",
"0.5078886",
"0.5069313",
"0.5055437",
"0.50341... | 0.7048054 | 0 |
Returns True when this message is a duplicate, otherwise the message must be processed. | def _is_duplicate_sync_message(self, message):
community = message.community
# fetch the duplicate binary packet from the database
try:
have_packet, undone = self._database.execute(u"SELECT packet, undone FROM sync WHERE community = ? AND member = ? AND global_time = ?",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _deduplicate_message(self, message):\n\n key = (message.remote, message.mid)\n if key in self._recent_messages:\n if message.mtype is CON:\n if self._recent_messages[key] is not None:\n self.log.info('Duplicate CON received, sending old response again'... | [
"0.7582035",
"0.718433",
"0.6632222",
"0.65484715",
"0.6452502",
"0.62928617",
"0.61890024",
"0.6047644",
"0.60145295",
"0.5990938",
"0.59627473",
"0.59265596",
"0.59142953",
"0.59075934",
"0.589519",
"0.5861441",
"0.5849016",
"0.58262265",
"0.58185387",
"0.5797181",
"0.57899... | 0.75062656 | 1 |
Tries to guess the most recent sequence number used by the master member for META in COMMUNITY. This is a risky method because sequence numbers must be unique, however, we can not guarantee that two peers do not claim a sequence number for the master member at around the same time. Unfortunately we can not overcome thi... | def _claim_master_member_sequence_number(self, community, meta):
assert isinstance(meta.distribution, FullSyncDistribution), "currently only FullSyncDistribution allows sequence numbers"
sequence_number, = self._database.execute(u"SELECT COUNT(*) FROM sync WHERE member = ? AND sync.meta_message = ?",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSequence(self):\n if self.sequence != None: # a sequence has been assigned\n return self.sequence\n elif self.seqscores != None: # inferred by parsimony but not yet assigned\n return None # determine most parsimonous sequence, not yet implemented",
"def _find_last_se... | [
"0.5846389",
"0.58385175",
"0.5712841",
"0.5638536",
"0.5616841",
"0.5612507",
"0.5424975",
"0.535834",
"0.534",
"0.53367084",
"0.5312183",
"0.53064",
"0.5301774",
"0.52814233",
"0.52638984",
"0.5194946",
"0.5186961",
"0.51849806",
"0.51849806",
"0.51849806",
"0.51849806",
... | 0.6831175 | 0 |
Constructor of DenoiserImageProcessingMethod. Initialises the variables describing the Denoising filter strength. | def __init__(self, denoiser_strength):
self._strength = denoiser_strength | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, input_dim):\n super(ps_FNNDenoiser, self).__init__()\n\n self._input_dim = input_dim\n\n self.fnn_enc = Linear(self._input_dim, int(self._input_dim / 2))\n self.fnn_dec = Linear(int(self._input_dim / 2), self._input_dim)\n\n self.initialize_module()",
"def __... | [
"0.6367458",
"0.63344586",
"0.63035595",
"0.60392046",
"0.6019234",
"0.5945961",
"0.58763665",
"0.5809447",
"0.57781184",
"0.577237",
"0.5768741",
"0.5767068",
"0.5758271",
"0.5747164",
"0.5742086",
"0.5729025",
"0.5724371",
"0.5718335",
"0.57000214",
"0.56992126",
"0.5690762... | 0.63912785 | 0 |
Generates name, containing timestamp, for file. | def _generate_output_name(extension):
output_name = 'TDG_{:%Y-%m-%d_%H-%M-%S}.{}'.format(datetime.now(), extension)
return output_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTimeToFileName(self):\n return self.sNow.strftime(\"%d-%m-%Y_%H-%M-%S\")",
"def datetime_filename(prefix='output_',extension='.txt'):\n outputname = prefix + '{:%Y%m%d%H%M%S}utc{}'.format(\n datetime.datetime.utcnow(),extension)\n return outputname",
"def standardized_name(path, filename):\n ... | [
"0.7729668",
"0.7674219",
"0.755236",
"0.7452364",
"0.7342889",
"0.7321595",
"0.7221625",
"0.718941",
"0.7176355",
"0.70745164",
"0.70539796",
"0.7044839",
"0.70323306",
"0.7010471",
"0.69910896",
"0.69903696",
"0.69800836",
"0.69770396",
"0.6962915",
"0.696181",
"0.69542485"... | 0.69216245 | 23 |
Create the main Flask application. | def create_app(test_config=None) -> Flask:
app = Flask("front-end-web-server", instance_relative_config=True)
if test_config is None:
# Get path to configuration file and load that configuration into Flask's app.config object.
curr_dir = os.path.abspath(os.path.dirname(__file__))
config... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_app() -> Flask:\n logger.info('creating flask application')\n app = Flask(\n 'pasta',\n static_url_path='/static',\n static_folder='./static',\n template_folder='./views')\n config.flask.SECRET_KEY = os.urandom(32)\n config.flask.SERVER_NAME = None\n app.config.f... | [
"0.83634686",
"0.8147395",
"0.812069",
"0.81102735",
"0.810905",
"0.8108057",
"0.80816466",
"0.80796754",
"0.8037024",
"0.80354893",
"0.8034872",
"0.7991176",
"0.7975027",
"0.79708254",
"0.7961025",
"0.7934542",
"0.7899397",
"0.78859544",
"0.7877166",
"0.7859817",
"0.7843347"... | 0.72674507 | 93 |
Precision metric. Only computes a batchwise average of precision. Computes the precision, a metric for multilabel classification of how many selected items are relevant. | def precision(y_true, y_pred):
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1)))
precision = true_positives / (predicted_positives + K.epsilon())
return precision | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(self):\n self.overall_precision = precision_score(\n self.y_true, self.y_pred, average = self.average_type).round(self.digits_count_fp)\n self.classes_precision = precision_score(\n self.y_true, self.y_pred, average = None).round(self.digits_count_fp)",
"def comp... | [
"0.74902546",
"0.7288079",
"0.715916",
"0.715289",
"0.7066431",
"0.69866836",
"0.6966592",
"0.6954892",
"0.69129443",
"0.6833995",
"0.6818441",
"0.6810019",
"0.6805678",
"0.6805678",
"0.6805678",
"0.6805678",
"0.6805678",
"0.6805678",
"0.67862916",
"0.6755704",
"0.6755704",
... | 0.67582285 | 24 |
Recall metric. Only computes a batchwise average of recall. Computes the recall, a metric for multilabel classification of how many relevant items are selected. | def recall(y_true, y_pred):
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
possible_positives = K.sum(K.round(K.clip(y_true, 0, 1)))
recall = true_positives / (possible_positives + K.epsilon())
return recall | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recall(y_true, y_pred, average, labels):\n\n y_true, y_pred = check_metric_args(y_true, y_pred, average, labels)\n\n result = None\n\n m = len(y_true)\n n = len(labels)\n\n confusion_matrix = get_confusion_matrix(y_true, y_pred, labels).T\n\n if average == \"micro\":\n numerator = np.t... | [
"0.7605139",
"0.7447918",
"0.74042726",
"0.72813445",
"0.7209321",
"0.71659344",
"0.7157751",
"0.7145294",
"0.7145294",
"0.7145294",
"0.7145294",
"0.7145294",
"0.7145294",
"0.7131868",
"0.71009445",
"0.70971656",
"0.70971656",
"0.70971656",
"0.70971656",
"0.70971656",
"0.7097... | 0.7062941 | 43 |
Recall metric. Only computes a batchwise average of recall. Computes the recall, a metric for multilabel classification of how many relevant items are selected. | def recall(y_true, y_pred):
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
possible_positives = K.sum(K.round(K.clip(y_true, 0, 1)))
recall = true_positives / (possible_positives + K.epsilon())
return recall | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recall(y_true, y_pred, average, labels):\n\n y_true, y_pred = check_metric_args(y_true, y_pred, average, labels)\n\n result = None\n\n m = len(y_true)\n n = len(labels)\n\n confusion_matrix = get_confusion_matrix(y_true, y_pred, labels).T\n\n if average == \"micro\":\n numerator = np.t... | [
"0.76059914",
"0.7449167",
"0.7405468",
"0.7281615",
"0.72102433",
"0.7166693",
"0.7158562",
"0.7146135",
"0.7146135",
"0.7146135",
"0.7146135",
"0.7146135",
"0.7146135",
"0.7132622",
"0.71017796",
"0.7066623",
"0.7065428",
"0.70636654",
"0.70636654",
"0.70636654",
"0.7063665... | 0.7097979 | 32 |
Precision metric. Only computes a batchwise average of precision. Computes the precision, a metric for multilabel classification of how many selected items are relevant. | def precision(y_true, y_pred):
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1)))
precision = true_positives / (predicted_positives + K.epsilon())
return precision | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(self):\n self.overall_precision = precision_score(\n self.y_true, self.y_pred, average = self.average_type).round(self.digits_count_fp)\n self.classes_precision = precision_score(\n self.y_true, self.y_pred, average = None).round(self.digits_count_fp)",
"def comp... | [
"0.74902546",
"0.7288079",
"0.715916",
"0.715289",
"0.7066431",
"0.69866836",
"0.6966592",
"0.6954892",
"0.69129443",
"0.6833995",
"0.6818441",
"0.6810019",
"0.6805678",
"0.6805678",
"0.6805678",
"0.6805678",
"0.6805678",
"0.6805678",
"0.67862916",
"0.67582285",
"0.67582285",... | 0.6755704 | 43 |
Compute softmax values for each sets of scores in x. | def softmax(x):
e_x = np.exp(x - np.max(x))
return e_x / e_x.sum() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ... | [
"0.7798025",
"0.77622545",
"0.7761262",
"0.7757878",
"0.7658788",
"0.7658788",
"0.7658788",
"0.7658788",
"0.7587013",
"0.7432032",
"0.74086267",
"0.7395737",
"0.7359896",
"0.7318716",
"0.7270583",
"0.7264047",
"0.7263263",
"0.7257894",
"0.723235",
"0.7216223",
"0.7203632",
... | 0.70915663 | 57 |
extracts sequence of geneID from the current annotations. type is cds, pep or fasta. | def extractseq(geneID, db=dbpaths['cds'], startpos=0, endpos=-1):
#fname = dbpaths[type]
geneseq = ""
fobj = open(db, 'rb')
for line in fobj:
if line[0] == '>':
query = re.search( geneID + '[\s]', line)
if query:
thisline = fobj.next()
while thisline[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_annotation_gene_types(args):\n ref_mgr = ReferenceManager(args.reference_path)\n tss = BedTool(ref_mgr.tss_track)\n if tss.field_count() == 7:\n return TRANSCRIPT_ANNOTATION_GENE_TYPES\n else:\n return None",
"def cellannotation2ID(self, annotation_type):\n annotations = ... | [
"0.5662214",
"0.54267174",
"0.53648776",
"0.5334028",
"0.5317295",
"0.5313579",
"0.5258759",
"0.5245655",
"0.5237802",
"0.5233585",
"0.5167605",
"0.51283205",
"0.5126109",
"0.51074994",
"0.50516504",
"0.50449187",
"0.50252074",
"0.50071573",
"0.500155",
"0.49981478",
"0.49958... | 0.5907434 | 0 |
Load array from working data ``` >> train_ids = load_array(self._conf, 'task.dataset.id_train') ``` | def load_array(conf, name_path):
arr_ = dict(conf)
for name in name_path.split('.'):
arr_ = arr_[name]
if isinstance(arr_, dict):
mat_fn = arr_['file']
mat_name = arr_['name']
return hstack_mat(None, mat_fn, mat_name)
elif isinstance(arr_, str):
return hstack_ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_array(data_arrays, batch_size, is_train=True): #@save\n dataset = tf.data.Dataset.from_tensor_slices(data_arrays)\n if is_train:\n dataset = dataset.shuffle(buffer_size=1000)\n dataset = dataset.batch(batch_size)\n return dataset",
"def load_array(data_arrays, batch_size, is_train=Tr... | [
"0.6605536",
"0.6605536",
"0.6545658",
"0.6500626",
"0.6472056",
"0.63579816",
"0.63073903",
"0.6098631",
"0.6054112",
"0.6035797",
"0.5969059",
"0.5956629",
"0.5954701",
"0.5954701",
"0.59065944",
"0.5887013",
"0.5854554",
"0.57795125",
"0.5742136",
"0.57212913",
"0.5720446"... | 0.0 | -1 |
Tries to restore the weights of the model. Continues if no data is present. Tries to restore all weights first, then pretrained weights only. | def restore(self, sess: tf.Session) -> None:
super().restore(sess)
BaseModel._restore_checkpoint(self.pretrained_saver, sess, path=FLAGS.pretrained_checkpoint) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _restore(self, checkpoint):\n checkpoint_path = os.path.join(checkpoint, \"model_weights\")\n self.model.load_weights(checkpoint_path)",
"def restore(self):\n # For multi-worker training, it should not restore a model in certain\n # worker setting (e.g. non-chief worker in Paramet... | [
"0.7193469",
"0.6996376",
"0.69916284",
"0.68978137",
"0.6689391",
"0.6683962",
"0.6601889",
"0.6601889",
"0.6537569",
"0.63814706",
"0.6331325",
"0.6329863",
"0.6318073",
"0.6313517",
"0.6278855",
"0.62160736",
"0.6203247",
"0.6187642",
"0.61867094",
"0.617069",
"0.616689",
... | 0.59401286 | 41 |
Builds the ResNet model graph with the TF API. This function is intentionally kept simple and sequential to simplify the addition of new layers. | def _build_model(self, x: tf.Tensor) -> tf.Tensor:
x = ResNet._first_conv(x)
x = ResNet._v2_block(x, 'block1', base_depth=64, num_units=3, stride=2)
x = ResNet._v2_block(x, 'block2', base_depth=128, num_units=4, stride=2)
x = ResNet._v2_block(x, 'block3', base_depth=256, num_units=6, str... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_graph(self):\n\t\tself._create_placeholders()\n\t\tself._create_embedding()\n\t\tself._create_recurrent_layers()\n\t\tself._create_de_embedding()\n\t\tself._create_loss()\n\t\tself._create_optimizer()\n\t\tself._create_summaries()",
"def build_tf_graph(self):\n raise NotImplementedError",
"def bui... | [
"0.7167492",
"0.71257806",
"0.6935861",
"0.6929277",
"0.6873462",
"0.6863753",
"0.6851451",
"0.6801977",
"0.67938524",
"0.67680085",
"0.6765718",
"0.6761188",
"0.67526054",
"0.6734978",
"0.6734197",
"0.66962105",
"0.6685752",
"0.66815615",
"0.6678256",
"0.667687",
"0.6624449"... | 0.64020896 | 54 |
Adds a classification cross entropy loss term to the LOSSES collection. Initializes the loss attribute from the LOSSES collection (sum of all entries). | def _init_loss(self) -> None:
labels_one_hot = tf.one_hot(self.labels, depth=Data.num_classes)
cross_entropy_loss = tf.losses.softmax_cross_entropy(labels_one_hot, self.logits)
# cross_entropy_loss is a scalar
tf.add_to_collection(tf.GraphKeys.LOSSES, cross_entropy_loss)
self.los... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_loss_op(self, pred):\n ### YOUR CODE HERE\n loss = cross_entropy_loss(self.labels_placeholder,pred)\n ### END YOUR CODE\n return loss",
"def setup_loss(self):\n with vs.variable_scope(\"loss\"):\n self.loss = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_... | [
"0.6853098",
"0.6785605",
"0.664682",
"0.66212046",
"0.6615802",
"0.6549143",
"0.65392613",
"0.6462261",
"0.6417518",
"0.6413369",
"0.64058745",
"0.639511",
"0.6377996",
"0.636467",
"0.6336875",
"0.6331348",
"0.63192064",
"0.63083047",
"0.6307947",
"0.62998617",
"0.62917644",... | 0.7008454 | 0 |
First conv layer of the ResNet followed by max pooling. | def _first_conv(x: tf.Tensor) -> tf.Tensor:
with slim.arg_scope([slim.conv2d], activation_fn=None, normalizer_fn=None):
x = ResNet._conv2d_same(x, 64, 7, stride=2, scope='conv1')
return slim.max_pool2d(x, [3, 3], stride=2, scope='pool1') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv_and_max_pool(x, conv):\n return F.relu(conv(x).permute(0, 2, 1).max(1)[0])",
"def __init__(self, filter1x1):\n super(poolproj, self).__init__()\n self.max = layers.MaxPooling2D(pool_size=3, strides=1, padding=\"same\")\n self.conv = layers.Conv2D(\n filter1x1, kern... | [
"0.7434547",
"0.70575374",
"0.6948558",
"0.68813705",
"0.6807957",
"0.68037117",
"0.6794671",
"0.6794671",
"0.6794671",
"0.6794671",
"0.6794671",
"0.67860895",
"0.67267597",
"0.6721148",
"0.6721148",
"0.6653793",
"0.6619886",
"0.6613855",
"0.6594107",
"0.65686387",
"0.6565767... | 0.806326 | 0 |
Retrieves the persistence simplfication level being used for this complex Returns float Floating point value specifying the current persistence setting | def get_persistence(self):
return self.persistence | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAudioLevel(self) :\n\t\tif not Util.AUDIO : return\n\t\treturn self.audioLevel",
"def QualExtension_getDefaultLevel():\n return _libsbml.QualExtension_getDefaultLevel()",
"def getDefaultLevel():\n return _libsbml.QualExtension_getDefaultLevel()",
"def _get_isis_level(self):\n return self.__... | [
"0.5783778",
"0.5723058",
"0.5539368",
"0.5485123",
"0.5442123",
"0.54302406",
"0.5411877",
"0.53818744",
"0.53783333",
"0.53640366",
"0.53637695",
"0.53554523",
"0.5347339",
"0.53375447",
"0.53293365",
"0.53293365",
"0.53293365",
"0.53293365",
"0.53293365",
"0.5302932",
"0.5... | 0.5323987 | 19 |
Returns the label pair indices requested by the user | def get_label(self, indices=None):
if indices is None:
indices = list(range(0, self.get_sample_size()))
elif isinstance(indices, collections.abc.Iterable):
indices = sorted(list(set(indices)))
else:
indices = [indices]
if len(indices) == 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indices_of_label(self, label_name):\n return self.indices_of('label', label_name)",
"def labeled_indices(self):\n return self._labeled_indices",
"def get_label_2_index(self, label):\n return self._labels_2_index.get(label, 0) # return unknown index when not found",
"def test_label_indic... | [
"0.72450227",
"0.66376305",
"0.64800036",
"0.6322828",
"0.627343",
"0.6126067",
"0.61040473",
"0.6087146",
"0.60349274",
"0.60047156",
"0.5998461",
"0.59819496",
"0.5981919",
"0.59817195",
"0.5978114",
"0.59683645",
"0.595929",
"0.5933239",
"0.5910694",
"0.5902691",
"0.590032... | 0.0 | -1 |
Replace a character at a random position with a random character | def replace_random_character(self, node, verbose=False):
s = node.children[0].symbol
if s:
pos = random.randint(0, len(s) - 1)
#random_character = chr(random.randrange(0, 127))
random_character = random.choice(self.char_pool)
if verbose:
pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_char_candidate_typo(self, char):\n i = np.random.randint(0, 2)\n\n return self.typo[char][i]",
"def mutate(text, mutation_rate):\n if mutation_rate is None or not randint(0, mutation_rate) == 0:\n return text\n\n chars = list(text)\n new_char = choice([\" \", \"X\"])\n ... | [
"0.76067",
"0.7222626",
"0.6926276",
"0.6861797",
"0.68179584",
"0.6747207",
"0.6704646",
"0.6649654",
"0.6648097",
"0.66113585",
"0.6556977",
"0.6494964",
"0.64882547",
"0.6469378",
"0.64481014",
"0.6344109",
"0.63404214",
"0.6318366",
"0.6306871",
"0.62959796",
"0.618165",
... | 0.80698806 | 0 |
This method splits an array of measurements into train and test data sets with the specified split. | def train_test_split(measurements: np.ndarray, split: float = 0.8) -> (np.ndarray, np.ndarray):
labels_measurements = [m.label for m in measurements]
labels = np.unique(labels_measurements)
for i, l in enumerate(labels):
indices_label = np.argwhere(np.array(labels_measurements) == l).flatten()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_dataset(self, split):\n trunk_pos_size = math.ceil((1 - split) * len(self.Pos))\n trunk_neg_size = math.ceil((1 - split) * len(self.Neg))\n trunk_num = int(1 / (1 - split))\n pos_temp = list()\n neg_temp = list()\n for index in range(trunk_num):\n pos_... | [
"0.8101568",
"0.77468383",
"0.75648856",
"0.74929947",
"0.745164",
"0.7404906",
"0.7385529",
"0.7308533",
"0.7253971",
"0.72037363",
"0.71789664",
"0.7159913",
"0.71504116",
"0.7145964",
"0.71187127",
"0.707697",
"0.7064171",
"0.70577216",
"0.7057104",
"0.70542663",
"0.705032... | 0.8009372 | 1 |
Calculate IntersectionOverObject(IOB) of two bounding boxes. ! differenct between Fast RCNN bbox_overlaps and gluoncv bbox_iou | def bbox_iob(bbox_a, bbox_b):
if bbox_a.shape[1] < 4 or bbox_b.shape[1] < 4:
raise IndexError("Bounding boxes axis 1 must have at least length 4")
tl = np.maximum(bbox_a[:, None, :2], bbox_b[:, :2])
br = np.minimum(bbox_a[:, None, 2:4], bbox_b[:, 2:4]) + 1
area_i = np.prod(br - tl, axis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iou_bbox(bboxes1, bboxes2):\n bboxes1 = np.array(bboxes1, np.float32)\n bboxes2 = np.array(bboxes2, np.float32)\n \n intersection_min_y = np.maximum(bboxes1[:, 0], bboxes2[:, 0])\n intersection_max_y = np.minimum(bboxes1[:, 0] + bboxes1[:, 2] - 1, bboxes2[:, 0] + bboxes2[:, 2] - 1)\n intersec... | [
"0.7712872",
"0.75029147",
"0.75029147",
"0.7420554",
"0.73759794",
"0.7330687",
"0.73221415",
"0.7275076",
"0.7223357",
"0.71758157",
"0.7157643",
"0.71349317",
"0.7127541",
"0.7051737",
"0.6890331",
"0.68853706",
"0.682142",
"0.6780137",
"0.6772172",
"0.6729368",
"0.6721675... | 0.6042696 | 70 |
Returns a random hand containing n lowercase letters. At least n/3 the letters in the hand should be VOWELS. Hands are represented as dictionaries. The keys are letters and the values are the number of times the particular letter is repeated in that hand. | def dealHand(n):
hand={}
numVowels = n // 3
for i in range(numVowels):
x = VOWELS[random.randrange(0,len(VOWELS))]
hand[x] = hand.get(x, 0) + 1
for i in range(numVowels, n):
x = CONSONANTS[random.randrange(0,len(CONSONANTS))]
hand[x] = hand.get... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deal_hand(n):\n hand = {}\n num_vowels = n // 3\n\n for i in range(num_vowels):\n x = VOWELS[random.randrange(0, len(VOWELS))]\n hand[x] = hand.get(x, 0) + 1\n\n for i in range(num_vowels, n):\n x = CONSONANTS[random.randrange(0, len(CONSONANTS))]\n hand[x] =... | [
"0.7800366",
"0.7696999",
"0.76785237",
"0.7450054",
"0.6462174",
"0.61527944",
"0.6078002",
"0.60661083",
"0.6056235",
"0.599994",
"0.59685695",
"0.59579647",
"0.591717",
"0.591717",
"0.591717",
"0.58798337",
"0.58763254",
"0.5846789",
"0.5825735",
"0.58013684",
"0.5796041",... | 0.7669171 | 3 |
Return the contents of the .travis.yml file. | def _get_yaml_content(self):
with open('.travis.yml') as f:
content = yaml.load(f)
return content | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(path=\".travis.yml\"):\n if not path:\n path = \".travis.yml\"\n with open(path, 'r') as stream:\n return yaml.load(stream)",
"def get_yml_files():\n repo_fs()\n return YML_FILES",
"def readme():\n with open(os.path.join(build_root, 'README.rst')) as f:\n return f.r... | [
"0.71477246",
"0.60372835",
"0.58110964",
"0.5783853",
"0.5661705",
"0.562468",
"0.55627483",
"0.55493027",
"0.549967",
"0.549379",
"0.5482828",
"0.5460947",
"0.540087",
"0.53984547",
"0.5373335",
"0.5372923",
"0.5368626",
"0.5362527",
"0.53587914",
"0.53507423",
"0.529618",
... | 0.8137851 | 0 |
Returns nodenames of all nodes managed by the compute service. This method is for multi computenodes support. If a driver supports multi computenodes, this method returns a list of nodenames managed by the service. Otherwise, this method should return [hypervisor_hostname]. | def get_available_nodes(self, refresh=False):
# TODO(preethipy): Refresh parameter should be handled to fetch
# updated nodenames
LOG.debug("get_available_nodes return node %(cpcsubset_name)s" %
{'cpcsubset_name': self._host.properties[
"hypervisor_hostnam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_nodes(self):\n nodes = self.nodes\n result = []\n for i_node in self.iapi.node.list():\n if i_node.name:\n name = i_node.name\n else:\n # Sometimes Ironic does not show the names, pull them from Nova if possible.\n sel... | [
"0.7244441",
"0.67744815",
"0.6688071",
"0.6612138",
"0.6536389",
"0.65173835",
"0.640309",
"0.6397725",
"0.63750756",
"0.6367326",
"0.63235855",
"0.6308414",
"0.6299488",
"0.6272551",
"0.6251894",
"0.62495553",
"0.6209872",
"0.6151072",
"0.614149",
"0.6140894",
"0.6139483",
... | 0.6927579 | 1 |
Get connector information for the instance for attaching to volumes. Connector information is a dictionary representing the initiator WWPNs and a unique identifier of the partition. { | def get_volume_connector(self, instance):
props = {}
# 'get_volume_connector' will be invoked during creation
# of the partition and during deletion of the partition.
# But 'wwpns' we can access only when partition is available.
# During spawn flow 'get_volume_connector' function... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_volume_connector(self, instance):\n iqn = volume_util.get_host_iqn(self._session, self._cluster)\n return {\n 'ip': CONF.vmwareapi_host_ip,\n 'initiator': iqn,\n 'host': CONF.vmwareapi_host_ip\n }",
"def initialize_connection(self, volume, connector):... | [
"0.7217811",
"0.5731354",
"0.5719643",
"0.5626514",
"0.56229466",
"0.5587685",
"0.554909",
"0.5512526",
"0.5443555",
"0.5432417",
"0.5393865",
"0.53157926",
"0.52930737",
"0.52738225",
"0.5260998",
"0.52491385",
"0.5242627",
"0.5212603",
"0.51588446",
"0.51039207",
"0.5099608... | 0.7021322 | 1 |
Returns a list of all supported platforms. | def Platforms():
return platforms | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def platforms(self):\n logger.debug(\"Get platforms\")\n return self._raw_api.platforms.get()",
"def get_platforms(self):\n if self.platform == 'All':\n return PLATFORMS\n else:\n return self.platform.split(':')",
"def list_platforms(self):\n return self... | [
"0.8469478",
"0.84350204",
"0.8323497",
"0.81891674",
"0.79978454",
"0.77241737",
"0.7588078",
"0.7408845",
"0.73557884",
"0.7238537",
"0.698357",
"0.6899838",
"0.6823315",
"0.6802424",
"0.67996347",
"0.67626536",
"0.6738391",
"0.66473496",
"0.6570459",
"0.6557098",
"0.649542... | 0.8486307 | 0 |
Return the name of the next link name to be used when archiving a previously active release directory for the given promotion label. This picks the highest numerical portion of the promotion label type found in all supported platform directories and then adds 1 to it to compose the new archival promotion label. Ex. Hig... | def NewLinkName(promotion_label):
latestlinks = {}
highval = 0
for platform in platforms:
latestlinks[platform] = ''
for link in prolinks[platform]:
if promotion_label in link and '_' in link and \
link > latestlinks[platform]:
latestlinks[platf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_release_label():\n release = \"\".join(map(lambda x: x.lower(), sh.lsb_release(\"-irs\").split()))\n return OS_MAPPING[next(k for k in OS_MAPPING if re.search(k, release))]",
"def get_label_name(label):\n\tindex = np.argmax(label)\n\tlabels = ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog... | [
"0.57763886",
"0.5655021",
"0.55032444",
"0.5381864",
"0.5346807",
"0.53060865",
"0.5243026",
"0.5188378",
"0.51658285",
"0.5145332",
"0.51091605",
"0.5082027",
"0.5068403",
"0.5033763",
"0.5011738",
"0.4979112",
"0.4934989",
"0.491461",
"0.49044046",
"0.48930407",
"0.4880539... | 0.7795426 | 0 |
Removes the topmost item from the stack, will return the old value or `None` if the stack was already empty. | def pop(self):
stack = getattr(self._local, 'stack', None)
if stack is None:
return None
elif len(stack) == 1:
release(self._local)
return stack[-1]
else:
return stack.pop() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_last_item_from_stack(self):\n if self.length > 0:\n return self.container.pop()\n else:\n return None",
"def pop(self):\n try:\n if self.size() > 0:\n top = self.top()\n self.items.pop()\n return top\n ... | [
"0.82667035",
"0.82075346",
"0.80730194",
"0.8061972",
"0.79645854",
"0.79088116",
"0.7892373",
"0.78918564",
"0.78518593",
"0.7851721",
"0.78069144",
"0.77675545",
"0.7694437",
"0.7690464",
"0.76771176",
"0.7655624",
"0.7652102",
"0.7642626",
"0.76382995",
"0.7617483",
"0.76... | 0.77498764 | 12 |
The topmost item on the stack. If the stack is empty, `None` is returned. | def value(self):
try:
return self._local.stack[-1]
except (AttributeError, IndexError):
raise UnboundProxyError('object unbound') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top(self):\n if self.stack == []:\n return None\n return self.stack[-1]",
"def top(self):\n if self.is_empty():\n raise RuntimeError(\"Attempt to get a top of the empty stack!\")\n return self._items[-1]",
"def top(self):\n # Pre:\n # The stac... | [
"0.884895",
"0.86250734",
"0.8605158",
"0.8506827",
"0.8366959",
"0.8362208",
"0.8343744",
"0.8296608",
"0.8284964",
"0.8255428",
"0.82433987",
"0.82389426",
"0.8093782",
"0.80514085",
"0.8041542",
"0.803269",
"0.79157406",
"0.79111195",
"0.7886462",
"0.78580177",
"0.78580177... | 0.0 | -1 |
Return a random string of alphanumeric characaters of 'size' length. | def random_string(prefix=None, suffix=None, size=8):
if size <= 0:
return "{0}{1}".format(prefix or '', suffix or '')
charpool = tuple(string.ascii_letters + string.digits)
final_string = ""
while size > 0:
segment_size = min(int(len(charpool)/2), size)
size = size - segment_siz... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_string_alphanumeric(size):\n\t# requirements = random, string\n\treturn ''.join(random.choice(string.ascii_letters + string.digits) for x in range(size))",
"def stringGen(size, chars=string.ascii_uppercase + string.digits):\n\treturn ''.join(random.choice(chars) for _ in range(size))",
"def _rand_st... | [
"0.88290995",
"0.8651498",
"0.85271025",
"0.84672743",
"0.81312615",
"0.811324",
"0.79546636",
"0.79037404",
"0.7842807",
"0.78427076",
"0.7820385",
"0.78135645",
"0.7805821",
"0.7803483",
"0.779882",
"0.7788533",
"0.77805907",
"0.7765721",
"0.76815957",
"0.76802397",
"0.7668... | 0.76357055 | 21 |
Gets a random cidr using the random_ip function in this module. If mask is None then a random mask between 0 and 30 inclusive will be assigned. | def random_cidr(ip_pattern=None, mask=None, min_mask=0, max_mask=30):
if mask is None:
mask = random.randint(min_mask, max_mask)
ip = random_ip(ip_pattern)
return ''.join([ip, '/', str(mask)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_ip():\n return new_ip(\"%i.%i.%i.%i\" % (randint(1, 254), # nosec\n randint(1, 254), # nosec\n randint(1, 254), # nosec\n randint(1, 254))) # nosec",
"def get_static_ip(cidr_block, mask, ip_blo... | [
"0.6930924",
"0.67024636",
"0.66299516",
"0.65706676",
"0.63367563",
"0.6235149",
"0.62161034",
"0.6205034",
"0.6169165",
"0.61217475",
"0.59297633",
"0.59187055",
"0.59187055",
"0.59047616",
"0.5884301",
"0.5874056",
"0.58580476",
"0.5849997",
"0.5849997",
"0.58244616",
"0.5... | 0.85735756 | 0 |
Creates an instance of this model from a dictionary | def from_dictionary(cls,
dictionary):
if dictionary is None:
return None
# Extract variables from the dictionary
folder_id = dictionary.get('folderId')
public_folder_item_id_list = dictionary.get("publicFolderItemIdList")
restore_entire_folder... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction... | [
"0.8318104",
"0.8168106",
"0.8168106",
"0.8119619",
"0.8089429",
"0.7978183",
"0.79495466",
"0.79227656",
"0.7898806",
"0.7894103",
"0.7887986",
"0.78827816",
"0.78821284",
"0.7876549",
"0.7858773",
"0.78385323",
"0.78039247",
"0.78039247",
"0.78039247",
"0.78039247",
"0.7803... | 0.0 | -1 |
Add a member to the bound group | def add_member(self, member, dn=False):
if dn:
if self.check_member(member, dn=True):
return
mod = (ldap.MOD_ADD, 'member', member.encode('ascii'))
else:
if self.check_member(member):
return
mod = (ldap.MOD_ADD, 'member', m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addMember(self, *args):\n return _libsbml.Group_addMember(self, *args)",
"def AddMemberToGroup(group_id,user_id):\r\n Group.AddMemberToGroup(group_id,user_id)",
"def member(self, member):\r\n return GroupMember(self, member)",
"def add_member_to_group(self, group_id, member_id):\n ... | [
"0.76254046",
"0.7225025",
"0.7090743",
"0.7028953",
"0.70045745",
"0.69630474",
"0.6825504",
"0.6816953",
"0.6789259",
"0.6752057",
"0.67101455",
"0.66765815",
"0.66524976",
"0.66354644",
"0.6541035",
"0.6511655",
"0.6458326",
"0.644447",
"0.6401591",
"0.6391151",
"0.6382018... | 0.6363967 | 22 |
Load the pretrained ResNet152 and replace top fc layer. | def __init__(self, embed_size):
super(EncoderCNN, self).__init__()
resnet = models.resnet152(pretrained=True)
modules = list(resnet.children())[:-1] # delete the last fc layer.
self.resnet = nn.Sequential(*modules)
self.linear = nn.Linear(resnet.fc.in_features, embed_size)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet152(pretrained=False, **kwargs):\n model = ResNet(Bottleneck, [3, 8, 36, 3], **kwargs)\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet152']))\n fc = transfer_fc(model.fc)\n model.fc = fc\n return model",
"def resnet152(pretrained=False):\n model =... | [
"0.7173052",
"0.6806408",
"0.67975897",
"0.67849594",
"0.67489475",
"0.67489475",
"0.67489475",
"0.67489475",
"0.67324644",
"0.6507087",
"0.6507087",
"0.64752775",
"0.63904417",
"0.62846625",
"0.62234324",
"0.61872536",
"0.6139846",
"0.61031175",
"0.6084447",
"0.60670197",
"0... | 0.0 | -1 |
Returns true if file with name filename is allowed. | def allowed_code_file(filename):
return '.' in filename and filename.rsplit('.', 1)[1] in app.config['ALLOWED_CODE_EXTENSIONS'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_file(filename: str) -> bool:\n return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS",
"def allowed_file(filename):\n \n if not '.' in filename:\n return False\n \n ext = filename.rsplit('.', 1)[1]\n \n if ext.lower() in ALLOWED_FILE_EXTENSION... | [
"0.8504029",
"0.8482801",
"0.8448395",
"0.83593833",
"0.83307433",
"0.8306116",
"0.8306116",
"0.8267732",
"0.8267732",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8208295",
"0.819348",
... | 0.7330617 | 48 |
Returns true if file with name filename is allowed. | def allowed_test_file(filename):
return '.' in filename and filename.rsplit('.', 1)[1] in app.config['ALLOWED_TEST_EXTENSIONS'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_file(filename: str) -> bool:\n return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS",
"def allowed_file(filename):\n \n if not '.' in filename:\n return False\n \n ext = filename.rsplit('.', 1)[1]\n \n if ext.lower() in ALLOWED_FILE_EXTENSION... | [
"0.8504029",
"0.8482801",
"0.8448395",
"0.83593833",
"0.83307433",
"0.8306116",
"0.8306116",
"0.8267732",
"0.8267732",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8208295",
"0.819348",
... | 0.7412807 | 47 |
Returns true if file with name filename is allowed. | def allowed_class_file(filename):
return '.' in filename and filename.rsplit('.', 1)[1] in app.config['ALLOWED_TEST_EXTENSIONS'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_file(filename: str) -> bool:\n return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS",
"def allowed_file(filename):\n \n if not '.' in filename:\n return False\n \n ext = filename.rsplit('.', 1)[1]\n \n if ext.lower() in ALLOWED_FILE_EXTENSION... | [
"0.8504029",
"0.8482801",
"0.8448395",
"0.83593833",
"0.83307433",
"0.8306116",
"0.8306116",
"0.8267732",
"0.8267732",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8264552",
"0.8208295",
"0.819348",
... | 0.68242186 | 83 |
Convenience method that returns a string indicating the status of receipt address document. | def get_receipt_address_status(self):
return self.get_document_status_choice(self.receipt_address_status) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def address_str(self):\n return self._plrevgeoloc.addressString",
"def address(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"address\")",
"def address(self):\n return str(self._address)",
"def __str__(self):\n return format_address(**self._get_elements())",
"def addre... | [
"0.62897563",
"0.5880195",
"0.58506715",
"0.58247614",
"0.5818251",
"0.5772292",
"0.57720983",
"0.5764578",
"0.5728619",
"0.5718868",
"0.5718868",
"0.5718868",
"0.57158655",
"0.5715355",
"0.57119936",
"0.57119936",
"0.5623254",
"0.56032777",
"0.556492",
"0.5561944",
"0.555510... | 0.81621444 | 0 |
Convenience method that returns a string indicating the status of receipt penal document. | def get_receipt_penal_status(self):
return self.get_document_status_choice(self.receipt_penal_status) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_receipt_knowledge_status(self):\n return self.get_document_status_choice(self.receipt_knowledge_status)",
"def get_receipt_id_status(self):\n return self.get_document_status_choice(self.receipt_id_status)",
"def get_receipt_diploma_status(self):\n return self.get_document_status_ch... | [
"0.67679644",
"0.674314",
"0.66405",
"0.61538893",
"0.6117163",
"0.6070003",
"0.5917965",
"0.57881945",
"0.57881945",
"0.57881945",
"0.57881945",
"0.5719738",
"0.5695668",
"0.56879103",
"0.56819606",
"0.5653465",
"0.56028736",
"0.5599267",
"0.5593819",
"0.5593819",
"0.5593819... | 0.80558944 | 0 |
Convenience method that returns a string indicating the status of receipt knowledge document. | def get_receipt_knowledge_status(self):
return self.get_document_status_choice(self.receipt_knowledge_status) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_receipt_id_status(self):\n return self.get_document_status_choice(self.receipt_id_status)",
"def get_receipt_penal_status(self):\n return self.get_document_status_choice(self.receipt_penal_status)",
"def get_receipt_diploma_status(self):\n return self.get_document_status_choice(sel... | [
"0.693166",
"0.6818368",
"0.6389375",
"0.61780834",
"0.60561395",
"0.60359305",
"0.60359305",
"0.60310453",
"0.59778786",
"0.59778786",
"0.59666306",
"0.59666306",
"0.59666306",
"0.59666306",
"0.59666306",
"0.59666306",
"0.59666306",
"0.59666306",
"0.59666306",
"0.59666306",
... | 0.79215044 | 0 |
Convenience method that returns a boolean indicating whether or not this mentor has uploaded a receipt passport document. | def has_receipt_diploma(self):
return self.receipt_diploma_uploaded_at is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_receipt_penal(self):\n return self.receipt_penal_uploaded_at is not None",
"def has_receipt_id(self):\n return self.receipt_id_uploaded_at is not None",
"def has_receipt_knowledge(self):\n return self.receipt_knowledge_uploaded_at is not None",
"def has_receipt_address(self):\n ... | [
"0.6817882",
"0.67727685",
"0.6462237",
"0.60717213",
"0.5934922",
"0.59257764",
"0.57185644",
"0.55742115",
"0.5547077",
"0.5535746",
"0.5509754",
"0.55038905",
"0.5475617",
"0.5463665",
"0.542392",
"0.53927714",
"0.53632206",
"0.5339438",
"0.5337276",
"0.5319696",
"0.531725... | 0.61248827 | 3 |
Convenience method that returns a string indicating the status of receipt passport document. | def get_receipt_diploma_status(self):
return self.get_document_status_choice(self.receipt_diploma_status) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_receipt_penal_status(self):\n return self.get_document_status_choice(self.receipt_penal_status)",
"def get_receipt_id_status(self):\n return self.get_document_status_choice(self.receipt_id_status)",
"def get_status(self):\n if self.cancelled:\n return \"Cancelled\"\n ... | [
"0.65383106",
"0.62247264",
"0.610772",
"0.60748607",
"0.6011493",
"0.5771245",
"0.5754408",
"0.5741605",
"0.5612203",
"0.5586848",
"0.55859387",
"0.5513454",
"0.55053663",
"0.55053663",
"0.55053663",
"0.55053663",
"0.55053663",
"0.55053663",
"0.55053663",
"0.55053663",
"0.55... | 0.56774616 | 8 |
Convenience method that returns a boolean indicating the validation of phone | def has_validated_phone(self):
return self.phone is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_phone(phone_number):\n return bool(re.match(r\"^\\+?\\d{10,15}$\", phone_number))",
"def is_valid(self):\n return phonenumbers.is_valid_number(self)",
"def is_valid_phone(phone):\n assert phone is not None\n phone = str(phone)\n return len(phone) == 10 and is_valid_integer(phone)",... | [
"0.79293686",
"0.7683468",
"0.7595781",
"0.75742424",
"0.7514392",
"0.7443512",
"0.7431461",
"0.73148483",
"0.72093153",
"0.7154014",
"0.7131935",
"0.7127212",
"0.706573",
"0.70380145",
"0.6987092",
"0.69846326",
"0.6960358",
"0.6925507",
"0.6909568",
"0.6862383",
"0.68532175... | 0.8030809 | 0 |
Retrieve time series data as Pandas DataFrame. Validate date input format as string. Not for stock data. | def get_time_series(rics: list, fields: list, start_date: str, end_date: str) -> pd.DataFrame:
# Check date formats are YYYY-MM-DD.
try:
dt.datetime.strptime(start_date, '%Y-%m-%d')
except ValueError:
raise ValueError('"start_date" has incorrect format.')
try:
dt.datetime.strptim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def TimeFrame(*args, **kwargs):\n underride(kwargs, dtype=float)\n return pd.DataFrame(*args, **kwargs)",
"def read_time_series(name: str) -> pd.DataFrame:\n import_dir = Path.cwd().joinpath('eikon_time_series_files')\n\n path = Path.joinpath(import_dir, Path(name))\n if path.exists():\n re... | [
"0.67307806",
"0.6705269",
"0.66020596",
"0.657405",
"0.65603095",
"0.65370435",
"0.6523316",
"0.649397",
"0.6477624",
"0.64643633",
"0.6460553",
"0.6448663",
"0.6393308",
"0.6381207",
"0.6349828",
"0.63427573",
"0.6296152",
"0.62775445",
"0.62595654",
"0.62567705",
"0.624957... | 0.63868326 | 13 |
Save a Pandas DataFrame as a .csv file in the "eikon_data_files" directory. | def to_csv(df: pd.DataFrame, name: str, time_series=False) -> None:
abs_dir = os.path.dirname(__file__)
if time_series:
rel_dir = os.path.join(abs_dir, 'eikon_time_series_files')
else:
rel_dir = os.path.join(abs_dir, 'eikon_data_files')
path = ''.join([rel_dir, '/' + name])
df.to_cs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_df(data_frame, file_path):\r\n data_frame.to_csv(file_path)\r\n return None",
"def save_dataframe(dataframe, filename):\n with open(filename, \"w\", encoding=\"utf8\") as outfile: \n dataframe.to_csv(outfile, sep=\",\")",
"def save_to_csv(self):\n path = partial(os.path.join, 'd... | [
"0.7751126",
"0.7741542",
"0.77235526",
"0.7530153",
"0.75150573",
"0.73782974",
"0.73363316",
"0.72214663",
"0.71898437",
"0.7180845",
"0.7163062",
"0.7144632",
"0.7106038",
"0.709286",
"0.7091352",
"0.70737886",
"0.7071926",
"0.7053148",
"0.70504844",
"0.7031922",
"0.701255... | 0.78083926 | 0 |
Returns an int64_list from a bool / enum / int / uint. | def _int64_feature(value):
if type(value) is tuple:
return tf.train.Feature(int64_list=tf.train.Int64List(value=value))
return tf.train.Feature(int64_list=tf.train.Int64List(value=[value])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _BoolsToInts(arg_list):\n result = []\n for arg in arg_list:\n if isinstance(arg, (list, tuple)):\n result.append(_BoolsToInts(arg))\n elif arg is True:\n result.append(1)\n elif arg is False:\n result.append(0)\n else:\n result.append(arg)\n\n return result",
"def convertT... | [
"0.6881019",
"0.6595714",
"0.6460859",
"0.644786",
"0.6367044",
"0.6291411",
"0.62717515",
"0.62177426",
"0.610388",
"0.5953394",
"0.59478253",
"0.5900836",
"0.586359",
"0.586359",
"0.5856958",
"0.58468026",
"0.5843094",
"0.5829474",
"0.5800727",
"0.57932305",
"0.57932305",
... | 0.5570758 | 42 |
Return the geo location as GeoJSON string. | def data_geojson(self):
coordinates = self.value
if not coordinates:
return
title = getattr(self.context, 'title', '') or ''
description = getattr(self.context, 'description', '') or ''
geo_json = {
'type': 'FeatureCollection',
'features': [
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_text(self) -> ir.StringValue:\n return ops.GeoAsText(self).to_expr()",
"def as_geojson(self):\n return _property_op(arctern.ST_AsGeoJSON, self)",
"def toJSON(self):\n if self.gps_position is None:\n latitude = 0\n longitude = 0\n else:\n latit... | [
"0.6826806",
"0.6814304",
"0.6656529",
"0.658978",
"0.65632164",
"0.6535655",
"0.6346617",
"0.6252169",
"0.61669576",
"0.6144571",
"0.6127827",
"0.6127827",
"0.6085484",
"0.6054189",
"0.59957534",
"0.59815854",
"0.5959491",
"0.59433246",
"0.59433246",
"0.5941777",
"0.5922727"... | 0.6473962 | 6 |
CameraNet It estimates both the pose and camera intrinsics. | def CameraNet(features, is_training):
with tf.variable_scope("pose_net"):
batch_norm_params = {"is_training": is_training}
pyramid_src_img_1 = features[0]
pyramid_tgt_img = features[1]
pyramid_src_img_2 = features[2]
input_batch = tf.concat(
[pyramid_src_img_1[4]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def estimate_pose(self, corners, intrinsics: CameraIntrinsics):\n raise NotImplementedError()",
"def computeMVP(self):\n projMat = self.converterYUR\n modelViewMat = self.transforMat.invertCompose(\n Globals.render.getTransform(self.cameraNode)).getMat()\n return UnalignedL... | [
"0.6592196",
"0.6223447",
"0.6046168",
"0.60334927",
"0.5917073",
"0.59081036",
"0.5891999",
"0.5871949",
"0.5829941",
"0.57441187",
"0.5743422",
"0.56673825",
"0.5648097",
"0.5638882",
"0.56342745",
"0.56110543",
"0.5599019",
"0.55657715",
"0.5561983",
"0.55607575",
"0.55546... | 0.6673962 | 0 |
Generate a circularly symmetric Gaussian in the Argand plane. | def complex_normal(
state: _RS,
loc: ArrayLike = 0.0j,
scale: ArrayLike = 1.0,
size: Union[int, Tuple[int, ...], None] = None
):
return (
state.normal(np.real(loc), scale, size) # type: ignore
+ 1j * state.normal(np.imag(loc), scale, size) # type: ignore
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_gaussian():\n amp = 10 * numpy.random.chisquare(3)\n width = numpy.random.chisquare(3)\n mean = numpy.random.uniform(-10 + width, 10 - width)\n x = numpy.linspace(-10, 10, 500)\n y = amp * numpy.exp(- (x - mean) ** 2 / width ** 2)\n add_noise(y, 0.1)\n return x, y",
"def makeGau... | [
"0.6495352",
"0.62161845",
"0.61475927",
"0.6042078",
"0.5990618",
"0.5967892",
"0.59457856",
"0.5945013",
"0.5940905",
"0.5937702",
"0.5857704",
"0.5848969",
"0.5833778",
"0.58322203",
"0.58276606",
"0.58276606",
"0.58135635",
"0.5810499",
"0.57672626",
"0.57608104",
"0.5743... | 0.0 | -1 |
The resource selector to filter policies by resource properties. | def __init__(__self__, *,
name: Optional[pulumi.Input[str]] = None,
selectors: Optional[pulumi.Input[Sequence[pulumi.Input['SelectorArgs']]]] = None):
if name is not None:
pulumi.set(__self__, "name", name)
if selectors is not None:
pulumi.set(__... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_policies_for_resource(self, resource):\n type_id = resource.get('volume_type_id', None)\n # Handle case of volume with no type. We still want the\n # specified defaults from above\n if type_id:\n ctxt = context.get_admin_context()\n volume_type = volume_t... | [
"0.57999605",
"0.5773181",
"0.54636776",
"0.53519744",
"0.5323741",
"0.5285424",
"0.5230564",
"0.5220954",
"0.5216926",
"0.5207869",
"0.5194203",
"0.5194203",
"0.5150603",
"0.51208556",
"0.51208556",
"0.510472",
"0.50736773",
"0.50736773",
"0.50736773",
"0.50492823",
"0.50436... | 0.0 | -1 |
The list of the selector expressions. | def selectors(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['SelectorArgs']]]]:
return pulumi.get(self, "selectors") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __expression_list(self):\n exprs = []\n try:\n expr = self.expression()\n exprs.extend(expr)\n\n while True:\n self.match_value(Punctuator, \",\")\n expr = self.expression()\n exprs.extend(expr)\n except ParseErr... | [
"0.6877212",
"0.6760001",
"0.6653466",
"0.6502484",
"0.59006786",
"0.58701307",
"0.5803656",
"0.57836914",
"0.5719632",
"0.56802464",
"0.56700075",
"0.5573982",
"0.556798",
"0.5540461",
"0.55181104",
"0.5493651",
"0.54884094",
"0.548296",
"0.548296",
"0.5469628",
"0.54270285"... | 0.6876682 | 1 |
The list of values to filter in. | def in_(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "in_") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_(self, value):\n if isinstance(value, (str, text_type)):\n value = [value]\n return Filter(self, value, 'in')",
"def get_filter_values(self):\n return [f.get() for f in self._filters[:-1]] # Ignore placeholder",
"def make_where_in(cls, key, value_list):\n\n return ... | [
"0.71713203",
"0.6701488",
"0.66340995",
"0.66078377",
"0.6269268",
"0.62213147",
"0.6200513",
"0.6115527",
"0.60629606",
"0.5897873",
"0.58724445",
"0.5792276",
"0.57921875",
"0.5784851",
"0.57680815",
"0.57653475",
"0.57638615",
"0.567285",
"0.56682295",
"0.56666315",
"0.56... | 0.0 | -1 |
The list of values to filter out. | def not_in(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "not_in") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_filter_values(self):\n return [f.get() for f in self._filters[:-1]] # Ignore placeholder",
"def values(self):\n return [i.value for i in self.value]",
"def get_values(self):\n \n return []",
"def test_for_criteria(self):\n ignore = ['interpreter_method', 'average_by... | [
"0.7670988",
"0.66491383",
"0.6604559",
"0.6485117",
"0.64402753",
"0.63619",
"0.63611275",
"0.6303091",
"0.62816817",
"0.62771314",
"0.62499774",
"0.6248328",
"0.62341136",
"0.6233651",
"0.6211231",
"0.6209761",
"0.61722285",
"0.61689764",
"0.61556506",
"0.61294425",
"0.6114... | 0.0 | -1 |
Creates and sets a random public nick for the given user | def refresh_public_nickname(user: User) -> str:
nick = _random_nickname()
while DBDiscussionSession.query(User).filter_by(public_nickname=nick).first():
nick = _random_nickname()
LOG.debug("User %s -> %s", user.public_nickname, nick)
user.set_public_nickname(nick)
return nick | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nick(self):\n if(not SOCKET_TO_USERID.has_key(self.source)):\n new_userid = _char_list_to_string(random.sample(ALPHABET, USERID_LENGTH))\n while(USERID_TO_SOCKET.has_key(new_userid)):\n new_userid = _char_list_to_string(random.sample(ALPHABET, USERID_LENGTH))\n ... | [
"0.7106242",
"0.7085513",
"0.6646613",
"0.66199774",
"0.655937",
"0.6467132",
"0.6396582",
"0.63553417",
"0.63118786",
"0.61878216",
"0.6175937",
"0.6136565",
"0.6120226",
"0.6097814",
"0.6094966",
"0.6057226",
"0.60486376",
"0.6038778",
"0.6001381",
"0.59761566",
"0.596908",... | 0.7029205 | 2 |
Get the temp directory for this invocation of pytest shared by all workers. | def root_tmp_dir(
request: pytest.FixtureRequest, tmp_path_factory: pytest.TempPathFactory
) -> Path:
if using_xdist(request):
return tmp_path_factory.getbasetemp().parent
return tmp_path_factory.getbasetemp() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_temp_dir():\n return tempfile.mkdtemp()",
"def temp_directory(self):\n\n return self.get_raw(\"temp_directory\")",
"def tempdir(self):\n path = tempfile.gettempdir()\n return os.path.join(path, 'parquet-index-test-' + str(uuid.uuid4()))",
"def _get_root_temp_dir(self):\n ... | [
"0.7931793",
"0.7759326",
"0.77546394",
"0.7746799",
"0.7732067",
"0.7634266",
"0.76271355",
"0.75296533",
"0.7440563",
"0.74401087",
"0.7429447",
"0.7423604",
"0.74020976",
"0.74008393",
"0.739439",
"0.72771746",
"0.7271872",
"0.7176214",
"0.71696126",
"0.71393585",
"0.71284... | 0.7049334 | 23 |
Replace nonprinting chars with escape sequences, rightstrip. Limit s to max_len by snipping out bits in the middle. | def sanitise(s, max_len=MAX_STRING_LENGTH):
result = ''
if len(s) > max_len:
s = s[0: max_len // 2] + "\n*** <snip> ***\n" + s[-max_len // 2:]
lines = s.rstrip().splitlines()
for line in lines:
for c in line.rstrip() + '\n':
if c < ' ' and c != '\n':
if c == '... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stripEscapes(s):\r\n result = ''\r\n show = 1\r\n i = 0\r\n L = len(s)\r\n while i < L:\r\n if show == 0 and s[i] in ANSI_TERMINATORS:\r\n show = 1\r\n elif show:\r\n n = s.find(ANSI_ESCAPE_BEGIN, i)\r\n if n == -1:\r\n return result ... | [
"0.6786607",
"0.6505607",
"0.63193846",
"0.62063974",
"0.62054354",
"0.6113116",
"0.6063999",
"0.5985852",
"0.5972879",
"0.5971324",
"0.59582806",
"0.59450966",
"0.5943937",
"0.59311616",
"0.5877219",
"0.5802846",
"0.5795996",
"0.57476574",
"0.5725873",
"0.5708619",
"0.569996... | 0.78412265 | 0 |
Allocate a LeNetConvPoolLayer with shared variable internal parameters. | def __init__(self, rng, input, filter_shape, image_shape, poolsize=(2, 2), activation=T.tanh):
assert image_shape[1] == filter_shape[1]
self.input = input
# there are "num input feature maps * filter height * filter width"
# inputs to each hidden unit
fan_in = numpy.prod(filter... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allocate_primal_variables_conv(layer):\n\n assert layer.isconv\n\n gpu_vars = ((layer.l, [1]),\n (layer.k, [1]))\n cpu_vars = ()\n\n heavy_vars = ((layer.W_i, [Cfg.n_batches] + layer.W_shape),\n (layer.b_i, [Cfg.n_batches] + layer.b_shape),\n (layer.... | [
"0.64842194",
"0.63480014",
"0.6143992",
"0.6093791",
"0.603467",
"0.5953963",
"0.5925224",
"0.58546287",
"0.5829507",
"0.5802242",
"0.57969373",
"0.57878524",
"0.5782577",
"0.57791287",
"0.5775954",
"0.5772936",
"0.5769636",
"0.57685167",
"0.5765619",
"0.5759815",
"0.5758101... | 0.0 | -1 |
Specifies the account name of the contact | def account(self) -> str:
return self._account | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_name(self, account_name):\n\n self._account_name = account_name",
"def account_name(self, account_name):\n\n self._account_name = account_name",
"def contact_name(self, contact_name):\n\n self._contact_name = contact_name",
"def contact_name(self, contact_name):\n\n se... | [
"0.7713327",
"0.7713327",
"0.737539",
"0.737539",
"0.68344593",
"0.68344593",
"0.68344593",
"0.6812906",
"0.6778055",
"0.667788",
"0.667788",
"0.66114724",
"0.66114724",
"0.6593748",
"0.6579822",
"0.64956504",
"0.64889306",
"0.63126355",
"0.62590504",
"0.6215418",
"0.611387",... | 0.57079816 | 66 |
Specifies the account name of the contact | def account(self, account: str):
self._account = account | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_name(self, account_name):\n\n self._account_name = account_name",
"def account_name(self, account_name):\n\n self._account_name = account_name",
"def contact_name(self, contact_name):\n\n self._contact_name = contact_name",
"def contact_name(self, contact_name):\n\n se... | [
"0.7713327",
"0.7713327",
"0.737539",
"0.737539",
"0.68344593",
"0.68344593",
"0.68344593",
"0.6812906",
"0.667788",
"0.667788",
"0.66114724",
"0.66114724",
"0.6593748",
"0.6579822",
"0.64956504",
"0.64889306",
"0.63126355",
"0.62590504",
"0.6215418",
"0.611387",
"0.6085297",... | 0.6778055 | 8 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, MapiContactPersonalInfoPropertySetDto):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Iniitalise an ApiClientFactory by passing the token, api_url and app_name, or by passing in the api_secrets_filename | def __init__(self, **kwargs):
builder_kwargs = {}
if "token" in kwargs and str(kwargs["token"]) != "None":
# If there is a token use it along with the specified proxy details if specified
config = ApiConfiguration(
api_url=kwargs.get("api_url", None),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_factory(config):\n return SdkApi(config.get('apiKey'),\n sdk_api_base_url=config['sdkApiBaseUrl'],\n events_api_base_url=config['eventsApiBaseUrl'],\n split_sdk_machine_name=config['splitSdkMachineName'],\n split_sdk_machine_ip=config['... | [
"0.6772961",
"0.650356",
"0.6399361",
"0.6361063",
"0.63227516",
"0.629303",
"0.6280186",
"0.6200639",
"0.6141231",
"0.614054",
"0.61003244",
"0.6023286",
"0.6010457",
"0.59964985",
"0.59919703",
"0.5990344",
"0.5944311",
"0.59302074",
"0.5878384",
"0.587532",
"0.5846201",
... | 0.69160074 | 0 |
Assert that an email will fail with no flask app supplied. | def test_process_filing_missing_app(app, session):
# setup
email_msg = {'email': {'type': 'bn'}}
# TEST
with pytest.raises(Exception):
worker.process_email(email_msg, flask_app=None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testEmailRequired(self):\r\n res = self.app.post('/signup_process')\r\n self.assertIn('Please supply', res.body)",
"def test_no_email(self):\n user = self.make_user()\n data: dict = {}\n\n with self.login(user):\n response = self.post(\"referrals:create\", data=d... | [
"0.7141608",
"0.712236",
"0.71125066",
"0.69904053",
"0.69764674",
"0.68966794",
"0.6896086",
"0.6757559",
"0.6675555",
"0.66366965",
"0.66221803",
"0.66028523",
"0.65942",
"0.6550338",
"0.649285",
"0.6485451",
"0.6474219",
"0.6468559",
"0.64467806",
"0.6436596",
"0.6425632",... | 0.7731551 | 0 |
Assert that the ar reminder notification can be processed. | def test_process_ar_reminder_email(app, session):
# setup filing + business for email
app.env = 'development'
filing = prep_incorp_filing(session, 'BC1234567', '1', 'COMPLETED')
business = Business.find_by_internal_id(filing.business_id)
business.legal_type = 'BC'
business.legal_name = 'test bu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_appointment_date(self):\n # Default for email\n appt_date = datetime.date.today() + datetime.timedelta(days=7) \n self.create_confirmed_notification(self.test_patient, appt_date)\n self.create_unconfirmed_notification(self.other_patient, appt_date)\n\n # run email job\n ... | [
"0.7014083",
"0.7008331",
"0.6841694",
"0.67598665",
"0.67057115",
"0.67057115",
"0.66763777",
"0.6639211",
"0.6618366",
"0.6607627",
"0.65986973",
"0.6553329",
"0.6553329",
"0.65420717",
"0.6476992",
"0.6431637",
"0.6404476",
"0.63858175",
"0.63858175",
"0.63529295",
"0.6337... | 0.6738896 | 4 |
Assert that the nr notification can be processed. | def test_nr_notification(app, session, option, nr_number, subject, expiration_date, refund_value,
expected_legal_name, names):
nr_json = {
'expirationDate': expiration_date,
'names': names,
'applicants': {
'emailAddress': 'test@test.com'
}
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inner_test(param: models.Notification):\n self.assertEqual(param, notif)",
"def test_send_notification(self):\n management.call_command('send_first_report_notification', [], {})\n eq_(len(mail.outbox), 4)",
"def test_counter(self):\n self.assertEqual(self._n_registered, 1)",... | [
"0.61588",
"0.6128881",
"0.59934753",
"0.59739757",
"0.5959257",
"0.5939343",
"0.5930117",
"0.59251463",
"0.59238625",
"0.59238625",
"0.59200567",
"0.59200567",
"0.5906974",
"0.5883313",
"0.58722126",
"0.58332455",
"0.58160204",
"0.58160204",
"0.58160204",
"0.58068407",
"0.57... | 0.5928494 | 7 |
Assert that the email not have body can not be processed. | def test_send_email_with_incomplete_payload(app, session, email_msg):
# TEST
with pytest.raises(QueueException) as excinfo:
worker.send_email(email_msg, None)
assert 'Unsuccessful sending email' in str(excinfo) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_skip_blank_emails(self):\n appt_date = datetime.date.today() + datetime.timedelta(days=7) # Default for email\n confirmed = self.create_confirmed_notification(self.test_patient, appt_date)\n\n blank_contact = self.create_contact(data={'email': ''})\n self.group.contacts.add(bla... | [
"0.7146107",
"0.6915675",
"0.6826136",
"0.6788039",
"0.67554945",
"0.6752405",
"0.67394775",
"0.6733447",
"0.66554475",
"0.6549379",
"0.6529032",
"0.64943486",
"0.6453134",
"0.64490557",
"0.64445615",
"0.6433952",
"0.64199895",
"0.6416688",
"0.64124966",
"0.63992095",
"0.6396... | 0.67659074 | 4 |
Sequence of allowed model components. | def _allowed_components():
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def required_components(cls) -> List[Type[Component]]:\n\n return []",
"def required_components(cls) -> List[Type[Component]]:\n\n return []",
"def components(self):\r\n return list(self._components)",
"def elements_sequence(cls):\n return [\"id\", \"extension\", \"modifierExtension\"... | [
"0.73793",
"0.73793",
"0.66908985",
"0.6516343",
"0.6499231",
"0.6499231",
"0.6359277",
"0.6316025",
"0.6316025",
"0.6161053",
"0.6154886",
"0.60737824",
"0.59501714",
"0.59359324",
"0.5906922",
"0.5901398",
"0.59005386",
"0.58965147",
"0.58965147",
"0.5883939",
"0.58774275",... | 0.7006442 | 2 |
Returns probability density at x. | def pdf(self, x, norm=False):
raise NotImplementedError("Normalized posterior not implemented") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def density(self, x):\n\t\tN = len(self.train_data)\n\t\tpoints = list(self.train_data)\n\t\tdists = [np.linalg.norm(x-point)**2 for point in points]\n\t\texps = [np.exp(-dist / (2 * (self.bandwidth ** 2))) for dist in dists]\n\t\tunnormalized_sum = sum(exps)\n\t\tprobability = (1 / N) * self.normalizing_constant(... | [
"0.8338742",
"0.81750166",
"0.78887165",
"0.7680405",
"0.75821435",
"0.7574821",
"0.7435341",
"0.7435341",
"0.73020935",
"0.7194696",
"0.71118313",
"0.71043575",
"0.7102687",
"0.7077465",
"0.6988106",
"0.69524246",
"0.69523066",
"0.6946738",
"0.6935417",
"0.6851207",
"0.68303... | 0.6214727 | 66 |
Returns log probability density at x. | def logpdf(self, x, norm=False):
raise NotImplementedError("Normalized logposterior not implemented") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_pdf_at_x(x):\n return lambda point: gs.log(\n self.information_manifold.point_to_pdf(point)(x)\n )",
"def log_pdf(self, x):\n if x < 0:\n raise Exception(\"input value x can't be a negative value!\")\n\n if self.is_fit:\n if x >= 0:... | [
"0.774589",
"0.7734643",
"0.7657524",
"0.7616679",
"0.7616679",
"0.75011146",
"0.7486162",
"0.74470204",
"0.728757",
"0.726374",
"0.71725374",
"0.7147766",
"0.71249753",
"0.7120719",
"0.7109896",
"0.71039367",
"0.70449007",
"0.70440155",
"0.7033241",
"0.7021883",
"0.69966984"... | 0.7153739 | 11 |
Converts a file to TFRecords. | def convert_to_tfrecord(data_files, label_files, output_file, num_steps, test_flag):
print('Generating %s' % output_file)
with tf.python_io.TFRecordWriter(output_file) as record_writer:
for idx in enumerate(data_files):
print('Working on %s' % data_files[idx[0]])
print('Working on %s' % label_fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_tfrecord(fname, n_jobs=1, verbose=0):\n dfx = delayed(bytestring_to_record)\n pool = Parallel(n_jobs=n_jobs, verbose=verbose)\n results = pool(dfx(x) for x in tf.compat.v1.python_io.tf_record_iterator(fname))\n features = np.concatenate([xy[0] for xy in results], axis=0)\n meta = pd.concat(... | [
"0.6521392",
"0.6498583",
"0.6342973",
"0.63348126",
"0.62712693",
"0.6258702",
"0.62265116",
"0.6119497",
"0.60536116",
"0.60062724",
"0.59636205",
"0.5962356",
"0.5958885",
"0.59112483",
"0.5869996",
"0.5857997",
"0.5796895",
"0.5724878",
"0.5669789",
"0.56629556",
"0.56558... | 0.5849053 | 16 |
Returns an int64_list from a bool / enum / int / uint. | def _int64_feature(value):
return tf.train.Feature(int64_list=tf.train.Int64List(value=[value])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _BoolsToInts(arg_list):\n result = []\n for arg in arg_list:\n if isinstance(arg, (list, tuple)):\n result.append(_BoolsToInts(arg))\n elif arg is True:\n result.append(1)\n elif arg is False:\n result.append(0)\n else:\n result.append(arg)\n\n return result",
"def convertT... | [
"0.6881019",
"0.6595714",
"0.6460859",
"0.644786",
"0.6367044",
"0.6291411",
"0.62717515",
"0.62177426",
"0.610388",
"0.5953394",
"0.59478253",
"0.5900836",
"0.586359",
"0.586359",
"0.5856958",
"0.58468026",
"0.5843094",
"0.5829474",
"0.5800727",
"0.57932305",
"0.57932305",
... | 0.5494453 | 65 |
Create a reference to this chunk except for anonymous chunks. | def weaveReferenceTo( self, aWeb, aWeaver ):
raise Exception( "Cannot reference an anonymous chunk.""") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, chunk):\n self.anchor = chunk",
"def chunkReferencedBy( self, aChunk ):\n pass",
"def weaveShortReferenceTo( self, aWeb, aWeaver ):\n raise Exception( \"Cannot reference an anonymous chunk.\"\"\")",
"def __init__(self, *args, **kwargs):\n self.anchor = None # Th... | [
"0.56787395",
"0.5616958",
"0.5263241",
"0.5255459",
"0.5109167",
"0.50636923",
"0.5046425",
"0.50201815",
"0.50180846",
"0.49789992",
"0.49304873",
"0.491963",
"0.49041337",
"0.48338857",
"0.4807949",
"0.47960266",
"0.47957504",
"0.478178",
"0.47474682",
"0.47415078",
"0.473... | 0.5177641 | 4 |
Return duration of the action. | def duration( self ):
return (self.start and time.process_time()-self.start) or 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duration(self):\n pass",
"def duration(self):\n pass",
"def get_duration(self):\n return self.duration",
"def duration(self):\n # type: () -> int\n return self._duration",
"def duration(self) -> int:\n return 0",
"def duration(self):\n return self._get... | [
"0.7895342",
"0.7895342",
"0.7618661",
"0.75292933",
"0.7504358",
"0.7488684",
"0.7432561",
"0.7422858",
"0.7364661",
"0.7358063",
"0.7358063",
"0.7358063",
"0.7358063",
"0.7358063",
"0.7358063",
"0.7358063",
"0.7358063",
"0.73210686",
"0.732026",
"0.73166597",
"0.7311676",
... | 0.7163024 | 31 |
Verify that the user isn't redirected with no tour | def test_no_tour(self):
mock_request = Mock(user=self.test_user, path='mock2', method='get', GET={})
mock_view = MockView(request=mock_request)
response = mock_view.dispatch(mock_request)
self.assertEqual(200, response.status_code) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_request_unrelated_page(self, mock_step1_is_complete):\n mock_step1_is_complete.return_value = False\n\n self.tour1.load_tour_class().add_user(self.test_user)\n\n # request page that isn't in the tour before tour is complete\n mock_request = Mock(user=self.test_user, path='mock-... | [
"0.66997665",
"0.6686417",
"0.66811967",
"0.6569483",
"0.654089",
"0.64401174",
"0.6413879",
"0.63206506",
"0.6318933",
"0.62673044",
"0.6264956",
"0.6245029",
"0.6226861",
"0.62205815",
"0.62173223",
"0.6214819",
"0.62034816",
"0.6174233",
"0.6138139",
"0.61237067",
"0.61226... | 0.6050557 | 28 |
Update a current review | def update_review(review_id):
review_obj = storage.get(Review, review_id)
if review_obj:
body_dic = request.get_json()
if not body_dic:
return jsonify({'error': 'Not a JSON'}), 400
for key, value in body_dic.items():
setattr(review_obj, key, value)
review_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_review(review_id=None):\n review = storage.get(Review, review_id)\n if review:\n updated = request.get_json()\n if not updated:\n abort(400, \"Not a JSON\")\n for key, val in updated.items():\n if key not in ['id', 'created_at', 'updated_at',\n ... | [
"0.71294487",
"0.71207255",
"0.7097907",
"0.7027455",
"0.6988941",
"0.6972015",
"0.69259816",
"0.6915716",
"0.6864468",
"0.6665433",
"0.6638563",
"0.6580652",
"0.65779734",
"0.6547396",
"0.6541889",
"0.64922386",
"0.6455932",
"0.64030564",
"0.6367938",
"0.6324456",
"0.6313481... | 0.7068726 | 3 |
create dictionary for sparse feature | def sparseFeature(feat_name, feat_num, embed_dim=4):
return {'feat_name': feat_name, 'feat_num': feat_num, 'embed_dim': embed_dim} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sparseFeature(self, feat, feat_num, embed_dim=4):\n return {'feat': feat, 'feat_num': feat_num, 'embed_dim': embed_dim}",
"def denseFeature(self, feat):\n return {'feat': feat}",
"def featurize(vector,features):\n dictionary = collections.defaultdict(lambda:0)\n for feature in iter(set(... | [
"0.75767976",
"0.68565416",
"0.6779232",
"0.65597075",
"0.6550707",
"0.6534703",
"0.64986527",
"0.64876294",
"0.6419102",
"0.6395745",
"0.63638943",
"0.6296161",
"0.6294983",
"0.6291927",
"0.6231663",
"0.61766374",
"0.60696816",
"0.602503",
"0.600544",
"0.5999356",
"0.5997134... | 0.76782995 | 0 |
Restrict the queryset to questions the given user has access to. A staff user has access to all questions. | def filter_subjects(queryset, user):
if user.is_staff:
return queryset
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self: 'AnswerViewSet'):\n queryset = super().get_queryset()\n can_create = self.request.user.user_type.create_questions\n if can_create:\n pass\n else:\n raise PermissionDenied\n return queryset",
"def filter_granted(self, queryset):\n ... | [
"0.7082054",
"0.68774784",
"0.6868787",
"0.6740431",
"0.67040294",
"0.666735",
"0.663966",
"0.66258794",
"0.6619525",
"0.66009635",
"0.65996474",
"0.65994376",
"0.6583608",
"0.6555876",
"0.6522044",
"0.65150607",
"0.6462709",
"0.64138156",
"0.6316598",
"0.62935036",
"0.627161... | 0.6682282 | 5 |
Given a row in the test dataset Returns the recall score when popular products are recommended | def popular_recommend(row):
actual = new_purchase_row(row)
return f1(actual, popular_products) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recallAndPrecision(self,train = None,test = None,k = 8,nitem = 10):\n train = train or self.traindata\n test = test or self.testdata\n hit = 0\n recall = 0\n precision = 0\n for user in train.keys():\n tu = test.get(user,{})\n rank = self.recomme... | [
"0.70278084",
"0.6613444",
"0.6551399",
"0.6453224",
"0.6417849",
"0.63159454",
"0.6313836",
"0.63087803",
"0.62681466",
"0.62192",
"0.621912",
"0.61930907",
"0.61916447",
"0.61904746",
"0.61890614",
"0.61855364",
"0.6154689",
"0.61428875",
"0.6133423",
"0.6125558",
"0.612443... | 0.7091549 | 0 |
Given a row in the test dataset Returns the recall score when our model recommends new products | def svd_recommend_new(row):
actual = new_purchase_row(row)
recommended = svd_rec.recommend_new(u_dict[row["user_id"]], N=10)
recommended = [p_dict[r[0]] for r in recommended]
return f1(actual, recommended) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recallAndPrecision(self,train = None,test = None,k = 8,nitem = 10):\n train = train or self.traindata\n test = test or self.testdata\n hit = 0\n recall = 0\n precision = 0\n for user in train.keys():\n tu = test.get(user,{})\n rank = self.recomme... | [
"0.7109916",
"0.6802936",
"0.6678143",
"0.66692823",
"0.66546273",
"0.66385275",
"0.65905946",
"0.6557385",
"0.6557385",
"0.6557385",
"0.6557385",
"0.6557385",
"0.6557385",
"0.6537762",
"0.65038174",
"0.65038174",
"0.65038174",
"0.65038174",
"0.65038174",
"0.65038174",
"0.650... | 0.6058264 | 70 |
Find local maxima of x. | def find_maxima(x):
idx = []
for i in range(len(x)):
# `i` is a local maximum if the signal decreases before and after it
if x[i-1] < x[i] and x[i+1] < x[i]:
idx.append(i)
return idx | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_max(x, threshold=1e-5):\n maxima = np.r_[True, x[1:] > x[:-1]] & np.r_[x[:-1] > x[1:] , True]\n # select all local maxima above the threshold\n maxima_f = maxima & np.r_[x > threshold , True][:-1]\n peak_indices = np.where(maxima_f==True)[0]\n return np.array(peak_indices)",
"def local_... | [
"0.7678949",
"0.7214239",
"0.7185012",
"0.69021314",
"0.68611604",
"0.6824614",
"0.6649827",
"0.65998054",
"0.65641016",
"0.6546477",
"0.65399814",
"0.64374244",
"0.6367273",
"0.6353284",
"0.631738",
"0.6308344",
"0.630741",
"0.62965506",
"0.6295892",
"0.62558866",
"0.6236714... | 0.7662323 | 1 |
Turn the switch off. | def turn_off(self, **kwargs):
self.enabled = self.fritz_box.set_call_forwarding(self.uid, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_off(self, **kwargs):\n self.smartplug.turn_off()",
"def off_switch(self):\n self._switch_callback = None",
"def turn_off(self):\n self.handleCommand(1)\n self._state = STATE_OFF",
"def turn_off(self, **kwargs):\n set_sonoff_state(self._host, \"off\")\n self.... | [
"0.870139",
"0.867637",
"0.85906535",
"0.8523712",
"0.84588856",
"0.84180963",
"0.8404447",
"0.8398465",
"0.8375364",
"0.83491224",
"0.83192796",
"0.82949907",
"0.8277566",
"0.81680954",
"0.8155346",
"0.8112255",
"0.8091075",
"0.8072859",
"0.8058921",
"0.8058517",
"0.8041678"... | 0.7470762 | 56 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.