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 |
|---|---|---|---|---|---|---|
Return humanreadable relative time string. | def relative_datetime(self):
now = datetime.now(timezone.utc)
created_at = self.created_at.astimezone(timezone.utc)
delta = humanize.naturaldelta(abs(created_at - now))
tense = "from now" if now < created_at else "ago"
return f"{delta} {tense}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_time_human_readable():\n return time.strftime(\"%A, %H:%M\")",
"def get_time(self):\n x = time.localtime()\n return ''.join([\n str(x[0]).rjust(4, '0'), '/', str(x[1]).rjust(2, '0'), '/',\n str(x[2]).rjust(2, '0'), ' ', str(x[3]).rjust(2, '0'), ':',\n str... | [
"0.70410514",
"0.69390804",
"0.68644935",
"0.686331",
"0.6802071",
"0.6749616",
"0.6729886",
"0.6659623",
"0.66467756",
"0.6636499",
"0.66157746",
"0.66020143",
"0.6573047",
"0.656654",
"0.6514791",
"0.64840144",
"0.64817506",
"0.6452832",
"0.64522374",
"0.64282495",
"0.64208... | 0.6399556 | 21 |
Return humanreadable absolute time string. | def absolute_datetime(self):
return self.created_at.strftime("%a, %d %b %Y %H:%M:%S") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_time_human_readable():\n return time.strftime(\"%A, %H:%M\")",
"def friendly_time(time=None):\n if time is None:\n time = pass_good_until()\n return time.strftime(config.TIME_PRINT_FORMAT)",
"def get_time() -> str:\n return strftime(\"%H:%M:%S\")",
"def timestr():\n return dt.st... | [
"0.75000525",
"0.7122323",
"0.7091522",
"0.6977427",
"0.690155",
"0.68371636",
"0.68304455",
"0.6816692",
"0.6798105",
"0.6734693",
"0.6687905",
"0.66261804",
"0.6598092",
"0.6595055",
"0.65705943",
"0.65313894",
"0.6505681",
"0.64928216",
"0.64826185",
"0.6466328",
"0.646540... | 0.65405095 | 15 |
Calculates the entropy of a single column(position) in the transposed MSA. H(i) = sum_x(P(x)ln2(P(x))) | def entropy(column_string):
frequencies = dict()
total = len(column_string)
entropy = 0
for i in column_string:
if i in frequencies:
frequencies[i] +=1
else:
frequencies[i] = 1
for key in frequencies:
frequencies[key] /= total
entropy += frequencies[key]*math.log(frequencies[key], 2)
return -entrop... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entropy(x):\n nz = np.nonzero(x)[0]\n return -np.sum(x[nz]*np.log2(x[nz]))",
"def entropy(target_col):\n elements,counts = np.unique(target_col,return_counts = True)\n entropy = np.sum([(-counts[i]/np.sum(counts))*np.log2(counts[i]/np.sum(counts)) for i in range(len(elements))])\n return entro... | [
"0.70721626",
"0.70701116",
"0.6930125",
"0.68648076",
"0.6862334",
"0.66924185",
"0.66274935",
"0.6602205",
"0.65917414",
"0.65580195",
"0.64931446",
"0.6445587",
"0.6439341",
"0.6421814",
"0.64181036",
"0.6410196",
"0.64051795",
"0.6383893",
"0.6371382",
"0.6350537",
"0.634... | 0.62086606 | 34 |
Chooses a random option (separated by comma) | async def choose(self, ctx: Message, *, message):
await self.send(random.choice(message.replace(", ", ",").split(","))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def choices(self, ctx, *, options):\n choices = options.split('-')\n choice = random.choice(choices)\n await ctx.send(f'My choice is\\\"{choice}\\\"')",
"async def choose(*choices : str):\n await bot.say(random.choice(choices))",
"async def choose(ctx, *choices: str):\n await c... | [
"0.7356122",
"0.72980154",
"0.7231456",
"0.7221386",
"0.7074008",
"0.70598996",
"0.7036463",
"0.69809496",
"0.68713456",
"0.6863059",
"0.6861717",
"0.68052274",
"0.6797242",
"0.67940915",
"0.67906696",
"0.674972",
"0.67444324",
"0.67344636",
"0.6720222",
"0.6681825",
"0.66429... | 0.6794183 | 13 |
f"""Sets the latest message as starred, you can access starred messages with `{self.prefix}starred` | async def setstar(self, ctx: Message):
global msg #making the variables global so we can access them from any command
global msgauthor
global starred
global starredauthor
starred = msg
starredauthor = msgauthor
await self.send(f"Starred message was set! You may access it with d!starred") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def starred(self, ctx: Message):\n\t\tglobal starred\n\t\tglobal starredauthor\n\t\tawait self.send(\n\t\t f\"Starred Message: {starred}ㅤ|ㅤMessage Creator: @{starredauthor}\")",
"async def starboard(self, ctx):\n if self.bot.db.execute(\"SELECT * FROM starboards WHERE guild_id = ?\",(ctx.guild.id... | [
"0.7614617",
"0.6198602",
"0.6024754",
"0.60036963",
"0.59466106",
"0.5769455",
"0.55561626",
"0.5517419",
"0.55013496",
"0.5439447",
"0.5326988",
"0.53031874",
"0.5292317",
"0.52669215",
"0.5251434",
"0.5243599",
"0.52354676",
"0.5227666",
"0.52235234",
"0.52235234",
"0.5202... | 0.75660044 | 1 |
Decorator to wrap a class or instance method with a memoizing callable that saves results in a cache. | def cachedmethod(cache, key=keys.hashkey, lock=None):
def decorator(method):
if lock is None:
def wrapper(self, *args, **kwargs):
c = cache(self)
if c is None:
return method(self, *args, **kwargs)
k = key(*args, **kwargs)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decorator(method):\n\n def wrapper(*args, **kwargs):\n \"\"\"\n decorates the given method or function and makes it a lazy one.\n\n :param object args: function positional arguments.\n :param object kwargs: function keyword arguments.\n\n :returns: ... | [
"0.78838277",
"0.78170985",
"0.77516216",
"0.77098095",
"0.76443774",
"0.759869",
"0.75841075",
"0.75835615",
"0.75625193",
"0.7555885",
"0.75371236",
"0.753597",
"0.74854475",
"0.7473189",
"0.74439394",
"0.74331075",
"0.7424788",
"0.7423074",
"0.7423074",
"0.7423074",
"0.740... | 0.7377774 | 23 |
Return True if the two strings are equal, False otherwise. | def constant_time_compare(val1, val2):
return secrets.compare_digest(force_bytes(val1), force_bytes(val2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isEqual(string1, string2):\n return (True)",
"def _strings_are_equal(self, value1, value2):\n if value1.lower().strip().replace('_', ' ') == value2.lower().strip().replace('_', ' '):\n return 1\n return 0",
"def test_strings_are_equal(self):\n string1 = 'this is the first s... | [
"0.82969666",
"0.7894558",
"0.78396666",
"0.76290977",
"0.7594734",
"0.7462896",
"0.74592745",
"0.7340261",
"0.73230886",
"0.727015",
"0.7196578",
"0.71828926",
"0.70921886",
"0.7079344",
"0.70285",
"0.6967209",
"0.69438595",
"0.6921239",
"0.68983316",
"0.6808479",
"0.6806627... | 0.0 | -1 |
Set a value in a nested object in root by item sequence. | def set_by_path(data: Dict[str, T], path: Sequence[str], value: T):
get_by_path(data, path[:-1])[path[-1]] = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(self, item, value, set_doc):\n if item is None:\n raise Exception(\"call __setitem__ with None argument\")\n else:\n self.size += 1\n self.root = self.set(self.root, item, int(value), 0, set_doc)",
"def set_by_path(root, items, value):\n get_by_path(root, ite... | [
"0.7220228",
"0.6891136",
"0.6576016",
"0.6516086",
"0.6507098",
"0.64205235",
"0.6411641",
"0.63742626",
"0.6364478",
"0.6345405",
"0.62299913",
"0.62247443",
"0.6131387",
"0.61229557",
"0.6119613",
"0.60986227",
"0.60964847",
"0.60803896",
"0.606418",
"0.6049419",
"0.601501... | 0.5696156 | 51 |
Test create_app without passing test config. | def test_config():
assert not sample.create_app().testing
assert sample.create_app({"TESTING": True}).testing | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_app():\n assert not create_app().testing\n assert create_app({'TESTING': True}).testing",
"def test_config():\n assert not create_app().testing\n assert create_app(TestConfig).testing",
"def test_app_is_created(app):\n assert app.name == \"myapp.app\"",
"def test_create(self):\... | [
"0.88498396",
"0.8124712",
"0.803595",
"0.8010812",
"0.76881677",
"0.76236284",
"0.7604287",
"0.7598619",
"0.7561507",
"0.75018466",
"0.73570627",
"0.73001164",
"0.7252014",
"0.7214372",
"0.7185277",
"0.7180016",
"0.71766704",
"0.71629363",
"0.71615326",
"0.71521",
"0.7067521... | 0.8132289 | 1 |
Set the uuid for the given blender object. | def set_uuid(self, obj, obj_uuid):
if not "opensim" in obj.properties:
obj.properties["opensim"] = {}
obj.properties["opensim"]["uuid"] = str(obj_uuid) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uuid(self, uuid: str):\n \n self._uuid = uuid",
"def uuid(self, uuid):\n\n self._uuid = uuid",
"def uuid(self, uuid):\n\n self._uuid = uuid",
"def uuid(self, uuid):\n\n self._uuid = uuid",
"def uuid(self, uuid):\n\n self._uuid = uuid",
"def uuid(self, uuid: s... | [
"0.754095",
"0.7501207",
"0.7501207",
"0.7501207",
"0.7501207",
"0.7452443",
"0.68505347",
"0.65738225",
"0.6551237",
"0.6537102",
"0.6489831",
"0.6280202",
"0.6255105",
"0.6255105",
"0.6213228",
"0.61867446",
"0.6071201",
"0.6071201",
"0.6017261",
"0.6001831",
"0.5990585",
... | 0.6806787 | 7 |
Return a generator over the given texts that yields batches of `batch_size` texts at a time. | def yield_batches(self, texts):
batch = []
for text in self._iter_texts(texts):
batch.append(text)
if len(batch) == self.batch_size:
yield batch
batch = []
if batch:
yield batch | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_batches(summaries, texts, batch_size):\n for batch_i in range(0, len(texts)//batch_size):\n start_i = batch_i * batch_size\n summaries_batch = summaries[start_i:start_i + batch_size]\n texts_batch = texts[start_i:start_i + batch_size]\n pad_summaries_batch = np.array(pad_sent... | [
"0.7762104",
"0.7755449",
"0.6940338",
"0.69279873",
"0.690108",
"0.68479675",
"0.68453777",
"0.68303055",
"0.6803756",
"0.67918473",
"0.674294",
"0.6732417",
"0.67042583",
"0.666098",
"0.6653685",
"0.6618091",
"0.65829265",
"0.65809155",
"0.65289533",
"0.65220654",
"0.646072... | 0.77898896 | 0 |
Returns datetime.datetime.utcnow(). Provided as a method here so that it is easy to monkeypatch for testing. | def _utcnow(self):
return datetime.datetime.utcnow() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def datetime_utcnow() -> datetime:\n return datetime.now(tz=pytz.timezone('UTC'))",
"def now():\n return datetime.datetime.utcnow()",
"def _Now():\n return datetime.datetime.utcnow()",
"def _now():\n return datetime.datetime.utcnow().replace(tzinfo=pytz.utc)",
"def now_datetime():\n return dat... | [
"0.8908604",
"0.85124075",
"0.8492621",
"0.8486097",
"0.8467661",
"0.8332094",
"0.8300898",
"0.82957476",
"0.8254138",
"0.82106686",
"0.8201794",
"0.7980567",
"0.79187965",
"0.7898403",
"0.7890518",
"0.7874206",
"0.78659505",
"0.78306174",
"0.77715486",
"0.7557348",
"0.755356... | 0.8875176 | 1 |
True if the current or specified app version is the default. | def is_default_version(version=None):
version = version or get_current_version_name()
return version == get_default_version() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_default_version(self) -> Optional[bool]:\n return pulumi.get(self, \"set_default_version\")",
"def default(self) -> bool:\n return pulumi.get(self, \"default\")",
"def default(self) -> Optional[bool]:\n return pulumi.get(self, \"default\")",
"def default(self) -> Optional[bool]:\... | [
"0.772681",
"0.6940067",
"0.6833589",
"0.6833589",
"0.6833589",
"0.6833589",
"0.6833589",
"0.6758137",
"0.6740214",
"0.6727526",
"0.6727526",
"0.6727526",
"0.6631582",
"0.65461373",
"0.6484051",
"0.64713746",
"0.64553",
"0.6429615",
"0.6415335",
"0.63927865",
"0.6356097",
"... | 0.8380437 | 0 |
True if the dev_appserver is running (localhost or local development server). | def is_development():
return os.environ.get('SERVER_SOFTWARE', '').startswith('Development') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_appengine():\n runtime = os.environ.get('SERVER_SOFTWARE', '')\n return (runtime.startswith('Development/') or\n runtime.startswith('Google App Engine/'))",
"def is_localhost() -> bool:\n if not has_request_context():\n return True\n\n host = request.headers.get(\"Host\", \"\... | [
"0.741669",
"0.71911776",
"0.70739365",
"0.6905765",
"0.68173414",
"0.6816723",
"0.6765967",
"0.67199194",
"0.66788757",
"0.6613591",
"0.6549747",
"0.65254384",
"0.6508623",
"0.6505181",
"0.6487575",
"0.64841694",
"0.6479798",
"0.64565057",
"0.6411692",
"0.6387343",
"0.638734... | 0.7834348 | 0 |
True if the app is hosted by Google (appspot.com) but the version is not the default. | def is_staging(version=None):
return is_host_google() and not is_default_version(version) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_host_google():\n return os.environ.get('SERVER_SOFTWARE', '').startswith('Google') or get_hostname().endswith('.appspot.com')",
"def is_production(version=None):\n return is_host_google() and is_default_version(version)",
"def on_appengine():\n runtime = os.environ.get('SERVER_SOFTWARE', '')\n r... | [
"0.78718776",
"0.7848482",
"0.7105191",
"0.60794103",
"0.5947001",
"0.5870007",
"0.58545595",
"0.5787777",
"0.57830673",
"0.56562567",
"0.5615425",
"0.55722284",
"0.55030566",
"0.5441202",
"0.54393244",
"0.5423002",
"0.5417493",
"0.5415486",
"0.5387807",
"0.5368626",
"0.53599... | 0.71080875 | 2 |
True if the app is being hosted by Google and the default version. | def is_production(version=None):
return is_host_google() and is_default_version(version) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_host_google():\n return os.environ.get('SERVER_SOFTWARE', '').startswith('Google') or get_hostname().endswith('.appspot.com')",
"def on_appengine():\n runtime = os.environ.get('SERVER_SOFTWARE', '')\n return (runtime.startswith('Development/') or\n runtime.startswith('Google App Engine/'... | [
"0.78136915",
"0.70029646",
"0.6968191",
"0.6026386",
"0.60192406",
"0.58875763",
"0.582418",
"0.5808776",
"0.58086157",
"0.5788909",
"0.57182306",
"0.57105726",
"0.56911755",
"0.5684011",
"0.56268823",
"0.5618302",
"0.55995536",
"0.5591077",
"0.5575814",
"0.5568064",
"0.5552... | 0.7635994 | 1 |
Return a dictionary of key/values from os.environ. | def _get_os_environ_dict(keys):
return {k: os.environ.get(k, _UNDEFINED) for k in keys} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env_dict(self): # type: () -> t.Dict[str, str]\n return dict((item[0], item[1]) for item in [e.split('=', 1) for e in self.env])",
"def _get_env(self):\n env = {}\n for k, v in os.environ.items():\n k = k.decode() if isinstance(k, bytes) else k\n v = v.decode() if ... | [
"0.80361634",
"0.7982982",
"0.77362555",
"0.76071644",
"0.75005096",
"0.7499689",
"0.7467644",
"0.74087524",
"0.7384348",
"0.7360694",
"0.73264164",
"0.7157489",
"0.7088433",
"0.70668805",
"0.7057955",
"0.7046177",
"0.7021099",
"0.6982962",
"0.69719166",
"0.69719166",
"0.6971... | 0.76562595 | 3 |
Return a dictionary of all environment keys/values. | def get_environ_dict():
return {
'os.environ': _get_os_environ_dict((
'AUTH_DOMAIN',
'CURRENT_CONFIGURATION_VERSION',
'CURRENT_MODULE_ID',
'CURRENT_VERSION_ID',
'DEFAULT_VERSION_HOSTNAME',
'FEDERATED_IDENTITY',
'FEDERATED_PROVIDER',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env_dict(self): # type: () -> t.Dict[str, str]\n return dict((item[0], item[1]) for item in [e.split('=', 1) for e in self.env])",
"def _all_env_vars_to_dict(self):\n all_env_vars = {}\n for k, v in self.env.items():\n c_vars = {}\n for x, y in v['vars'].items():\n... | [
"0.7838127",
"0.76772326",
"0.75440085",
"0.7520959",
"0.74886906",
"0.74356574",
"0.7420341",
"0.7319362",
"0.7290992",
"0.72615975",
"0.72059035",
"0.71573085",
"0.71573085",
"0.703609",
"0.70357156",
"0.70357156",
"0.70357156",
"0.70231026",
"0.7020375",
"0.70022434",
"0.6... | 0.7408746 | 7 |
A method to compute the distance between X_test and X_train and return the euclidean distance input a pandas Series or numpy array output euclidean distance | def get_distance(self,row_vector):
d = row_vector-self.X_test
return np.sqrt(np.dot(d,d)) # return the euclidean distance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_distances(train_data, test_datum):\n n = train_data.shape[0]\n dist = []\n for i in range(n):\n distance = np.sqrt(np.sum(np.square(train_data[i]-test_datum)))\n dist.append(distance)\n dist = np.asarray(dist)\n return dist",
"def compute_distances(self, X):\n nu... | [
"0.75142086",
"0.7399837",
"0.7243397",
"0.707046",
"0.6967581",
"0.6965228",
"0.6943702",
"0.6870658",
"0.6785432",
"0.6773118",
"0.67636585",
"0.67608",
"0.67496693",
"0.6652266",
"0.66108686",
"0.6584114",
"0.65776694",
"0.65604275",
"0.6541176",
"0.65374935",
"0.6525712",... | 0.6819569 | 8 |
Read version from pyproject.toml. Fallback to setup.cfg. | def main() -> int:
version: str | None = None
if (path_pyproject := Path("pyproject.toml")).is_file():
with open(path_pyproject, "rb") as fp:
data = tomllib.load(fp)
try:
version = data["project"]["version"]
except KeyError:
pass
if version is N... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_version():\n found = None\n with open(os.path.join(PATH, \"pyproject.toml\"), \"rt\") as setup_file:\n for line in setup_file:\n line = line.strip()\n if line.startswith(\"version\"):\n found = line\n break\n\n if found is None:\n r... | [
"0.77620876",
"0.6764137",
"0.67278796",
"0.66459954",
"0.661202",
"0.6550006",
"0.6475499",
"0.64624816",
"0.64310944",
"0.6424412",
"0.6424412",
"0.63990474",
"0.63905674",
"0.6379119",
"0.63753563",
"0.63627774",
"0.63587075",
"0.6322798",
"0.6316064",
"0.62923396",
"0.624... | 0.78628546 | 0 |
Sames as test_gated_conv2d_initialization except that input and output dimensions are different Also, GatedConv2d has multiple tasks, all of which must be equivalent to nn.Conv2d at initialization | def test_gated_conv2d_initialization2():
seed(0)
gconv: GatedConv2d = GatedConv2d(15, 32, (2, 4), bias=True, n_tasks=3)
gconv.set_task(0)
seed(0)
conv: nn.Conv2d = nn.Conv2d(15, 32, (2, 4), bias=True)
for task in range(3):
randvec: torch.Tensor = torch.rand((200, 15, 60, 120))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_gated_conv2d_initialization():\n seed(0)\n gconv: GatedConv2d = GatedConv2d(16, 33, (3, 5), stride=(2, 1), bias=True)\n gconv.set_task(0)\n\n seed(0)\n conv: nn.Conv2d = nn.Conv2d(16, 33, (3, 5), stride=(2, 1), bias=True)\n\n randvec: torch.Tensor = torch.randn((20, 16, 50, 100))\n \n... | [
"0.81275254",
"0.6787331",
"0.67305773",
"0.6696995",
"0.6675332",
"0.6673586",
"0.66566265",
"0.66512203",
"0.6513561",
"0.65115994",
"0.6498315",
"0.64659786",
"0.6448527",
"0.6439628",
"0.6416859",
"0.6370605",
"0.63614136",
"0.6337462",
"0.6327379",
"0.63149166",
"0.63119... | 0.8366868 | 0 |
Clones a CachedQuerySet. If caching and this is a ValuesQuerySet, automatically add any related foreign relations to the select fields so we can invalidate this query. | def _base_clone(self, queryset, klass=None, setup=False, **kwargs):
cache_query = kwargs.get('_cache_query', getattr(self, '_cache_query', False))
kwargs['_cache_query'] = cache_query
if not hasattr(self, '_reversemapping'):
self._reversemapping = {}
if cache_query and... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _clone(self):\n c = self.__class__(\n model=self.model,\n query=self.query.chain(),\n using=self._db,\n hints=self._hints,\n )\n c._sticky_filter = self._sticky_filter\n c._for_write = self._for_write\n c._prefetch_related_lookups =... | [
"0.61725074",
"0.59812343",
"0.59461266",
"0.59003377",
"0.584395",
"0.56303823",
"0.5615513",
"0.5554182",
"0.5544305",
"0.5536982",
"0.55095303",
"0.5501754",
"0.5419497",
"0.54085493",
"0.537575",
"0.5325959",
"0.52936274",
"0.5293385",
"0.5253096",
"0.5230616",
"0.5225892... | 0.66464555 | 0 |
A hackish way to figure out if this is a field or reverse foreign relation | def _is_valid_field(self, field, allow_m2m=True):
try:
self.query.setup_joins(field.split(LOOKUP_SEP), self.query.get_meta(), self.query.get_initial_alias(), False, allow_m2m, True)
return True
except FieldError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isForeignKey(cls, _field):\n return isinstance(_field, fields.ForeignKeyField)",
"def isReferenceField(cls, _field):\n return isinstance(_field, fields.ReferenceField)",
"def isForeignKey(self):\n return self._foreignKey",
"def is_field(self, proof = True):\n return True",
"... | [
"0.73403466",
"0.6849318",
"0.6827766",
"0.67418176",
"0.66495365",
"0.636335",
"0.629098",
"0.62434417",
"0.6227401",
"0.62188214",
"0.6202432",
"0.6103606",
"0.60668206",
"0.60197663",
"0.6006163",
"0.5977515",
"0.58941185",
"0.58592147",
"0.5821377",
"0.5792899",
"0.574693... | 0.5553224 | 35 |
Cache this queryset. If this is a query over reverse foreign relations, those fields will automatically be added to select_reverse, because we need them for invalidation. Do not cache queries on tables in CACHEBOT_TABLE_BLACKLIST | def cache(self, *flush_fields):
_cache_query = self.model._meta.db_table not in conf.CACHEBOT_TABLE_BLACKLIST
return self._clone(setup=True, _cache_query=_cache_query, _flush_fields=flush_fields) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fullcache(self):\n query = {\n \"%s__id\" % self._model: self._objid,\n \"attribute__db_model__iexact\": self._model,\n \"attribute__db_attrtype\": self._attrtype,\n }\n attrs = [\n conn.attribute\n for conn in getattr(self.obj, self.... | [
"0.6775402",
"0.59993213",
"0.596222",
"0.58145946",
"0.5670215",
"0.5609738",
"0.55994034",
"0.55506045",
"0.5535557",
"0.54939467",
"0.5365281",
"0.5360304",
"0.53333545",
"0.532666",
"0.531732",
"0.53152156",
"0.5242422",
"0.52284163",
"0.52197117",
"0.51829463",
"0.516082... | 0.6865942 | 0 |
returns True if same class | def is_same_class(obj, a_class):
return type(obj) == a_class | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_same_class(obj, a_class):\n if type(obj) == a_class:\n return True\n else:\n return False",
"def is_same_class(obj, a_class):\n return(type(obj) == a_class)",
"def class_is(cls: Class) -> bool:\n pass",
"def is_same_class(obj, a_class):\n if type(obj) is a_class:\n ... | [
"0.78040755",
"0.77975726",
"0.7773719",
"0.77728266",
"0.7767954",
"0.7753993",
"0.77302134",
"0.77113855",
"0.7694895",
"0.76916796",
"0.76916796",
"0.7265725",
"0.7178978",
"0.6930947",
"0.6919382",
"0.691706",
"0.6907653",
"0.673987",
"0.67143154",
"0.6678296",
"0.6660986... | 0.77375275 | 6 |
Returns value counts of categorical variable. | def transform(self, x):
return x.apply(lambda x_i: self.d[x_i] if x_i in self.d else 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_counts(self, X: np.ndarray) -> Dict[int, np.ndarray]:\n return {f: np.bincount(X[:, f].astype(int), minlength=n_cat) for f, n_cat in\n self.categories_per_feature.items()}",
"def counts_vals(self):\n\n return unumpy.nominal_values(self.counts)",
"def get_value_counts(X, co... | [
"0.69942605",
"0.67549676",
"0.6734097",
"0.6698544",
"0.6636755",
"0.6601023",
"0.64900833",
"0.63997895",
"0.63928306",
"0.62541586",
"0.624678",
"0.6137413",
"0.6109233",
"0.608899",
"0.60091877",
"0.599579",
"0.5986034",
"0.597623",
"0.5961613",
"0.5955025",
"0.5939641",
... | 0.0 | -1 |
Return all applicable ConfigContexts for a given object. Only active ConfigContexts will be included. | def get_for_object(self, obj, aggregate_data=False):
# `device_role` for Device; `role` for VirtualMachine
role = getattr(obj, 'device_role', None) or obj.role
# Device type and location assignment is relevant only for Devices
device_type = getattr(obj, 'device_type', None)
loc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _context_list(self):\r\n url = \"{}/contexts/\".format(self._org_url)\r\n contexts = self._request(url)\r\n if not contexts:\r\n LOGGER.warning(\"No contexts available\")\r\n return contexts",
"def get_contexts(self):\n params = self._get_configurational_params()... | [
"0.67423195",
"0.63874483",
"0.6288563",
"0.6134643",
"0.60941",
"0.5821991",
"0.5788118",
"0.5764118",
"0.57478577",
"0.5685389",
"0.5561476",
"0.5472794",
"0.54687864",
"0.53679305",
"0.5259285",
"0.5245345",
"0.5188176",
"0.5185638",
"0.513328",
"0.51033306",
"0.5074107",
... | 0.0 | -1 |
Test email address is set. | def test_email_address(self):
key = api.portal.get_registry_record(
'plone.email_from_address'
)
self.assertEqual(u'site@briefy.co', key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_email(self):\r\n \r\n self.assertEqual('maryc123@yahoo.com', self.user.email)",
"def test_invalid_email_when_logging_in(self):\n pass",
"def test_email(self, env: yaenv.Env):\n _email = {\n 'EMAIL_BACKEND': yaenv.email.SCHEMES['dummy'],\n 'EMAIL_HOST_U... | [
"0.7611134",
"0.7195895",
"0.7082477",
"0.7025699",
"0.70236313",
"0.6988792",
"0.6987156",
"0.6861115",
"0.68181455",
"0.67952514",
"0.6763157",
"0.67444533",
"0.6705161",
"0.6694789",
"0.66897583",
"0.6661837",
"0.6633471",
"0.66177654",
"0.6575388",
"0.65562",
"0.6545701",... | 0.7595855 | 1 |
Test email name is set. | def test_email_name(self):
key = api.portal.get_registry_record(
'plone.email_from_name'
)
self.assertEqual(u'Briefy CMS', key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_for_email_attribute_by_name(self):\n name = u\"__TestUser__\"\n password = u\"ekfdweurwerh\"\n email = \"__TestUser__@moinhost\"\n self.createUser(name, password, email=email)\n theuser = user.User(self.request, name=name)\n assert theuser.email == \"\"",
"def t... | [
"0.8078864",
"0.7592621",
"0.6945445",
"0.69436026",
"0.69260883",
"0.68844074",
"0.6852423",
"0.6669014",
"0.6648711",
"0.6596142",
"0.6590379",
"0.65896183",
"0.6588239",
"0.6584014",
"0.6582953",
"0.65080476",
"0.6454704",
"0.6434885",
"0.64311403",
"0.6407559",
"0.6406547... | 0.77568376 | 1 |
Test if logo is set. | def test_logo(self):
key = api.portal.get_registry_record(
'plone.site_logo'
)
self.assertIsNotNone(key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_logo(self):\n\n return self.exclude(models.Q(logo=\"\") | models.Q(logo=None))",
"def logo(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"logo\")",
"def logo(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"logo\")",
"def logo(self) -> Optional... | [
"0.7107877",
"0.67418164",
"0.67418164",
"0.67418164",
"0.67418164",
"0.66061246",
"0.6446538",
"0.6446538",
"0.63952404",
"0.63714206",
"0.63714206",
"0.63000387",
"0.62816286",
"0.62816286",
"0.62816286",
"0.62216955",
"0.6205712",
"0.6187272",
"0.6105691",
"0.6105691",
"0.... | 0.7037793 | 1 |
Remove stop words words that do not contribute to the deeper meaning of the phrase. e.g. 'some', 'not', 'do', 'the' | def remove_stopwords(word: str) -> str:
stop_words = stopwords.words('english')
if not word in stop_words:
return word
else:
return '0' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stopwords(text):\n stopwords = [\"i\", \"me\", \"my\", \"myself\", \"we\", \"our\", \"ours\", \"ourselves\", \"you\", \"your\", \"yours\", \"yourself\", \"yourselves\", \"he\", \"him\", \"his\", \"himself\", \"she\", \"her\", \"hers\", \"herself\", \"it\", \"its\", \"itself\", \"they\", \"them\", \"t... | [
"0.8126381",
"0.8110614",
"0.8047423",
"0.79152584",
"0.78571343",
"0.7856788",
"0.78490096",
"0.7815386",
"0.7814012",
"0.78045386",
"0.78030384",
"0.77863",
"0.7765254",
"0.77563715",
"0.7755881",
"0.7718692",
"0.7711407",
"0.77077824",
"0.7695696",
"0.7687436",
"0.7651064"... | 0.7113439 | 70 |
Return a dictionary of this model containing just the fields needed for javascript rendering. | def get_entry_dict(self):
# generating thumbnail URLs is slow, so only generate the ones
# that will definitely be used.
ret = {
'id': self.id,
'vertices': self.vertices,
'triangles': self.triangles,
'segments': self.segments,
'photo':... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json(self):\n return {\n '_id' : self._id,\n 'name' : self.name,\n 'description' : self.description,\n }",
"def json(self):\n return {'id': self.id, 'name': self.name, 'description': self.description}",
"def json(self):\n return {\n 'i... | [
"0.65631473",
"0.6489846",
"0.64666986",
"0.645209",
"0.6302593",
"0.62496924",
"0.6229523",
"0.6228484",
"0.62241656",
"0.6212719",
"0.6212719",
"0.6210559",
"0.61916965",
"0.61916965",
"0.61916965",
"0.6179371",
"0.6166464",
"0.61609536",
"0.6157381",
"0.61437607",
"0.61407... | 0.0 | -1 |
Returns the file name of this item and all its headings from top down | def location(self) -> List[str]:
loc = [os.path.basename(self.filepath)]
for h in self.headings:
loc.append(h.heading.strip())
return loc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def title(self):\n return os.path.basename(self.__path) if self.isdir() else self.file_title",
"def get_file_name(self):\n\n return \"%s - %s\" % (self.get_tags()[\"artist\"], self.get_tags()[\"title\"])",
"def _prettyfilename(self):\n return self.title",
"def get_file_name(self):\n ... | [
"0.6929421",
"0.6831913",
"0.68071866",
"0.6767465",
"0.67439365",
"0.659311",
"0.6561725",
"0.6547633",
"0.653607",
"0.65291476",
"0.6481994",
"0.64708656",
"0.64689744",
"0.6468221",
"0.64479697",
"0.64443076",
"0.63771623",
"0.636629",
"0.63550174",
"0.630625",
"0.6289095"... | 0.6051534 | 47 |
Returns the string representation on this item as should be written to the stdout. | def output(self) -> str:
output = '- ' + self.output_location() + '\n'
output += self.INDENT + self.lines[0][2:] + '\n'
for line in self.lines[1:]:
output += self.INDENT + line + '\n'
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_string(self):\n return self.__repr__()",
"def __str__(self):\n buf = StringIO()\n self.write_to(buf)\n return buf.getvalue()",
"def __str__(self):\n return str(self._items)",
"def __str__(self):\n return '\\n\\n'.join(str(item) for item in self._data)",
"def... | [
"0.75616163",
"0.7462769",
"0.7430526",
"0.7430516",
"0.7409261",
"0.7409261",
"0.7409261",
"0.74063027",
"0.74063027",
"0.74035186",
"0.7402519",
"0.739608",
"0.73788226",
"0.736141",
"0.7337064",
"0.73278606",
"0.73278606",
"0.73278606",
"0.7323719",
"0.7302992",
"0.7285791... | 0.0 | -1 |
Plot validation graphs for all labels corresponding to a specific setup. Will be saved to files in `path`. | def plot_val_all_labels(
db: MongoCosemDB, setup: str, path: str, threshold: int = 127, filetype: str = "pdf"
):
valcrops = db.get_all_validation_crops()
labels = get_unet_setup(setup).labels
for lbl in labels:
in_crop = [check_label_in_crop(lbl, crop) for crop in valcrops]
if any(in_cro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_training_curve(path):\n import matplotlib.pyplot as plt\n train_err = np.loadtxt(\"{}_train_err.csv\".format(path))\n val_err = np.loadtxt(\"{}_val_err.csv\".format(path))\n train_loss = np.loadtxt(\"{}_train_loss.csv\".format(path))\n val_loss = np.loadtxt(\"{}_val_loss.csv\".format(path))... | [
"0.6364331",
"0.6203751",
"0.61374027",
"0.6054215",
"0.60218644",
"0.5904355",
"0.5870643",
"0.5821895",
"0.57631457",
"0.5755101",
"0.57389474",
"0.5737532",
"0.57373315",
"0.5722636",
"0.57101905",
"0.5686633",
"0.5683642",
"0.56830406",
"0.56823343",
"0.5666912",
"0.56632... | 0.633306 | 1 |
Opens the last built file in a Web browser. | def viewBuild (self, event = None):
path = 'file://' + urllib.pathname2url(self.buildDestination)
path = path.replace('file://///', 'file:///')
wx.LaunchDefaultBrowser(path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _open_browser(self, single_doc_html):\n url = os.path.join(\"file://\", DOC_PATH, \"build\", \"html\", single_doc_html)\n webbrowser.open(url, new=2)",
"def _open_browser(self, single_doc_html):\n url = os.path.join(\n \"file://\", DOC_PATH, \"build\", \"html\", single_doc_htm... | [
"0.73582006",
"0.7323412",
"0.6964546",
"0.6952937",
"0.69458205",
"0.6939445",
"0.6900211",
"0.6878149",
"0.6791994",
"0.67902684",
"0.67884827",
"0.6759981",
"0.67422956",
"0.67392117",
"0.67234075",
"0.6579325",
"0.6542764",
"0.65300286",
"0.65091604",
"0.6469551",
"0.6447... | 0.65704614 | 16 |
Sets the dirty flag to the value passed. Make sure to use this instead of setting the dirty property directly, as this method automatically updates the pristine property as well. If you pass an action parameter, this action will be saved for undoing under that name. | def setDirty (self, value, action = None):
self.dirty = value
self.pristine = False
if value is True and action:
self.storyPanel.pushUndo(action) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetDirty(self, *args, **kwargs):\n pass",
"def setDirty( self, state = True ):\n self._dirty = state",
"def _reset(self, *args):\n self.dirty = True",
"def UNUSED_save_ifdirty(self):\n if (self.get_isdirty()):\n self.save()",
"def save_edits(self, value):\r\n ... | [
"0.6286011",
"0.59443146",
"0.57823217",
"0.5231629",
"0.5030259",
"0.49741504",
"0.4948412",
"0.4880673",
"0.48540953",
"0.4848074",
"0.48417193",
"0.48278692",
"0.4714081",
"0.4714081",
"0.4691578",
"0.4691578",
"0.46523595",
"0.4586552",
"0.45801178",
"0.44932994",
"0.4457... | 0.7878987 | 0 |
Returns a dictionary of state suitable for pickling. | def serialize (self):
return { 'target': self.target, 'buildDestination': self.buildDestination, \
'saveDestination': self.saveDestination, \
'storyPanel': self.storyPanel.serialize() } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getstate__(self):\n result_dict = {}\n for pickle_attr in self.pickle_attrs:\n result_dict[pickle_attr] = self.__dict__[pickle_attr]\n return result_dict",
"def __getstate__(self):\n\n state = {}\n for key in self.__slots__:\n state[key] = getattr(se... | [
"0.8078824",
"0.77479404",
"0.7688168",
"0.7621085",
"0.7621085",
"0.75852185",
"0.75799656",
"0.74513334",
"0.74429923",
"0.74429923",
"0.7401747",
"0.7391154",
"0.73559755",
"0.73341995",
"0.7325707",
"0.7274801",
"0.72677183",
"0.7246104",
"0.72425944",
"0.7240643",
"0.722... | 0.0 | -1 |
Returns a dictionary of state suitable for pickling. | def serialize_noprivate (self, dest):
return { 'target': self.target, 'buildDestination': '', \
'saveDestination': dest, \
'storyPanel': self.storyPanel.serialize_noprivate() } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getstate__(self):\n result_dict = {}\n for pickle_attr in self.pickle_attrs:\n result_dict[pickle_attr] = self.__dict__[pickle_attr]\n return result_dict",
"def __getstate__(self):\n\n state = {}\n for key in self.__slots__:\n state[key] = getattr(se... | [
"0.8078393",
"0.77483",
"0.768786",
"0.76216984",
"0.76216984",
"0.75849223",
"0.757967",
"0.74517804",
"0.7441994",
"0.7441994",
"0.7402533",
"0.73904663",
"0.7356226",
"0.73345864",
"0.73246145",
"0.7274528",
"0.72675216",
"0.7246171",
"0.7241589",
"0.72407603",
"0.72285223... | 0.0 | -1 |
Return safe defaults for model globals, this will be called instead of model() in case the model has been deactivated in deployment_settings. | def defaults():
return Storage(
hazard_id = S3ReusableField("hazard_id", "integer",
readable=False,
writable=False),
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_defaults(self):\n\t\treturn self.__defaults",
"def dealWithDefaultValues(self):\n return _libsbml.Model_dealWithDefaultValues(self)",
"def get_default_models():\n\n print (\"\")\n log_app.debug(\"create_new_config\")\n log_app.debug(\"create_new_config / method : %s\", request.method )\n \n ... | [
"0.6250287",
"0.61721903",
"0.61385167",
"0.6078777",
"0.6078777",
"0.6076428",
"0.6074019",
"0.5908622",
"0.5905933",
"0.5896708",
"0.58943796",
"0.58817697",
"0.586109",
"0.58499587",
"0.583422",
"0.58322823",
"0.5824284",
"0.5748612",
"0.57464457",
"0.5738713",
"0.5736318"... | 0.0 | -1 |
Drops and creates the tables in the database. Module flask_monitoringdashboard must be imported locally. | def clear_db():
from flask_monitoringdashboard.database import get_tables, engine
for table in get_tables():
table.__table__.drop(engine)
table.__table__.create(engine) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_up():\n drop_all_tables()\n create_all()",
"def recreate_db():\n db.session.execute('SET FOREIGN_KEY_CHECKS=0;')\n db.session.execute('DROP TABLE IF EXISTS logs;')\n db.session.execute('DROP TABLE IF EXISTS employees;')\n db.session.execute('DROP TABLE IF EXISTS sales;')\n ... | [
"0.7322428",
"0.7195561",
"0.71846676",
"0.71665865",
"0.711359",
"0.7063226",
"0.70234025",
"0.7021921",
"0.7015413",
"0.69985765",
"0.69595975",
"0.6936402",
"0.6931401",
"0.69009584",
"0.68879503",
"0.68267804",
"0.6824874",
"0.6820962",
"0.6819869",
"0.68192804",
"0.68173... | 0.76238817 | 0 |
Test whether the page returns a 200 OK. | def test_get_ok(test_case, page):
with test_case.app.test_client() as c:
test_case.assertEqual(200, c.get('dashboard/{}'.format(page)).status_code) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert200(self, response):\n self.assertEqual(response.status_code, 200)",
"def assertHttpOK(self, response):\r\n self.assertEqual(response.status_code, 200)",
"def check_status(response):\n if response.status_code == 200:\n return True",
"def is_ok(r) -> bool:\n\tif r.status_code... | [
"0.79986423",
"0.79654616",
"0.7930902",
"0.79155874",
"0.7839797",
"0.7835429",
"0.7775186",
"0.768653",
"0.74720347",
"0.7443766",
"0.74371564",
"0.73889667",
"0.73889667",
"0.73889667",
"0.73889667",
"0.73889667",
"0.73889667",
"0.73889667",
"0.73889667",
"0.73889667",
"0.... | 0.68214476 | 89 |
Insert node in the head of linked list. | def push_head(self, data):
node = Node(data)
if self.is_empty() or self._size == 1:
self.__init_ll(node)
else:
current = self._head
current._previ = node
node._next = current
self._head = node
self._size += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_start(self, data):\n\n if self.head is None:\n self.head = ListNode(data)\n else:\n temp = self.head\n self.head = ListNode(data)\n self.head.next = temp",
"def insert_head(self, data):\n node = Node(data)\n if self.is_empty():\n ... | [
"0.8180544",
"0.8114963",
"0.78332347",
"0.76325566",
"0.7382686",
"0.7325001",
"0.7277919",
"0.7214656",
"0.71993846",
"0.7188786",
"0.7176238",
"0.71742064",
"0.71544975",
"0.71376836",
"0.7130383",
"0.7113012",
"0.711262",
"0.7110402",
"0.71051514",
"0.7084249",
"0.7064641... | 0.70915943 | 19 |
Insert node in the tail of linked list. | def push_tail(self, data):
node = Node(data)
if self.is_empty() or self._size == 1:
self.__init_ll(node)
else:
current = self._tail
current._next = node
node._previ = current
self._tail = node
self._size += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_end(self, data):\n\n if self.head is None:\n self.head = ListNode(data)\n else:\n temp = self.head\n while temp.next is not None:\n temp = temp.next\n temp.next = ListNode(data)",
"def insertTail(head, data):\n # Using the ite... | [
"0.7865883",
"0.7552978",
"0.7346866",
"0.71527034",
"0.71155643",
"0.70713484",
"0.7059535",
"0.7059535",
"0.7050727",
"0.7049063",
"0.70197594",
"0.6981269",
"0.69764465",
"0.6927388",
"0.69109684",
"0.6898189",
"0.6892151",
"0.6864535",
"0.6815965",
"0.679749",
"0.67963177... | 0.6480641 | 34 |
Remove the node in the tail and return it's data. | def pop_tail(self):
if self.is_empty():
return None
current = self._tail._previ
node = self._tail
current._next = None
self._tail = current
data = node._data
node = Node(None)
self._size -= 1
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_last(self):\n # return None if no Node to remove\n if self.tail is None:\n return None\n # save the tail\n removed = self.tail\n # set the new tail\n if self.tail != self.head:\n if self.tail.skip_back is None:\n self.tail = ... | [
"0.80271435",
"0.8005039",
"0.77667886",
"0.76389104",
"0.7635231",
"0.74857175",
"0.7458775",
"0.741937",
"0.741579",
"0.7406742",
"0.739009",
"0.7263018",
"0.7259851",
"0.71966535",
"0.71686405",
"0.71169114",
"0.71088445",
"0.71048707",
"0.707463",
"0.70467544",
"0.7004692... | 0.7913234 | 2 |
Check whether the user should have authority to add a comment. Government Users with abilities to review the documents should always have authority to add a comment, unless it's archived. Fuel Suppliers with abilities to add or submit can add a comment if the document is either in draft or submitted status. | def user_can_comment(user, document, privileged):
if user.is_government_user and \
user.has_perm('DOCUMENTS_GOVERNMENT_REVIEW') and \
document.status.status in ['Received', 'Submitted']:
return True
if not user.is_government_user and not privileged and \
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_can_edit_comment(user, comment: DocumentComment):\n current_status = comment.document.status.id\n\n if user.id == comment.create_user_id and \\\n current_status == \\\n DocumentStatus.objects.get_by_natural_key('Draft').id:\n return True\n\n re... | [
"0.7271652",
"0.67438865",
"0.665852",
"0.65113",
"0.63269186",
"0.6268414",
"0.6247392",
"0.62267804",
"0.62259763",
"0.609809",
"0.6085613",
"0.60617465",
"0.60515285",
"0.60477924",
"0.603752",
"0.603205",
"0.60241735",
"0.60176",
"0.6010362",
"0.60091203",
"0.60087854",
... | 0.76989025 | 0 |
Check permissions When an object does not yet exist (POST) | def has_permission(self, request, view):
# Fallback to has_object_permission unless it's a POST
if request.method != 'POST':
return True
# Need this information to make a decision
if 'privileged_access' not in request.data and \
'document' in request.data:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_object_permissions(self, request, obj):\n for permission in self.get_permissions():\n if not permission.has_object_permission(request, self, obj):\n self.permission_denied(\n request,\n message=getattr(permission, 'message', None),\n ... | [
"0.72669476",
"0.72639483",
"0.7189025",
"0.7180526",
"0.70522213",
"0.7005184",
"0.70026386",
"0.6998934",
"0.6975461",
"0.6975461",
"0.69745016",
"0.69448566",
"0.6884961",
"0.6874693",
"0.6839076",
"0.6839076",
"0.6833978",
"0.6832702",
"0.6819339",
"0.68118906",
"0.680728... | 0.0 | -1 |
Check permissions When an object does exist (PUT, GET) | def has_object_permission(self, request, view, obj):
# Users can always see and edit their own comments
if obj.create_user == request.user:
return True
# And see but not edit those from their others in their own
# organization
if obj.create_user.organization == requ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_object_permission(self, request, view, obj):\n if request.method == \"GET\":\n return self.model_admin_config.has_view_permission(self, request, obj=obj)\n if request.method == \"PUT\":\n return self.model_admin_config.has_change_permission(self, request, obj=obj)\n ... | [
"0.7644794",
"0.7528569",
"0.7400692",
"0.7377789",
"0.73407245",
"0.7321072",
"0.72752535",
"0.72601265",
"0.72163105",
"0.7198844",
"0.71889865",
"0.71889865",
"0.71542627",
"0.71001434",
"0.70958287",
"0.7069107",
"0.7063763",
"0.70194304",
"0.70145094",
"0.6960202",
"0.69... | 0.6580469 | 47 |
Fetches the DataLoader object for each type in types from data_dir. | def fetch_dataloader(splits, params):
# train_transforms, val_transforms = get_transforms_initial()
train_transforms, val_transforms = get_transforms_stanford()
dataloaders = {}
for split in splits:
if split == args.TRAIN:
dl = DataLoader(ISBI2012Dataset(path_img=args.path_img_tra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_dataloader(types, dataset_dir, params):\n\n dataloaders = {}\n samplers = {}\n\n for split in ['train', 'val', 'test']:\n if split in types:\n path = os.path.join(dataset_dir, \"{}\".format(split))\n\n # Use the train_transformer if training data, else use eval_trans... | [
"0.76289386",
"0.73933464",
"0.6986406",
"0.68310714",
"0.68107843",
"0.67513543",
"0.66739625",
"0.666572",
"0.66258794",
"0.660907",
"0.65926415",
"0.6503621",
"0.6455934",
"0.64470595",
"0.64216655",
"0.64156145",
"0.64035064",
"0.6368777",
"0.6348611",
"0.63402015",
"0.63... | 0.0 | -1 |
Construct the extension class that adds weight decay to an optimizer. | def __init__(self, weight_decay, **kwargs):
self._decay_var_list = None # is set in minimize or apply_gradients
self._weight_decay = weight_decay
# The tensors are initialized in call to _prepare
self._weight_decay_tensor = None
super(DecoupledWeightDecayExtension, self).__init__(**kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,\n weight_decay,\n learning_rate=0.001,\n beta1=0.9,\n beta2=0.999,\n epsilon=1e-8,\n use_locking=False,\n name=\"AdamW\"):\n super(AdamWOptimizer, self).__init__(\n weight_decay,\n ... | [
"0.76263696",
"0.748923",
"0.7134511",
"0.6737376",
"0.6686473",
"0.6480909",
"0.6443058",
"0.62940276",
"0.62670785",
"0.6248732",
"0.62434214",
"0.6213813",
"0.6205761",
"0.6183056",
"0.61107177",
"0.6038618",
"0.6036245",
"0.5994739",
"0.59839594",
"0.59734875",
"0.5949287... | 0.7751367 | 0 |
Factory function returning an optimizer class with decoupled weight decay. Returns an optimizer class. An instance of the returned class computes the update step of `base_optimizer` and additionally decays the weights. E.g., the class returned by `extend_with_decoupled_weight_decay(tf.compat.v1.train.AdamOptimizer)` is... | def extend_with_decoupled_weight_decay(base_optimizer):
class OptimizerWithDecoupledWeightDecay(DecoupledWeightDecayExtension,
base_optimizer):
"""Base_optimizer with decoupled weight decay.
This class computes the update step of `base_optimizer` and
additionall... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,\n weight_decay,\n learning_rate=0.001,\n beta1=0.9,\n beta2=0.999,\n epsilon=1e-8,\n use_locking=False,\n name=\"AdamW\"):\n super(AdamWOptimizer, self).__init__(\n weight_decay,\n ... | [
"0.7078224",
"0.6981097",
"0.667451",
"0.6630046",
"0.6625502",
"0.6578805",
"0.64517415",
"0.6448513",
"0.64309204",
"0.6414019",
"0.6376434",
"0.6366005",
"0.6362686",
"0.63562506",
"0.6356187",
"0.63430727",
"0.63406575",
"0.633333",
"0.6310957",
"0.63037944",
"0.6286209",... | 0.8740536 | 0 |
Construct a new AdamW optimizer. For further information see the documentation of the Adam Optimizer. | def __init__(self,
weight_decay,
learning_rate=0.001,
beta1=0.9,
beta2=0.999,
epsilon=1e-8,
use_locking=False,
name="AdamW"):
super(AdamWOptimizer, self).__init__(
weight_decay,
learning_rate=lea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_optimizer(init_lr, num_train_steps, num_warmup_steps):\n # Implements linear decay of the learning rate.\n learning_rate_fn = tf.keras.optimizers.schedules.PolynomialDecay(\n initial_learning_rate=init_lr,\n decay_steps=num_train_steps,\n end_learning_rate=0.0)\n if num_warmup_steps:\n... | [
"0.6771279",
"0.67677313",
"0.666231",
"0.6603509",
"0.65492004",
"0.6491629",
"0.63637257",
"0.62906617",
"0.62903893",
"0.62898374",
"0.6282439",
"0.6227277",
"0.61658525",
"0.61088383",
"0.60857916",
"0.6040332",
"0.59798986",
"0.5956418",
"0.5931988",
"0.5910213",
"0.5900... | 0.7531271 | 0 |
Construct a new ShampooW optimizer. For further information see the documentation of the Shampoo Optimizer. | def __init__(self,
weight_decay,
global_step,
max_matrix_size=768,
gbar_decay=0.0,
gbar_weight=1.0,
mat_gbar_decay=1.0,
mat_gbar_weight=1.0,
learning_rate=1.0,
svd_interval=1,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(self, optimizer):\n limit = 1 / math.sqrt(self.input_shape[0])\n self.W = np.random.uniform(-limit, limit, (self.input_shape[0], self.units)) # TODO check limits\n self.b = np.zeros((1, self.units))\n\n self.W_optimizer = copy.copy(optimizer)\n self.b_optimizer = c... | [
"0.6013109",
"0.59717166",
"0.5745999",
"0.5601538",
"0.55156535",
"0.54103607",
"0.5334195",
"0.5316951",
"0.5305765",
"0.52873975",
"0.51777035",
"0.51750827",
"0.51090956",
"0.50915885",
"0.5079751",
"0.5076531",
"0.507405",
"0.5070588",
"0.5026943",
"0.50117916",
"0.49998... | 0.6836618 | 0 |
Derivative of the sigmoid function. | def sigmoid_prime(z):
return sigmoid(z) * (1 - sigmoid(z)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid_derivative(x):\n return x * (1-x)",
"def sigmoid_derivative(x):\n return x * (1.0 - x)",
"def sigmoid_derivative(x):\n\n return sigmoid(x) * (1 - sigmoid(x))",
"def derivative_sigmoid(x):\n return x * (1 - x)",
"def derivative_sigmoid(x):\n return x * (1 - x)",
"def sigmoid_der... | [
"0.84754366",
"0.8450928",
"0.8396931",
"0.83485264",
"0.83485264",
"0.8298343",
"0.80539966",
"0.7753385",
"0.77070266",
"0.7498153",
"0.7464916",
"0.7454039",
"0.7401582",
"0.7385017",
"0.73829913",
"0.7346935",
"0.7321687",
"0.73094004",
"0.7192053",
"0.7113881",
"0.709236... | 0.0 | -1 |
Return image data from a raw PGM file as numpy array. | def read_pgm(filename, byteorder='>'):
with open(filename, 'rb') as f:
buffer = f.read()
try:
header, width, height, maxval = re.search(
b"(^P5\s(?:\s*#.*[\r\n])*"
b"(\d+)\s(?:\s*#.*[\r\n])*"
b"(\d+)\s(?:\s*#.*[\r\n])*"
b"(\d+)\s(?:\s*#.*[\... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_pgm(filename, byteorder='>'):\n with open(filename, 'rb') as f:\n buffer = f.read()\n try:\n header, width, height, maxval = re.search(\n b\"(^P5\\s(?:\\s*#.*[\\r\\n])*\"\n b\"(\\d+)\\s(?:\\s*#.*[\\r\\n])*\"\n b\"(\\d+)\\s(?:\\s*#.*[\\r\\n])*\"\n ... | [
"0.7730566",
"0.7728106",
"0.7713083",
"0.7545925",
"0.74387604",
"0.69338894",
"0.6734058",
"0.64388365",
"0.6428982",
"0.63659805",
"0.623475",
"0.62275773",
"0.6217904",
"0.62111574",
"0.61487556",
"0.6141127",
"0.61343825",
"0.61343825",
"0.6131553",
"0.61081797",
"0.6084... | 0.7749413 | 0 |
Given an image, extract patches of a given shape with a certain amount of allowed overlap between patches, using a heuristic to ensure maximum coverage. If cropvalue is specified, it is treated as a flag denoting a pixel that has been cropped. Patch will be rejected if it has more than crop_fraction_allowed prod(patchs... | def extract_patches(image, patchshape, overlap_allowed=0.1, cropvalue=None, crop_fraction_allowed=0.1):
jump_cols = int(patchshape[1] * overlap_allowed)
jump_rows = int(patchshape[0] * overlap_allowed)
# Restrict ourselves to the rectangle containing non-cropped pixels
if cropvalue is not None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_to_patches(image, patch_size=8, overlap=False, is_mask=False):\n H, W = np.shape(image)\n num_patches = (\n (H - patch_size + 1) * (W - patch_size + 1)\n if overlap\n else int(H / patch_size) * int(W / patch_size)\n )\n patches = (\n np.zeros((patch_size ** 2, patc... | [
"0.5984532",
"0.5841861",
"0.57167107",
"0.55550015",
"0.5497948",
"0.5380395",
"0.53651226",
"0.5362727",
"0.5358716",
"0.53110784",
"0.52789223",
"0.5265371",
"0.52064407",
"0.51908445",
"0.5186069",
"0.51654446",
"0.5164763",
"0.5133878",
"0.5127952",
"0.5118306",
"0.51134... | 0.80314445 | 0 |
Return the CDC status for the specified state. | async def status_by_state(self, state: str) -> Dict[str, Any]:
data = await self.raw_cdc_data()
try:
info = next((v for k, v in data.items() if state in k))
except StopIteration:
return {}
return adjust_status(info) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_status(self, state):\n raise NotImplementedError",
"def state(self):\n return self._attributes['status']",
"def get_status(self):\n return self._conn_state",
"def getState( self, cCtrlName ):\n return self.getControlModelProperty( cCtrlName, \"State\" )",
"def get_device... | [
"0.6950197",
"0.6188221",
"0.60602915",
"0.6054206",
"0.60436743",
"0.6007757",
"0.5899706",
"0.5898291",
"0.5840877",
"0.58122015",
"0.5802145",
"0.5794245",
"0.5737817",
"0.5732222",
"0.5714972",
"0.56979555",
"0.56842417",
"0.56687534",
"0.56262016",
"0.5582584",
"0.557716... | 0.7512813 | 0 |
Test if event 'event' hits widget 'widget' (or any of its parents). | def doesEventHitWidgetOrParents(event, widget):
while widget:
if event.target == widget.element:
return widget
widget = widget.parent()
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doesEventHitWidgetOrChildren(event, widget):\n if event.target == widget.element:\n return widget\n\n for child in widget.children():\n if doesEventHitWidgetOrChildren(event, child):\n return child\n\n return None",
"def handle_uncaught_event(self, event):\r\n if self... | [
"0.80501217",
"0.65787",
"0.63367635",
"0.6224147",
"0.61510354",
"0.5992296",
"0.5992296",
"0.5980612",
"0.5892508",
"0.58876485",
"0.5870506",
"0.5859626",
"0.5856972",
"0.58065057",
"0.5806029",
"0.57168585",
"0.5710279",
"0.5702223",
"0.5694154",
"0.5618313",
"0.55871356"... | 0.8459502 | 0 |
Build and send a single message from a campaign. | def _message(self, recipient, connection, context=None):
base_subject = '{{ event.calendar.course.name }} {{ event.title }}'
if not self.event.get_documents(True):
template_name = self.REQUEST_TEMPLATE
subject = 'Got a {} study guide?'.format(base_subject)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_campaign_command(client: Client, campaign_id: str) -> CommandResults | str:\n try:\n raw_response = client.get_campaign(campaign_id)\n except ValueError:\n return 'Campaign Id not found'\n\n campaign_general_fields = ['id', 'name', 'description', 'startDate', 'notable']\n campaign... | [
"0.6070291",
"0.5929668",
"0.5830548",
"0.5694929",
"0.5659411",
"0.55584955",
"0.55079764",
"0.54406506",
"0.54061556",
"0.5340694",
"0.5314835",
"0.5313341",
"0.5310776",
"0.5291198",
"0.5281365",
"0.5272663",
"0.5202269",
"0.5199063",
"0.5191958",
"0.5174547",
"0.5174164",... | 0.5311255 | 12 |
Deactivate all stillactive campaigns. Notes The `until` field of each campaign will be set to "now." Each campaign will retain its `when` field to indicate the rough time of creation. This method is not strictly necessary, except to indicate for metrics how many campaigns are considered "active" at any one time. | def _deactivate_campaigns(self):
now = timezone.now()
for campaign in self.campaigns.active():
campaign.until = now
campaign.save(update_fields=['until']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deactivate_drip_campaign(self, id):\n DripCampaign.objects(id=id).update(set__active=False, set__updated_at=datetime.utcnow())",
"def stop_all_agents(self):\n for agent in self.agents:\n if agent.available:\n agent.stop_activity()",
"def get_expired_campaign(self):\n... | [
"0.60527074",
"0.5630347",
"0.562254",
"0.5554843",
"0.5446443",
"0.54009086",
"0.5375945",
"0.5277232",
"0.5126579",
"0.51044387",
"0.5075955",
"0.5045264",
"0.5027603",
"0.50142807",
"0.49869668",
"0.49637213",
"0.49527264",
"0.49330115",
"0.490023",
"0.4891117",
"0.4881864... | 0.7771713 | 0 |
Create a new column with the truth array of the chi2 cuts on the ion channels. | def offset_ion_cut(df):
offset_threshold = quality_parameters['offset_ion_threshold']
truth_array = pd.Series(data=True, index=df.index)
for suffix in ion_channel_labels:
offset_column_name = 'offset_ion{}'.format(suffix)
offset = abs( df[offset_column_name] )
truth_array =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ion_chi2_cut(stream, df):\n ion_chi2_threshold = quality_parameters['ion_chi2_threshold']\n \n truth_array = pd.Series(data=True, index=df.index)\n for suffix in ion_channel_labels:\n chi2_column_name = 'chi2_ion{}'.format(suffix)\n chi2_ion = df[chi2_column_name]\n \n e... | [
"0.7263757",
"0.6292078",
"0.5769869",
"0.54531854",
"0.52104783",
"0.5190182",
"0.5125601",
"0.5123869",
"0.51127404",
"0.5101781",
"0.50807714",
"0.502889",
"0.49815428",
"0.49234533",
"0.49120077",
"0.4911549",
"0.49019995",
"0.49002504",
"0.4849663",
"0.4793729",
"0.47849... | 0.60605234 | 2 |
Creates a high pass filter with size radius. Returns a kernel in the frequency domain | def create_high_pass_frequency_kernel(im: np.array,
radius: int):
center_col = im.shape[1] // 2
center_row = im.shape[0] // 2
assert len(im.shape) == 2,\
"Expected a grayscale image. Got image shape: {}".format(im.shape)
kernel = np.ones_like((im))
rr, c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_low_pass_frequency_kernel(im, radius):\n kernel = create_high_pass_frequency_kernel(im, radius)\n kernel = 1 - kernel\n return kernel",
"def create_low_pass_frequency_kernel(im, radius):\n kernel = create_high_pass_frequency_kernel(im, radius)\n kernel = 1 - kernel\n return kernel",
... | [
"0.78529",
"0.78529",
"0.6649468",
"0.6646551",
"0.6549375",
"0.6358656",
"0.63261074",
"0.62897265",
"0.6205089",
"0.6203927",
"0.61277795",
"0.60955054",
"0.6051659",
"0.60070324",
"0.5933284",
"0.5906416",
"0.590382",
"0.58800393",
"0.58795744",
"0.584949",
"0.577058",
"... | 0.7620803 | 3 |
Gets the agent_id of this DataView. | def agent_id(self):
return self._agent_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAgentID(self):\n\t\treturn self.agentID",
"def agent_id(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"agent_id\")",
"def agent_id(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"agent_id\")",
"def agent_id(self) -> Optional[pulumi.Input[int]]:\n return pulumi.ge... | [
"0.8083156",
"0.79691285",
"0.78115857",
"0.76219046",
"0.69031",
"0.65911037",
"0.6097658",
"0.6008568",
"0.6001827",
"0.59495735",
"0.59487915",
"0.59402347",
"0.5937929",
"0.59277266",
"0.59277266",
"0.5922756",
"0.5922756",
"0.5922756",
"0.5922756",
"0.5922756",
"0.592275... | 0.8310618 | 0 |
Sets the agent_id of this DataView. | def agent_id(self, agent_id):
self._agent_id = agent_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_agent_id(self, agent_id):\n self.id = agent_id",
"def agent_id(self):\n return self._agent_id",
"def agent_id(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"agent_id\")",
"def getAgentID(self):\n\t\treturn self.agentID",
"def with_agent(self, agent: Agent):\n ... | [
"0.81010234",
"0.6719917",
"0.6095088",
"0.59701824",
"0.59012455",
"0.5855861",
"0.5816381",
"0.57755524",
"0.5661669",
"0.56426847",
"0.55166215",
"0.5496809",
"0.54740965",
"0.54161376",
"0.54161376",
"0.54161376",
"0.54161376",
"0.5383501",
"0.53787416",
"0.5373367",
"0.5... | 0.83411765 | 0 |
Gets the charts of this DataView. | def charts(self):
return self._charts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def charts(self):\n return self.container['charts']",
"def charts(self):\n return self.properties.get('charts',\n EntityCollection(self.context, WorkbookChart,\n ResourcePath(\"charts\", self.resource_path)))",
"... | [
"0.82675946",
"0.79279137",
"0.6807959",
"0.67548007",
"0.6658193",
"0.65832984",
"0.65825135",
"0.6336219",
"0.6336219",
"0.63013816",
"0.6268031",
"0.6224177",
"0.60823053",
"0.6030702",
"0.6030702",
"0.60146344",
"0.59476095",
"0.59191996",
"0.5856549",
"0.5778034",
"0.576... | 0.8620336 | 0 |
Gets the end of this DataView. | def end(self):
return self._end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_end(self):\n return self._end",
"def get_end(self):\n return self.__end",
"def end(self):\n return self._t0 + self.length",
"def _get_end(self):\n return self._end",
"def end(self):\n return self.range().end()",
"def end(self):\n return self.__end_line",
... | [
"0.7790458",
"0.77900547",
"0.7550342",
"0.75261223",
"0.751785",
"0.7436059",
"0.73776907",
"0.7347647",
"0.7176045",
"0.71656615",
"0.7156478",
"0.71158147",
"0.70670545",
"0.70649004",
"0.70325243",
"0.7014097",
"0.7002444",
"0.69923085",
"0.6958729",
"0.6904575",
"0.68297... | 0.72510004 | 10 |
Sets the end of this DataView. | def end(self, end):
self._end = end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end(self, end: pos.Pos) -> None:\n self.__end = end",
"def set_end(self, end_line):\n self.__end_line = end_line",
"def _set_end(self, coordinates):\n self._end = coordinates",
"def set_line_end(self, line_nr):\n self._line_end = line_nr",
"def setEnd(self, *args):\n ... | [
"0.740318",
"0.7190862",
"0.6701947",
"0.6684691",
"0.6545107",
"0.6527118",
"0.6515386",
"0.6451569",
"0.63730067",
"0.6368684",
"0.6358861",
"0.6295339",
"0.61620694",
"0.61452234",
"0.6119705",
"0.61171925",
"0.6049421",
"0.6036433",
"0.6008573",
"0.6008573",
"0.6008573",
... | 0.75068325 | 1 |
Gets the ion of this DataView. | def ion(self):
return self._ion | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getI(self):\n\n return self.i",
"def i(self):\n return self._i",
"def ionization(self):\n return self._ionization",
"def ion_id(self):\n return self._ion_id",
"def I(self) :\n\t\ttry :\n\t\t\treturn self._I\n\t\texcept Exception as e:\n\t\t\traise e",
"def idx(self):\n ... | [
"0.6912367",
"0.64726067",
"0.6313581",
"0.6267831",
"0.61950713",
"0.60924727",
"0.6036644",
"0.6016022",
"0.599894",
"0.5959279",
"0.59040457",
"0.5896677",
"0.5882723",
"0.5864374",
"0.5856137",
"0.5855202",
"0.57790303",
"0.57683027",
"0.57218146",
"0.5716438",
"0.5700164... | 0.7884481 | 0 |
Sets the ion of this DataView. | def ion(self, ion):
self._ion = ion | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ion_id(self, ion_id):\n\n self._ion_id = ion_id",
"def set_col( self, col ):\n self.ix_col = col",
"def ion_instance(self, ion_instance):\n\n self._ion_instance = ion_instance",
"def ion(self):\n return self._ion",
"def i(self, i):\n\n self._i = i",
"def imei(self,... | [
"0.6815875",
"0.5993985",
"0.59775084",
"0.5886131",
"0.583014",
"0.57173365",
"0.5697282",
"0.56899935",
"0.56899935",
"0.56854016",
"0.5558502",
"0.5547624",
"0.552964",
"0.54306763",
"0.54232234",
"0.5399543",
"0.5378332",
"0.53737926",
"0.53737926",
"0.53737926",
"0.53737... | 0.7709867 | 0 |
Gets the ion_id of this DataView. | def ion_id(self):
return self._ion_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_id(self):\n return self._column_id",
"def get_id(self):\n return self.iid",
"def getOid(self):\n return self.getDbRecord().getColumnValue(OID_COLUMN)",
"def iid(self) -> str:\n return self._iid",
"def ion_node_id(self):\n return self._ion_node_id",
"def getIdent... | [
"0.7067871",
"0.70338047",
"0.69187796",
"0.6845771",
"0.6836222",
"0.6764785",
"0.658163",
"0.6567781",
"0.65557307",
"0.6543656",
"0.65214735",
"0.65035874",
"0.65035874",
"0.64930797",
"0.6486929",
"0.646655",
"0.6464553",
"0.6461085",
"0.64540666",
"0.6421553",
"0.6405028... | 0.82477623 | 0 |
Sets the ion_id of this DataView. | def ion_id(self, ion_id):
self._ion_id = ion_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ion_node_id(self, ion_node_id):\n\n self._ion_node_id = ion_node_id",
"def ion(self, ion):\n\n self._ion = ion",
"def ion_id(self):\n return self._ion_id",
"def inode_id(self, inode_id):\n\n self._inode_id = inode_id",
"def setID(self, idNb):\n self._id = idNb",
"de... | [
"0.7140456",
"0.7003836",
"0.6627499",
"0.6358579",
"0.6340337",
"0.62749934",
"0.62377805",
"0.62309617",
"0.62236243",
"0.61920166",
"0.61461836",
"0.61065215",
"0.61017543",
"0.60969234",
"0.60548955",
"0.60082406",
"0.6006385",
"0.5989457",
"0.5989457",
"0.59892523",
"0.5... | 0.8526509 | 0 |
Gets the ion_node_id of this DataView. | def ion_node_id(self):
return self._ion_node_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_id(self) -> int:\r\n return self._node_id",
"def node_id(self) -> int:\n return self.data[\"nodeId\"]",
"def node_id(self) -> int:\n return self.data[\"nodeId\"]",
"def getNodeId(self):\n if self.cursor:\n return self.cursor.nodeId\n return None",
"def... | [
"0.8092444",
"0.7992669",
"0.7992669",
"0.7685792",
"0.7065414",
"0.6903447",
"0.6670985",
"0.6667599",
"0.65232325",
"0.6453948",
"0.64446473",
"0.6408016",
"0.6399902",
"0.6339369",
"0.6318225",
"0.62823737",
"0.6266092",
"0.62025696",
"0.6195449",
"0.6190497",
"0.6183084",... | 0.85748845 | 0 |
Sets the ion_node_id of this DataView. | def ion_node_id(self, ion_node_id):
self._ion_node_id = ion_node_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_id(self, node_id: int):\r\n self._node_id = node_id",
"def set_node_id(self, node_id):\n self._node_id = node_id",
"def node_id(self, node_id):\n\n self._node_id = node_id",
"def setNodeId(self, recId):\n if self.cursor:\n self.cursor.nodeId = recId",
"def no... | [
"0.8007105",
"0.79903716",
"0.7870654",
"0.7247624",
"0.677212",
"0.6765711",
"0.6763304",
"0.6632971",
"0.6618369",
"0.65899694",
"0.6578358",
"0.6489694",
"0.6362614",
"0.63026375",
"0.62918276",
"0.6270562",
"0.6237373",
"0.62297523",
"0.62008226",
"0.60088336",
"0.5996676... | 0.85334593 | 0 |
Gets the is_ml_healthy of this DataView. | def is_ml_healthy(self):
return self._is_ml_healthy | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_ml_healthy(self, is_ml_healthy):\n\n self._is_ml_healthy = is_ml_healthy",
"def is_ml_healthy(self, is_ml_healthy):\n\n self._is_ml_healthy = is_ml_healthy",
"def get_health(self):\n return self.__healthy",
"def desired_healthy(self) -> pulumi.Input[int]:\n return pulumi.ge... | [
"0.7828043",
"0.7828043",
"0.6977052",
"0.6609083",
"0.6579832",
"0.6572235",
"0.6517879",
"0.6374331",
"0.6308414",
"0.5945541",
"0.5945541",
"0.5945541",
"0.5945541",
"0.5945541",
"0.5920435",
"0.5850914",
"0.5820433",
"0.5747238",
"0.56230235",
"0.5596854",
"0.5581868",
... | 0.8593428 | 0 |
Gets the pipeline_id of this DataView. | def pipeline_id(self):
return self._pipeline_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pipeline_id(self) -> PipelineId:\r\n return self._pipeline_id",
"def pipeline_id(self) -> PipelineId:\r\n return self._pipeline_id",
"def pipeline_id(self):\n pass",
"def pipeline_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"pipeline_id\")",
"def id(s... | [
"0.86169803",
"0.86169803",
"0.80269295",
"0.77186674",
"0.7365885",
"0.6960441",
"0.6673542",
"0.6541607",
"0.64623046",
"0.63065374",
"0.6282377",
"0.6282377",
"0.62358356",
"0.62286454",
"0.620379",
"0.620332",
"0.6187737",
"0.6187737",
"0.6185531",
"0.61724883",
"0.616843... | 0.8736661 | 0 |
Sets the start of this DataView. | def start(self, start):
self._start = start | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_start(self, start_line):\n self.__start_line = start_line",
"def start(self, start: pos.Pos) -> None:\n self.__start = start",
"def setStart(self, *args):\n return _libsbml.LineSegment_setStart(self, *args)",
"def start(self, start):\n if start is None:\n raise ... | [
"0.7552558",
"0.73209524",
"0.71720827",
"0.6931185",
"0.65700287",
"0.6477026",
"0.6461911",
"0.64054716",
"0.64022917",
"0.621424",
"0.621424",
"0.621424",
"0.621424",
"0.621424",
"0.621424",
"0.621424",
"0.621424",
"0.621424",
"0.6203887",
"0.6183193",
"0.6177296",
"0.61... | 0.69485396 | 5 |
Get the absolute path to a resource. | def _get_resource_path(filename, path=Path.TEST):
return os.path.normpath(os.path.join(path.value, filename)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_path(self, resource):\n return str(self.path.joinpath(resource))",
"def resource_path(self, resource):\n return str(self.path.joinpath(resource))",
"def get_absolute_resource_path(resource_path):\n return pkg_resources.resource_filename(\n cloudify_agent.__name__,\n ... | [
"0.8101276",
"0.8101276",
"0.7937851",
"0.7487554",
"0.7374785",
"0.7339987",
"0.73086655",
"0.7290156",
"0.7243981",
"0.7197428",
"0.71036464",
"0.7097384",
"0.7061433",
"0.7008481",
"0.6920594",
"0.68736976",
"0.68546516",
"0.6758555",
"0.67255324",
"0.6716057",
"0.671587",... | 0.7623171 | 3 |
Add vertical lines at given timestamp to this graph. | def add_vert_lines(self, timestamp: datetime = None) -> None:
self._logger.debug("running")
for axes in self.figure.get_axes():
if timestamp:
self._vlines.append(timestamp)
axes.axvline(timestamp)
self.refresh_self()
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plotvertlines(self, ax, time, color='k', label=None):\n if isinstance(time, list):\n t = time.pop()\n ax = self.plotvertlines(ax, t, color=color)\n\n # plot vertical lines of 'predicted' onset/offset\n ax.axvline(time,\n color=color,\n ... | [
"0.6450222",
"0.59987015",
"0.59340715",
"0.592195",
"0.58885115",
"0.5886967",
"0.5843267",
"0.5843185",
"0.5809671",
"0.5748127",
"0.5663894",
"0.5537205",
"0.54678774",
"0.5400069",
"0.53967285",
"0.53449357",
"0.5280914",
"0.5239761",
"0.52253634",
"0.52033776",
"0.517874... | 0.8716596 | 0 |
Transform string keys back to numbers, if any | def unjsonify(obj):
t = type(obj)
if t == dict:
try:
return {int(k):unjsonify(v) for k,v in obj.items()}
except ValueError:
return {k:unjsonify(v) for k,v in obj.items()}
if t == list:
return [unjsonify(x) for x in obj]
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_to_numeric(x):\n reg = re.compile(r'\\[(\\d+\\_?(\\d+)?)[a-z]?\\]')\n inspect = reg.search(x).groups(0)[0]\n if '_' in inspect:\n left, right = inspect.split('_')\n return int(left), int(right)\n else:\n return int(inspect), 0",
"def letter_to_num(string, dict_):\n patt ... | [
"0.7333477",
"0.68629026",
"0.6823235",
"0.67440444",
"0.6623677",
"0.6488933",
"0.64673656",
"0.64450496",
"0.6444145",
"0.63916874",
"0.6364056",
"0.6348871",
"0.6348871",
"0.6348871",
"0.6348871",
"0.6337103",
"0.6332712",
"0.63290256",
"0.63206065",
"0.62590486",
"0.62590... | 0.0 | -1 |
Gets the total number of pieces left in the game. Returns int Number of pieces left on the game including both sides. | def num_pieces_left(self):
return self.num_white_pieces + self.num_black_pieces | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_left_players(definition):\n return int(parse_player_definition(definition)[1]['left_players'])",
"def get_num_pieces(self):\n return self.num_pieces",
"def number_of_their_pieces_to_left(column):\n row = __get_top_of_stack(column)\n return number_pieces_of_type_in_direction(column, row,... | [
"0.7208803",
"0.71186554",
"0.6963779",
"0.6872969",
"0.6596645",
"0.65618724",
"0.6543449",
"0.6540226",
"0.6506596",
"0.643708",
"0.6382835",
"0.6318214",
"0.63041174",
"0.6302455",
"0.6232004",
"0.61698586",
"0.6035231",
"0.6033205",
"0.6021036",
"0.5980832",
"0.59724534",... | 0.8290224 | 0 |
Gets the total number of white pieces left in the game. Returns int Number of white pieces left on the game. | def get_num_white_pieces(self):
return self.num_white_pieces | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_pieces_left(self):\n return self.num_white_pieces + self.num_black_pieces",
"def get_num_black_pieces(self):\n return self.num_black_pieces",
"def get_num_pieces(self):\n return self.num_pieces",
"def get_pieces_left(board, piece):\r\n\tpieces = 0\r\n\tfor row in board:\r\n\t\tfo... | [
"0.85458285",
"0.75002486",
"0.67709124",
"0.665229",
"0.662178",
"0.6482162",
"0.6479186",
"0.647392",
"0.6368068",
"0.6350992",
"0.6269282",
"0.62382966",
"0.6224586",
"0.6145063",
"0.59801507",
"0.5937517",
"0.5916103",
"0.58829266",
"0.58673376",
"0.58483696",
"0.58481175... | 0.7956143 | 1 |
Gets the total number of black pieces left in the game. Returns int Number of black pieces left on the game. | def get_num_black_pieces(self):
return self.num_black_pieces | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_pieces_left(self):\n return self.num_white_pieces + self.num_black_pieces",
"def get_num_white_pieces(self):\n return self.num_white_pieces",
"def get_num_pieces(self):\n return self.num_pieces",
"def _evaluate_num_pieces(self, player):\n evaluation = 0\n if player ... | [
"0.8350262",
"0.7266518",
"0.6833469",
"0.66669196",
"0.65097266",
"0.6499511",
"0.6450219",
"0.6340809",
"0.6281526",
"0.6275128",
"0.6224086",
"0.62041384",
"0.62018627",
"0.61103886",
"0.60240304",
"0.5991686",
"0.59614974",
"0.593803",
"0.5932012",
"0.588325",
"0.5786409"... | 0.7997119 | 1 |
Checks for a threemove repetition. Returns boolean True if the players have performed the same board state three times in a row. False if that is not the case. | def repetition_happened(self):
repetition = False
if len(self.moves) >= 12:
if self.moves[-1][0] == self.moves[-5][0] == self.moves[-9][0] and \
self.moves[-1][1] == self.moves[-5][1] == self.moves[-9][1] and \
self.moves[-2][0] == self.moves[-6][0] ==... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def row_win(board):\n\tfor row in range(3):\n\t\tif board[row][0] != EMPTY and board[row][0] == board[row][1] == board[row][2]:\n\t\t\treturn True\n\treturn False",
"def is_repetition(self, num: int = 3) -> bool:\n\n if sum(self.history_board == self.board_fen()) == num:\n return True\n ... | [
"0.7173008",
"0.7064638",
"0.69212025",
"0.68244314",
"0.6793843",
"0.6786237",
"0.673265",
"0.6723749",
"0.67016715",
"0.6698637",
"0.66793907",
"0.66163313",
"0.66133076",
"0.6575391",
"0.65447694",
"0.65376806",
"0.6535677",
"0.65238446",
"0.65200335",
"0.65036523",
"0.650... | 0.7442051 | 0 |
Checks if X number of moves have passed without any capture. Returns boolean True if for the past X moves a piece have not been captured. False if otherwise. | def passive_game(self):
passive_game = False
if len(self.moves) >= constant.MAX_MOVES_WITHOUT_CAPTURE:
passive_game = True
for move in range(constant.MAX_MOVES_WITHOUT_CAPTURE):
if len(self.moves[-move][2]) != 0:
passive_game = False
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repetition_happened(self):\n repetition = False\n if len(self.moves) >= 12:\n if self.moves[-1][0] == self.moves[-5][0] == self.moves[-9][0] and \\\n self.moves[-1][1] == self.moves[-5][1] == self.moves[-9][1] and \\\n self.moves[-2][0] == self.mov... | [
"0.70696807",
"0.6995193",
"0.663368",
"0.6564272",
"0.6560904",
"0.65410894",
"0.65116787",
"0.6479438",
"0.64201534",
"0.63873404",
"0.63794744",
"0.634978",
"0.63360286",
"0.62971157",
"0.62826073",
"0.6279461",
"0.6272917",
"0.6253832",
"0.62504506",
"0.62255096",
"0.6224... | 0.64683664 | 8 |
defines the value of the nth wavefunction (i.e. stationary state) at a particular xposition. | def psi(n,x):
a = 1/(sqrt((2**n)*fac(n)*sqrt(pi)))
b = (e)**(-1*(x**2)*0.5)
H_n = H(n,x)
return a*b*(H_n) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wavefunction(self, x):\n return ( float(1) / math.pi**(float(1)/4)) * math.exp( x**2 / float(-2))",
"def set_x(self, state_value):\n val = state_value / self.space_subdivisions + self.unit\n epsilon = 1e-6\n if not self.unit <= val <= 1.0 - self.unit + epsilon:\n raise ... | [
"0.6279385",
"0.6003984",
"0.59114647",
"0.5880627",
"0.57661617",
"0.5721362",
"0.5699365",
"0.56352526",
"0.56097597",
"0.55931485",
"0.5588514",
"0.55865777",
"0.5519296",
"0.5492344",
"0.54729277",
"0.5468367",
"0.5466655",
"0.5466515",
"0.5438754",
"0.5438348",
"0.543457... | 0.0 | -1 |
Finds the derivative in respect to position of the wave function at position x. | def psi_prime(n,x):
a = 1/(sqrt((2**n)*fac(n)*sqrt(pi)))
b = (e)**(-1*(x**2)*0.5)
third_factor = (-1*x*H(n,x))+(2*n*H(n-1,x))
return a*b*third_factor | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derivative(self,x,dx=None):\n if dx is None:\n x = np.array(x,copy=False)\n if len(x.shape)>0:\n dx = np.convolve(x,[1,-1],mode='valid')\n dx = np.insert(dx,0,np.mean(dx))/2\n else:\n dx = 1\n return (self(x+dx)-self(x)... | [
"0.7530965",
"0.74311084",
"0.7427981",
"0.723189",
"0.7209879",
"0.7171253",
"0.70788145",
"0.70788145",
"0.7076965",
"0.69997644",
"0.6977682",
"0.6949384",
"0.6811303",
"0.6766832",
"0.67201763",
"0.67201763",
"0.6713462",
"0.66991866",
"0.66702473",
"0.66672033",
"0.66015... | 0.0 | -1 |
tee(iterable, n=2) > tuple of n independent iterators. | def tee(iterable, n=2):
return tee_manager(iter_(iterable), n=n).iterators() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tee(self, n=1) -> Tuple[\"Iter\", ...]:\n self._iterator, *rest = itertools.tee(self._iterator, n + 1)\n n = self._size_hint\n return tuple(Iter(it, n) for it in rest)",
"def pairwise(iterable: Iterable,\n tuple_size: int):\n return zip_longest(*(islice(it, pos, None) for ... | [
"0.87578595",
"0.7142656",
"0.7121445",
"0.69700426",
"0.693995",
"0.68587744",
"0.6835638",
"0.6823658",
"0.6794443",
"0.6775503",
"0.6749069",
"0.6749069",
"0.6733964",
"0.6713979",
"0.6706039",
"0.6701765",
"0.6692903",
"0.6692903",
"0.66877156",
"0.66366696",
"0.66343766"... | 0.88933706 | 0 |
return True if the subdict is present with the sames values in dict. can be recursive. if maindict contains some key not in subdict it's ok. but if subdict has a key not in maindict or the value are not the same, it's a failure. >>> dict_contains(dict(a=1, b=2), dict(a=1, c=2, b=2)) True >>> dict_contains(dict(a=dict(a... | def dict_contains(subdict, maindict):
try:
for k, v in subdict.items():
mainv = maindict[k]
if isinstance(mainv, dict) and isinstance(v, dict):
if not dict_contains(v, mainv):
return False
elif isinstance(mainv, (set, frozenset)):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dict_contains(dct, keys):\n\n assert isinstance(dct, dict), \"dict_contains: dct should be of type dict \"\n assert type(keys) in [int, str, list], \"dict_contains: keys should be of type list or string \"\n if not type(keys) == list:\n keys = [keys]\n\n return contains(dct.keys(), keys)",
... | [
"0.66512334",
"0.66166574",
"0.6531787",
"0.6468742",
"0.62784237",
"0.6248886",
"0.61431175",
"0.6082384",
"0.60412145",
"0.6032539",
"0.60256547",
"0.6017977",
"0.6009765",
"0.5963048",
"0.59471875",
"0.5932046",
"0.5930083",
"0.5910565",
"0.5904908",
"0.5860756",
"0.585794... | 0.82831967 | 0 |
helper that load the json in path | def __load_json(self, path):
try:
with Path(path).open('r') as f:
return json.load(f)
except ValueError as ve:
six.raise_from(ValueError("error while loading the fixture %s" % path), ve) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fromJSON(self, path='') -> dict:\n try:\n return(importJSON(path))\n except Exception as error:\n print(f\"Error: self.fromJSON({path}) -> {error}\")",
"def load(self, path):\n with open(path, \"rt\") as open_file:\n data = json.load(open_file)\n r... | [
"0.7618847",
"0.7611738",
"0.7593999",
"0.7549557",
"0.7514844",
"0.75062424",
"0.7489144",
"0.7438951",
"0.7406316",
"0.73932517",
"0.72328717",
"0.7214155",
"0.7200662",
"0.7194693",
"0.7174308",
"0.7159632",
"0.71362984",
"0.7103068",
"0.70673597",
"0.70606065",
"0.7049296... | 0.7583676 | 3 |
Search orginial_text for ngrams of proper nouns and return a list of relevant ngrams, read the comments above the function/method declaration as wo what each input does. | def get_nnp_ngrams(original_text, highlight=4, minsize=0):
minsize = minsize-1
if minsize<0:
minsize = 0
tokens = nltk.wordpunct_tokenize(original_text)
tagged = nltk.word_tokenize(original_text)
tagged = nltk.pos_tag(tokens)
#for word in tagged:
# print word
doc_len... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getgrams(text, tokendict):\n n = len(text)\n grams = []\n # Get lower-case of words\n if n >= 1:\n grams.append(tokendict[text[0]].lemma.lower())\n grams.append(tokendict[text[-1]].lemma.lower())\n grams.append(tokendict[text[0]].pos)\n grams.append(tokendict[text[-1]].p... | [
"0.6998756",
"0.6557585",
"0.6488658",
"0.64507395",
"0.6444212",
"0.64440334",
"0.6443234",
"0.643346",
"0.642747",
"0.6426936",
"0.640855",
"0.6377119",
"0.63669044",
"0.63055366",
"0.6256915",
"0.6249533",
"0.6238751",
"0.62131053",
"0.61431855",
"0.6142371",
"0.6089042",
... | 0.68377024 | 1 |
Humanize Time in Seconds. | async def humanize_time(self, value):
if value is None:
return "None"
return str(datetime.timedelta(seconds=value)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def human_seconds(seconds):\n if seconds < 60:\n return '{: >5.1f} seconds'.format(seconds)\n if seconds < 60*60:\n return '{: >5.1f} minutes'.format(seconds / 60)\n return '{: >7.1f} hours'.format(seconds / (60 * 60))",
"def seconds2human(self, my_time):\n my_da... | [
"0.7270839",
"0.7239655",
"0.72356373",
"0.70906293",
"0.69775575",
"0.6893899",
"0.6890476",
"0.67919374",
"0.67410797",
"0.6734592",
"0.67244315",
"0.6716846",
"0.6715274",
"0.6698442",
"0.6675489",
"0.6630495",
"0.66239184",
"0.6608705",
"0.660073",
"0.6591279",
"0.655426"... | 0.76336104 | 0 |
Return device status as string. | async def device_status(self, value):
if value is None:
return
binvalue = str(bin(value))
binarr = binvalue[::-1]
binarr = binarr[:len(DEVICE_STATUS)]
return_value = []
for x in range(len(DEVICE_STATUS)):
if binarr[len(binarr) - 1 - x]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def get_status(self) -> str:\n return await self.hw_device.status()",
"def get_status(self):\n request_format = \"{oscillating:01d} {initialising:01d} {initialised:01d} {width:03d} \" \\\n \"{offset:+04d} {speed:02d} {acceleration:03d} {cycles:0... | [
"0.8536378",
"0.7916975",
"0.74693376",
"0.74182075",
"0.73284817",
"0.7303137",
"0.7242775",
"0.7242775",
"0.7242775",
"0.7242775",
"0.7242775",
"0.7242775",
"0.7242775",
"0.7242775",
"0.7242775",
"0.7242775",
"0.7242775",
"0.7242775",
"0.7242775",
"0.7242775",
"0.7242775",
... | 0.66679716 | 83 |
Returns the version number stored in the VERSION file. | def getVersion(self):
try:
filepath = f"{EXTERNAL_DIRECTORY}/VERSION"
with open(filepath, "r") as file:
lines = file.readlines()
for line in lines:
if line != "\n":
return line.replace("\n", "")
except ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version(self):\n a = re.search('(?<=_V)\\d{1,2}', self.fname)\n if a is None:\n return None\n else:\n return int(a.group())",
"def get_version():\n\n current_dir = os.path.dirname(os.path.realpath(__file__))\n version_path = os.path.join(current_dir, VERSION_F... | [
"0.84446853",
"0.8181313",
"0.78775024",
"0.78101045",
"0.77669406",
"0.77473015",
"0.7720251",
"0.7677858",
"0.7647385",
"0.76299775",
"0.7584255",
"0.7552774",
"0.7523589",
"0.74719244",
"0.74486035",
"0.74423325",
"0.74363714",
"0.7433876",
"0.7427879",
"0.73837554",
"0.73... | 0.75481117 | 12 |
Close the IO object. Attempting any further operation after the object is closed will raise a ValueError. This method has no effect if the file is already closed. | def close(self):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n self.__file_object.close()",
"def close(self):\n self.__file.close()",
"def _close(self):\n self.fh.close()",
"def close(self):\n self._file.close()",
"def close(self):\n self._file.close()",
"def Close(self):\n if not self._is_open:\n raise I... | [
"0.74909556",
"0.7478729",
"0.74631053",
"0.7422201",
"0.7422201",
"0.7414083",
"0.73802376",
"0.7378542",
"0.73566717",
"0.7342441",
"0.7342441",
"0.7334397",
"0.7334397",
"0.72953236",
"0.7283559",
"0.7255763",
"0.7249238",
"0.7249238",
"0.7247827",
"0.7247666",
"0.7244096"... | 0.0 | -1 |
The manifest should throw an exception on an invalid manifest path | def test_invalid_manifest_filepath(self):
load_manifest("./ehiiehaiehnatheita") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sa_invalid_manifest_file(self):\n with open(str(Path(__file__).parent.parent.parent) +\n '/data/manifests/400/npmlist.json', 'rb') as fp:\n fs = FileStorage(stream=fp, filename='npmlist.json')\n sa_post_request = StackAnalysesPostRequest(manifest=fs, file_path... | [
"0.6800787",
"0.6770722",
"0.67663354",
"0.67659944",
"0.6737608",
"0.6574377",
"0.65191704",
"0.6490452",
"0.639593",
"0.638238",
"0.63594663",
"0.6350318",
"0.63358414",
"0.63203055",
"0.6297556",
"0.6233188",
"0.6191696",
"0.6154841",
"0.6154232",
"0.6122446",
"0.61068803"... | 0.7926902 | 0 |
Test that models/base.py conforms to PEP8 | def test_pep8(self):
pep8style = pep8.StyleGuide(quiet=True)
result = pep8style.check_files(['models/base.py'])
self.assertEqual(result.total_errors, 0, "Fix PEP8 Style") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_pep8_base_model(self):\n syntax = pep8.StyleGuide(quit=True)\n check = syntax.check_files(['models/base_model.py'])\n self.assertEqual(\n check.total_errors, 0,\n \"Found code style errors (and warnings).\"\n )",
"def test_base_pep8(self):\n\n pep... | [
"0.7453463",
"0.72078586",
"0.72025883",
"0.71329147",
"0.7119043",
"0.7045536",
"0.70115036",
"0.6908024",
"0.68620104",
"0.67976946",
"0.659859",
"0.659363",
"0.65897286",
"0.6516813",
"0.64944935",
"0.64626634",
"0.6439026",
"0.6439002",
"0.64148736",
"0.6414271",
"0.64069... | 0.6787752 | 10 |
batch an iterable up into tuples with a maximum size | def batch_iter(iterable: Iterable[T], size: int) -> Iterator[Tuple[T]]:
# make sure we can deal with iterables like lists too
sourceiter = iter(iterable)
# call islice until it returns an empty tuple
return iter(lambda: tuple(islice(sourceiter, size)), ()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch(size, iterable):\r\n return list(xbatch(size, iterable))",
"def batch(iterable, size):\n sourceiter = iter(iterable)\n while True:\n batchiter = islice(sourceiter, size)\n yield list(chain([batchiter.next()], batchiter))",
"def batches(iterable, size):\n sourceiter = iter(it... | [
"0.7924629",
"0.76717794",
"0.75228584",
"0.75008875",
"0.74855304",
"0.7432641",
"0.7402862",
"0.7172108",
"0.7155361",
"0.7130077",
"0.7028351",
"0.70072824",
"0.70072824",
"0.70072824",
"0.69237196",
"0.69193083",
"0.6870717",
"0.6852512",
"0.681833",
"0.6813188",
"0.67766... | 0.79150397 | 1 |
Updates the network weights. | def update_network(self, a, batch_size):
for layer in self.layers:
layer.weights_update(a, self.alpha, self.l2_lambda, batch_size)
a = layer.a | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_weights(self):\n self._weights = self._weights + self.update_weights_value",
"def update_weights(self):\n\t\tpass",
"def update_weights(self):\n self._weights = self._weights + self.update_weights_value\n self.weights_clipping()",
"def update_weights(self):\n\n self.wei... | [
"0.8726613",
"0.8613679",
"0.8576386",
"0.8171482",
"0.7992122",
"0.7872943",
"0.7724959",
"0.76731193",
"0.75429904",
"0.7486164",
"0.7407017",
"0.7387649",
"0.73589486",
"0.7331907",
"0.73277515",
"0.73205686",
"0.7315462",
"0.72713023",
"0.72708505",
"0.7260415",
"0.724947... | 0.6829889 | 53 |
Create a hidden layer. | def __init__(self, weights_matrix, bias, activation_function, activation_function_derivative, dropout_rate=0):
self.theta = weights_matrix
self.b = bias
self.activation = activation_function
self.activation_derivative = activation_function_derivative
self.dropout_rate = dropout_r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_hidden(self, batch_size):\n hidden = torch.zeros(self.nb_layers, batch_size, self.hidden_size).to(device)\n return hidden",
"def _make_hidden(self, batch_size):\n hidden = (torch.zeros(self.nb_layers, batch_size, self.hidden_size).to(device),\n torch.zeros(self.nb_... | [
"0.72378963",
"0.70175266",
"0.6591287",
"0.6334704",
"0.6298461",
"0.6239861",
"0.62101823",
"0.6202704",
"0.61825305",
"0.61562395",
"0.60587496",
"0.6018373",
"0.5989349",
"0.5974181",
"0.5969316",
"0.595533",
"0.5918924",
"0.5918924",
"0.591377",
"0.58694804",
"0.58598316... | 0.0 | -1 |
>>> import view >>> from bs4 import BeautifulSoup as BS >>> ht = BS(view.wrap("BODY"), "lxml") >>> print(ht.find_all("script")[0]) | def wrap(body):
return """<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>OpenWhisk Crud Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="%s">
<script src="%s"></script>
<script src="%s"></script>
</head... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_script(soup):\r\n for script in soup.find_all('script'):\r\n soup.script.decompose()",
"def BS(url, find_key, class_ = None):\n html_page = requests.get(url)\n soup = BeautifulSoup(html_page.content, 'html.parser')\n script = soup.findAll(find_key, class_ = class_)\n return str(sc... | [
"0.6966485",
"0.66813946",
"0.6234755",
"0.5889644",
"0.5841699",
"0.5738259",
"0.5605203",
"0.5569684",
"0.55578315",
"0.55303204",
"0.5519775",
"0.5518968",
"0.5491542",
"0.54907656",
"0.54793984",
"0.5453536",
"0.543355",
"0.5362612",
"0.5358709",
"0.5358672",
"0.53479856"... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.