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 |
|---|---|---|---|---|---|---|
Sets the updated_at of this BigqueryConnection. | def updated_at(self, updated_at):
self._updated_at = updated_at | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updated_at(self, updated_at: \"datetime\"):\n self._attrs[\"updatedAt\"] = updated_at",
"def updated_at(self, updated_at: \"datetime\"):\n self._attrs[\"updatedAt\"] = updated_at",
"def updated_at(self, updated_at: \"datetime\"):\n self._attrs[\"updatedAt\"] = updated_at",
"def updat... | [
"0.70217466",
"0.70217466",
"0.70217466",
"0.65971154",
"0.62454593",
"0.5838231",
"0.5838231",
"0.58257",
"0.5774106",
"0.5774106",
"0.5774106",
"0.5774106",
"0.57486933",
"0.57486933",
"0.57486933",
"0.56997776",
"0.56910825",
"0.5631999",
"0.5631999",
"0.5631999",
"0.56079... | 0.72413105 | 3 |
Sets the project_id of this BigqueryConnection. | def project_id(self, project_id):
self._project_id = project_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_project_id(self, project_id):\n self._project_id = project_id",
"def set_project(project_id):\n return fluent.set_project(project_id)",
"def project_id(self, project_id):\n if project_id is None:\n raise ValueError(\"Invalid value for `project_id`, must not be `None`\") # n... | [
"0.8256723",
"0.7359914",
"0.7285354",
"0.7017314",
"0.6697303",
"0.65217",
"0.65217",
"0.6499262",
"0.64824057",
"0.64824057",
"0.64824057",
"0.64824057",
"0.5997859",
"0.587626",
"0.573961",
"0.56826234",
"0.5638119",
"0.56310046",
"0.56310046",
"0.56310046",
"0.56310046",
... | 0.80450344 | 2 |
Sets the client_email of this BigqueryConnection. | def client_email(self, client_email):
self._client_email = client_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 setEmail(self, email):\n self.email = email\n ... | [
"0.630568",
"0.6241642",
"0.6155655",
"0.6155655",
"0.6155655",
"0.6155655",
"0.6155655",
"0.6155655",
"0.6155655",
"0.6155655",
"0.6155655",
"0.6155655",
"0.6093457",
"0.60278374",
"0.6026907",
"0.6026907",
"0.6026907",
"0.6026907",
"0.58056325",
"0.57187164",
"0.5657896",
... | 0.805182 | 0 |
Sets the token_uri of this BigqueryConnection. | def token_uri(self, token_uri):
self._token_uri = token_uri | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_token_url(self, access_token_url):\n\n self._access_token_url = access_token_url",
"def auth_token_provider_endpoint(self, auth_token_provider_endpoint):\n\n self._auth_token_provider_endpoint = auth_token_provider_endpoint",
"def auth_uri(self, auth_uri):\n\n self._auth_uri = a... | [
"0.60428053",
"0.57762086",
"0.56720537",
"0.5606755",
"0.5600332",
"0.55200356",
"0.5468206",
"0.54573166",
"0.54573166",
"0.5306066",
"0.5302382",
"0.5284382",
"0.52734005",
"0.52444065",
"0.5219296",
"0.51599866",
"0.5157792",
"0.5157434",
"0.5098574",
"0.5070664",
"0.5063... | 0.73389703 | 0 |
Sets the client_x509_cert_url of this BigqueryConnection. | def client_x509_cert_url(self, client_x509_cert_url):
self._client_x509_cert_url = client_x509_cert_url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client_cert(self, client_cert):\n\n self._client_cert = client_cert",
"def auth_provider_x509_cert_url(self, auth_provider_x509_cert_url):\n\n self._auth_provider_x509_cert_url = auth_provider_x509_cert_url",
"def org_apache_felix_https_clientcertificate(self, org_apache_felix_https_clientcer... | [
"0.67225325",
"0.63417757",
"0.6191684",
"0.6082272",
"0.5772625",
"0.5432383",
"0.53903365",
"0.52588344",
"0.5203637",
"0.5203637",
"0.5203637",
"0.5203637",
"0.51629514",
"0.51223",
"0.51223",
"0.5081893",
"0.5026269",
"0.501235",
"0.50076276",
"0.4981881",
"0.49137843",
... | 0.8200095 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, BigqueryConnection):
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 |
Return a page to bootstrap the application | def bootstrap(path=None):
LOGGER.info(path)
if path and re.match('/assets/.*', path):
raise ValueError()
return render_template('bootstrap.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_page():\n return render_template(\"index.html\")",
"def index():\n return render_template('index.html', title='PanOS Bootstrap Utility')",
"def index_page():\n\n return redirect(\"/application-form\")\n\n # Alternately, we could make this a Jinja template in `templates/`\n # and return ... | [
"0.70577115",
"0.6973365",
"0.69479346",
"0.68490654",
"0.6812971",
"0.67740977",
"0.67586505",
"0.67107356",
"0.66908133",
"0.6690625",
"0.6678766",
"0.6640148",
"0.66142863",
"0.66142863",
"0.66081595",
"0.6581482",
"0.65724903",
"0.6566023",
"0.65590185",
"0.65298855",
"0.... | 0.0 | -1 |
Returns the highest score. | def getHighScore(self):
return max(self.scores) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_score(self):\n return max(self._extract_set('score') or [0])",
"def max_score(self):\r\n return self.lcp.get_max_score()",
"def getNextHighest(self):\r\n maxScore = -1\r\n idx = -1\r\n for i, s in enumerate(self.scores):\r\n if s.score > maxScore:\r\n ... | [
"0.8818188",
"0.84807724",
"0.835259",
"0.8324772",
"0.82806855",
"0.81326896",
"0.80440915",
"0.79591155",
"0.7943476",
"0.7934118",
"0.785137",
"0.7810449",
"0.7779032",
"0.76996386",
"0.7575776",
"0.7553467",
"0.7516782",
"0.74972826",
"0.74240077",
"0.74194306",
"0.741132... | 0.8535671 | 1 |
Generate and normalize a new random world using snoise4 | def calculateWorldValues(self):
# 等值面
for x in range(self.worldSize):
for y in range(self.worldSize):
for z in range(self.worldSize):
if self.t=='b':
self.world[x][y][z] = math.cos(x) + math.cos(y) + math.cos(z)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _addNoise(self):\n self.dispNoise = self.dispRaw.copy()\n self.dispNoise[:, 0] += self.sigmaEast * numpy.random.randn(self.numStations)\n self.dispNoise[:, 1] += self.sigmaNorth * numpy.random.randn(self.numStations)\n self.dispNoise[:, 2] += self.sigmaUp * numpy.random.randn(self.numStations)\n ... | [
"0.6292676",
"0.59377533",
"0.5878786",
"0.586216",
"0.5855966",
"0.58510923",
"0.5838642",
"0.579784",
"0.5636251",
"0.5618961",
"0.5577793",
"0.5570468",
"0.55558217",
"0.554498",
"0.55433095",
"0.5543074",
"0.55373806",
"0.5505858",
"0.5495746",
"0.5494078",
"0.54878074",
... | 0.0 | -1 |
parses the home page | def parse(self, response):
for cate_selector in response.css("div.sub-nav-cont ul li a"):
link = cate_selector.css("::attr(href)").extract_first()
if response.urljoin(link) in self.start_urls:
continue
cate_name = cate_selector.css("::attr(c-bname)").extract_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home() -> Any:\n return home_page()",
"def homepage():\n return (\n f\"Welcome to Hawaii - Climate Page<br/>\"\n f\"<br/>\"\n f\"This site has data from 01-01-2010 to 08-23-2017<br/>\"\n f\"<br/>\"\n f\"Available Pages:<br/>\"\n f\"<br/>\"\n f\"<br/>\"\n... | [
"0.7194566",
"0.6826848",
"0.6800559",
"0.67980015",
"0.6754894",
"0.66995484",
"0.66548115",
"0.6596466",
"0.65695477",
"0.6565286",
"0.6561834",
"0.65540177",
"0.65516937",
"0.65514374",
"0.6521593",
"0.6521593",
"0.6521593",
"0.6521593",
"0.6521593",
"0.6521593",
"0.652159... | 0.0 | -1 |
Yield `get(x)` for each `x` in the iterable `xs`. | def gets(self, xs, txn=None, rec=None, default=None):
return (self.get(x, txn, rec, default) for x in xs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def itervalues(self, *args, **kwargs):\n for key in self.iterkeys():\n yield self._get(key, *args, **kwargs)",
"def __iter__(self):\n\n # For each key in set of keys\n for key in self.keys_set:\n\n # Yield that key and associated value\n yield key, self.__get... | [
"0.58548295",
"0.56954026",
"0.55972797",
"0.5475167",
"0.5433384",
"0.5421819",
"0.5411479",
"0.52709156",
"0.52600944",
"0.52473813",
"0.5232616",
"0.52298725",
"0.5229124",
"0.5228351",
"0.5143503",
"0.5112543",
"0.51098645",
"0.5067082",
"0.5049542",
"0.5047411",
"0.50272... | 0.63888204 | 0 |
Yield record values in key order. If `rec` is ``True``, | def values(self, key=None, lo=None, hi=None, reverse=None, max=None,
include=False, txn=None, rec=None):
return itertools.imap(ITEMGETTER_1,
self.items(key, lo, hi, reverse, max, include, txn, rec)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def items(self, key=None, lo=None, hi=None, reverse=False, max=None,\n include=False, txn=None, rec=None):\n txn_id = getattr(txn or self.engine, 'txn_id', None)\n it = self._iter(txn, key, lo, hi, reverse, max, include, None)\n for batch, key, data in it:\n obj = self.en... | [
"0.6273055",
"0.5913158",
"0.57419676",
"0.5635457",
"0.562697",
"0.55337006",
"0.54943013",
"0.54555845",
"0.53805816",
"0.52733606",
"0.5260301",
"0.52367646",
"0.5232978",
"0.5215794",
"0.5206892",
"0.51916707",
"0.5182624",
"0.5182624",
"0.5167703",
"0.5154487",
"0.514847... | 0.5369749 | 9 |
Write a dictionary to the file as json. | def write_json(toWrite):
with open('clubs.json', 'w+') as outfile:
json.dump(toWrite, outfile) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_to_json(dict, file):\n with open(file, 'w') as f:\n json.dump(dict, f, indent=2)\n return file",
"def json_write(path, dictionary):\n json_output = json.dumps(dictionary, indent=4)\n with open(path, \"w\", encoding=\"utf-8\") as f:\n f.write(json_output)",
"def _write_json(fn... | [
"0.86293125",
"0.8564128",
"0.84844726",
"0.8350433",
"0.8337333",
"0.8282019",
"0.82804036",
"0.81859004",
"0.81419873",
"0.80932117",
"0.8004497",
"0.7913128",
"0.788949",
"0.7887075",
"0.77698004",
"0.7754596",
"0.77471846",
"0.77020895",
"0.7680587",
"0.767096",
"0.762582... | 0.0 | -1 |
returns an n period exponential moving average for the time series s s is a list ordered from oldest (index 0) to most recent (index 1) n is an integer returns a numeric array of the exponential moving average | def ema(s, n):
ema = []
j = 1
#get n sma first and calculate the next n period ema
sma = sum(s[:n]) / n
multiplier = 2 / float(1 + n)
ema.append(sma)
#EMA(current) = ( (Price(current) - EMA(prev) ) x Multiplier) + EMA(prev)
ema.append(( (s[n] - sma) * multiplier) + sma)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moving_average(a, n: int = 3) -> np.array:\n ret = np.cumsum(a, dtype=float)\n ret[n:] = ret[n:] - ret[:-n]\n return ret[n - 1:] / n",
"def moving_average(a, n=5):\n ret = np.cumsum(a, dtype=float)\n ret[n:] = ret[n:] - ret[:-n]\n ret[n-1:] *= 1 / n\n ret[:n-1] *= 1 / np.arange(1, n)\n ... | [
"0.74028605",
"0.7296576",
"0.72747",
"0.7268313",
"0.72586125",
"0.71004415",
"0.7091385",
"0.7057606",
"0.70309013",
"0.69481266",
"0.69246125",
"0.6874147",
"0.67940295",
"0.6785554",
"0.6768282",
"0.6737907",
"0.6717414",
"0.6709948",
"0.6671454",
"0.66080034",
"0.6595614... | 0.7348136 | 1 |
Sets the learning rate | def adjust_learning_rate(optimizer, gamma, epoch, step_index, iteration, epoch_size):
warmup_epoch = -1
if epoch <= warmup_epoch:
lr = 1e-6 + (initial_lr-1e-6) * iteration / (epoch_size * warmup_epoch)
else:
lr = initial_lr * (gamma ** (step_index))
for param_group in optimizer.param_gro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_learning_rate(self, rate):\n self.SGD.set_learning_rate(rate)",
"def adjust_lr(self):\n learning_rate = self.params.base_lr * (1 - float(self.epoch) / self.params.num_epoch) ** self.params.power\n for param_group in self.opt.param_groups:\n param_group['lr'] = learning_rat... | [
"0.8623272",
"0.76981455",
"0.7697208",
"0.7697208",
"0.7636927",
"0.758479",
"0.7572249",
"0.7514606",
"0.7490861",
"0.74744666",
"0.74288964",
"0.7413075",
"0.739503",
"0.73916996",
"0.73894364",
"0.73817927",
"0.73783433",
"0.7377333",
"0.7363047",
"0.7362884",
"0.7362884"... | 0.0 | -1 |
Sends a 401 response that enables basic auth | def authenticate():
return Response(
'Could not verify your access level for that URL.\n'
'You have to login with proper credentials', 401,
{'WWW-Authenticate': 'Basic realm="Login Required"'}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})",
"def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )",
"def authenticate():\n return Response(\n 'You have to login with pro... | [
"0.8093736",
"0.80926424",
"0.7958403",
"0.7852648",
"0.7843114",
"0.7824419",
"0.776624",
"0.7754693",
"0.774767",
"0.774767",
"0.774767",
"0.774767",
"0.774767",
"0.774767",
"0.774767",
"0.774767",
"0.771945",
"0.7667712",
"0.7664151",
"0.76493174",
"0.76140213",
"0.76131... | 0.7810746 | 15 |
Returns the first environment variable set. if none are nonempty, defaults to '' or keyword arg default. | def env(*vars, **kwargs):
for v in vars:
value = os.environ.get(v)
if value:
return value
return kwargs.get('default', '') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env(*vars, **kwargs):\n for v in vars:\n value = os.environ.get(v, None)\n if value:\n return value\n return kwargs.get('default', '')",
"def env(*vars, **kwargs):\n for v in vars:\n value = os.environ.get(v, None)\n if value:\n return value\n ret... | [
"0.7659608",
"0.7659608",
"0.765618",
"0.754722",
"0.75204015",
"0.70700836",
"0.704792",
"0.6990025",
"0.69792265",
"0.69578755",
"0.6949888",
"0.68441415",
"0.6825165",
"0.6794135",
"0.6680647",
"0.66783625",
"0.66763157",
"0.6639027",
"0.6628669",
"0.66113937",
"0.6609096"... | 0.76820445 | 0 |
Convert a complex object into primitives. Handy for JSON serialization. We can optionally handle instances, but since this is a recursive function, we could have cyclical data structures. To handle cyclical data structures we could track the actual objects visited in a set, but not all objects are hashable. Instead we ... | def to_primitive(value, convert_instances=False, convert_datetime=True,
level=0, max_depth=3):
# handle obvious types first - order of basic types determined by running
# full tests on nova project, resulting in the following counts:
# 572754 <type 'NoneType'>
# 460353 <type 'int'>... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toComplex(simpleObject):\n if simpleObject[0] == ENCODING_SIMPLE_PYTHON:\n return simpleObject[1]\n\n if simpleObject[0] == ENCODING_INT:\n return int(simpleObject[1])\n\n if simpleObject[0] == ENCODING_UNICODE:\n return unicode(simpleObject[1], 'utf-8')\n\n if simpleObject[0] ... | [
"0.61621344",
"0.6119563",
"0.6090617",
"0.6067958",
"0.5865956",
"0.5863861",
"0.58078617",
"0.5807257",
"0.57476157",
"0.5735223",
"0.57309777",
"0.56405354",
"0.55863905",
"0.5514896",
"0.5479702",
"0.5463501",
"0.5460837",
"0.5456098",
"0.54283094",
"0.5421082",
"0.540230... | 0.6711862 | 0 |
Stringify time in ISO 8601 format. | def isotime(at=None, subsecond=False):
if not at:
at = utcnow()
st = at.strftime(_ISO8601_TIME_FORMAT
if not subsecond
else _ISO8601_TIME_FORMAT_SUBSECOND)
tz = at.tzinfo.tzname(None) if at.tzinfo else 'UTC'
st += ('Z' if tz == 'UTC' else tz)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _serialize_time(val):\n return val.isoformat()",
"def serialized_time(time):\n formatted = time.isoformat()\n if formatted.endswith(\"+00:00\"):\n formatted = formatted[:-6] + \"Z\"\n\n return formatted",
"def iso_8601(self):\n return self.isoformat(timespec=\"microseconds\")",
... | [
"0.7921921",
"0.76403725",
"0.7635921",
"0.75742286",
"0.7442112",
"0.7433434",
"0.7152545",
"0.7101218",
"0.70719206",
"0.70004195",
"0.69848937",
"0.6951013",
"0.69459647",
"0.6923628",
"0.6847123",
"0.68436843",
"0.682481",
"0.6747217",
"0.6742459",
"0.6722489",
"0.6662687... | 0.62951654 | 49 |
Normalize time in arbitrary timezone to UTC naive object. | def normalize_time(timestamp):
offset = timestamp.utcoffset()
if offset is None:
return timestamp
return timestamp.replace(tzinfo=None) - offset | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_to_utc(date, timezone):\n local_tz = pytz.timezone(timezone)\n new_date = date.replace(tzinfo = local_tz)\n utc_tz = pytz.timezone('UTC')\n new_date = new_date.astimezone(utc_tz)\n return new_date",
"def normalize_time(timestamp):\n offset = timestamp.utcoffset()\n if offset is... | [
"0.7121004",
"0.7118167",
"0.68719333",
"0.6638765",
"0.6492223",
"0.6492223",
"0.64689595",
"0.6383807",
"0.63305354",
"0.6259214",
"0.6201917",
"0.61943454",
"0.6189186",
"0.61438674",
"0.6071864",
"0.6052293",
"0.6044807",
"0.6037905",
"0.60008335",
"0.60007656",
"0.599034... | 0.70751613 | 2 |
Return True if after is newer than seconds. | def is_newer_than(after, seconds):
if isinstance(after, six.string_types):
after = parse_strtime(after).replace(tzinfo=None)
return after - utcnow() > datetime.timedelta(seconds=seconds) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after(self, time2):\r\n return self.to_seconds() > time2.to_seconds()",
"def after(self, time2):\n return self.to_seconds() > time2.to_seconds()",
"def is_older_than(before, seconds):\r\n if isinstance(before, six.string_types):\r\n before = parse_strtime(before).replace(tzinfo=None... | [
"0.75669533",
"0.742963",
"0.71677315",
"0.6837955",
"0.6765337",
"0.67651576",
"0.6717801",
"0.66049165",
"0.66049165",
"0.6487326",
"0.6445979",
"0.6404347",
"0.6373316",
"0.63638264",
"0.63342094",
"0.62849617",
"0.62745655",
"0.62698144",
"0.6252573",
"0.62229604",
"0.619... | 0.8153654 | 0 |
Timestamp version of our utcnow function. | def utcnow_ts():
return calendar.timegm(utcnow().timetuple()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tstamp_now(self):\n return self.tstamp(datetime.datetime.now(tz))",
"def get_utc_now_timestamp() -> int:\n return int(datetime.datetime.now(datetime.timezone.utc).timestamp() * 1000)",
"def utcnow():\n utctime = datetime.datetime.utcnow()\n utcstamp = utctime.strftime(\"%Y-%m-%d %H:%M:%S\")... | [
"0.7703725",
"0.76807797",
"0.7659119",
"0.7656595",
"0.76366156",
"0.7590121",
"0.7575319",
"0.75474936",
"0.74716765",
"0.7452968",
"0.7421942",
"0.7407102",
"0.7405051",
"0.7390046",
"0.7380471",
"0.7355461",
"0.7339692",
"0.73166203",
"0.7290635",
"0.72782147",
"0.7266158... | 0.8233759 | 0 |
Returns a iso8601 formated date from timestamp. | def iso8601_from_timestamp(timestamp):
return isotime(datetime.datetime.utcfromtimestamp(timestamp)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iso8601_date(ts=None):\n ts = _get_gmtime_compatible_timestamp(ts)\n return _time.strftime('%Y-%m-%dT%H:%M:%SZ', _time.gmtime(ts))",
"def dateformat(timestamp):\n date = datetime.datetime.fromtimestamp(int(timestamp))\n return date.isoformat()",
"def timestamp_to_iso_format(timestamp):\n ... | [
"0.8012124",
"0.7738112",
"0.7716933",
"0.72823215",
"0.68830425",
"0.674141",
"0.66666543",
"0.6664841",
"0.66526645",
"0.6644603",
"0.66098595",
"0.6549779",
"0.65161186",
"0.6515649",
"0.64987385",
"0.64808416",
"0.6479994",
"0.64681756",
"0.6428433",
"0.64221674",
"0.6414... | 0.8048834 | 0 |
Make an rpcsafe datetime with microseconds. | def marshall_now(now=None):
if not now:
now = utcnow()
return dict(day=now.day, month=now.month, year=now.year, hour=now.hour,
minute=now.minute, second=now.second,
microsecond=now.microsecond) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _from_microseconds(value):\n return _UTC_EPOCH + datetime.timedelta(microseconds=value)",
"def microseconds_to_datetime(ms):\n return datetime.utcfromtimestamp(ms / 1000000.0).replace(tzinfo=pytz.utc)",
"def test_datetime_microseconds(self):\n\n conn = self.connect()\n c = conn.cursor()... | [
"0.72955406",
"0.6745341",
"0.6546629",
"0.62955177",
"0.62632775",
"0.6257551",
"0.60458",
"0.5988852",
"0.5935393",
"0.5934929",
"0.588929",
"0.58725315",
"0.5852818",
"0.58453894",
"0.58427435",
"0.5805733",
"0.57647955",
"0.5762631",
"0.5752216",
"0.5742179",
"0.57391465"... | 0.0 | -1 |
Unmarshall a datetime dict. | def unmarshall_time(tyme):
return datetime.datetime(day=tyme['day'],
month=tyme['month'],
year=tyme['year'],
hour=tyme['hour'],
minute=tyme['minute'],
second=tyme['s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def object_deserializer(obj):\n for key, val in obj.items():\n if isinstance(val, six.string_types) and DATETIME_REGEX.search(val):\n try:\n obj[key] = dates.localize_datetime(parser.parse(val))\n except ValueError:\n obj[key] = val\n return obj",
... | [
"0.6475352",
"0.6210666",
"0.5951044",
"0.5946126",
"0.5938974",
"0.5869619",
"0.57887393",
"0.57838917",
"0.5710373",
"0.5709906",
"0.5632626",
"0.56293726",
"0.5613223",
"0.5601391",
"0.55799556",
"0.55782783",
"0.55162144",
"0.5470559",
"0.5452197",
"0.54498893",
"0.544297... | 0.62471277 | 1 |
Return the difference between two timing objects. Compute the difference in seconds between two date, time, or datetime objects (as a float, to microsecond resolution). | def delta_seconds(before, after):
delta = after - before
try:
return delta.total_seconds()
except AttributeError:
return ((delta.days * 24 * 3600) + delta.seconds +
float(delta.microseconds) / (10 ** 6)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_difference(time1: Time, time2: Time) -> float:\n dsec = time1.sec - time2.sec\n dnanosec = time1.nanosec - time2.nanosec\n dt = dsec + dnanosec/(10**9)\n return dt",
"def diff_secs(self, other):\n if not isinstance(other, datetime):\n types = (type(other), datetime)\n raise Type... | [
"0.7998108",
"0.77785176",
"0.7445272",
"0.7311164",
"0.729413",
"0.71129584",
"0.6885367",
"0.6800558",
"0.6722529",
"0.67073655",
"0.67053294",
"0.6702218",
"0.6681119",
"0.6623488",
"0.6506007",
"0.6500347",
"0.6487345",
"0.64641964",
"0.64473045",
"0.6333131",
"0.6321425"... | 0.6046005 | 39 |
Search for the first defined of possibly many env vars. Returns the first environment variable defined in vars, or returns the default defined in kwargs. | def env(*_vars, **kwargs):
for v in _vars:
value = os.environ.get(v, None)
if value:
return value
return kwargs.get('default', '') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env(*vars, **kwargs):\r\n for v in vars:\r\n value = os.environ.get(v)\r\n if value:\r\n return value\r\n return kwargs.get('default', '')",
"def env(*vars, **kwargs):\n for v in vars:\n value = os.environ.get(v)\n if value:\n return value\n retur... | [
"0.81396717",
"0.8130392",
"0.8084651",
"0.8084651",
"0.8052573",
"0.7108746",
"0.6713527",
"0.65370256",
"0.6281168",
"0.62741953",
"0.6237768",
"0.6195849",
"0.6175166",
"0.6139684",
"0.6013404",
"0.5995129",
"0.59928715",
"0.59626305",
"0.5920632",
"0.589451",
"0.58413297"... | 0.8068117 | 4 |
lbhealthmonitorcreate with all params set. | def test_create_healthmonitor_with_all_params(self):
resource = 'health_monitor'
cmd = healthmonitor.CreateHealthMonitor(test_cli20.MyApp(sys.stdout),
None)
admin_state_up = False
delay = '60'
expected_codes = '200-202,204'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_health_monitor(request, **kwargs):\n data = request.DATA\n\n conn = get_sdk_connection(request)\n health_mon = conn.load_balancer.create_health_monitor(\n type=data['monitor']['type'],\n delay=data['monitor']['delay'],\n timeout=data['monitor']['timeout'],\n max_retr... | [
"0.75129503",
"0.7409148",
"0.73262256",
"0.715247",
"0.70747596",
"0.7055953",
"0.66473466",
"0.6554029",
"0.6330939",
"0.6179492",
"0.6168356",
"0.61410666",
"0.58231896",
"0.5739331",
"0.563608",
"0.5608463",
"0.55104584",
"0.5497163",
"0.5486312",
"0.5385871",
"0.53716004... | 0.716522 | 3 |
Prepare the test environment. | def setUp(self):
super(CLITestAuthNoAuth, self).setUp()
self.mox = mox.Mox()
self.client = client.HTTPClient(username=USERNAME,
tenant_name=TENANT_NAME,
password=PASSWORD,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def _prepare_test_cases(ptfhost, request):\n logger.info(\"Preparing SAI test environment.\")\n _create_sai_test_folders(ptfhost)\n _copy_sai_test_cases(ptfhost, request)",
"def setUp(self) -> None:\n\n self.helper = EnvironmentVariableHelper()\n\n ... | [
"0.78418756",
"0.728655",
"0.726932",
"0.72028303",
"0.70853347",
"0.70853347",
"0.70788866",
"0.68969417",
"0.68401045",
"0.6805316",
"0.6788486",
"0.6712335",
"0.6697553",
"0.6680663",
"0.6640051",
"0.66314745",
"0.6630454",
"0.6624623",
"0.6624623",
"0.6621988",
"0.6619646... | 0.0 | -1 |
Prepare the test environment. | def setUp(self):
super(CLITestAuthKeystone, self).setUp()
self.mox = mox.Mox()
self.client = client.HTTPClient(username=USERNAME,
tenant_name=TENANT_NAME,
password=PASSWORD,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def _prepare_test_cases(ptfhost, request):\n logger.info(\"Preparing SAI test environment.\")\n _create_sai_test_folders(ptfhost)\n _copy_sai_test_cases(ptfhost, request)",
"def setUp(self) -> None:\n\n self.helper = EnvironmentVariableHelper()\n\n ... | [
"0.78418756",
"0.728655",
"0.726932",
"0.72028303",
"0.70853347",
"0.70853347",
"0.70788866",
"0.68969417",
"0.68401045",
"0.6805316",
"0.6788486",
"0.6712335",
"0.6697553",
"0.6680663",
"0.6640051",
"0.66314745",
"0.6630454",
"0.6624623",
"0.6624623",
"0.6621988",
"0.6619646... | 0.0 | -1 |
Prepare the test environment. | def setUp(self):
super(CLITestAuthKeystoneWithId, self).setUp()
self.client = client.HTTPClient(user_id=USER_ID,
tenant_id=TENANT_ID,
password=PASSWORD,
auth_url=AUTH_URL,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def _prepare_test_cases(ptfhost, request):\n logger.info(\"Preparing SAI test environment.\")\n _create_sai_test_folders(ptfhost)\n _copy_sai_test_cases(ptfhost, request)",
"def setUp(self) -> None:\n\n self.helper = EnvironmentVariableHelper()\n\n ... | [
"0.78418756",
"0.728655",
"0.726932",
"0.72028303",
"0.70853347",
"0.70853347",
"0.70788866",
"0.68969417",
"0.68401045",
"0.6805316",
"0.6788486",
"0.6712335",
"0.6697553",
"0.6680663",
"0.6640051",
"0.66314745",
"0.6630454",
"0.6624623",
"0.6624623",
"0.6621988",
"0.6619646... | 0.0 | -1 |
Prepare the test environment. | def setUp(self):
super(CLITestAuthKeystoneWithIdandName, self).setUp()
self.client = client.HTTPClient(username=USERNAME,
user_id=USER_ID,
tenant_id=TENANT_ID,
tenant_name=TENANT_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def _prepare_test_cases(ptfhost, request):\n logger.info(\"Preparing SAI test environment.\")\n _create_sai_test_folders(ptfhost)\n _copy_sai_test_cases(ptfhost, request)",
"def setUp(self) -> None:\n\n self.helper = EnvironmentVariableHelper()\n\n ... | [
"0.78418756",
"0.728655",
"0.726932",
"0.72028303",
"0.70853347",
"0.70853347",
"0.70788866",
"0.68969417",
"0.68401045",
"0.6805316",
"0.6788486",
"0.6712335",
"0.6697553",
"0.6680663",
"0.6640051",
"0.66314745",
"0.6630454",
"0.6624623",
"0.6624623",
"0.6621988",
"0.6619646... | 0.0 | -1 |
Prepare the test environment. | def setUp(self, plurals={}):
super(CLITestV20Base, self).setUp()
client.Client.EXTED_PLURALS.update(constants.PLURALS)
client.Client.EXTED_PLURALS.update(plurals)
self.metadata = {'plurals': client.Client.EXTED_PLURALS,
'xmlns': constants.XML_NS_V20,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def _prepare_test_cases(ptfhost, request):\n logger.info(\"Preparing SAI test environment.\")\n _create_sai_test_folders(ptfhost)\n _copy_sai_test_cases(ptfhost, request)",
"def setUp(self) -> None:\n\n self.helper = EnvironmentVariableHelper()\n\n ... | [
"0.78418756",
"0.728655",
"0.726932",
"0.72028303",
"0.70853347",
"0.70853347",
"0.70788866",
"0.68969417",
"0.68401045",
"0.6805316",
"0.6788486",
"0.6712335",
"0.6697553",
"0.6680663",
"0.6640051",
"0.66314745",
"0.6630454",
"0.6624623",
"0.6624623",
"0.6621988",
"0.6619646... | 0.0 | -1 |
Create a qos queue. | def test_create_qos_queue(self):
resource = 'qos_queue'
cmd = qos.CreateQoSQueue(
test_cli20.MyApp(sys.stdout), None)
myid = 'myid'
name = 'my_queue'
default = False
args = ['--default', default, name]
position_names = ['name', 'default']
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_qos_queue(self, body=None):\r\n return self.post(self.qos_queues_path, body=body)",
"def post_qos_queue_create(self, resource_dict):\n pass",
"def pre_qos_queue_create(self, resource_dict):\n pass",
"def create_qos(self, specs):\n aname = \"cinder_v%s.create_qos\" % sel... | [
"0.8185874",
"0.73180425",
"0.72160995",
"0.72153395",
"0.716852",
"0.698072",
"0.6829998",
"0.6647159",
"0.65395284",
"0.6425167",
"0.62928766",
"0.6290166",
"0.62852246",
"0.62071264",
"0.61866313",
"0.61802065",
"0.614668",
"0.6122831",
"0.6100696",
"0.6072488",
"0.6061471... | 0.8327914 | 0 |
Create a qos queue. | def test_create_qos_queue_all_values(self):
resource = 'qos_queue'
cmd = qos.CreateQoSQueue(
test_cli20.MyApp(sys.stdout), None)
myid = 'myid'
name = 'my_queue'
default = False
min = '10'
max = '40'
qos_marking = 'untrusted'
d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_qos_queue(self):\r\n resource = 'qos_queue'\r\n cmd = qos.CreateQoSQueue(\r\n test_cli20.MyApp(sys.stdout), None)\r\n myid = 'myid'\r\n name = 'my_queue'\r\n default = False\r\n args = ['--default', default, name]\r\n position_names = ['na... | [
"0.8327914",
"0.8185874",
"0.73180425",
"0.72160995",
"0.72153395",
"0.698072",
"0.6829998",
"0.6647159",
"0.65395284",
"0.6425167",
"0.62928766",
"0.6290166",
"0.62852246",
"0.62071264",
"0.61866313",
"0.61802065",
"0.614668",
"0.6122831",
"0.6100696",
"0.6072488",
"0.606147... | 0.716852 | 5 |
Prepare the test environment. | def setUp(self):
super(CLITestNameorID, self).setUp()
self.mox = mox.Mox()
self.endurl = test_cli20.ENDURL
self.client = client.Client(token=test_cli20.TOKEN,
endpoint_url=self.endurl)
self.addCleanup(self.mox.VerifyAll)
self.add... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def _prepare_test_cases(ptfhost, request):\n logger.info(\"Preparing SAI test environment.\")\n _create_sai_test_folders(ptfhost)\n _copy_sai_test_cases(ptfhost, request)",
"def setUp(self) -> None:\n\n self.helper = EnvironmentVariableHelper()\n\n ... | [
"0.78418756",
"0.728655",
"0.726932",
"0.72028303",
"0.70853347",
"0.70853347",
"0.70788866",
"0.68969417",
"0.68401045",
"0.6805316",
"0.6788486",
"0.6712335",
"0.6697553",
"0.6680663",
"0.6640051",
"0.66314745",
"0.6630454",
"0.6624623",
"0.6624623",
"0.6621988",
"0.6619646... | 0.0 | -1 |
vpnservicelist sortkey name sortkey id sortkey asc sortkey desc | def test_list_vpnservice_sort(self):
resources = "vpnservices"
cmd = vpnservice.ListVPNService(test_cli20.MyApp(sys.stdout), None)
self._test_list_resources(resources, cmd,
sort_key=["name", "id"],
sort_dir=["asc", "desc"]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort(self, key: str):\n return self._select_interface(self._rc_sort, self._http_sort, key)",
"def test_list_vips_sort(self):\r\n resources = \"vips\"\r\n cmd = vip.ListVip(test_cli20.MyApp(sys.stdout), None)\r\n self._test_list_resources(resources, cmd,\r\n ... | [
"0.63703066",
"0.61061853",
"0.60698044",
"0.60150844",
"0.59789616",
"0.5975713",
"0.5869214",
"0.5810832",
"0.5778297",
"0.5718343",
"0.5699173",
"0.5675813",
"0.5645624",
"0.5600735",
"0.55357623",
"0.55282575",
"0.55243665",
"0.5522524",
"0.55137986",
"0.54805565",
"0.545... | 0.8074301 | 0 |
Fetches information of a certain network. | def show_port(self, port, **_params):
return self.get(self.port_path % (port), params=_params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_network(self, network, **_params):\r\n return self.get(self.network_path % (network), params=_params)",
"def GetNetwork(self, network, reason=None):\n query = []\n _AppendReason(query, reason)\n\n return self._SendRequest(HTTP_GET,\n \"/%s/networks/%s\" % (GAN... | [
"0.7827048",
"0.7025692",
"0.6826883",
"0.6770438",
"0.67534244",
"0.67281926",
"0.6689964",
"0.6590673",
"0.65494996",
"0.6434791",
"0.6377579",
"0.6312347",
"0.62848645",
"0.62848645",
"0.62848645",
"0.6279836",
"0.6277307",
"0.62063056",
"0.62010485",
"0.6165593",
"0.60936... | 0.0 | -1 |
Fetches information of a certain network. | def show_network(self, network, **_params):
return self.get(self.network_path % (network), params=_params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetNetwork(self, network, reason=None):\n query = []\n _AppendReason(query, reason)\n\n return self._SendRequest(HTTP_GET,\n \"/%s/networks/%s\" % (GANETI_RAPI_VERSION, network),\n query, None)",
"def get_network_info(self, network_id):\n ... | [
"0.7025692",
"0.6826883",
"0.6770438",
"0.67534244",
"0.67281926",
"0.6689964",
"0.6590673",
"0.65494996",
"0.6434791",
"0.6377579",
"0.6312347",
"0.62848645",
"0.62848645",
"0.62848645",
"0.6279836",
"0.6277307",
"0.62063056",
"0.62010485",
"0.6165593",
"0.609365",
"0.604815... | 0.7827048 | 0 |
Fetches information of a certain subnet. | def show_subnet(self, subnet, **_params):
return self.get(self.subnet_path % (subnet), params=_params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_subnet_details(self, subnet_name=\"dummy_subnet\", subnet_id=None):\n _url = \"http://\" + self.host_ip + \":9696/v2.0/subnets\"\n _headers = {'x-auth-token': self.project_info[\"token_project\"]}\n _body = None\n\n result = self.request(\"GET\", _url, _headers, _body)\n ... | [
"0.7390836",
"0.7267412",
"0.72269106",
"0.69200927",
"0.6865069",
"0.6851835",
"0.6811328",
"0.6652118",
"0.6632633",
"0.6610862",
"0.6433478",
"0.6383471",
"0.63660246",
"0.62896067",
"0.62729573",
"0.6270225",
"0.6262065",
"0.62597907",
"0.62462574",
"0.62135315",
"0.61285... | 0.7742677 | 0 |
Creates a new floatingip. | def create_floatingip(self, body=None):
return self.post(self.floatingips_path, body=body) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self, network_id, tenant_id, port_id):\n data = {\n \"floatingip\": {\n \"tenant_id\": tenant_id,\n \"floating_network_id\": network_id,\n \"port_id\": port_id\n }\n }\n \n path = '%s/floatingips' % (self.ver)... | [
"0.7378122",
"0.73097956",
"0.7262478",
"0.67980736",
"0.67412883",
"0.67399395",
"0.65076995",
"0.64782184",
"0.645232",
"0.637573",
"0.6367837",
"0.63190114",
"0.6313995",
"0.62223685",
"0.62001455",
"0.61518633",
"0.6129838",
"0.6112548",
"0.5935769",
"0.5922887",
"0.58890... | 0.82209605 | 0 |
Deletes the specified security group. | def delete_security_group(self, security_group):
return self.delete(self.security_group_path % (security_group)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def del_secgroup(self, args):\n region = args[\"Region\"]\n sgid = args[\"Security-group-ID\"]\n message = MessageClass()\n\n # Boto3 client creation by providing the access_id and access_secret\n ec2 = boto3.client(service_name='ec2', region_name=region, api_version=None, use_ss... | [
"0.8035514",
"0.8021995",
"0.7983719",
"0.79304713",
"0.7878552",
"0.77813673",
"0.7729755",
"0.7597194",
"0.7571937",
"0.754748",
"0.75433195",
"0.74403715",
"0.72224003",
"0.72200805",
"0.71985203",
"0.71627986",
"0.7125496",
"0.7101876",
"0.70702475",
"0.7063061",
"0.70546... | 0.8509912 | 0 |
Creates a new IPsecSiteConnection. | def create_ipsec_site_connection(self, body=None):
return self.post(self.ipsec_site_connections_path, body=body) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_ipsec_site_connection(self,ipsecpolicy_id, ikepolicy_id,\n vpnservice_id, psk, peer_cidrs,\n peer_address, peer_id,\n ipsec_body = None, **kwargs):\n _body = {\n \"psk\":psk,\n ... | [
"0.6654018",
"0.5621504",
"0.5489131",
"0.548049",
"0.54644406",
"0.53190583",
"0.53171176",
"0.5298952",
"0.5275487",
"0.5240896",
"0.52201253",
"0.520641",
"0.5199626",
"0.5149092",
"0.5132901",
"0.5109163",
"0.5025522",
"0.49949932",
"0.4975458",
"0.49691355",
"0.49545088"... | 0.7530423 | 0 |
Fetches a list of all configured IKEPolicies for a tenant. | def list_ikepolicies(self, retrieve_all=True, **_params):
return self.list('ikepolicies', self.ikepolicies_path, retrieve_all,
**_params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_ikepolicy_sort(self):\r\n resources = \"ikepolicies\"\r\n cmd = ikepolicy.ListIKEPolicy(test_cli20.MyApp(sys.stdout), None)\r\n self._test_list_resources(resources, cmd,\r\n sort_key=[\"name\", \"id\"],\r\n sort_di... | [
"0.6085039",
"0.5921704",
"0.5858558",
"0.57856494",
"0.5732946",
"0.56552166",
"0.5616965",
"0.5488311",
"0.5480259",
"0.54361844",
"0.5299078",
"0.5253691",
"0.5238233",
"0.5227512",
"0.51910096",
"0.51746917",
"0.51731324",
"0.5148066",
"0.5125747",
"0.511701",
"0.51071024... | 0.6754452 | 0 |
Fetches a list of all configured IPsecPolicies for a tenant. | def list_ipsecpolicies(self, retrieve_all=True, **_params):
return self.list('ipsecpolicies',
self.ipsecpolicies_path,
retrieve_all,
**_params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_policies(self):\n client = self.connect(VAULT_TOKEN)\n return client.list_policies()",
"def ListPolicies(self, request, global_params=None):\n config = self.GetMethodConfig('ListPolicies')\n return self._RunMethod(\n config, request, global_params=global_params)",
"def... | [
"0.63227504",
"0.60403246",
"0.6016396",
"0.5927996",
"0.5792352",
"0.5752553",
"0.5711208",
"0.56451374",
"0.5639545",
"0.56173253",
"0.56097",
"0.5489103",
"0.5458932",
"0.5458366",
"0.5350394",
"0.53385234",
"0.5295462",
"0.5262144",
"0.5258188",
"0.52507967",
"0.52499187"... | 0.64229774 | 0 |
Creates a new queue. | def create_qos_queue(self, body=None):
return self.post(self.qos_queues_path, body=body) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _queue_create(self, **kwargs):\n name = self.generate_random_name()\n return self.clients(\"zaqar\").queue(name, **kwargs)",
"def new_queue() -> Queue:\n return multiprocessing.Queue()",
"def create_queue(self):\n queue_name = self.generate_name()\n try:\n queue = ... | [
"0.8306998",
"0.8157555",
"0.7832899",
"0.7501946",
"0.7475025",
"0.7205768",
"0.71105415",
"0.71074736",
"0.701571",
"0.7006347",
"0.6964188",
"0.6952397",
"0.67890424",
"0.6751467",
"0.6724318",
"0.6672495",
"0.66494775",
"0.6640487",
"0.66327125",
"0.6620654",
"0.6607363",... | 0.67977005 | 12 |
Fetches a list of all queues for a tenant. | def list_qos_queues(self, **_params):
return self.get(self.qos_queues_path, params=_params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queue_list(self):\n return self.manager.get_queue_list()",
"def get_queues(client, vhost):\n queues = [q['name'] for q in client.get_queues(vhost)]\n\n return queues",
"def get_queues(self, tags=None):\r\n params = {}\r\n if tags:\r\n params['tags'] = ','.join(tags... | [
"0.7036245",
"0.70148903",
"0.68754697",
"0.68531364",
"0.6701982",
"0.6699241",
"0.66236746",
"0.65338826",
"0.6434618",
"0.63970745",
"0.6371336",
"0.6333619",
"0.6333619",
"0.6333619",
"0.6333619",
"0.6333619",
"0.6333619",
"0.6333619",
"0.6333619",
"0.6333619",
"0.6305139... | 0.6305609 | 20 |
Deletes the specified queue. | def delete_qos_queue(self, queue):
return self.delete(self.qos_queue_path % (queue)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _queue_delete(self, queue):\n\n queue.delete()",
"def delete_queue(self, queue, force_deletion=False):\r\n return self.get_status('DeleteQueue', None, queue.id)",
"def delete_queue(client, vhost, queue):\n client.delete_queue(vhost, queue)",
"def delete_queue(self, queue_name: str) -> No... | [
"0.8262002",
"0.8030569",
"0.79694426",
"0.7897055",
"0.7806034",
"0.777775",
"0.75492966",
"0.7467442",
"0.74282676",
"0.7414319",
"0.71122193",
"0.6921096",
"0.69171715",
"0.6842006",
"0.67439556",
"0.67159396",
"0.6685009",
"0.66613895",
"0.6440496",
"0.63945127",
"0.63560... | 0.75361574 | 7 |
Fetches a list of all firewall policies for a tenant. | def list_firewall_policies(self, retrieve_all=True, **_params):
# Pass filters in "params" argument to do_request
return self.list('firewall_policies', self.firewall_policies_path,
retrieve_all, **_params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_policies(self):\n client = self.connect(VAULT_TOKEN)\n return client.list_policies()",
"def list_policies(self):\n return self.con.list_policies(\n Scope='Local'\n )",
"def ListPolicies(self, request, global_params=None):\n config = self.GetMethodConfig('Lis... | [
"0.6369753",
"0.5877332",
"0.56792355",
"0.5663501",
"0.55814",
"0.5498755",
"0.54811",
"0.54676265",
"0.5452789",
"0.54221016",
"0.53502595",
"0.53350145",
"0.5325583",
"0.5253421",
"0.5231644",
"0.52054423",
"0.5202875",
"0.5132389",
"0.50926423",
"0.5080169",
"0.50724727",... | 0.6845963 | 0 |
Fetches information of a certain firewall policy. | def show_firewall_policy(self, firewall_policy, **_params):
return self.get(self.firewall_policy_path % (firewall_policy),
params=_params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_policy(client, policy_name):\n response = client.describe_firewall_policy(\n FirewallPolicyName=policy_name,\n )\n return response",
"def read(self, policy_name):\n path = self.vault.normalize(\"/sys/policies/acl/\" + policy_name)\n address = self.vault.vault_adress + \"/v1\" + path\n... | [
"0.75920844",
"0.6699691",
"0.66329557",
"0.6356902",
"0.6346933",
"0.6233168",
"0.620738",
"0.620738",
"0.620738",
"0.6192408",
"0.6159254",
"0.6159254",
"0.6159254",
"0.6134643",
"0.60909563",
"0.6058809",
"0.6058809",
"0.6014234",
"0.6014234",
"0.6004263",
"0.5964909",
"... | 0.7842972 | 0 |
Create a new packet filter. | def create_packet_filter(self, body=None):
return self.post(self.packet_filters_path, body=body) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, filter,\n double_precision = False):\n filters.check_is_filter(filter)\n (f, i) = filter\n filt_len = f.shape[0]\n assert filt_len == i * 2 + 1 # check it's symmetric\n dtype = (torch.float64 if double_precision else torch.float32)\n # t... | [
"0.6488138",
"0.614059",
"0.613992",
"0.6001748",
"0.584723",
"0.58219844",
"0.57764983",
"0.57568866",
"0.5745277",
"0.574284",
"0.5729884",
"0.5645626",
"0.56437176",
"0.5626443",
"0.557961",
"0.5567407",
"0.554649",
"0.5511731",
"0.54957",
"0.547382",
"0.5453739",
"0.544... | 0.79164827 | 0 |
Splits a protocol path string into the property name, and the individual protocol ids. | def to_components(path_string):
property_name_index = path_string.find(ProtocolPath.property_separator)
property_name = path_string[property_name_index + 1:]
protocol_id_path = path_string[:property_name_index]
protocol_ids = protocol_id_path.split(ProtocolPath.path_separator)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _from_components(self, property_name, *protocol_ids):\n\n assert property_name is not None and isinstance(property_name, str)\n\n assert property_name.find(ProtocolPath.path_separator) < 0\n\n for protocol_id in protocol_ids:\n\n assert protocol_id is not None and isinstance(pro... | [
"0.61609274",
"0.6133861",
"0.60456616",
"0.6042714",
"0.6003168",
"0.5955503",
"0.5950088",
"0.59124535",
"0.5872106",
"0.5835307",
"0.5825878",
"0.5824099",
"0.57710177",
"0.57510704",
"0.5652095",
"0.562677",
"0.5614178",
"0.55737364",
"0.55539405",
"0.5530218",
"0.5516221... | 0.79196525 | 0 |
Prepend a new protocol id onto the front of the path. | def prepend_protocol_id(self, id_to_prepend):
property_name, protocol_ids = ProtocolPath.to_components(self._full_path)
if len(protocol_ids) == 0 or (len(protocol_ids) > 0 and protocol_ids[0] != id_to_prepend):
protocol_ids.insert(0, id_to_prepend)
self._from_components(property_na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepend_path(path, paths):\n\n if path in paths: paths.remove(path)\n paths.insert(0, path)",
"def replace_protocol(self, old_id, new_id):\n self._full_path = self._full_path.replace(old_id, new_id)",
"def append_to_path(path, name):\n if path[-1] == '/' or path[-1] == ':':\n return path... | [
"0.66855586",
"0.66787505",
"0.6110264",
"0.6004697",
"0.59061235",
"0.5879382",
"0.5854363",
"0.58252287",
"0.56801903",
"0.55817735",
"0.5521786",
"0.5509535",
"0.549153",
"0.54776144",
"0.5396674",
"0.53601295",
"0.53539044",
"0.5328268",
"0.53162754",
"0.5288578",
"0.5278... | 0.8019293 | 0 |
Returns true if the two inputs are equal. | def __eq__(self, other):
return type(self) == type(other) and self._full_path == other.full_path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_equal(self, a, b):\n return a == b",
"def is_equal(self, a, b):\n return a is b",
"def equals(x, y):\n return x == y",
"def are_equal(self, sp1, sp2):\n return sp1 == sp2",
"def _is_equal(x, y):\n return x[0] == y",
"def is_equal(self, a, b):\n return a.X[0] == b.... | [
"0.8133215",
"0.80805945",
"0.7860062",
"0.74624217",
"0.7403423",
"0.73973495",
"0.738341",
"0.73550874",
"0.7268792",
"0.7253367",
"0.7201139",
"0.7177163",
"0.7155714",
"0.7130971",
"0.707686",
"0.7070321",
"0.7017552",
"0.699523",
"0.6964369",
"0.6960014",
"0.69412607",
... | 0.0 | -1 |
Returns true if the two inputs are not equal. | def __ne__(self, other):
return not (self == other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __ne__ (self, other):\n return not self == other",
"def __ne__(self, other):\n # type: (object) -> bool\n return not self == other",
"def __ne__(self, other):\n # type: (object) -> bool\n return ... | [
"0.7860023",
"0.7843332",
"0.778411",
"0.778411",
"0.778411",
"0.77775484",
"0.77775484",
"0.7759391",
"0.77439564",
"0.7741223",
"0.7733821",
"0.7733821",
"0.7733821",
"0.7733821",
"0.7733821",
"0.7733821",
"0.7733821",
"0.7733821",
"0.7733821",
"0.7733821",
"0.7733821",
"... | 0.0 | -1 |
A class for implementing a node in a double linked list | def __init__(self, data=None, next_node=None, prev_node=None):
self._data = data
self._prev = prev_node
self._next = next_node | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.head = ListNode()",
"def __init__(self):\n node = ListNode(0) # dummy\n self.head = node\n self.tail = node\n self.len = 0",
"def __init__(self, data, next_node=None): #self.next_node ??\n self.data = data\n self.next_node = next_node... | [
"0.69109243",
"0.6801261",
"0.65469325",
"0.65393585",
"0.65393585",
"0.65393585",
"0.65393585",
"0.65393585",
"0.6523249",
"0.64160264",
"0.64010274",
"0.6388002",
"0.62329596",
"0.6229504",
"0.62148803",
"0.62092936",
"0.6203172",
"0.6203172",
"0.6198991",
"0.6176695",
"0.6... | 0.0 | -1 |
Calculate the area of a simple polygon, i.e. one that does not contain holes or intersections. This function uses the Shoelace formula. | def poly_area(x, y):
return 0.5*np.abs(np.dot(x, np.roll(y, 1)) - np.dot(y, np.roll(x, 1))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def area_polygon(polygon):\n o = centroid_points(polygon)\n u = subtract_vectors(polygon[-1], o)\n v = subtract_vectors(polygon[0], o)\n a = 0.5 * length_vector(cross_vectors(u, v))\n for i in range(0, len(polygon) - 1):\n u = v\n v = subtract_vectors(polygon[i + 1], o)\n a += 0... | [
"0.7657773",
"0.7517512",
"0.741382",
"0.73501813",
"0.7341305",
"0.7332317",
"0.72577804",
"0.7167491",
"0.71637255",
"0.71448743",
"0.7112153",
"0.71114564",
"0.6942594",
"0.68431515",
"0.6822862",
"0.6819632",
"0.6811305",
"0.67973435",
"0.67303306",
"0.6682587",
"0.665720... | 0.6235647 | 47 |
Read or create a new json file and return the data. | def read_or_new_json(filename, value, *args, **kwargs):
data = None
filename = "{}.json".format(filename)
os.makedirs(os.path.dirname(filename), exist_ok=True)
if os.path.isfile(filename):
# If file had been created, but is empty return None since another process
# could be writing to i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read_json(cls, input_file):\n with open(input_file) as f:\n return json.load(f)",
"def _read_json(cls, input_file):\n with open(input_file) as f:\n return json.load(f)",
"def read_json_file(self, fname):\n return {}",
"def openJson(self):\n json_file = o... | [
"0.7190205",
"0.7190205",
"0.71838874",
"0.71492124",
"0.7089315",
"0.7088723",
"0.7088723",
"0.7031506",
"0.701352",
"0.699548",
"0.6972864",
"0.692402",
"0.6919216",
"0.6880745",
"0.6876042",
"0.68599683",
"0.6858713",
"0.68038887",
"0.67970616",
"0.67945015",
"0.6791648",
... | 0.73330307 | 0 |
Given a document (represented as a string), return a list of all of the words in that document, in order. Process document by coverting all words to lowercase, and removing any punctuation or English stopwords. | def tokenize(document):
raw_words=[word.lower() for word in nltk.word_tokenize(document) if word.isalpha()]
raw_words=[word.lower() for word in raw_words]
final_words=[]
for word in raw_words:
if word not in string.punctuation and word not in nltk.corpus.stopwords.words("english"):
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(document):\n token = nltk.word_tokenize(document)\n\n output = [word.lower() for word in token if (word not in string.punctuation and word not in nltk.corpus.stopwords.words(\"english\"))]\n\n return output",
"def tokenize(document):\n words = [word.lower() for word in nltk.word_tokenize... | [
"0.79225713",
"0.78998256",
"0.77558446",
"0.7736347",
"0.77261716",
"0.766667",
"0.7387504",
"0.7341044",
"0.72900367",
"0.7227586",
"0.70762444",
"0.7042829",
"0.7022621",
"0.70182997",
"0.70182997",
"0.69928956",
"0.6972842",
"0.6969272",
"0.6964892",
"0.69495815",
"0.6945... | 0.79469746 | 0 |
Converts a tuple to a string with spaces between each element. | def tupleStrFormat(tupl):
string = "this is a tuple ("
for element in tupl:
string += str(element) + ", "
string += ")"
return string | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _tupstr(tuple_):\n return ', '.join(list(map(str, tuple_)))",
"def _tuple_to_str(self, the_tuple):\r\n ret = \"\"\r\n for item in the_tuple:\r\n ret += (\" \" + str(item))\r\n return ret[1:]",
"def deg_tuple_to_str(tup):\n if len(tup) == 0:\n return \"()\"\n ... | [
"0.85688806",
"0.8206376",
"0.74045837",
"0.73978865",
"0.73820204",
"0.73111916",
"0.7281604",
"0.72253036",
"0.7165276",
"0.7037618",
"0.67660064",
"0.6765193",
"0.66387004",
"0.66347206",
"0.6629074",
"0.66283923",
"0.6570392",
"0.65035474",
"0.6494112",
"0.6488801",
"0.64... | 0.7947945 | 2 |
String for representing the Model object. | def __str__(self):
return self.title | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return str(self.user) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return str(self.id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return self.acti | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return str(self.get_action_display()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
Generating start vector with random numbers in range [1; 1] with length columns_num. Using division by norm of this vector to scale values. | def generate_start_w0(columns_num):
start_w0 = [uniform(-1, 1.) for _ in range(columns_num)]
norm_start_w0 = start_w0 / np.linalg.norm(start_w0)
return norm_start_w0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initial_vector(self):\n\n return asarray([np.random.uniform(l, u) for l, u in self.bounds])",
"def _generate_random_vector(size):\n return np.random.uniform(-0.1, 0.1, size)",
"def gen_vector(size):\n solution = []\n for i in range(size):\n rand_num = uniform(-size, size)... | [
"0.6294636",
"0.60306394",
"0.5967467",
"0.5958537",
"0.5909196",
"0.58106685",
"0.5785931",
"0.56947416",
"0.56108725",
"0.55979025",
"0.55717945",
"0.5541559",
"0.5512951",
"0.5509296",
"0.5499508",
"0.5478247",
"0.5463694",
"0.54308057",
"0.5373491",
"0.535581",
"0.5354147... | 0.7427251 | 0 |
Calculates component Y value in the current iteration. Multiplies dataframe_row with transposed vector_w to get scalar value y. | def calculate_y(dataframe_row, vector_w):
y_val = np.dot(dataframe_row, np.transpose(vector_w))
return y_val | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subtract_component(dataframe, component_y, vector_w):\n if dataframe.empty:\n raise TypeError('It is impossible to calculate eigen vector W '\n 'and component Y on the empty dataframe.')\n component_df = np.outer(component_y, vector_w)\n result_df = dataframe - component_... | [
"0.6645866",
"0.6599684",
"0.65895844",
"0.6283939",
"0.61474097",
"0.59581596",
"0.59146947",
"0.58367455",
"0.5569749",
"0.5507695",
"0.5389976",
"0.5309533",
"0.5297916",
"0.524368",
"0.5234031",
"0.5189916",
"0.51827174",
"0.5161803",
"0.51593584",
"0.51460093",
"0.512977... | 0.88765943 | 0 |
Calculates vector component Y and eigen vector W. | def calculate_component(dataframe, vector_w, component_num):
if dataframe.empty:
raise TypeError('It is impossible to calculate eigen vector W '
'and component Y on the empty dataframe.')
df_size = len(dataframe)
# calculate start value y(1)
y_val = calculate_y(dataframe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_w(self):\n self.pinvX = np.linalg.pinv(self.X)\n return np.dot(self.pinvX, self.y)",
"def compute_Y(X, w):\n Y = np.sign(np.dot(X, w))\n return Y\n\n # for i in range(A.shape[0]):\n # # prevent overflow by subtracting the max value from each entry in row i\n # A[i... | [
"0.69866955",
"0.6786509",
"0.6595988",
"0.6350192",
"0.63401175",
"0.6268155",
"0.6211122",
"0.61750144",
"0.5989577",
"0.59585726",
"0.59568036",
"0.59144247",
"0.5897604",
"0.58693224",
"0.58656764",
"0.58177876",
"0.5800067",
"0.57830244",
"0.5775913",
"0.5763378",
"0.575... | 0.6458211 | 3 |
Sets the learning rate to the initial LR decayed by 10 every 30 epochs | def adjust_learning_rate(optimizer, epoch, base_lr):
lr = max(base_lr * (0.5 ** (epoch // 20)), 1e-5)
for param_group in optimizer.param_groups:
param_group['lr'] = lr
#if (epoch + 1) == 51 or (epoch + 1) == 101 or (epoch + 1) == 151:
# #lr = lr * 0.1
# for param_group in optimizer.par... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(init_lr, optimizer, epoch, n=100):\n init_lr = init_lr * (0.1 ** (epoch // n))\n print('learning rate : ', init_lr)\n for param_group in optimizer.param_groups:\n param_group['lr'] = init_lr",
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #l... | [
"0.7913536",
"0.7906521",
"0.7849834",
"0.777524",
"0.77338326",
"0.77306354",
"0.7722718",
"0.77224237",
"0.771982",
"0.77092624",
"0.7693604",
"0.76742035",
"0.7665748",
"0.7665748",
"0.7665748",
"0.7655329",
"0.76419765",
"0.76399755",
"0.7637868",
"0.7626077",
"0.76247585... | 0.7296856 | 94 |
Computes the precision for the specified values of k | def accuracy(output, target, topk=(1,)):
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, -1).expand_as(pred))
res = []
for k in topk:
correct_k = correct[:k].view(-1).float().sum(0)
res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(gt, pred, k):\n k = min(len(pred), k)\n den = min(len(gt), k)\n return sum([int(pred[i] in gt) for i in range(k)]) / den",
"def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\... | [
"0.76427615",
"0.74189496",
"0.7418079",
"0.72710466",
"0.72456723",
"0.72446615",
"0.7237539",
"0.72213703",
"0.7210107",
"0.7058935",
"0.6852219",
"0.6786084",
"0.67836976",
"0.6768417",
"0.67273885",
"0.67181736",
"0.67181736",
"0.67181736",
"0.67181736",
"0.67181736",
"0.... | 0.0 | -1 |
Get jwt token encoded in 'UTF8' format | def get_token(public_key,delta):
return jwt.encode(
{
'public_key':public_key,
'exp': datetime.datetime.utcnow() + datetime.timedelta(minutes=delta)
},
current_app.config['SECRET_KEY'],
algorithm="HS256"
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token(self):\n \n payload = {\n 'sub_type': self.sub_type,\n '_hash' : self._hash,\n 'jti' : str(uuid.uuid4())\n }\n return jwt.encode(payload, self.secret, self.algo).decode('utf-8')",
"def token(self):\n payload = {\n 'id': str(... | [
"0.7669464",
"0.7409526",
"0.7336648",
"0.71528876",
"0.71506435",
"0.7149892",
"0.7060671",
"0.7009394",
"0.69922596",
"0.699075",
"0.6984086",
"0.6967576",
"0.6964478",
"0.6922152",
"0.6920615",
"0.6904445",
"0.6895097",
"0.68921465",
"0.6877937",
"0.6866972",
"0.6859526",
... | 0.64848936 | 41 |
Constructor for a NN (Vanilla MLP) used for classifying and comparison at the same time | def __init__(self, input_size, hidden_sizes, output_size=1,
batchnorm_bool=False,
dropout_bool=False):
super(NeuralNet, self).__init__()
self.input_size = input_size
sizes = [input_size] + hidden_sizes + [output_size]
self.layers = nn.ModuleList(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, input, n_in, n_out):\r\n # start-snippet-1\r\n\r\n # initialize with 0 the weights W as a matrix of shape (n_in, n_out)\r\n self.W = theano.shared( value=numpy.zeros( (n_in, n_out), dtype=theano.config.floatX ), name='W', borrow=True )\r\n\r\n # initialize the baises ... | [
"0.7001437",
"0.69548666",
"0.69458395",
"0.6928083",
"0.6916352",
"0.6910734",
"0.68619514",
"0.68613815",
"0.68606097",
"0.6844327",
"0.6830608",
"0.68217874",
"0.6802126",
"0.67958444",
"0.6779241",
"0.6774415",
"0.6743219",
"0.6738447",
"0.6732856",
"0.6721876",
"0.671976... | 0.0 | -1 |
Constructor for a NN working as the classifier submodule | def __init__(self, input_size, hidden_sizes,
num_labels=10,
batchnorm_classifer_bool=False,
dropout_classifier_bool=False):
super(NeuralNetCalssifier, self).__init__()
self.input_size = input_size
sizes = [input_size] + hidden_sizes + [num_label... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, **config):\n super(Classifier, self).__init__()\n self.input_dim_drug = config['hidden_dim_drug']\n self.input_dim_protein = config['hidden_dim_protein']\n self.hidden_dims = config['cls_hidden_dims']\n self.visual_attention=config['visual_attention']\n ... | [
"0.7636093",
"0.7360531",
"0.73243654",
"0.7294436",
"0.72752136",
"0.7258325",
"0.72189087",
"0.7192877",
"0.71409845",
"0.7140797",
"0.7140797",
"0.7140797",
"0.7130494",
"0.71283853",
"0.71180177",
"0.7111744",
"0.70988286",
"0.70852745",
"0.7079973",
"0.70560104",
"0.7052... | 0.73311913 | 2 |
Constructor for a NN used a sthe comparer submodule | def __init__(self, input_size, hidden_sizes,
num_labels=10, output_size=1,
batchnorm_comparer_bool=False,
dropout_comparer_bool=False):
super(NeuralNetComparer, self).__init__()
sizes = [2 * num_labels] + hidden_sizes + [output_size]
self.layers... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, network: Network):\n self.graph = network.graph",
"def __init__(self, inputnodes, hiddennodes, outputnodes, learningrate):\n # set number of nodes in each input, hidden, output layer\n self.inodes = inputnodes\n self.hnodes = hiddennodes\n self.onodes = outpu... | [
"0.6710942",
"0.67074245",
"0.6682953",
"0.6604958",
"0.64907384",
"0.6483975",
"0.6477833",
"0.64563036",
"0.6446919",
"0.6438356",
"0.64310414",
"0.6428357",
"0.6427498",
"0.63945305",
"0.6375418",
"0.63718176",
"0.6370687",
"0.63609296",
"0.6339547",
"0.63324785",
"0.63302... | 0.6730846 | 0 |
Constructor for a NN with two sub Module 1. Classifier 2.Comparer | def __init__(self, input_size,
hidden_sizes_classifier,
hidden_sizes_comparer,
batchnorm_classifer_bool=False,
dropout_classifier_bool=False,
batchnorm_comparer_bool=False,
dropout_comparer_bool=False):
super(N... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, input_size,\n hidden_sizes_comparer,\n batchnorm_comparer_bool=False,\n dropout_comparer_bool=False):\n super(CNNCalssifierComparer, self).__init__()\n self.input_size = input_size\n self.classifier = CNNClassifier()\n s... | [
"0.6698417",
"0.66477185",
"0.65447664",
"0.639298",
"0.6311966",
"0.6306205",
"0.6299503",
"0.62407625",
"0.6210094",
"0.6200054",
"0.6184288",
"0.6162633",
"0.61604714",
"0.6140371",
"0.61231875",
"0.6113906",
"0.6094997",
"0.60883737",
"0.6084445",
"0.6076991",
"0.60675097... | 0.6288271 | 7 |
Constructor for a CNN with two sub Module 1. Classifier 2.Comparer | def __init__(self, input_size,
hidden_sizes_comparer,
batchnorm_comparer_bool=False,
dropout_comparer_bool=False):
super(CNNCalssifierComparer, self).__init__()
self.input_size = input_size
self.classifier = CNNClassifier()
self.comparer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n super(SCNN, self).__init__()\n\n # Linear classifier.\n self.inplanes = 128\n self._norm_layer = nn.BatchNorm2d\n self.dilation = 1\n self.groups = 1\n self.base_width = 64\n\n self.num_class = 125\n backbone = torchvision.models.... | [
"0.703168",
"0.6759595",
"0.6644531",
"0.66385365",
"0.6632358",
"0.6617524",
"0.65919757",
"0.6583789",
"0.6558685",
"0.65006775",
"0.649134",
"0.6481717",
"0.6467541",
"0.6467387",
"0.6456215",
"0.6450546",
"0.64445513",
"0.64377886",
"0.6429936",
"0.6427293",
"0.6427293",
... | 0.70681906 | 0 |
Constructor for a NN with two sub Module 1. Classifier 2.Comparer | def __init__(self, input_size,
hidden_sizes_classifier,
hidden_sizes_comparer,
num_labels=10,
batchnorm_classifer_bool=False,
dropout_classifier_bool=False,
batchnorm_comparer_bool=False,
dropout_compa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, input_size,\n hidden_sizes_comparer,\n batchnorm_comparer_bool=False,\n dropout_comparer_bool=False):\n super(CNNCalssifierComparer, self).__init__()\n self.input_size = input_size\n self.classifier = CNNClassifier()\n s... | [
"0.6698417",
"0.66477185",
"0.65447664",
"0.639298",
"0.6311966",
"0.6306205",
"0.6299503",
"0.6288271",
"0.62407625",
"0.6210094",
"0.6200054",
"0.6184288",
"0.6162633",
"0.61604714",
"0.6140371",
"0.61231875",
"0.6113906",
"0.6094997",
"0.6084445",
"0.6076991",
"0.60675097"... | 0.60883737 | 18 |
Constructor for a NN with two sub Module 1. Classifier 2.Comparer | def __init__(self, input_size,
hidden_sizes_comparer,
num_labels=10,
batchnorm_comparer_bool=False,
dropout_comparer_bool=False):
super(CNNCalssifierComparerAuxLoss, self).__init__()
self.input_size = input_size
self.classifier ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, input_size,\n hidden_sizes_comparer,\n batchnorm_comparer_bool=False,\n dropout_comparer_bool=False):\n super(CNNCalssifierComparer, self).__init__()\n self.input_size = input_size\n self.classifier = CNNClassifier()\n s... | [
"0.6696851",
"0.66472495",
"0.6543522",
"0.6310579",
"0.6304067",
"0.62967974",
"0.6286403",
"0.6239112",
"0.62088275",
"0.61988795",
"0.6182234",
"0.6161123",
"0.61592996",
"0.6138488",
"0.61215115",
"0.61109626",
"0.60923576",
"0.6086157",
"0.608197",
"0.60747993",
"0.60650... | 0.63912195 | 3 |
Multiply a sparse Tensor by a vector along a particular dimension. | def sparse_dim_multiply(
A: Tensor,
x: Tensor,
dim: int
) -> Tensor:
idx = A._indices()[dim]
vals = A._values()
vals *= x[idx]
return A | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matvec(self, x):\n return self * x",
"def dot(x, y, sparse=False):\n if sparse:\n res = tf.sparse_tensor_dense_matmul(x, y)\n else:\n res = tf.matmul(x, y)\n return res",
"def dot(x,y,sparse=False):\n if sparse:\n res = tf.sparse_tensor_dense_matmul(x, y)\n else:\... | [
"0.60994023",
"0.60374564",
"0.6016153",
"0.60002637",
"0.5900316",
"0.59003067",
"0.59003067",
"0.58817714",
"0.5870412",
"0.5835138",
"0.5826516",
"0.5803307",
"0.57906675",
"0.5764829",
"0.5762314",
"0.57615113",
"0.5732349",
"0.57092464",
"0.57058054",
"0.56932294",
"0.56... | 0.7774255 | 0 |
Gets the icon file from the resources directory. | def get_icon():
icon = Path(__file__).parent.joinpath("resources", "icon.png")
# We just want the string to the path for PySide.
return str(icon) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_icon(icon_file): \n img_path = _path.join(\n BASEPATH, _path.join('hallbench', _path.join('resources', 'img')))\n icon_path = _path.join(img_path, icon_file)\n icon = _QIcon()\n icon.addPixmap(\n _QPixmap(icon_path),\n _QIcon.Normal,\n _QIcon.Off)\n return icon"... | [
"0.7267057",
"0.7186539",
"0.71680295",
"0.71423817",
"0.7094803",
"0.7014663",
"0.699875",
"0.69923085",
"0.6906685",
"0.6906226",
"0.6885282",
"0.68688995",
"0.6847708",
"0.6815401",
"0.6753929",
"0.673115",
"0.6730291",
"0.6727965",
"0.6727965",
"0.6727965",
"0.6727965",
... | 0.7683156 | 0 |
Gets the style.css file from the resources directory. | def get_css():
css = Path(__file__).parent.joinpath("resources", "style.css")
with open(css, "r") as style_file:
css_data = style_file.read()
return css_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_style():\n\n style = os.path.join(os.path.dirname(__file__), \"templates\", \"style.css\")\n with open(style, \"r\") as opencss:\n return opencss.read().strip()",
"def load_stylesheet(name):\n with suppress(FileNotFoundError):\n with open(STATIC_PATH / name, 'rt') as stylesheet:\n ... | [
"0.7298122",
"0.67225504",
"0.63319784",
"0.62525135",
"0.6076459",
"0.59549505",
"0.59542996",
"0.57827294",
"0.577367",
"0.5773628",
"0.5684894",
"0.56523114",
"0.56331784",
"0.56084",
"0.5472248",
"0.5466866",
"0.54628026",
"0.5364383",
"0.534764",
"0.5338111",
"0.5276471"... | 0.7843269 | 0 |
Load Stack instance from .stack file. | def load(path_stack, compression="gzip"):
if not path_stack.endswith('.stack'):
raise ValueError(
"To avoid ambiguity, when using Stack.load() you must provide the full path to "
"the stack file you want to create, including the file extension. For example: "
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_stack(stack):\n path = os.path.join(STACK_DIRECTORY, '%s.%s' % (stack.module, stack.caller))\n if os.path.exists(path):\n with open(path, 'rb') as f:\n return dill.load(f)\n return None",
"def test01_load_stack(self):\n stack = self.experiment.load_stack(self.experiment... | [
"0.74203265",
"0.71121866",
"0.6927553",
"0.683277",
"0.6359416",
"0.6169216",
"0.60651875",
"0.5946897",
"0.5788267",
"0.5776267",
"0.57725227",
"0.5771468",
"0.57546693",
"0.571505",
"0.5701428",
"0.56975514",
"0.5688502",
"0.5688502",
"0.56856483",
"0.568146",
"0.5660482",... | 0.6664211 | 4 |
Sets the x_variables and y_variables in the data part of the stack for this data_key, e.g. stack['Jan']. This method can also be used to add to the current lists and it makes sure the list stays unique. | def _set_x_and_y_keys(self, data_key, x, y):
if self.stack_pos == 'stack_root':
self[data_key].__set_x_key(x)
self[data_key].__set_y_key(y)
else:
raise KeyError("set_x_keys can only be called from a stack at root level. Current level is '{0}'".format(self.stack_p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push(self, **vars):\n self._variable_stack.append(dict(self._variables))\n self.update(**vars)",
"def set_data(self, x = None, y = None):\n self.x_axis = x\n self.y_axis = y",
"def set_xList(self, *xList):\n assert len(xList) == self.__nx\n self.__x = xList\n ... | [
"0.58428204",
"0.5507232",
"0.54659504",
"0.5432805",
"0.54303056",
"0.54111904",
"0.5294803",
"0.5270163",
"0.5206912",
"0.52056944",
"0.5143031",
"0.51415336",
"0.51316047",
"0.51277274",
"0.5122735",
"0.5116576",
"0.5107302",
"0.50981134",
"0.50929874",
"0.5043019",
"0.504... | 0.6777685 | 0 |
Generates all combinations of items from a list | def __get_all_combinations(self, list_of_items):
return [itertools.combinations(list_of_items, index+1)
for index in range(len(list_of_items))] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_combinations(items):\n\n def inner(items, r):\n \"\"\"\n recursively yields partitioned remainders of original partition lists\n \"\"\"\n items = set(items)\n if not len(items):\n yield ()\n ... | [
"0.73547757",
"0.7042136",
"0.6938442",
"0.6915465",
"0.6875703",
"0.67848724",
"0.6771032",
"0.67682385",
"0.67648953",
"0.67328763",
"0.6639714",
"0.65762985",
"0.6549294",
"0.6549017",
"0.65443975",
"0.64914507",
"0.64767146",
"0.6452351",
"0.63577306",
"0.6336958",
"0.627... | 0.7876408 | 0 |
Takes a stack_pos and returns the stack with that location raises an exception IF the stack pointer is not found | def __get_stack_pointer(self, stack_pos):
if self.parent.stack_pos == stack_pos:
return self.parent
else:
return self.parent.__get_stack_pointer(stack_pos) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_stack(self, offset):\n self.validate_stack_offset(offset)\n return self.stack[offset]",
"def getStackPosition(self):\r\n return self.callstack.getStack()",
"def findCaller(self, stack_info=False, stacklevel=2):\n f = currentframe()\n #On some versions of IronPython, ... | [
"0.6661285",
"0.64549404",
"0.6386795",
"0.63797617",
"0.62505674",
"0.6199616",
"0.6169721",
"0.6112925",
"0.6090924",
"0.6016371",
"0.5990624",
"0.5959264",
"0.5959168",
"0.59493977",
"0.5908766",
"0.58735526",
"0.5840768",
"0.583369",
"0.5831592",
"0.5808342",
"0.5787022",... | 0.6940179 | 0 |
r"""Compute the count matrix of the largest connected set. The input count matrix is used as a weight matrix for the construction of a directed graph. The largest connected set of the constructed graph is computed. Vertices belonging to the largest connected component are used to generate a completely connected subgrap... | def largest_connected_submatrix(C, directed=True, lcc=None):
if lcc is None:
lcc = largest_connected_set(C, directed=directed)
"""Row slicing"""
if scipy.sparse.issparse(C):
C_cc = C.tocsr()
else:
C_cc = C
C_cc = C_cc[lcc, :]
"""Column slicing"""
if scipy.sparse.iss... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_matrix_largest(self, effective=False):\n return self.count_matrix(connected_set=0, effective=effective)",
"def largest_cc_size(ugraph):\n\tconnected = cc_visited(ugraph)\n\tmaxnum = 0\n\tfor content in connected:\n\t\tmaxnum = max(maxnum,len(content))\n\treturn maxnum",
"def largest_cc_size(ug... | [
"0.7187229",
"0.67732567",
"0.66503936",
"0.64790595",
"0.63026357",
"0.6130358",
"0.6057025",
"0.58247626",
"0.5786079",
"0.57021856",
"0.5690249",
"0.5685671",
"0.5599237",
"0.55933434",
"0.5581449",
"0.5565662",
"0.5503299",
"0.5489995",
"0.54810613",
"0.54782736",
"0.5475... | 0.5429884 | 26 |
Create an Nbin discrete colormap from the specified input map | def discrete_cmap(N, base_cmap=None):
# Note that if base_cmap is a string or None, you can simply do
# return plt.cm.get_cmap(base_cmap, N)
# The following works for string, None, or a colormap instance:
base = plt.cm.get_cmap(base_cmap)
color_list = base(np.linspace(0, 1, N))
cmap_name = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discrete_cmap(N, base_cmap=None):\n base = plt.get_cmap(base_cmap)\n color_list = base(np.linspace(0, 1, N))\n cmap_name = base.name + str(N)\n return base.from_list(cmap_name, color_list, N)",
"def discrete_cmap(N, base_cmap=None):\n # see https://gist.github.com/jakevdp/91077b0cae40f8f8244a\... | [
"0.7242656",
"0.71656114",
"0.69012064",
"0.6878302",
"0.6878302",
"0.6878302",
"0.6861746",
"0.68548363",
"0.6848493",
"0.673402",
"0.66581506",
"0.6597995",
"0.65935785",
"0.65876263",
"0.6582851",
"0.65091336",
"0.64394367",
"0.6404845",
"0.6328366",
"0.631741",
"0.6287024... | 0.6861796 | 7 |
Converts the provided string value to an int, float or string if possible, in this order. | def extractVal(value):
assert value is not None, "Value is None"
trimmed = value.strip()
try:
return int(trimmed)
except ValueError:
try:
return float(trimmed)
except ValueError:
return str(trimmed) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_data_type(value: str):\n try:\n f = float(value)\n if f.is_integer():\n return int(f)\n return f\n except ValueError:\n return value",
"def assign_type(s):\n if type(s) == list:\n return s\n else:\n s = str(s)\n try:\n ... | [
"0.7501429",
"0.7206362",
"0.7106891",
"0.70643115",
"0.7062834",
"0.70494425",
"0.69937587",
"0.6958848",
"0.69011235",
"0.6895673",
"0.6779864",
"0.6761304",
"0.67368513",
"0.6729287",
"0.6674927",
"0.667095",
"0.6639109",
"0.65581304",
"0.65279675",
"0.65266836",
"0.652608... | 0.59364235 | 68 |
Initialize name and age attributes | def __init__(self, first_name, last_name, Screen_name):
self.first_name = first_name
self.last_name = last_name
self.Screen_name = Screen_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, name, age):\n\t\tself.name = name\n\t\tself.age = age",
"def __init__(self, name, age):\n\t\tself.name = name\n\t\tself.age = age",
"def __init__(self, name, age):\n\t\tself.name = name\n\t\tself.age = age",
"def __init__(self, first_name, last_name, age):\n\n self.first_name = firs... | [
"0.79270184",
"0.79270184",
"0.79270184",
"0.7788543",
"0.7761817",
"0.7761817",
"0.7761817",
"0.7761817",
"0.7761817",
"0.7761817",
"0.7761817",
"0.7761817",
"0.77532536",
"0.77477014",
"0.77477014",
"0.77477014",
"0.77477014",
"0.7524497",
"0.7448133",
"0.7366197",
"0.73223... | 0.5948295 | 98 |
Check if equals to. | def __eq__(self, compareto: Union[str, float, int, "AwesomeVersion"]) -> bool:
if isinstance(compareto, (str, int)):
compareto = AwesomeVersion(compareto)
if not isinstance(compareto, AwesomeVersion):
raise AwesomeVersionCompare("Not a valid AwesomeVersion object")
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equals(self, other): # -> bool:\n ...",
"def equals(self, obj: object) -> bool:\n ...",
"def __eq__(self,other):\n return self is other",
"def is_equal(self, a, b):\n return a is b",
"def __eq__(self, other):\n return self is other",
"def __eq__(self, other):\n ... | [
"0.7633624",
"0.7342384",
"0.72783095",
"0.7262677",
"0.7231852",
"0.7231852",
"0.7206297",
"0.7206297",
"0.7206297",
"0.7206297",
"0.7206297",
"0.7206297",
"0.7206297",
"0.7206297",
"0.7206297",
"0.7206297",
"0.7206297",
"0.72016895",
"0.7195291",
"0.71949697",
"0.71925175",... | 0.0 | -1 |
Return a bool to indicate beta version. | def beta(self) -> bool:
return "b" in self.modifier if self.modifier else "beta" in self.string | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_installed_beta_no_newer_stable(self):\n self.change_version(self.version_1_2_2, '1.2beta')\n self.change_status(self.version_1_2_2, amo.STATUS_BETA)\n\n version, file = self.get('1.2beta', self.version_int,\n self.app, self.platform)\n assert ver... | [
"0.6776148",
"0.6726279",
"0.6702003",
"0.660505",
"0.65905607",
"0.6581529",
"0.6487351",
"0.64485204",
"0.64485204",
"0.628221",
"0.6265156",
"0.62314755",
"0.6192408",
"0.61612093",
"0.61580074",
"0.61532915",
"0.6114675",
"0.608962",
"0.608962",
"0.608962",
"0.608962",
... | 0.7676527 | 0 |
Return a bool to indicate release candidate version. | def release_candidate(self) -> bool:
return "rc" in self.modifier if self.modifier else "rc" in self.string | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_release(self):\n # version string: N.N.N.N is for release.\n return bool(re.match(r'^[\\d.]+$', self.version))",
"def is_release():\n return VERSION[-1]",
"def is_stable(self) -> bool:\n return not self.is_prerelease",
"def is_on(self) -> bool:\n current = self.coordinat... | [
"0.77111655",
"0.7372624",
"0.73395634",
"0.7116929",
"0.6996039",
"0.68743455",
"0.67760915",
"0.6740432",
"0.65852237",
"0.65619236",
"0.6561246",
"0.6549472",
"0.6474533",
"0.63579464",
"0.6334861",
"0.63199437",
"0.6260757",
"0.6252647",
"0.6239154",
"0.62103075",
"0.6141... | 0.70023155 | 4 |
Returns a date and time formatted as per HTTP RFC 2616. | def http_date_time(when):
gmtime = time.gmtime(when)
return '%s, %02d %3s %4d %02d:%02d:%02d GMT' % (
WEEKDAY_ABR[gmtime.tm_wday], gmtime.tm_mday,
MONTH_ABR[gmtime.tm_mon - 1], gmtime.tm_year, gmtime.tm_hour,
gmtime.tm_min, gmtime.tm_sec) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formatRFC2616Date(secs=None):\n\tif secs is None:\n\t\tsecs = time.time()\n\treturn emailutils.formatdate(secs, localtime=False, usegmt=True)",
"def rfc3999(date):\n if not date: return ''\n date = date + datetime.timedelta(seconds = -time.timezone)\n if time.daylight:\n date += datetime.time... | [
"0.73714656",
"0.7116985",
"0.69873196",
"0.6974283",
"0.68409675",
"0.6838362",
"0.68314415",
"0.681626",
"0.6791276",
"0.6748883",
"0.67287123",
"0.6700428",
"0.6695328",
"0.6688156",
"0.668528",
"0.6676679",
"0.6670514",
"0.66421837",
"0.66373765",
"0.66150707",
"0.6611124... | 0.72268707 | 1 |
This function computes a modified Hogg et al. (2002) definition of the Kcorrection. The observed filter and zeropoint will be the IRAC 4.5 um values. | def cluster_k_correction(self):
# Load in the IRAC 4.5 um filter as the observed filter
irac_45 = SpectralElement.from_file('Data_Repository/filter_curves/Spitzer_IRAC/080924ch2trans_full.txt',
wave_unit=u.um)
# Store the official IRAC 4.5 um zero po... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kcorrect(self, filter_list_q=None, filter_list_r=None, band_shift=0.):\n if not filter_list_q: filter_list_q = self.filter_list\n if not filter_list_r: filter_list_r = self.filter_list\n\n if len(filter_list_q) != len(filter_list_r):\n raise ValueError('Numbers of filters must m... | [
"0.6049725",
"0.593412",
"0.5909316",
"0.5889606",
"0.5803568",
"0.57738686",
"0.5743096",
"0.5700665",
"0.5682678",
"0.56737506",
"0.56637645",
"0.55764914",
"0.5571384",
"0.555053",
"0.5475023",
"0.54531264",
"0.54312754",
"0.54308134",
"0.53924924",
"0.53894144",
"0.538182... | 0.6409771 | 0 |
Determine which cell a particle at position vector x belongs to. | def XtoL(self, x):
lc = np.zeros(3)
lc[0] = (x[0]-self.x0[0])/self.dh[0];
lc[1] = (x[1]-self.x0[1])/self.dh[1];
lc[2] = (x[2]-self.x0[2])/self.dh[2];
return lc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cell(self, point):\n return self._grid[point.x][point.y]",
"def getCellFromPosition(self, xPos, yPos):\n for cell in self.cells:\n if(xPos == cell.x and yPos == cell.y):\n return cell\n return False",
"def cell_at(self, x, y):\n\n return self.maze_m... | [
"0.6753854",
"0.6712785",
"0.66762173",
"0.65578485",
"0.6547064",
"0.65168625",
"0.65103424",
"0.6452624",
"0.6423538",
"0.6325912",
"0.6277554",
"0.62739766",
"0.62087977",
"0.6206665",
"0.6193134",
"0.6144184",
"0.6140906",
"0.60559",
"0.6049448",
"0.6041645",
"0.6025644",... | 0.0 | -1 |
Compute the charge density. | def computeChargeDensity(self):
self.rho = np.zeros((self.ni, self.nj, self.nk))
for species in self.speciesList:
if species.charge!=0:
self.rho += species.charge*species.den | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _density(self):\n fraction = np.array([0.]+[m.value for m in self.fraction])\n # TODO: handle invalid fractions using penalty functions\n # S = sum(fraction)\n # scale = S/100 if S > 100 else 1\n # fraction[0] = 100 - S/scale\n # penalty = scale - 1\n fraction[0... | [
"0.7530408",
"0.73343456",
"0.7283132",
"0.72509116",
"0.72509116",
"0.72509116",
"0.71329844",
"0.70839",
"0.7079626",
"0.69515586",
"0.6775504",
"0.67077136",
"0.6704856",
"0.66575205",
"0.65954286",
"0.65954286",
"0.6564065",
"0.6545288",
"0.65450436",
"0.65390414",
"0.653... | 0.79801714 | 0 |
Persists the timestamp when the bot was last instantiated. | def set_last_init():
last_init = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
db["last_init"] = last_init
logger.info("Last initialization time set as: %s", last_init) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_timestamp(self):\n self._timestamp = datetime.datetime.now()",
"def save(self):\n self.touch()\n self._lastmtime = self.get_lock_file_mtime()",
"def republish(self):\n self.timestamp = time.time()",
"def get_timestamp(self):\n return datetime.datetime.utcnow()",
... | [
"0.6565771",
"0.6359629",
"0.63107467",
"0.6290457",
"0.62890166",
"0.6220186",
"0.62020296",
"0.6183994",
"0.61838436",
"0.61680466",
"0.61444813",
"0.6136349",
"0.60778266",
"0.6073126",
"0.60624164",
"0.60624164",
"0.6018065",
"0.6018065",
"0.5980631",
"0.59214073",
"0.592... | 0.6064979 | 14 |
Basic function to make email messages RFC2822 2.1.1 Compliant (Line Length Limit) Split the message at {max_line_length} (default 900) | def email_rfc2822_compliance(message, max_line_length=900):
returnmsg = ""
while len(message) > 0:
returnmsg = returnmsg + message[:max_line_length] + "\r\n"
message = message[max_line_length:]
return returnmsg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_message(message, max_length):\n ms = []\n while len(message) > max_length:\n ms.append(message[:max_length])\n message = message[max_length:]\n ms.append(message)\n return ms",
"def split_message(text, max_length=640):\n res = []\n sub_message = ''\n sentences = split... | [
"0.6790232",
"0.6611094",
"0.6376905",
"0.61982185",
"0.6119895",
"0.5845836",
"0.5761279",
"0.5732705",
"0.56816584",
"0.5646598",
"0.55363816",
"0.55151194",
"0.5499898",
"0.5486851",
"0.54598796",
"0.5451781",
"0.54024404",
"0.5397445",
"0.5381521",
"0.536209",
"0.53542113... | 0.7511238 | 0 |
Takes a string and returns it in a numeric type if suitable (using eval()) | def get_quant(q):
try:
e_q = eval(q)
except:
return None
if isinstance(e_q, (int,float,complex)):
return e_q
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _eval(string):\n # Remove black spaces\n string = string.strip()\n # Check if the string is None\n if string == \"\":\n return None\n # Check if the string is an integer\n elif string.isdigit():\n return int(string)\n # Try to convert to fl... | [
"0.8178696",
"0.7911357",
"0.73735964",
"0.7280555",
"0.72195154",
"0.7142069",
"0.71314657",
"0.71004516",
"0.70809036",
"0.69961417",
"0.69709206",
"0.69700766",
"0.69069797",
"0.6849515",
"0.6831007",
"0.68238914",
"0.6789066",
"0.6742951",
"0.66986835",
"0.66927123",
"0.6... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.