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 |
|---|---|---|---|---|---|---|
This test checks whether for a given synset, all possible hypernyms are returned | def test_all_hypernyms(id, hypernym_ids):
synset = germanet_data.get_synset_by_id(id)
hypernyms = synset.all_hypernyms()
np.testing.assert_equal(sorted([synset.id for synset in hypernyms]), sorted(hypernym_ids)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_hypernyms(self, syns):\n names = set()\n # Find hypernyms of each syn\n for syn in syns:\n hypernyms = syn.hypernyms()\n # find hypernyms one more level up\n for hypernym in hypernyms:\n names.add(hypernym.name())\n hypern... | [
"0.6447984",
"0.635646",
"0.5946183",
"0.5932303",
"0.5716497",
"0.57008815",
"0.5606709",
"0.5599611",
"0.5594502",
"0.5508961",
"0.5491522",
"0.54866076",
"0.5483737",
"0.54553556",
"0.5453023",
"0.54368407",
"0.54358184",
"0.5426661",
"0.5425853",
"0.541473",
"0.53654814",... | 0.7029513 | 0 |
Tests whether the length of the shortest path between two given adjectives is correct. | def test_pathlength_adj(id1, id2, pathlength):
synset1 = germanet_data.get_synset_by_id(id1)
synset2 = germanet_data.get_synset_by_id(id2)
dist = synset1.shortest_path_distance(synset2)
np.testing.assert_equal(dist, pathlength) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_pathlength_verbs(id1, id2, pathlength):\n synset1 = germanet_data.get_synset_by_id(id1)\n synset2 = germanet_data.get_synset_by_id(id2)\n dist = synset1.shortest_path_distance(synset2)\n np.testing.assert_equal(dist, pathlength)",
"def test_pathlength_nouns(id1, id2, pathlength):\n synset... | [
"0.7541143",
"0.7260202",
"0.6267226",
"0.6255776",
"0.6217914",
"0.613497",
"0.61056346",
"0.6098089",
"0.608721",
"0.6059022",
"0.6059022",
"0.6059022",
"0.6059022",
"0.6059022",
"0.6059022",
"0.6059022",
"0.6059022",
"0.6059022",
"0.6059022",
"0.6015397",
"0.596174",
"0.... | 0.769569 | 0 |
Compute a sparse cross entropy. This means that the preds are logits and the targets are not one hot encoded. | def __init__(self, model=None, reduction: str = "mean"):
super().__init__()
self.loss_fun = CrossEntropyLoss(reduction=reduction) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sparse_cross_entropy(true, pred, axis=-1, epsilon=1e-7):\n true = ivy.one_hot(true, pred.shape[axis])\n return cross_entropy(true, pred, axis, epsilon)",
"def sparse_cross_entropy(y_true, y_pred):\n\n # Calculate the loss. This outputs a\n # 2-rank tensor of shape [batch_size, sequence_length]\n ... | [
"0.82323325",
"0.7429562",
"0.73316807",
"0.73081577",
"0.7285346",
"0.6862087",
"0.6850867",
"0.68386394",
"0.6686496",
"0.6593712",
"0.6568145",
"0.65485775",
"0.65369123",
"0.6533163",
"0.65197206",
"0.6491512",
"0.64902043",
"0.6458548",
"0.64531165",
"0.6451156",
"0.6419... | 0.0 | -1 |
Compute a binary cross entropy. This means that the preds are logits and the targets are a binary (1 or 0) tensor of same shape as logits. | def __init__(self, model=None, reduction: str = "mean"):
super().__init__()
self.loss_fun = BCEWithLogitsLoss(reduction=reduction) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross_entropy(input: Tensor, target: Tensor) -> Tensor:\n norm_log = log_softmax(input, 1)\n\n np_one_hot = np.eye(input.shape[1])[target.data]\n tensor_one_hot = tensor(np_one_hot, 'one-hot', False, True)\n\n mask = -norm_log * tensor_one_hot\n mask_sum = sum(mask, 1)\n loss = sum(mask_sum, ... | [
"0.79840446",
"0.7983569",
"0.78463763",
"0.76668656",
"0.7661692",
"0.7616074",
"0.7560217",
"0.73689306",
"0.7342569",
"0.72954977",
"0.7212439",
"0.71697986",
"0.71490806",
"0.7133071",
"0.71073663",
"0.70911866",
"0.70828855",
"0.7055289",
"0.70448",
"0.70448",
"0.7038638... | 0.0 | -1 |
Get a random element from the set. | def getRandom(self) -> int:
return random.choice(self._list) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getRandom(self):\n return self.nums[random.randint(0, len(self.nums) - 1)]\n\n # Your RandomizedSet object will be instantiated and called as such:\n # obj = RandomizedSet()\n # param_1 = obj.insert(val)\n # param_2 = obj.remove(val)\n # param_3 = obj.getRandom()",
"... | [
"0.77060276",
"0.738916",
"0.7296881",
"0.72187954",
"0.6871744",
"0.68453854",
"0.68330806",
"0.67740154",
"0.67226046",
"0.6703282",
"0.6665089",
"0.66356236",
"0.66217655",
"0.6612035",
"0.66000897",
"0.6567767",
"0.6477719",
"0.6462421",
"0.64428514",
"0.64162946",
"0.640... | 0.6322437 | 27 |
Returns the data directory. | def get_data_dir():
rootdir = os.path.dirname(__file__)
libdir = rootdir + os.sep + "data"
return libdir | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_directory(self):\n\n return self.get_raw(\"data_directory\")",
"def get_data_dir(self):\n return self.data_dir",
"def data_dir():\n return _config.datadir",
"def _get_data_directory(self):\n\n return self.data_directory",
"def data_dir():\n return os.path.join(os.path.di... | [
"0.91150814",
"0.8928915",
"0.89048344",
"0.8863079",
"0.87964994",
"0.8794162",
"0.8777221",
"0.87647927",
"0.87647927",
"0.8736446",
"0.87121147",
"0.8609783",
"0.8485702",
"0.846442",
"0.8444031",
"0.8390282",
"0.83682466",
"0.8359043",
"0.8314229",
"0.82693124",
"0.825739... | 0.8159899 | 26 |
Returns the human readable date of when the user signed up for google reader. | def getUserSignupDate(self):
userinfo = self.getUserInfo()
timestamp = int(float(userinfo["signupTimeSec"]))
return time.strftime("%m/%d/%Y %H:%M", time.gmtime(timestamp)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_date(self):\n return self.individual_session.session_date.strftime('%A')",
"def date_created(self) -> str:\n return pulumi.get(self, \"date_created\")",
"def date_registered(self) -> datetime:\n return datetime.utcfromtimestamp(self.registered)",
"def date_created(self):\n ... | [
"0.60583067",
"0.60124624",
"0.6006879",
"0.59750855",
"0.5881641",
"0.5879202",
"0.5864761",
"0.5828228",
"0.58203244",
"0.5763093",
"0.57532036",
"0.5736764",
"0.57355356",
"0.5717865",
"0.5717865",
"0.5717865",
"0.57166237",
"0.57090497",
"0.5624038",
"0.5618689",
"0.56161... | 0.7463178 | 0 |
Quote a string for being used in a HTTP URL | def urlQuote(string):
return quote(string.encode("utf-8")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _quote(self, arg):\n arg = arg.replace('\\\\', '\\\\\\\\')\n arg = arg.replace('\"', '\\\\\"')\n return '\"%s\"' % arg",
"def aws_urlquote(value):\n if isinstance(value, unicode):\n value = value.encode(\"utf-8\")\n return quote(value, \"/\")",
"def _quote(src, encoding=\"... | [
"0.72957665",
"0.72943646",
"0.7175487",
"0.7063",
"0.68737274",
"0.6790081",
"0.6758745",
"0.6752273",
"0.67297083",
"0.6702153",
"0.64785284",
"0.6440624",
"0.6416424",
"0.64022374",
"0.63811535",
"0.6347922",
"0.6290744",
"0.6289867",
"0.62790555",
"0.626407",
"0.6259825",... | 0.8493452 | 0 |
Initializes a path specification. Note that an XFS path specification must have a parent. | def __init__(
self, inode=None, location=None, parent=None, **kwargs):
if (not inode and not location) or not parent:
raise ValueError('Missing inode and location, or parent value.')
super(XFSPathSpec, self).__init__(parent=parent, **kwargs)
self.inode = inode
self.location = location | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testInitialize(self):\n path_spec = tsk_path_spec.TSKPathSpec(\n location=u'/test', parent=self._path_spec)\n\n self.assertIsNotNone(path_spec)\n\n path_spec = tsk_path_spec.TSKPathSpec(\n data_stream=u'test', location=u'/test', parent=self._path_spec)\n\n self.assertIsNotNone(path_sp... | [
"0.6587108",
"0.63917124",
"0.631676",
"0.62570417",
"0.6157883",
"0.6134044",
"0.60264254",
"0.59963125",
"0.5979689",
"0.5874691",
"0.5835547",
"0.5819054",
"0.57972467",
"0.5759765",
"0.5759765",
"0.5759765",
"0.5759765",
"0.57301426",
"0.5704401",
"0.5649574",
"0.5647379"... | 0.7312965 | 0 |
A decorator for functions that define TensorFlow operations. The wrapped function will only be executed once. Subsequent calls to it will directly return the result so that operations are added to the graph only once. The operations added by the function live within a tf.variable_scope(). If this decorator is used with... | def define_scope(function, scope=None, *args, **kwargs):
attribute = '_cache_' + function.__name__
name = scope or function.__name__
@property
@functools.wraps(function)
def decorator(self):
if not hasattr(self, attribute):
with tf.variable_scope(name, *args, **kwargs):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scope_op(name=None):\n def decorator(function):\n @functools.wraps(function)\n def wrapper(*args, **kwargs):\n with tf.name_scope(name or function.__name__):\n return function(*args, **kwargs)\n return wrapper\n return decorator",
"def scoped_fn(fn: Callab... | [
"0.78927577",
"0.751331",
"0.73755854",
"0.73552024",
"0.7162671",
"0.6325444",
"0.6179797",
"0.6169139",
"0.61481345",
"0.61018497",
"0.61018497",
"0.6034184",
"0.60232896",
"0.6012298",
"0.600714",
"0.5979663",
"0.5932648",
"0.5874545",
"0.5866294",
"0.5851432",
"0.5847887"... | 0.73757416 | 2 |
Sets the first_name of this CreateApplicantRequest. | def first_name(self, first_name):
self._first_name = first_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_first_name(self, first_name):\n self.first_name = first_name",
"def first_name(self, name):\n self._first_name = name",
"def first_name(self, first_name):\n if first_name is None:\n raise ValueError(\"Invalid value for `first_name`, must not be `None`\") # noqa: E501\n\... | [
"0.7933002",
"0.75360674",
"0.73992056",
"0.7396647",
"0.7345295",
"0.7262445",
"0.7262445",
"0.66625583",
"0.64858776",
"0.64858776",
"0.63673246",
"0.6342137",
"0.62878406",
"0.62611556",
"0.6241854",
"0.62040424",
"0.62040424",
"0.62040424",
"0.6108807",
"0.60430706",
"0.6... | 0.7664771 | 5 |
Sets the last_name of this CreateApplicantRequest. | def last_name(self, last_name):
self._last_name = last_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_last_name(self, last_name):\n self.last_name = last_name",
"def setLastname(self, lastname):\n self.lastname = lastname\n return self",
"def lastname(self, lastname):\n\n self._lastname = lastname",
"def last_name(self, last_name: str):\n if last_name is None:\n ... | [
"0.7346735",
"0.7145295",
"0.6957746",
"0.6795343",
"0.6773958",
"0.67020017",
"0.64087623",
"0.64087623",
"0.63383347",
"0.6119842",
"0.6029574",
"0.59530544",
"0.5940121",
"0.59247804",
"0.59247804",
"0.59218293",
"0.59218293",
"0.59218293",
"0.59218293",
"0.59038657",
"0.5... | 0.7140417 | 6 |
Sets the org_id of this CreateApplicantRequest. | def org_id(self, org_id):
self._org_id = org_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def organization_id(self, organization_id):\n\n self._organization_id = organization_id",
"def organization_id(self, organization_id):\n\n self._organization_id = organization_id",
"def org_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"org_id\")",
"def org_id(self) -> Option... | [
"0.60557467",
"0.60557467",
"0.592969",
"0.5854032",
"0.55530894",
"0.55530894",
"0.5536712",
"0.54492754",
"0.54492754",
"0.54248226",
"0.53522474",
"0.53110695",
"0.5284691",
"0.52356887",
"0.52159256",
"0.5195971",
"0.5187121",
"0.51376975",
"0.5027186",
"0.49676335",
"0.4... | 0.6870407 | 0 |
Sets the email of this CreateApplicantRequest. | def email(self, email):
self._email = email | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email(self, email):\n if self.local_vars_configuration.client_side_validation and email is None: # noqa: E501\n raise ValueError(\"Invalid value for `email`, must not be `None`\") # noqa: E501\n\n self._email = email",
"def email(self, email):\n if self.local_vars_configurat... | [
"0.7182072",
"0.69875395",
"0.6789771",
"0.6602995",
"0.64879864",
"0.63189346",
"0.6307234",
"0.6247706",
"0.5884455",
"0.5884455",
"0.57128245",
"0.5637214",
"0.5637214",
"0.5637214",
"0.5570526",
"0.54982924",
"0.5492251",
"0.54542756",
"0.5432048",
"0.5404546",
"0.5394034... | 0.6215094 | 12 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, CreateApplicantRequest):
return False
return self.to_dict() == other.to_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.8089139",
"0.8089139",
"0.8054507",
"0.79827213",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, CreateApplicantRequest):
return True
return self.to_dict() != other.to_dict() | {
"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.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Return the percolumn average gradient of xhat xhat with respect to r. | def auto_gradients(xhat , r ):
dxdr = tf.gradients(xhat,r)[0]
dxdr = tf.reduce_mean(dxdr,0)
minVal=.5/int(r.get_shape()[0])
dxdr = tf.maximum( dxdr, minVal)
return dxdr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gradient(cls, x):\n return 1 - TanH.apply(x) ** 2",
"def grad(self, A, y, x):\n z = y - A.dot(x) # Error for each observation\n grad_x = -1 * A.T.dot(np.sign(z))\n # Gradient normalized by the num obs\n return grad_x / y.size",
"def gradient(self, x):\n return 0.0... | [
"0.61650765",
"0.5845312",
"0.58304",
"0.58169204",
"0.5774122",
"0.57639885",
"0.56508726",
"0.5641918",
"0.56312984",
"0.5618514",
"0.5615527",
"0.56032676",
"0.5581195",
"0.5570839",
"0.5561711",
"0.55300313",
"0.54683375",
"0.5465065",
"0.5460379",
"0.5454601",
"0.5448456... | 0.65648156 | 0 |
soft threshold function y=sign(x)max(0,abs(x)theta[0]sqrt(rvar) )scaling where scaling is theta[1] (default=1) in other words, if theta is len(1), then the standard | def shrink_soft_threshold(r,rvar,theta):
if len(theta.get_shape())>0 and theta.get_shape() != (1,):
lam = theta[0] * tf.sqrt(rvar)
scale=theta[1]
else:
lam = theta * tf.sqrt(rvar)
scale = None
lam = tf.maximum(lam,0)
arml = tf.abs(r) - lam
xhat = tf.sign(r) * tf.maxi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_thresholding(x):\n return x > threshold_otsu(x)",
"def soft_threshold(X, sigma):\r\n tmp = abs(X) - sigma\r\n tmp[np.where(tmp < 0)] = 0\r\n return tmp * np.sign(X)",
"def _threshold(data, sigma=2.0):\r\n return np.mean(data)-sigma*np.sqrt(np.var(data))",
"def soft_thresholding(w, al... | [
"0.66342354",
"0.63382596",
"0.6260185",
"0.621073",
"0.62086296",
"0.59217685",
"0.5908592",
"0.5894611",
"0.5770166",
"0.5755764",
"0.5750161",
"0.5717057",
"0.56745875",
"0.56332046",
"0.56273985",
"0.56161016",
"0.5614397",
"0.5581289",
"0.5571791",
"0.5559763",
"0.555561... | 0.7106473 | 0 |
Convert name to camelcase, name_xyz into nameXyz. | def _name_convert_camel_case(self, meta):
if isinstance(meta, list):
new_meta = []
for m in meta:
new_meta.append(self._name_convert_camel_case(m))
elif isinstance(meta, dict):
new_meta = {}
for (key, value) in meta.items():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_camel_case(name):\n s1 = re.sub('(.)([A-Z][a-z]+)', r'\\1_\\2', name)\n return re.sub('([a-z0-9])([A-Z])', r'\\1_\\2', s1).lower()",
"def convert(name):\n s1 = re.sub('(.)([A-Z][a-z]+)', r'\\1_\\2', name)\n return re.sub('([a-z0-9])([A-Z])', r'\\1_\\2', s1).lower()",
"def to_upper_camel... | [
"0.817713",
"0.7989559",
"0.79879755",
"0.79784876",
"0.7960444",
"0.7900999",
"0.7820047",
"0.77032995",
"0.76384777",
"0.76278955",
"0.7624447",
"0.7518263",
"0.7510767",
"0.7384964",
"0.7382444",
"0.7322731",
"0.73220736",
"0.7315476",
"0.72346944",
"0.7228309",
"0.7209635... | 0.0 | -1 |
Overwrite __repr__. Returns str String representation is this instance. | def __repr__(self):
return self._metadata.__str__() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self) -> str:\n return self.__str__()",
"def __repr__(self) -> str:\n return self.__str__()",
"def __repr__(self) -> str:\n return self.__str__()",
"def __repr__(self) -> str:\n return self.__str__()",
"def __repr__(self):\n # this is a good default __repr__\... | [
"0.834079",
"0.834079",
"0.834079",
"0.834079",
"0.82991177",
"0.8208388",
"0.8195083",
"0.8160657",
"0.81425416",
"0.81425416",
"0.81425416",
"0.81274056",
"0.8091054",
"0.80855757",
"0.80855757",
"0.80855757",
"0.80732375",
"0.8066415",
"0.8062463",
"0.80618596",
"0.8028462... | 0.0 | -1 |
Overwrite __repr__. Returns str String representation is this instance. | def __repr__(self):
return self._metadata.__str__() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self) -> str:\n return self.__str__()",
"def __repr__(self) -> str:\n return self.__str__()",
"def __repr__(self) -> str:\n return self.__str__()",
"def __repr__(self) -> str:\n return self.__str__()",
"def __repr__(self):\n # this is a good default __repr__\... | [
"0.83398294",
"0.83398294",
"0.83398294",
"0.83398294",
"0.8298266",
"0.82076555",
"0.8193652",
"0.8159326",
"0.81408757",
"0.81408757",
"0.81408757",
"0.8125967",
"0.8089547",
"0.8084829",
"0.8084829",
"0.8084829",
"0.80720127",
"0.8065968",
"0.8062001",
"0.80607736",
"0.802... | 0.0 | -1 |
Create a single model instance for the given model class using initial data from the kwargs. | def make(model: Type[Model], **kwargs: Any) -> Model:
return modelfactory_factory(model)(**kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_instance(self, data, **kwargs):\n instance = self.instance or self.get_instance(data)\n if instance is not None:\n for key, value in iteritems(data):\n setattr(instance, key, value)\n return instance\n kwargs, association_attrs = self._split_model_... | [
"0.75729764",
"0.7188079",
"0.7022958",
"0.6907018",
"0.68906885",
"0.6796405",
"0.6750519",
"0.6661371",
"0.66439986",
"0.6620512",
"0.6618984",
"0.6618984",
"0.6618984",
"0.66003",
"0.6584936",
"0.6563957",
"0.6496155",
"0.6438705",
"0.64314574",
"0.6430422",
"0.64302135",
... | 0.6805391 | 5 |
Returns the file name (with no extension) of a file path | def getFileName(filepath):
return os.path.splitext(os.path.basename(filepath))[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file_name(path):\n return os.path.basename(path)",
"def get_file_name(path: str) -> str:\n return os.path.splitext(os.path.basename(path))[0]",
"def getfilename(path):\r\n return path.split('\\\\').pop().split('/').pop().rsplit('.', 1)[0]",
"def file_name(path):\n return os.path.basename(... | [
"0.8837971",
"0.87674034",
"0.86807775",
"0.8630858",
"0.8620158",
"0.8560175",
"0.85418713",
"0.8442598",
"0.84362113",
"0.83892107",
"0.81312454",
"0.8088448",
"0.8056311",
"0.80364877",
"0.7956966",
"0.7939716",
"0.7853413",
"0.78112227",
"0.7779326",
"0.7773028",
"0.77491... | 0.7988202 | 14 |
Mark story as read. | def mark_as_read(self):
# TODO: NewsBlur requests that stories are maked as read in batches.
return self._api_client.mark_stories_as_read([self]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mark_as_read(entry):\n if has_been_read(entry):\n return\n title = entry.title\n date = date_parser.parse(entry.updated)\n READLIST.append(str(date.timestamp()) + '|' + title)\n save_datfile()",
"def mark_read(self):\n # Obviously remove the exception when Kippt says the support ... | [
"0.6646454",
"0.6508366",
"0.64407915",
"0.6406497",
"0.64064676",
"0.6406132",
"0.63767743",
"0.6362675",
"0.63274366",
"0.6307067",
"0.6194394",
"0.6184216",
"0.6161115",
"0.6124295",
"0.5906011",
"0.57632416",
"0.5728083",
"0.5687896",
"0.5682324",
"0.5674693",
"0.5623822"... | 0.7617563 | 0 |
Mark story as unread. | def mark_as_unread(self):
response = self._api_client.session.post(
self._api_client._construct_url('/reader/mark_story_as_unread'),
data={'story_id': self.id, 'feed_id': self.feed_id})
return response.json()['result'] == 'ok' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mark_messages_unread(self, mbox, msgset):\n self._remove_flag(mbox, msgset, r'(\\Seen)')",
"def mark_messages_read(self, mbox, msgset):\n self._add_flag(mbox, msgset, r'(\\Seen)')",
"def set_article_unread_status(self, feed: Feed, article: Article, status: bool) -> None:\n if article.u... | [
"0.7048283",
"0.6786256",
"0.6577648",
"0.6561926",
"0.6536257",
"0.6476389",
"0.6454181",
"0.6251615",
"0.62086827",
"0.6174622",
"0.6069137",
"0.60144824",
"0.6010323",
"0.5929119",
"0.58836216",
"0.5776549",
"0.57741404",
"0.56974137",
"0.5645028",
"0.561902",
"0.5607947",... | 0.7941663 | 0 |
return a list contains node map from node_list | def get_map_list(self, node_list):
return [self.d[node] for node in node_list] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_inv_map_list(self, map_list):\n return [self.d_inv[node_map] for node_map in map_list]",
"def filter_list(self, node_list):\n filtered_list = []\n for node in node_list:\n if self.is_member(node):\n filtered_list.append(node)\n return filtered_list",
"def node_mapping(self):... | [
"0.646974",
"0.6247845",
"0.6233194",
"0.6214845",
"0.62065685",
"0.6140607",
"0.60903245",
"0.58971393",
"0.5891342",
"0.58773404",
"0.58572644",
"0.5843887",
"0.58334094",
"0.58334094",
"0.578527",
"0.577004",
"0.5754581",
"0.5722929",
"0.5717278",
"0.5708095",
"0.5680849",... | 0.81692505 | 0 |
The type of object | def type(self) -> str:
return self.type_ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_type ( self, object ):\n return self.type",
"def get_type ( self, object ):\n return self.type",
"def object_type(self):\n return self._object_type",
"def object_type(self):\n return self._object_type",
"def object_type(self):\n return self._object_type",
"def o... | [
"0.85759574",
"0.85759574",
"0.8466001",
"0.8466001",
"0.8466001",
"0.8466001",
"0.8466001",
"0.8360673",
"0.83356804",
"0.83356804",
"0.83356804",
"0.83356804",
"0.83356804",
"0.83356804",
"0.83356804",
"0.83356804",
"0.83356804",
"0.83356804",
"0.83356804",
"0.83356804",
"0... | 0.0 | -1 |
Get the arguments for this instance. | def _get_arguments(self) -> str:
func = self.node
# Early logic used to iterate over, `func.get_arguments()`, however when there
# is an unknown type clang will sometimes fail to provide tokens for that
# argument. For example in "unknown_type foo[]" the brackets will cause clang
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def args(self):\n return self._args",
"def args(self):\n return self._args",
"def args(self):\n return self._args",
"def get_args(self):\r\n return self.args",
"def arguments(self):\n return parse_arguments(self['data'])",
"def args(self):\n return self._parse_ar... | [
"0.83091754",
"0.83091754",
"0.83091754",
"0.81521505",
"0.8142482",
"0.80882025",
"0.8066919",
"0.80135965",
"0.7809999",
"0.77564883",
"0.76945955",
"0.76806515",
"0.76806515",
"0.76806515",
"0.76806515",
"0.76806515",
"0.76806515",
"0.76806515",
"0.76806515",
"0.76806515",
... | 0.0 | -1 |
r""" This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(self, cm, classes, normalize = False, title = 'Confusion matrix', cmap = plt.cm.Blues):
if normalize:
cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
else:
pass
plt.imshow(cm, interpolation='nearest', cmap=cmap)
plt.title(title)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.8109643",
"0.79920137",
"0.7933797",
"0.7887128",
"0.7877791",
"0.7853214",
"0.7848227",
"0.7827267",
"0.78138924",
"0.7809602",
"0.78063685",
"0.7792381",
"0.77863723",
"0.7773253",
"0.77680427",
"0.7766",
"0.7765681",
"0.775925",
"0.77573496",
"0.7756235",
"0.7753833",
... | 0.0 | -1 |
Get group action objects from notification | def get(self):
FetchGroupActionObjects.__init__(self)
kwargs = self.parser.parse_args()
query = self.notifications_db.construct_lucene_complex_query([
('target_role', {'value': self.role}),
('targets', {'value': self.username, 'join_operator': 'OR'}),
('group'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actions(self, request, action_list, group):\n return action_list",
"def get(self):\n FetchActionObjects.__init__(self)\n kwargs = self.parser.parse_args()\n notification_id = kwargs['notification_id']\n mcm_notification = self.notifications_db.get(notification_id)\n ... | [
"0.66256636",
"0.59811145",
"0.5977449",
"0.59467477",
"0.5859267",
"0.5859267",
"0.5859267",
"0.5777814",
"0.57573575",
"0.57348853",
"0.56954163",
"0.568788",
"0.56495345",
"0.5635704",
"0.5614752",
"0.56097156",
"0.56097156",
"0.55803347",
"0.5565751",
"0.5547309",
"0.5530... | 0.7204011 | 0 |
Removes any trailing/leading single/double quotes from a string. Noops if the given object is not a string or otherwise does not have a .strip() method. | def _Unquote(s):
if not hasattr(s, 'strip'):
return s
# Repeated to handle both "'foo'" and '"foo"'
return s.strip("'").strip('"').strip("'") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _Unquote(s):\n if not hasattr(s, 'strip'):\n return s\n # Repeated to handle both \"'foo'\" and '\"foo\"'\n return s.strip(\"\\\"'\")",
"def _strip(obj):\n return obj.translate(None, STRIP_CHARS)",
"def _strip(value):\n if isinstance(value, basestring):\n value = value.strip()\n i... | [
"0.726841",
"0.69170684",
"0.6822626",
"0.6798071",
"0.66474724",
"0.65854686",
"0.64752936",
"0.64637446",
"0.643556",
"0.6411858",
"0.63762885",
"0.6368248",
"0.63428587",
"0.6224813",
"0.6224813",
"0.6224813",
"0.62184024",
"0.6216035",
"0.6216035",
"0.6216035",
"0.6211679... | 0.70756 | 1 |
Returns whether a given file should be ignored when pulling minidumps. | def _IsIgnoredFileType(filename):
for extension in _IGNORE_FILETYPES_FOR_MINIDUMP_PULLS:
if filename.endswith(extension):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_ignored(file, ignored):\n return any(i in PurePath(path.abspath(file)).parts for i in ignored)",
"def check_if_file_is_ignored(file_path):\n path_parts = file_path.split('/')\n\n for part in path_parts:\n if part in INGORED_PATHS:\n return True",
"def _is_ignored(self, full_pa... | [
"0.71126187",
"0.68529415",
"0.68140715",
"0.67959666",
"0.6698069",
"0.66854966",
"0.66622967",
"0.65448433",
"0.65187216",
"0.6421802",
"0.6390078",
"0.63796127",
"0.63670486",
"0.63495505",
"0.6306864",
"0.6292586",
"0.62387305",
"0.62363386",
"0.62356716",
"0.62051105",
"... | 0.737881 | 1 |
Returns the ephemeral cryptohome mount poing for |user|. | def EphemeralCryptohomePath(self, user):
profile_path = self.CryptohomePath(user)
# Get user hash as last element of cryptohome path last.
return os.path.join('/run/cryptohome/ephemeral_mount/',
os.path.basename(profile_path)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CryptohomePath(self, user):\n stdout, stderr = self.RunCmdOnDevice(['cryptohome-path', 'user', \"'%s'\" %\n user])\n if stderr != '':\n raise OSError('cryptohome-path failed: %s' % stderr)\n return stdout.rstrip()",
"def get_home_directory(self, user: st... | [
"0.68962085",
"0.64882976",
"0.63332766",
"0.63188916",
"0.5837385",
"0.57429427",
"0.5555029",
"0.55323327",
"0.5522723",
"0.54860955",
"0.5450175",
"0.5448581",
"0.543648",
"0.5378382",
"0.53607446",
"0.534731",
"0.5341757",
"0.5341757",
"0.5335215",
"0.53292066",
"0.532435... | 0.81944716 | 0 |
Returns the cryptohome mount point for |user|. | def CryptohomePath(self, user):
stdout, stderr = self.RunCmdOnDevice(['cryptohome-path', 'user', "'%s'" %
user])
if stderr != '':
raise OSError('cryptohome-path failed: %s' % stderr)
return stdout.rstrip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def EphemeralCryptohomePath(self, user):\n profile_path = self.CryptohomePath(user)\n # Get user hash as last element of cryptohome path last.\n return os.path.join('/run/cryptohome/ephemeral_mount/',\n os.path.basename(profile_path))",
"def get_home_directory(self, user: str) -> ... | [
"0.7836316",
"0.7341156",
"0.6862847",
"0.63474596",
"0.6323965",
"0.63130707",
"0.6264248",
"0.6173251",
"0.605079",
"0.60396606",
"0.6022776",
"0.5991584",
"0.5989674",
"0.5989674",
"0.5881457",
"0.58718383",
"0.5836419",
"0.58135545",
"0.57938355",
"0.5790782",
"0.5770003"... | 0.76653254 | 1 |
Destroy blank temp database after each test | def tteardown_class(self):
os.close(self.db_fd)
os.unlink(app.config['DATABASE']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDown(self):\r\n empty_db()",
"def tearDown(self):\r\n empty_db()",
"def tearDown(self):\r\n empty_db()",
"def tearDown(self):\r\n empty_db()",
"def tearDown(self):\r\n empty_db()",
"def tearDown(self):\r\n empty_db()",
"def tearDown(self):\n app.... | [
"0.7994026",
"0.7994026",
"0.7994026",
"0.7994026",
"0.7994026",
"0.7994026",
"0.79939485",
"0.79194725",
"0.79194725",
"0.79194725",
"0.79194725",
"0.79194725",
"0.79194725",
"0.79194725",
"0.79194725",
"0.79194725",
"0.790249",
"0.78965896",
"0.7878383",
"0.785482",
"0.7822... | 0.0 | -1 |
Associates a user and a drone. | async def _associate_user_drone(self, apc_token, drone_signed_challenge: bytes):
url = f"{Cellular._ACADEMY_BASE_URL}/apiv1/4g/pairing"
headers = {
HeaderField.authorization: f"Bearer {apc_token}",
HeaderField.contentType: HeaderValue.appJson,
HeaderField.xApiKey: Ce... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user(self, user):\n self.user_id = user.get_id()",
"def add_user(self, user):\n\t\tself.users[user.username] = user",
"def user(self, user_token, user_device=None):\n self.set('user', user_token)\n self.set('device', user_device)",
"def add_user(self, user):\n return self.irep... | [
"0.6172492",
"0.6099067",
"0.5914972",
"0.5891338",
"0.5769779",
"0.5769779",
"0.5769779",
"0.5769779",
"0.5769779",
"0.5769779",
"0.5769779",
"0.5769779",
"0.5769779",
"0.56330836",
"0.5619924",
"0.5587993",
"0.5570525",
"0.5568763",
"0.5568763",
"0.5568763",
"0.55625236",
... | 0.6335442 | 0 |
OS/2.fsSelection bit 7 (USE_TYPO_METRICS) is set in all fonts. | def corg_sil_check_os2_fsselectionbit7(ttFonts):
bad_fonts = []
for ttFont in ttFonts:
if not ttFont["OS/2"].fsSelection & (1 << 7):
bad_fonts.append(ttFont.reader.file.name)
if bad_fonts:
yield FAIL,\
Message('missing-os2-fsselection-bit7',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_font_options(self): # real signature unknown; restored from __doc__\n pass",
"def setHardwareFont():\n dislin.hwfont()",
"def test_configs_font(\n self):\n root = Tk()\n custom = font.Font(root, family='Helvetica', size=12)\n self.assertEqual(custom.cget('famil... | [
"0.6390066",
"0.5965896",
"0.57695955",
"0.57437724",
"0.57346815",
"0.56134886",
"0.55980253",
"0.54639715",
"0.54132026",
"0.5398242",
"0.5384284",
"0.53807425",
"0.5331085",
"0.5316349",
"0.5310644",
"0.53018403",
"0.52837884",
"0.5269566",
"0.52644265",
"0.52448255",
"0.5... | 0.6866658 | 0 |
Return the given string converted to camelcase. Remove all spaces. | def to_camelcase(s):
words = re.split("[^a-zA-Z0-9]+", s)
return "".join(
w.lower() if i is 0 else w.title() for i, w in enumerate(words)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def camel(s):\n return s[0].upper() + s[1:]",
"def camelcase(string):\n\n string = re.sub(r\"^[\\-_\\.]\", '', str(string))\n if not string:\n return string\n return lowercase(string[0]) + re.sub(r\"[\\-_\\.\\s]([a-z])\", lambda matched: uppercase(matched.group(1)), string[1:])",
"def to_cam... | [
"0.8309142",
"0.814772",
"0.8047495",
"0.80404896",
"0.7962295",
"0.79336023",
"0.7928802",
"0.7921691",
"0.7906637",
"0.7844945",
"0.7801192",
"0.77701044",
"0.7750839",
"0.7729849",
"0.77128524",
"0.7695614",
"0.7668954",
"0.7636706",
"0.7572605",
"0.7563872",
"0.7553562",
... | 0.81755733 | 1 |
Moves the table to the zero position | def move_zero_order(kwargs=None):
self.variables.table.set_joystick(False)
self.variables.table.set_axis([True, True, True])
xpos = (
float(self.variables.devices_dict["Table_control"]["table_xmax"])
- float(self.variables.devices_dict["Table_control"]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n self.table[:, :] = 0\n self.counts[:] = 0\n self.names = []\n self.hashesperid.resize(0)\n self.dirty = True",
"def moveToZero(self):\n\t\tself.grp.a.t.v = [0,0,0]\n\t\tself.grp.a.r.v = [0,0,0]",
"def reset(self):\r\n\t\tself.index = 0",
"def reset_q_tabl... | [
"0.67311895",
"0.6600039",
"0.6527879",
"0.6291013",
"0.6279837",
"0.61645836",
"0.61000776",
"0.6063962",
"0.60570884",
"0.6050976",
"0.60397255",
"0.6026817",
"0.60229707",
"0.6003044",
"0.5994546",
"0.59610456",
"0.5949056",
"0.5936848",
"0.59280455",
"0.58459413",
"0.5845... | 0.6783335 | 0 |
The names of the taxonomic rank at each level. There are a total of 7 ranks. | def rank_names(self):
return ['Domain', # 0
'Phylum', # 1
'Class', # 2
'Order', # 3
'Family', # 4
'Genus', # 5
'Species'] # 6 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tank_names(self):\n return self._tanks",
"def get_hs_rank(self, points):\n p = points\n rank = self.RANKS\n while p > 0 and rank > 0:\n p = p - self.BASE * math.pow(self.FACTOR, (self.RANKS - rank))\n rank = rank - 1\n\n if rank > 0:\n retur... | [
"0.71001947",
"0.6290756",
"0.6282",
"0.62540925",
"0.62203336",
"0.6192158",
"0.6077735",
"0.6067119",
"0.6051529",
"0.60205543",
"0.5995516",
"0.5974485",
"0.59740627",
"0.59591556",
"0.5906825",
"0.58932966",
"0.588254",
"0.5873314",
"0.5869655",
"0.5857615",
"0.5852709",
... | 0.81616694 | 0 |
convert time string to number of seconds | def convert_time(timestr):
# 09:11:13 -> 9*60*60 + 11*60 + 13
h, m, s = timestr.split(':')
return int(h) * 3600 + int(m) * 60 + int(s) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time2secs( s ):\n t = s.split( ':' )\n nf = len( t )\n if nf == 1:\n # Seconds only!\n secs = int( t[0] )\n elif nf == 2:\n # Minutes & seconds!\n secs = int( t[1] ) + int( t[0] ) * 60\n elif nf == 3:\n # Hours, minutes & seconds!\n secs = int( t[2] ) + int( t[1] ) * 60 ... | [
"0.81974643",
"0.7972163",
"0.794022",
"0.7935839",
"0.7860366",
"0.7831832",
"0.7831832",
"0.7815262",
"0.77978617",
"0.7724175",
"0.76767945",
"0.75393254",
"0.7527625",
"0.7517905",
"0.74924314",
"0.7491635",
"0.7388888",
"0.73249733",
"0.7312834",
"0.7225838",
"0.7220521"... | 0.69080323 | 40 |
extract bounding boxes from the last layer (Darknet v2) | def get_boxes_v2(output, img_size, anchors):
bias_w, bias_h = anchors
w_img, h_img = img_size[1], img_size[0]
grid_w, grid_h, num_boxes = output.shape[:3]
offset_x = \
np.tile(np.arange(grid_w)[:, np.newaxis], (grid_h, 1, num_boxes))
offset_y = np.transpose(offset_x, (1, 0, 2))
box... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bounding_boxes(frame):\n\n blob = cv2.dnn.blobFromImage(frame,1/255,(320,320),(0,0,0),1,crop=False)\n net.setInput(blob)\n\n output_layer_names = net.getUnconnectedOutLayersNames()\n layer_outputs = net.forward(output_layer_names)\n\n all_boxes, confidences = get_all_boxes(layer_outputs)\n\n... | [
"0.72592145",
"0.71848005",
"0.7007672",
"0.68937206",
"0.68007046",
"0.676002",
"0.65278625",
"0.6527146",
"0.65236586",
"0.6522066",
"0.65202683",
"0.6509983",
"0.6503564",
"0.6486017",
"0.6467353",
"0.645849",
"0.6454853",
"0.6454382",
"0.64532185",
"0.6421015",
"0.639606"... | 0.0 | -1 |
compute the softmax of the given tensor, normalizing on axis | def softmax(val, axis=-1):
exp = np.exp(val - np.amax(val, axis=axis, keepdims=True))
return exp / np.sum(exp, axis=axis, keepdims=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(x):\r\n e_x = np.exp(x - np.expand_dims(np.max(x, axis=-1), axis=-1))\r\n return e_x / np.expand_dims(e_x.sum(axis=-1), axis=-1) # only difference\r",
"def softmax(x, axis=1):\n ndim = K.ndim(x)\n if ndim == 2:\n return K.softmax(x)\n elif ndim > 2:\n e = K.exp(x - K.max(... | [
"0.832326",
"0.829397",
"0.829397",
"0.8243587",
"0.8140723",
"0.81306094",
"0.81257516",
"0.81207216",
"0.812072",
"0.8112169",
"0.8102807",
"0.80504656",
"0.8038186",
"0.80186456",
"0.8004444",
"0.8004444",
"0.79923815",
"0.799122",
"0.79838717",
"0.79833454",
"0.7982644",
... | 0.79720384 | 29 |
Returns the number of vertices in the graph. | def get_no_vertices(self):
return len(self.__neighbours.keys()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_num_vertices(self):\n\n return self._graph_state.get_num_vertices()",
"def num_vertices(self):\r\n return len(self.__graph_dict.keys())",
"def vertexCount(self):\n return self._nVertices",
"def num_vertices(self):\n return self._top_exp.number_of_vertices()",
"def get_ve... | [
"0.8875626",
"0.87075895",
"0.8571782",
"0.85592526",
"0.8447311",
"0.8443883",
"0.8387859",
"0.8387859",
"0.8309793",
"0.82950824",
"0.8210203",
"0.8164651",
"0.80506647",
"0.8050254",
"0.79278207",
"0.77786523",
"0.7447412",
"0.7436436",
"0.73577154",
"0.72936",
"0.7286969"... | 0.6514669 | 75 |
Returns the number of edges in the graph. | def get_no_edges(self):
return len(self.__cost.keys()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_edges(self) -> int:\n return self.graph.number_of_edges()",
"def edge_count(self) -> int:\n return self._n_edges",
"def get_num_edges(self):\n\n return self._graph_state.get_num_edges()",
"def num_of_edge(self):\n try:\n return self.edges\n except:\... | [
"0.89276385",
"0.8788731",
"0.8686794",
"0.8642601",
"0.84997004",
"0.8491596",
"0.8485531",
"0.84717673",
"0.84467477",
"0.8440697",
"0.84357953",
"0.8425404",
"0.82675844",
"0.8265879",
"0.8244037",
"0.8233939",
"0.82142925",
"0.8175673",
"0.8107761",
"0.80415654",
"0.79851... | 0.0 | -1 |
Returns all the vertices from the graph using an iterator. | def get_all_vertices(self):
for vertex in self.__neighbours.keys():
yield vertex | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vertices(self):\n return list(self._graph)",
"def vertices(self):\n \n yielded = set()\n \n # Iterate over every tuple of edges, e.g. ..., (1, 2), (4, 3), ...\n for vertices in self.edges():\n # Iterate over every vertex in the tuple, e.g. ..., 1, 2, 4, 3,... | [
"0.73057723",
"0.7280901",
"0.7224261",
"0.7219157",
"0.71468794",
"0.7041448",
"0.70313036",
"0.69673693",
"0.69670856",
"0.69670856",
"0.69670856",
"0.69618386",
"0.69315237",
"0.6805687",
"0.67696136",
"0.675069",
"0.6721334",
"0.65608466",
"0.65506566",
"0.6470021",
"0.64... | 0.73996264 | 0 |
Returns True if there exists an edge between the 2 given vertices in the graph; False otherwise. If one of the given vertices does not exist in the graph an exception is thrown (GraphException). | def is_edge_in_graph(self, _from, _to):
if not self.is_vertex_in_graph(_from):
raise GraphException(f"The vertex {_from} does not exist in the graph.")
if not self.is_vertex_in_graph(_to):
raise GraphException(f"The vertex {_to} does not exist in the graph.")
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_edges(self):\n start = int(input('Enter start vertex: '))\n end = int(input('Enter end vertex: '))\n if self._graph.is_edge_between(start, end):\n print('There is an edge from ' + str(start) + ' to ' + str(end))\n else:\n print('There is NO edge from ' + ... | [
"0.6979326",
"0.6972127",
"0.68612117",
"0.6682086",
"0.6676287",
"0.6649803",
"0.6609418",
"0.6566397",
"0.65572",
"0.6517515",
"0.6479212",
"0.6451632",
"0.64434034",
"0.6425593",
"0.6424889",
"0.63817286",
"0.6300904",
"0.62969404",
"0.6279919",
"0.6272017",
"0.6257142",
... | 0.69642335 | 2 |
Adds an edge between 2 given vertices. If there already exists an edge between those 2 vertices in the graph or one of the 2 given vertices is not present in the graph an exception is thrown (GraphException). | def add_edge(self, _from, _to, cost):
if self.is_edge_in_graph(_from, _to) or self.is_edge_in_graph(_to, _from):
raise GraphException("The edge already exists.")
if not self.is_vertex_in_graph(_from):
raise GraphException(f"The vertex {_from} does not exist in the graph.")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(self, v1, v2):\n if v2 in self.vertices:\n self.vertices[v1].add(v2)\n else:\n raise ValueError(f\"The second Vertices you provided: {v2} is not in the graph. You can't link to a vertices that isn't in the graph.\")",
"def add_edge(self, v1, v2):\n # Check ... | [
"0.83398545",
"0.8305114",
"0.8253383",
"0.8224473",
"0.819668",
"0.8180931",
"0.8171985",
"0.81625307",
"0.80464965",
"0.79971856",
"0.7996275",
"0.7910294",
"0.7779212",
"0.77711445",
"0.77623373",
"0.7746103",
"0.7729423",
"0.7725128",
"0.7707646",
"0.7665495",
"0.7638565"... | 0.63994384 | 69 |
Adds a vertex in the graph. If the vertex is already present in the graph an exception is thrown. | def add_vertex(self, vertex):
if self.is_vertex_in_graph(vertex):
raise GraphException("The vertex already exists.")
self.__neighbours[vertex] = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertex(self, vertex):\n if vertex.id not in self.vertices.keys():\n self.vertices[vertex.id] = vertex",
"def add_vertex(self, vertex):\n raise NotImplementedError",
"def add_vertex(self, vertex):\n try:\n vertex_idx = self.vertices.index(vertex)\n #... | [
"0.8294296",
"0.82230926",
"0.81148654",
"0.80550855",
"0.7979323",
"0.7935447",
"0.79304874",
"0.79019046",
"0.78412336",
"0.78268504",
"0.78239",
"0.78239",
"0.77688545",
"0.7767798",
"0.7720662",
"0.77036726",
"0.7657048",
"0.7651296",
"0.7650478",
"0.7592595",
"0.75397944... | 0.83226633 | 0 |
Returns a copy of the graph. | def get_copy_of_graph(self):
return deepcopy(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_graph(self):\n return copy.deepcopy(self.graph)",
"def copy_graph(g):\n return copy.deepcopy(g)",
"def duplicate(self):\n\t\treturn Graph(self.vertices[:], self.edges[:])",
"def copy(self):\n cls = self.__class__\n new_graph = cls.__new__(cls)\n new_graph._nodes = self.... | [
"0.86434853",
"0.8614745",
"0.82969606",
"0.8267555",
"0.82379466",
"0.8096851",
"0.80613846",
"0.8047501",
"0.8010592",
"0.79221594",
"0.78961897",
"0.7827998",
"0.77809906",
"0.76042473",
"0.7507338",
"0.7459805",
"0.7453143",
"0.74236614",
"0.7374732",
"0.72904706",
"0.728... | 0.90555483 | 0 |
Custom terrain colormap with 256 distinct colors. | def terrain_cmap_256():
C = np.array(
[
[0, 125, 255],
[2, 97, 0], # Alternativley [0, 0, 255], for blue at sealevel
[2, 97, 0],
[3, 97, 0],
[4, 97, 0],
[5, 97, 0],
[6, 98, 0],
[7, 98, 0],
[8, 98, 0]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def terrain_cmap_50():\n C = np.array(\n [\n [2, 97, 0],\n [6, 98, 0],\n [11, 98, 0],\n [16, 99, 0],\n [20, 100, 0],\n [25, 101, 0],\n [30, 102, 0],\n [34, 103, 0],\n [39, 104, 0],\n [44, 105, 0]... | [
"0.81880325",
"0.70784736",
"0.7030331",
"0.69001037",
"0.6765916",
"0.65372473",
"0.65359825",
"0.6535806",
"0.6514682",
"0.64250934",
"0.6404706",
"0.63753986",
"0.63650966",
"0.6345845",
"0.63318586",
"0.63161856",
"0.6312007",
"0.6297633",
"0.6293747",
"0.6293747",
"0.628... | 0.86232257 | 0 |
Custom terrain colormap with 50 distinct colors | def terrain_cmap_50():
C = np.array(
[
[2, 97, 0],
[6, 98, 0],
[11, 98, 0],
[16, 99, 0],
[20, 100, 0],
[25, 101, 0],
[30, 102, 0],
[34, 103, 0],
[39, 104, 0],
[44, 105, 0],
[48... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def terrain_cmap_256():\n C = np.array(\n [\n [0, 125, 255],\n [2, 97, 0], # Alternativley [0, 0, 255], for blue at sealevel\n [2, 97, 0],\n [3, 97, 0],\n [4, 97, 0],\n [5, 97, 0],\n [6, 98, 0],\n [7, 98, 0],\n ... | [
"0.82065994",
"0.6936472",
"0.6598238",
"0.65500396",
"0.64865124",
"0.64839524",
"0.64526165",
"0.6436882",
"0.6427942",
"0.63515174",
"0.6332397",
"0.62964857",
"0.6290429",
"0.6282789",
"0.62705064",
"0.62663287",
"0.6207481",
"0.6201265",
"0.6200259",
"0.6197961",
"0.6191... | 0.8450503 | 0 |
Set ELB_ environment variables and clean them up after a test | def env_config():
# setup
env = {'ELB_GCP_PROJECT': 'expected-gcp-project',
'ELB_GCP_REGION': 'expected-gcp-region',
'ELB_GCP_ZONE': 'expected-gcp-zone',
'ELB_BATCH_LEN': '93',
'ELB_CLUSTER_NAME': 'expected-cluster-name',
'ELB_RESULTS': 'gs://expected-resul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env_cleanup(self):\n pass",
"def tearDown(self):\n tests.utils.cleanup_environment()",
"def tearDown(self):\n tests.utils.cleanup_environment()",
"def tearDown(self):\n test_env_teardown()",
"def teardown_test_env():\n if not keep_tmp_dirs:\n print('\\nClea... | [
"0.73022926",
"0.6900544",
"0.6900544",
"0.68956167",
"0.68276143",
"0.6630074",
"0.6525533",
"0.6520294",
"0.65141386",
"0.64866716",
"0.64762324",
"0.646341",
"0.6362244",
"0.6358403",
"0.62780493",
"0.62348783",
"0.6214115",
"0.6212042",
"0.61812806",
"0.6177067",
"0.61761... | 0.69581556 | 1 |
Set ELB_ environment variables and clean them up after a test | def env_config_no_cluster():
# setup
env = {'ELB_GCP_PROJECT': 'expected-gcp-project',
'ELB_RESULTS': 'gs://expected-results'}
for var_name in env:
os.environ[var_name] = env[var_name]
# Test that the results parameter is passed correctly and that trailing slash is discarded
os.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env_cleanup(self):\n pass",
"def env_config():\n # setup\n env = {'ELB_GCP_PROJECT': 'expected-gcp-project',\n 'ELB_GCP_REGION': 'expected-gcp-region',\n 'ELB_GCP_ZONE': 'expected-gcp-zone',\n 'ELB_BATCH_LEN': '93',\n 'ELB_CLUSTER_NAME': 'expected-cluster-... | [
"0.73022926",
"0.69581556",
"0.6900544",
"0.6900544",
"0.68956167",
"0.68276143",
"0.6630074",
"0.6525533",
"0.6520294",
"0.65141386",
"0.64866716",
"0.64762324",
"0.6362244",
"0.6358403",
"0.62780493",
"0.62348783",
"0.6214115",
"0.6212042",
"0.61812806",
"0.6177067",
"0.617... | 0.646341 | 12 |
Get absolute path to resource, works for dev and for PyInstaller | def resource_path(relative_path):
try:
# PyInstaller creates a temp folder and stores path in _MEIPASS
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_path():\n return os.path.join(os.path.dirname(__file__), \"resources\") + os.path.sep",
"def resourcePath(relative):\r\n try:\r\n # PyInstaller creates a temp folder and stores path in _MEIPASS\r\n base_path = sys._MEIPASS\r\n except Exception:\r\n base_path = os.pa... | [
"0.83695436",
"0.8280479",
"0.82485795",
"0.8139178",
"0.8114118",
"0.80985415",
"0.80940944",
"0.80797124",
"0.80677074",
"0.80673695",
"0.80569947",
"0.80545217",
"0.80448323",
"0.80448323",
"0.80448323",
"0.80448323",
"0.80448323",
"0.80448323",
"0.80448323",
"0.80448323",
... | 0.8062465 | 11 |
given state and action, obtain state prime and reward | def get_primes(self, state, action): #make direct call to environment's get_primes
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step(self, action):\n res = self.reward_table.get(self.curr_state, action)\n\n self.curr_state = res['result']\n\n return res",
"def query_model(self, state, action):\n\n state = np.asarray(state)\n if(action == 0):\n return [(1, (1, state[1], state[2], state[3]), 0, False)]... | [
"0.7789094",
"0.76675814",
"0.759144",
"0.7442807",
"0.7431208",
"0.73674136",
"0.726424",
"0.7259521",
"0.7236654",
"0.72015005",
"0.7192212",
"0.7176656",
"0.7126951",
"0.7124109",
"0.7120381",
"0.71149886",
"0.7106392",
"0.70948344",
"0.7092091",
"0.70906377",
"0.7083859",... | 0.0 | -1 |
Makes a series of boxplot where the intensity of the peptides are applied. | def draw_boxPlotPeptideIntensity(self,category_intensityList,exptCycle,nbrframes=7,nbrchannels=2):
edmanCycle = exptCycle - 2 #(nbrMock=4;)
desired_category = peptracks.getDesiredCategory('staggered',nbrframes)
category = desired_category[exptCycle]
all_peptrack_intensity = catego... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boxplot(data):\n sns.boxplot(data, width=0.5, palette=\"colorblind\")\n # add points on the plot\n sns.swarmplot(data, color='red', alpha=0.75)",
"def box_plots(norm, original):\n bp = plt.boxplot([norm, original], notch=False, patch_artist=True)\n for box in bp['boxes']:\n box.set(colo... | [
"0.71500444",
"0.69250965",
"0.6745764",
"0.6625098",
"0.65476775",
"0.6506785",
"0.6440014",
"0.63366383",
"0.63142484",
"0.6297186",
"0.6280673",
"0.6221413",
"0.62082034",
"0.6095325",
"0.6051413",
"0.60491335",
"0.6035579",
"0.6030599",
"0.60103947",
"0.60006636",
"0.5997... | 0.60736924 | 14 |
Finds if the target is in the Skiplist. | def search(self, target):
if DEBUG: print('search({})'.format(target))
result = False
cur = self.head
output = "\tPath: "
while cur:
output += "{}".format(cur.val)
if not cur.next and not cur.below:
output += " END"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has(self, target):\n return target in self.by_target",
"def has(self, target):\r\n return target in self.by_target",
"def contains(collection, target):\n\treturn target in collection",
"def IsTarget(self, target_name):\n return target_name in self.GetTargets()",
"def is_part_of_list(self, ... | [
"0.7222152",
"0.7219963",
"0.66806823",
"0.65571153",
"0.6528616",
"0.61732495",
"0.60472274",
"0.5994012",
"0.58727247",
"0.5870085",
"0.58177626",
"0.5704799",
"0.5696285",
"0.5688",
"0.5649943",
"0.5624577",
"0.56110054",
"0.5555259",
"0.55446446",
"0.55023295",
"0.5465619... | 0.5231481 | 41 |
Converts the 3D points to 3 sets of 2D projections in X,Y and Z. | def get_2d_points(ps_3d):
ps_2d = np.zeros((len(ps_3d),3,len(ps_3d[0]),2));
for axis in range(3):
if axis == 0:
x = 1;
y = 2;
z = 0;
if axis == 1:
x = 0;
y = 2;
z = 1;
if axis == 2:
x = 0;
y =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_3d_points_to_plane(points, p1, p2 ,p3, numpoints):\n p1 = np.asarray(p1)\n p2 = np.asarray(p2)\n p3 = np.asarray(p3)\n\n # get vectors in plane\n v1 = p3 - p1\n v2 = p2 - p1\n\n # compute cross product\n cp = np.cross(v1, v2)\n a, b, c = cp # normal to plane is ax + by + cz\n... | [
"0.72903675",
"0.7262945",
"0.70537406",
"0.6866667",
"0.6792261",
"0.6777396",
"0.6732945",
"0.64996547",
"0.6484491",
"0.6477572",
"0.6476189",
"0.6468455",
"0.64302987",
"0.6414353",
"0.63966846",
"0.6334759",
"0.63299316",
"0.6309395",
"0.6293061",
"0.62915593",
"0.628933... | 0.6265942 | 22 |
View to return the static frontend code Entry point to the webapp | def index(request):
try:
with open(join(settings.REACT_APP_DIR, "index.html")) as f:
return HttpResponse(f.read())
except FileNotFoundError:
a ='s'
return HttpResponse(
a,
status=501,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entry_point():\n return render_template(\"index.html\")",
"def main():\n return render_template('index.html')",
"def main():\n return render_template('index.html')",
"def main():\n return render_template(\"main.html\")",
"def main():\n return render_template(\"main.html\")",
"def index... | [
"0.7500945",
"0.7482134",
"0.7482134",
"0.745315",
"0.745315",
"0.7324195",
"0.7320969",
"0.7320969",
"0.7288592",
"0.72245115",
"0.71681666",
"0.7158437",
"0.71526605",
"0.7134308",
"0.70471805",
"0.7019955",
"0.70098186",
"0.7001672",
"0.69840056",
"0.6981827",
"0.6978529",... | 0.0 | -1 |
Sets the name of this TagPropertyDefinition. Name of a property, for example indexProperty or retentionCategory. | def name(self, name):
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def property_name(self, name: str) -> None:\n name = str(name)\n if len(name) > 100:\n name = name[:100]\n self.prop_name = name",
"def set_name(self, name):\n self.__name = name",
"def set_name(self, name):\n self.__name = name",
"def set_name(self, name):\n ... | [
"0.76049286",
"0.6593815",
"0.6593815",
"0.6590985",
"0.654234",
"0.650077",
"0.6495803",
"0.64862436",
"0.64862436",
"0.64862436",
"0.64862436",
"0.64862436",
"0.64603573",
"0.6386061",
"0.6374407",
"0.63694257",
"0.6336398",
"0.63311154",
"0.6322567",
"0.63112396",
"0.62892... | 0.61501926 | 78 |
Gets the values of this TagPropertyDefinition. Allowed values for a property. For example indexProperty may have allowed values evtag.category, evtag.inclusion etc. | def values(self):
return self._values | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def properties(self) -> Any:\n return pulumi.get(self, \"properties\")",
"def properties(self) -> List[ProductionFlowItemProperty]:\n return self._properties",
"def properties(self):\n return self._properties",
"def properties(self):\n return self._properties",
"def properties(s... | [
"0.61477035",
"0.5941516",
"0.58858687",
"0.58858687",
"0.58730084",
"0.5869019",
"0.5857431",
"0.5829077",
"0.58137053",
"0.5811482",
"0.5772265",
"0.5772265",
"0.5755332",
"0.5752956",
"0.5741239",
"0.5718678",
"0.5681117",
"0.56576484",
"0.56564516",
"0.56564516",
"0.56437... | 0.0 | -1 |
Gets the default_value of this TagPropertyDefinition. Optional default value for a property. If not specified, the property's default value is null / undefined. | def default_value(self):
return self._default_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_property_default_value(property):\n return _get_default_value(get_type_name(property.type),\n property.type.is_simple,\n property.is_iterative,\n property.is_required)",
"def default_value(self):\n return sel... | [
"0.8212416",
"0.7714157",
"0.6920394",
"0.6875884",
"0.68756855",
"0.68756855",
"0.6582398",
"0.65523326",
"0.6471905",
"0.63346446",
"0.6290546",
"0.62878466",
"0.62133056",
"0.61687285",
"0.61687285",
"0.6163441",
"0.6162693",
"0.61626714",
"0.61090857",
"0.6059163",
"0.604... | 0.7150207 | 2 |
Sets the default_value of this TagPropertyDefinition. Optional default value for a property. If not specified, the property's default value is null / undefined. | def default_value(self, default_value):
self._default_value = default_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_property_default_value(property):\n return _get_default_value(get_type_name(property.type),\n property.type.is_simple,\n property.is_iterative,\n property.is_required)",
"def default_value(self):\n return sel... | [
"0.69797164",
"0.6717135",
"0.66212934",
"0.64705545",
"0.6340189",
"0.6262495",
"0.6258584",
"0.6228945",
"0.6167936",
"0.6167936",
"0.6101725",
"0.60463804",
"0.5924355",
"0.58743036",
"0.5871336",
"0.5823178",
"0.5796763",
"0.5750575",
"0.57273954",
"0.5726576",
"0.5644840... | 0.6879076 | 1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, TagPropertyDefinition):
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 |
Compute softmax values for each sets of scores in x. | def softmax(x):
return np.exp(x) / np.sum(np.exp(x), axis=0) | {
"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.7796294",
"0.7760558",
"0.7759004",
"0.77567077",
"0.76577055",
"0.76577055",
"0.76577055",
"0.76577055",
"0.7585655",
"0.743143",
"0.7407772",
"0.73941606",
"0.7358175",
"0.73174125",
"0.72689486",
"0.72623265",
"0.72614294",
"0.7256868",
"0.723019",
"0.7214918",
"0.72017... | 0.6985568 | 83 |
Whether or not the worker is allowed or not. Returns | def is_worker_registered(self, worker_id):
return worker_id in self.registered_workers and self.registered_workers[worker_id] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_worker_allowed(self, worker_id):\n return worker_id in self.allowed_workers",
"def IsAllowed(self):\r\n\r\n return self.notify.IsAllowed()",
"def IsAllowed(self):\r\n\r\n return self.notify.IsAllowed()",
"def IsAllowed(self):\r\n\r\n return self.notify.IsAllowed()",
"def ... | [
"0.75839525",
"0.7569646",
"0.7569646",
"0.7569646",
"0.7060364",
"0.6715767",
"0.6498109",
"0.6495567",
"0.6466134",
"0.64358604",
"0.6421122",
"0.637656",
"0.6372131",
"0.63687396",
"0.63555455",
"0.6347928",
"0.63424337",
"0.62886536",
"0.6284391",
"0.6273671",
"0.62607616... | 0.0 | -1 |
For a given busy bus state in `cycle`, retrieves the id of the destination component. | def get_state_dst(self, cycle: int) -> int:
state = self.get_cycle_state(cycle)
dst_id = state.get_metadata_by_key('dst')
return dst_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state_src(self, cycle: int) -> int:\n state = self.get_cycle_state(cycle)\n src_id = state.get_metadata_by_key('src')\n return src_id",
"def get_state_data_id(self, cycle: int) -> int:\n state = self.get_cycle_state(cycle)\n data_id = state.get_metadata_by_key('data_id'... | [
"0.588058",
"0.5495831",
"0.5073772",
"0.5014762",
"0.5000629",
"0.4979639",
"0.49063343",
"0.48945066",
"0.48881772",
"0.48768425",
"0.48768425",
"0.48443463",
"0.48229176",
"0.48203966",
"0.4789354",
"0.47802234",
"0.47800797",
"0.47800797",
"0.47800797",
"0.47401944",
"0.4... | 0.64137536 | 0 |
Creates and returns the SparkSession object | def create_spark_session():
spark = SparkSession \
.builder \
.config("spark.jars.packages", "org.apache.hadoop:hadoop-aws:2.7.0") \
.getOrCreate()
return spark | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_sparksession():\n return SparkSession.builder.\\\n appName(\"Transforming the historical parking occupancy and blockface datasets\").\\\n getOrCreate()",
"def getOrCreate(self) -> \"SparkSession\":\n return SparkSession(connectionString=self._options[\"spark.connect... | [
"0.86329234",
"0.83818126",
"0.8285916",
"0.82514364",
"0.79428405",
"0.78860205",
"0.7881789",
"0.7881789",
"0.7881789",
"0.7881789",
"0.78395844",
"0.7826671",
"0.7823604",
"0.76256377",
"0.76062715",
"0.75704634",
"0.74770933",
"0.7446772",
"0.7406511",
"0.73691165",
"0.73... | 0.7952428 | 5 |
Closes the current http session. | def close(self) -> None:
self._session.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def close(self):\n await self._http_session.close()",
"def _close_http_session(self):\n if self._api_http_session:\n try:\n self._api_http_session.close()\n except RequestException:\n pass",
"def close_session(self):\n self.sess.clo... | [
"0.8015805",
"0.7943716",
"0.75687623",
"0.75008863",
"0.73464596",
"0.73262155",
"0.72874635",
"0.72474223",
"0.72372484",
"0.7225464",
"0.7225464",
"0.7225464",
"0.7225464",
"0.7225464",
"0.7225464",
"0.7200614",
"0.71290696",
"0.71239704",
"0.70897883",
"0.70897883",
"0.70... | 0.6986022 | 22 |
Get an environment variable | def getenv(self, key):
return self._env[key] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetEnvVariable(name):\n return os.environ.get(name)",
"def env(var):\n return os.environ[var]",
"def get_environment_variable(name):\n\n variable = None\n try:\n variable = os.environ[name]\n except KeyError:\n pass\n \n return variable",
"def getenv(self, var):\n ... | [
"0.85430455",
"0.8433429",
"0.8278801",
"0.8184435",
"0.81757915",
"0.80849797",
"0.8006711",
"0.7813789",
"0.77598375",
"0.772905",
"0.7704059",
"0.769469",
"0.7628268",
"0.7606596",
"0.7605706",
"0.75870156",
"0.75629324",
"0.75562567",
"0.7548743",
"0.7516464",
"0.7491258"... | 0.77080256 | 10 |
Convert the HDF5 trace back represented as a list of tuples. | def format_h5_backtrace(self, backtrace=None): # reliably restored by inspect
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ex_list(data):\n return tuple(data)",
"def toListOfTuple(self, df:pd.core.frame.DataFrame) -> List[Tuple]: \n df['TIME_STAMP'] = df['TIME_STAMP'].astype('str')\n records = df.to_records(index=False)\n listOfTuple = list(records)\n return listOfTuple",
"def trace(self):\n ... | [
"0.6390811",
"0.5942175",
"0.59141356",
"0.5794486",
"0.56745833",
"0.56738615",
"0.5613988",
"0.54870105",
"0.5419624",
"0.5384416",
"0.53759885",
"0.53367716",
"0.53186005",
"0.5299337",
"0.52897704",
"0.52771366",
"0.527088",
"0.52493346",
"0.5244646",
"0.52187365",
"0.521... | 0.0 | -1 |
Return the `raw_score` as is, since it is already normalized. | def normalize(cls, raw_score):
return super().normalize(raw_score) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(cls, raw_score):\n assert cls.min_value == 0.0\n return super().normalize(raw_score)",
"def make_normalize_score():\n\n def normalize_score(data):\n score = data['score']\n norm_score = (score - 24.3) / 166.7\n\n return {**data,\n 'normalized_sco... | [
"0.8009283",
"0.66080034",
"0.6312557",
"0.62981826",
"0.6182937",
"0.6164939",
"0.60608894",
"0.60364527",
"0.6000455",
"0.5987348",
"0.58634955",
"0.58634955",
"0.58634955",
"0.58596843",
"0.5830012",
"0.5830012",
"0.5830012",
"0.5827818",
"0.5825814",
"0.580776",
"0.580561... | 0.8804788 | 1 |
Checks if executables already contain a "MAJOR.MINOR" suffix. | def remove_major_minor_suffix(scripts):
minor_major_regex = re.compile(r"-\d.?\d?$")
return [x for x in scripts if not minor_major_regex.search(x)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_suffix(suffix):\n suffix = suffix.strip()\n if not suffix:\n return suffix\n allowed = set('.dev0123456789')\n disallowed = set(suffix).difference(allowed)\n if disallowed:\n disallowed = ''.join(sorted(disallowed))\n raise ValueError('Version suffix contains disallowe... | [
"0.59441763",
"0.5780364",
"0.5565527",
"0.55051917",
"0.5501355",
"0.5463462",
"0.54597324",
"0.5405685",
"0.5355454",
"0.5336027",
"0.5322834",
"0.53090274",
"0.53072995",
"0.5283652",
"0.52755535",
"0.5255433",
"0.52371526",
"0.52309626",
"0.5219363",
"0.5216195",
"0.52115... | 0.6133753 | 0 |
Return default save path for the packages | def get_default_save_path():
macro = '%{_topdir}'
if rpm:
save_path = rpm.expandMacro(macro)
else:
save_path = rpm_eval(macro)
if not save_path:
logger.warning("rpm tools are missing, using default save path "
"~/rpmbuild/.")
save_pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_default_path(self):\n return os.path.join(cfg.DATA_DIR, 'visual_genome')",
"def app_default_save_path(self, **kwargs):\n return self._get(\n _name=APINames.Application,\n _method=\"defaultSavePath\",\n response_class=six.text_type,\n **kwargs\n ... | [
"0.72079587",
"0.72033226",
"0.7190021",
"0.71084696",
"0.71084696",
"0.70552504",
"0.70194834",
"0.700158",
"0.694011",
"0.6936534",
"0.69232315",
"0.68991965",
"0.6860974",
"0.6811148",
"0.67979145",
"0.67979145",
"0.67832136",
"0.6739004",
"0.6738951",
"0.6729475",
"0.6651... | 0.78412735 | 0 |
return the first index of item in array or None if item is not found | def linear_search(array, item):
# implement linear_search_iterative and linear_search_recursive below, then
# change this to call your implementation to verify it passes all tests
# return linear_search_iterative(array, item)
return linear_search_recursive(array, item) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def np_index_of(array, item):\n where = np.where(array == item)\n if len(where) == 0:\n raise ValueError(\"{0} not found in array\".format(item))\n return where[0][0] # where is a 2d array",
"def __find_index(arr, val):\n if val is not None:\n return numpy.searchsorted(arr, val)\n e... | [
"0.7654498",
"0.76485795",
"0.73254657",
"0.7152995",
"0.70068246",
"0.6965024",
"0.6964481",
"0.6916574",
"0.6872765",
"0.6827316",
"0.67693734",
"0.6750015",
"0.66990155",
"0.668622",
"0.66723377",
"0.6657315",
"0.66358805",
"0.66342586",
"0.661365",
"0.6607807",
"0.6569612... | 0.60730076 | 57 |
return the index of item in sorted array or None if item is not found | def binary_search(array, item):
# implement binary_search_iterative and binary_search_recursive below, then
# change this to call your implementation to verify it passes all tests
return binary_search_iterative(array, item)
# return binary_search_recursive(array, item) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __find_index(arr, val):\n if val is not None:\n return numpy.searchsorted(arr, val)\n else:\n return val",
"def index_equals_value_search1(arr):\n for key, value in enumerate(arr):\n if value == key:\n return value\n return -1",
"def binary_search(elem: int, arr:... | [
"0.79116553",
"0.7231691",
"0.70945144",
"0.70503265",
"0.702492",
"0.7014106",
"0.6975659",
"0.693756",
"0.69133765",
"0.69059515",
"0.688041",
"0.6863463",
"0.6828841",
"0.6823668",
"0.676312",
"0.67249036",
"0.6687773",
"0.66777045",
"0.66451496",
"0.65669006",
"0.6558889"... | 0.59163046 | 90 |
This function is used to get a specific settings' value. Values defined in the secret file overrides values defined in the environment. | def __getitem__(self, item):
return self._config.get(item, '') or os.environ.get(item, '') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_secret(self, setting):\n\n if self._secrets is None:\n with open(self.here('secrets.json')) as f:\n self._secrets = json.loads(f.read())\n\n try:\n return self._secrets[setting]\n except KeyError:\n error_msg = \"Set the {0} variable in s... | [
"0.7567802",
"0.7296516",
"0.72637635",
"0.7250069",
"0.7243473",
"0.7196432",
"0.7102994",
"0.7044006",
"0.6699059",
"0.66374975",
"0.66364026",
"0.6565855",
"0.65541106",
"0.6552911",
"0.6532909",
"0.6472253",
"0.64714104",
"0.6468874",
"0.6456974",
"0.64204955",
"0.6406686... | 0.5843184 | 80 |
return the normalized logdistance to the centroid (zscore). | def transform(self, X):
d = numpy.squeeze(numpy.log(self._mdm.transform(X)))
z = self._get_z_score(d)
return z | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_likelihood_z_lognormal(self, std=1.0):\n #return self.log_det_Jxz - self.dim * tf.log(std) - (0.5 / (std**2)) * tf.reduce_sum(self.output_z**2, axis=1)\n from deep_boltzmann.util import logreg\n logz = logreg(self.output_z, a=0.001, tf=True)\n ll = self.log_det_Jxz \\\n ... | [
"0.65086603",
"0.6274803",
"0.622917",
"0.61761177",
"0.6102198",
"0.6010055",
"0.6002265",
"0.5982045",
"0.59187",
"0.59022003",
"0.5829192",
"0.58145696",
"0.5773506",
"0.57675457",
"0.57093734",
"0.5698337",
"0.56912494",
"0.5668638",
"0.5665902",
"0.5654122",
"0.5648143",... | 0.5524926 | 31 |
This test was originally built with djangononrel 1.6 which had an error when flushing the database after each test. So the flush is performed manually with this custom tearDown() | def wipe_test_data(alias='default'):
import ikwen.core.models
import ikwen.accesscontrol.models
import permission_backend_nonrel.models
import echo.models
Group.objects.using(alias).all().delete()
for name in ('Application', 'Service', 'Config', 'ConsoleEventType', 'ConsoleEvent', 'Country', ):... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDown(self):\r\n testing.tearDown()\r\n empty_db()",
"def tearDown(self):\r\n testing.tearDown()\r\n empty_db()",
"def tearDown(self):\r\n testing.tearDown()\r\n empty_db()",
"def tearDown(self):\r\n testing.tearDown()\r\n empty_db()",
"def tea... | [
"0.8357324",
"0.8357324",
"0.8357324",
"0.8357324",
"0.8357324",
"0.8357324",
"0.8357324",
"0.8357324",
"0.8357324",
"0.8138665",
"0.8138665",
"0.8138665",
"0.8138665",
"0.8138665",
"0.8138665",
"0.80721176",
"0.7966839",
"0.79367894",
"0.79027426",
"0.79027426",
"0.7884502",... | 0.0 | -1 |
read lines from text or write lines to txt | def text2lines(textpath, lines_content=None):
if lines_content is None:
with codecs.open(textpath, "r") as handle:
lines_content = handle.readlines()
processed_lines = list(
map(lambda x: x[:-1] if x[-1] in ["\n"] else x, lines_content)
)
return processed_line... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_text(input_text, output_text):\n with open(input_text, 'r') as in_text, open(output_text, 'a') as out_text:\n out_text.write(in_text.read())",
"def read_txt(path):\n with open(path, \"r\") as f:\n return f.read().splitlines()",
"def read_txt(path):\n with open(path, \"r\") as f:... | [
"0.61034495",
"0.60456264",
"0.60456264",
"0.5872886",
"0.58719695",
"0.5845747",
"0.58405256",
"0.5828128",
"0.5827269",
"0.57341474",
"0.5715059",
"0.56809556",
"0.5668179",
"0.5664616",
"0.5661296",
"0.5648393",
"0.56118315",
"0.5604156",
"0.5595288",
"0.55888146",
"0.5560... | 0.64574665 | 0 |
returns if the given phone number is valid | def validate_phone(phone:str) -> bool:
phone = phone.replace("-", "").replace("(", "").replace(")", "")
return phone.isdigit() and len(phone) == 10 | {
"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_phone(phone):\n assert phone is not None\n phone = str(phone)\n return len(phone) == 10 and is_valid_integer(phone)",
"def phone_number_validator(phone_number):\n if len(phone_number) != 1... | [
"0.87806386",
"0.84111184",
"0.82383585",
"0.8222734",
"0.8213372",
"0.80932915",
"0.80034155",
"0.79158086",
"0.789387",
"0.78675705",
"0.77588695",
"0.77294546",
"0.76701486",
"0.7600711",
"0.7461215",
"0.743816",
"0.743816",
"0.743816",
"0.743816",
"0.743816",
"0.743816",
... | 0.81730914 | 5 |
returns the current rotor setting | def rotor_setting(self):
return self._charset[self._rot_offset] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotation(self):\n return self._rotation",
"def rotation(self):\n return self._rotation",
"def rotation(self):\n return self._rotation",
"def rotation(self):\n return self._rotation",
"def rotation(self):\n return self._rotation",
"def rotation(self):\n return... | [
"0.6500356",
"0.6500356",
"0.6500356",
"0.6500356",
"0.6500356",
"0.6500356",
"0.6500356",
"0.6500356",
"0.6500356",
"0.6500356",
"0.6500356",
"0.6362623",
"0.63277936",
"0.6304081",
"0.6252658",
"0.6247341",
"0.61166596",
"0.60914356",
"0.603187",
"0.5988615",
"0.59851474",
... | 0.7082157 | 0 |
Return the email address to satisfy FlaskLogin's requirements. | def get_id(self):
return self.id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")",
"def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")",
"def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")",
"def email(self) -> Optional[str]:\n return pulumi.get(self,... | [
"0.74641806",
"0.74641806",
"0.74641806",
"0.74641806",
"0.74460185",
"0.74460185",
"0.74460185",
"0.74399614",
"0.74399614",
"0.74399614",
"0.74399614",
"0.74399614",
"0.74399614",
"0.74399614",
"0.7422053",
"0.72925925",
"0.72336566",
"0.72287595",
"0.7207441",
"0.71761113",
... | 0.0 | -1 |
Return True if the user is authenticated. | def is_authenticated(self):
return self.authenticated | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_authenticated(self):\n return self.user is not None and self.state == AuthenticationOptions.authenticated",
"def is_authenticated(self):\n return bool(get_auth_token())",
"def is_authenticated(self):\n return True",
"def is_authenticated(self):\n return True",
"def is_aut... | [
"0.8739372",
"0.87086535",
"0.86574197",
"0.86574197",
"0.86574197",
"0.86574197",
"0.86574197",
"0.86574197",
"0.86574197",
"0.8613915",
"0.8609252",
"0.8578436",
"0.83723366",
"0.83587176",
"0.8258534",
"0.82273275",
"0.8209421",
"0.8200795",
"0.8174884",
"0.81280386",
"0.8... | 0.8580474 | 11 |
False, as anonymous users aren't supported. | def is_anonymous(self):
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_anonymous():\n return False",
"def is_anonymous(self):\r\n return False",
"def is_anonymous(self):\n return False",
"def is_anonymous_access_allowed(self):\n return self._is_anonymous_access_allowed",
"def is_authenticated(self):\n return False",
"def _is_anonymous_u... | [
"0.85624325",
"0.83800477",
"0.82456774",
"0.7815806",
"0.7576082",
"0.72904116",
"0.72619915",
"0.72347337",
"0.72347337",
"0.72347337",
"0.72347337",
"0.72347337",
"0.72347337",
"0.72347337",
"0.72338396",
"0.715833",
"0.7106215",
"0.70944613",
"0.70567185",
"0.70209265",
"... | 0.8360155 | 5 |
Function that finds the index of the vector in vector_array that most closely matches state_vec. vector_array is array where each column is a vector, typically corresponding to an eigenstate of some Hamiltonian. | def find_closest_vector_idx(state_vec, vector_array):
overlaps = np.abs(state_vec.conj().T @ vector_array)
idx = np.argmax(overlaps)
return idx | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_idx(array, value):\n\n idx = np.searchsorted(array, value, side=\"left\")\n if idx > 0 and (\n idx == len(array)\n or math.fabs(value - array[idx - 1]) < math.fabs(value - array[idx])\n ):\n return idx - 1\n else:\n return idx",
"def find_state_idx_from_state(H, r... | [
"0.6390761",
"0.6302067",
"0.6005752",
"0.5967785",
"0.5945751",
"0.57818264",
"0.57367927",
"0.5653215",
"0.55837077",
"0.55690795",
"0.55676067",
"0.55398196",
"0.5527302",
"0.5503508",
"0.5497479",
"0.5493737",
"0.5493737",
"0.5472688",
"0.5441899",
"0.54384965",
"0.543547... | 0.8525113 | 0 |
Load a backend by name. Can either be the name of a builtin backend or a fully qualified name of a function, e.g. ``myproject.module.MyBackend``. | def load_backend(backend: str | Type[Backend]) -> Type[Backend]:
if isinstance(backend, type) and issubclass(backend, Backend):
return backend
elif isinstance(backend, str):
try:
backend = BUILTIN_BACKENDS[backend]
except KeyError:
raise ValueError(f'No such backe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_backend(name, options=None):\n if name is None:\n assert options is None\n return get_default()\n if options is None:\n options = {}\n if name not in _backends:\n raise UnknownBackend(name)\n try:\n res = _backends[name]()(**options)\n except Exception as ... | [
"0.78247666",
"0.7438215",
"0.73518246",
"0.73135483",
"0.7172073",
"0.70915824",
"0.7076665",
"0.67782426",
"0.6753916",
"0.6671585",
"0.6514552",
"0.6514552",
"0.6464475",
"0.6450025",
"0.6433486",
"0.6433486",
"0.619848",
"0.6178296",
"0.61345947",
"0.6109705",
"0.61072457... | 0.71668774 | 5 |
r""" Apply diagonal operator to MPS on site n. | def apply_diagonalO(self, diagO, n):
for ii in range(len(diagO)):
self.A[n][:, ii, :] *= diagO[ii] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tunneling(N, m=1, *, dtype=None):\n diags = [np.ones(N-m, dtype=int), np.ones(N-m, dtype=int)]\n T = qdiags(diags, [m, -m], dtype=dtype)\n T.isherm = True\n return T",
"def iterated_diagonal(self, n=1):\n def sign(p):\n \"\"\"Counts the number of pairs appearing in reversed orde... | [
"0.61548626",
"0.5913863",
"0.5883113",
"0.5761728",
"0.5634315",
"0.5610332",
"0.56101114",
"0.5528702",
"0.55009365",
"0.54926586",
"0.5472974",
"0.54690677",
"0.5462706",
"0.54598373",
"0.54383993",
"0.54037017",
"0.5388646",
"0.5381923",
"0.53793335",
"0.5367465",
"0.5336... | 0.6089452 | 1 |
r""" C[n]A[n] > A[n]. | def attach_CA(self):
n = self.pC
self.A[n] = self._mps_CA(self.C, self.A[n]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ccw(A,B,C):\n return (C[1]-A[1])*(B[0]-A[0]) > (B[1]-A[1])*(C[0]-A[0])",
"def ccw(A,B,C):\n return (C[1]-A[1]) * (B[0]-A[0]) > (B[1]-A[1]) * (C[0]-A[0])",
"def __gt__(self, *args):\n return _ida_hexrays.ccase_t___gt__(self, *args)",
"def __gt__(self, *args):\n return _ida_hexrays.ccas... | [
"0.69455075",
"0.6827512",
"0.65470093",
"0.6538218",
"0.647058",
"0.640294",
"0.6358552",
"0.6275395",
"0.6274447",
"0.6216729",
"0.6212127",
"0.6151863",
"0.6134469",
"0.61099625",
"0.6019169",
"0.5981229",
"0.596879",
"0.593895",
"0.5932106",
"0.59272546",
"0.59272134",
... | 0.0 | -1 |
r"""Set S to have one nonzero value. | def _one_S(self, D):
S = np.zeros(D)
S[0] = 1.
return S | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def faca_zero(self):\n n = self.n\n\n for i in range(n):\n if comozero(self[i]):\n self[i] = 0\n\n return self",
"def reset_S(self):\n self.S = [self._one_S(self.D[n]) for n in range(self.L + 1)]",
"def zero(self, value):\n raise NotImplementedError"... | [
"0.6414924",
"0.63835347",
"0.63644814",
"0.63374954",
"0.63370943",
"0.62817436",
"0.60865945",
"0.60615456",
"0.6044598",
"0.5978722",
"0.5954574",
"0.5868063",
"0.5868063",
"0.58625466",
"0.58339036",
"0.5825472",
"0.58250326",
"0.5817108",
"0.5793394",
"0.5792277",
"0.579... | 0.70203644 | 0 |
r"""Update left environment with 1site operator. | def _mps_RLO(self, RL, A, Ac, O):
T1 = np.tensordot(RL, A, axes=(1, 0))
T2 = np.tensordot(T1, O, axes=(1, 1))
return np.tensordot(Ac, T2, axes=([0, 1], [0, 2])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increase_left_boundary(self):\n self.L = self.L - 1.0\n self.Ne = self.Ne + 1",
"def go_left(self):\n self.change_x = -6",
"def go_left(self):\n self.change_x = -6",
"def set_left(self, left):\n self.left = left",
"def go_left(self):\n self.change_x = -6\n ... | [
"0.5933848",
"0.5385494",
"0.5385494",
"0.5330267",
"0.5259211",
"0.5255182",
"0.51589274",
"0.51589274",
"0.5101609",
"0.5069038",
"0.50187737",
"0.5011868",
"0.5004726",
"0.49612918",
"0.4952464",
"0.49349165",
"0.48849538",
"0.48823482",
"0.48709175",
"0.48334783",
"0.4829... | 0.0 | -1 |
r"""Reshapes block matrix into MPO tensor. | def _block_matrix_to_mpo(self, M, dout, din):
sout, sin = M.shape
H = np.transpose(np.reshape(M, [sout // dout, dout, sin // din, din]), (0, 1, 2, 3))
return H | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _unroll_block_matrix(mat1: tf.Tensor) -> tf.Tensor:\n n_dim, m1, n1 = mat1.get_shape().as_list()\n mat1_rsh = tf.reshape(mat1, [n_dim, m1, 1, n1])\n mat2 = tf.eye(n_dim, dtype=tf.float64)\n mat2_rsh = tf.reshape(mat2, [n_dim, 1, n_dim, 1])\n return tf.reshape(mat1_rsh * mat2_... | [
"0.65390646",
"0.61940837",
"0.6077257",
"0.6003397",
"0.59315455",
"0.5901217",
"0.5884176",
"0.5880277",
"0.58363956",
"0.5722719",
"0.5652498",
"0.5606317",
"0.559711",
"0.55181986",
"0.54547006",
"0.5428765",
"0.5396533",
"0.53789335",
"0.53525305",
"0.5329369",
"0.532360... | 0.6004344 | 3 |
Add errors in dict format. | def add_errors(self, errors):
self.errors = merge_errors(self.errors, errors) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def errors(self):\n\n dict = {\"Stellar Mass Error\":[self.st_masserr1,self.st_masserr2],\n \"Stellar Radius Error\":[self.st_raderr1,self.st_raderr2]}\n\n return dict",
"def __set_errors_json(self, error_count_by_operation, errors_by_operation):\n message = \"{0} error/s repo... | [
"0.71418",
"0.6748731",
"0.6647782",
"0.6629651",
"0.6546806",
"0.65402335",
"0.65267867",
"0.64615715",
"0.640557",
"0.6370486",
"0.6363577",
"0.62952006",
"0.6262236",
"0.6207296",
"0.6207296",
"0.6169688",
"0.61312824",
"0.610207",
"0.60539246",
"0.6050574",
"0.6035526",
... | 0.6346875 | 11 |
Prepare to annotate each element (either paragraphs or sentences) with a topic distribution. Paragraphs and sentences, each will be a document to annotate. | def readInputFileElements(inputFileName, sentence=True, L=None):
print("Read by elements (per sentences/paragraphs) in a document, each of these elements is grouped by document.")
data = []
f = open(inputFileName, 'r', encoding='utf8')
for line in f:
if L is not None:
line = line[:L... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_annotated_text_to_xml(self):\n #initialise file to write the output\n outfile = open(('annotated_text_' + self.lang + '_' + \n self.method + '.xml'), 'w')\n #initialise xml\n annotated_doc = etree.Element('Annotated_document')\n main_text = ''\n ... | [
"0.6177186",
"0.6002446",
"0.5913825",
"0.5902183",
"0.5807405",
"0.57135427",
"0.56812084",
"0.5653829",
"0.5518829",
"0.5517254",
"0.55061346",
"0.5500165",
"0.54680794",
"0.5463485",
"0.54628634",
"0.54483634",
"0.5412744",
"0.5381452",
"0.5371547",
"0.53627414",
"0.532579... | 0.0 | -1 |
Returns whether or not a passport instance meets the conditions outlined for Problem 4 Part I. | def is_valid_part_one(a_passport_dataclass_instance: Passport) -> bool:
# check all but cid, since that is OK to skip.
return all(
credential is not None for credential in
[
a_passport_dataclass_instance.byr,
a_passport_dataclass_instance.eyr,
a_passport_datac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_passport(passport: map) -> bool:\n results = []\n results.append(validate_birth_year(passport))\n results.append(validate_issue_year(passport))\n results.append(validate_exp_year(passport))\n results.append(validate_height(passport))\n results.append(validate_hair_color(passport))\n ... | [
"0.6986201",
"0.690556",
"0.669138",
"0.64604485",
"0.6256837",
"0.6180689",
"0.6145254",
"0.60553944",
"0.60496235",
"0.59839165",
"0.59745336",
"0.5963367",
"0.5958742",
"0.5901476",
"0.5853009",
"0.5851209",
"0.5838553",
"0.58323866",
"0.5818884",
"0.5817569",
"0.58164865"... | 0.69487315 | 1 |
returns whether or not a hair color meets the criteria specified in Part II. | def is_valid_hair_color(hair_color: str) -> bool:
return re.match(r'^#[a-f|0-9]{5}', hair_color) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_hair_color(passport: map) -> bool:\n if passport.get('hcl'):\n regex = re.compile('#[0-9a-f]{6}')\n match = regex.match(passport['hcl'])\n return bool(match)\n\n return False",
"def IsOk(*args, **kwargs):\n return _gdi_.Colour_IsOk(*args, **kwargs)",
"def IsHatch(... | [
"0.6359313",
"0.61407727",
"0.61299115",
"0.60680217",
"0.5948102",
"0.58231485",
"0.5797694",
"0.5770369",
"0.5767857",
"0.57633597",
"0.5754064",
"0.5737095",
"0.57289237",
"0.5721291",
"0.57193047",
"0.57004404",
"0.5690155",
"0.56727874",
"0.5631642",
"0.5631211",
"0.5620... | 0.6431609 | 0 |
Returns whether or not a passport instance meets the conditions outlined for Problem 4 Part II. | def is_valid_part_two(a_passport_dataclass_instance: Passport) -> bool:
if is_valid_part_one(a_passport_dataclass_instance):
return all([
is_valid_birth_year(a_passport_dataclass_instance.byr),
is_valid_expiration_year(a_passport_dataclass_instance.eyr),
is_valid_issue_ye... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_passport(passport: map) -> bool:\n results = []\n results.append(validate_birth_year(passport))\n results.append(validate_issue_year(passport))\n results.append(validate_exp_year(passport))\n results.append(validate_height(passport))\n results.append(validate_hair_color(passport))\n ... | [
"0.69742054",
"0.67244333",
"0.6431854",
"0.62015814",
"0.6160914",
"0.61448574",
"0.60969675",
"0.6094782",
"0.601677",
"0.6015258",
"0.5988778",
"0.59241474",
"0.59070927",
"0.59070927",
"0.5853609",
"0.58352554",
"0.58004844",
"0.578208",
"0.57765645",
"0.57676846",
"0.576... | 0.6914647 | 1 |
wrap a reader to apply the parsers to each of its rows | def parse_rows_with(reader, parsers):
for row in reader:
yield parse_row(row, parsers) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_rows_with(reader, parsers):\n for row in reader:\n yield parse_row(row,parsers)",
"def parse_row(input_row, parsers):\n\n return [parser(value) if parser is not None else value\n for value, parser in zip(input_row, parsers)]",
"def fit_reader(self, reader):\n return sel... | [
"0.8287646",
"0.6207953",
"0.6119234",
"0.5951758",
"0.5910228",
"0.58752733",
"0.58502537",
"0.5847309",
"0.582925",
"0.5819933",
"0.57757515",
"0.56996286",
"0.56738204",
"0.56554925",
"0.56327826",
"0.56295466",
"0.562182",
"0.5619101",
"0.5595051",
"0.5494195",
"0.548915"... | 0.8208489 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.