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 |
|---|---|---|---|---|---|---|
Website's portfolio analyst tool landing page | def daytrader():
if request.method == "POST":
if "grab" in request.form:
datatype = request.form.get('datatype')
ticker = request.form["ticker"]
return redirect(url_for('datapage',datatype=datatype,ticker=ticker))
return render_template('daytrader.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home(request):\n assert isinstance(request, HttpRequest)\n return render(\n request,\n 'AscensionESports_Baseline/index.html',\n {\n 'background': getSiteBackground(),\n 'color': getSiteColor(),\n 'title':'Home Page',\n 'year':datetime.now(... | [
"0.69499564",
"0.6773309",
"0.6747204",
"0.67020774",
"0.6695041",
"0.6693934",
"0.6693084",
"0.6677145",
"0.66704494",
"0.6640313",
"0.66122293",
"0.6611524",
"0.6606453",
"0.6594502",
"0.6582119",
"0.65654427",
"0.6556766",
"0.65538716",
"0.6544313",
"0.6529857",
"0.6522146... | 0.0 | -1 |
Return int(s), float(s) or s if unparsable. Also returns s if s starts with 0 unless it is "0" or starts with "0." (and therefore can't be treated like a number) | def try_parse_number(s):
if s.startswith("0") and len(s) != 1 and not s.startswith("0."):
return s
# Try parsing a nmeric
try:
return int(s)
except ValueError: # Try float or return s
try:
return float(s)
except:
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str2num(s):\n if s.is_constant() and (s.is_float() or s.is_integer()):\n return True, s.compute_value()\n elif s.functor == \".\":\n values = term2list(s)\n numvalues = []\n for value in values:\n if isinstance(value, int) or isinstance(value, float):\n ... | [
"0.74815905",
"0.7299863",
"0.7111118",
"0.7093674",
"0.70607793",
"0.7010791",
"0.696104",
"0.6956661",
"0.6915342",
"0.688626",
"0.6861667",
"0.68444234",
"0.6841532",
"0.6832864",
"0.6798507",
"0.67788756",
"0.67172396",
"0.66896385",
"0.6683508",
"0.6664536",
"0.6659144",... | 0.784655 | 0 |
Apply slice lists in a list | def apply_list_intervals(list_, intervals):
return [list_[interval] for interval in intervals] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slice_list(in_list, lens):\n if isinstance(lens, int):\n assert len(in_list) % lens == 0\n lens = [lens] * int(len(in_list) / lens)\n if not isinstance(lens, list):\n raise TypeError('\"indices\" must be an integer or a list of integers')\n elif sum(lens) != len(in_list):\n ... | [
"0.72267145",
"0.70516145",
"0.68852395",
"0.6795611",
"0.6760501",
"0.6713933",
"0.6509809",
"0.6346365",
"0.63380176",
"0.63293266",
"0.6308166",
"0.61057025",
"0.6074896",
"0.60545087",
"0.5950274",
"0.59458923",
"0.5923122",
"0.5919902",
"0.58970016",
"0.58492893",
"0.578... | 0.5414275 | 51 |
The front is the element of the list. | def dequeue(self):
return self.items.pop() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def front(self):\n return self.sentinel.next.item",
"def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\treturn front\n\t\tpass",
"def first(self):\n if self.is_empty():\n raise Empty('list is empty')\n return self._head._element # front aligned with head o... | [
"0.77749693",
"0.7668273",
"0.73567736",
"0.73224163",
"0.72623163",
"0.7222086",
"0.71912014",
"0.71878105",
"0.70682865",
"0.7043736",
"0.70315075",
"0.70231044",
"0.6971879",
"0.6962728",
"0.69573486",
"0.6945246",
"0.69159836",
"0.6911718",
"0.6911154",
"0.6908196",
"0.69... | 0.0 | -1 |
context manager method for 'with' statements | def __enter__(self):
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run401_02():\n\n class Context:\n def __init__(self):\n print('__init__()')\n\n def __enter__(self):\n print('__enter__()')\n return self\n\n def __exit__(self, exc_type, exc_val, exc_tb):\n # print(exc_type, exc_val, exc_tb)\n prin... | [
"0.6692548",
"0.6483014",
"0.6305534",
"0.6226039",
"0.6226039",
"0.6220497",
"0.6141803",
"0.6141803",
"0.6141803",
"0.6141803",
"0.6141803",
"0.61235666",
"0.61064214",
"0.61064214",
"0.6091651",
"0.6072343",
"0.606498",
"0.6056056",
"0.5960425",
"0.5950251",
"0.5925371",
... | 0.5676541 | 45 |
Test main_release / versions relationship | def test_master_versions(self):
m = self.d.master(4242)
r = self.d.release(79)
v = m.versions
self.assertEqual(len(v), 2)
self.assertTrue(r in v)
self.assertEqual(r.master, m)
r2 = self.d.release(3329867)
self.assertTrue(r2.master is None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_version(self):\n pass",
"def test_release(self):\n r = self.d.release(1)\n self.assertEqual(r.title, 'Stockholm')",
"def test_get_version(self):\n pass",
"def test_pre_release(scraper, version_parts):\n\n new_version_parts = list(version_parts)\n if len(new_version_... | [
"0.70611316",
"0.70087665",
"0.69780046",
"0.68437153",
"0.67887336",
"0.6767312",
"0.67335194",
"0.6731524",
"0.669257",
"0.6646281",
"0.6641185",
"0.66321737",
"0.6593295",
"0.6592753",
"0.6552657",
"0.65442705",
"0.65435386",
"0.65283024",
"0.65050346",
"0.64805704",
"0.64... | 0.7466025 | 0 |
Create a new center point at x, y | def __init__(self, x=0, y=0, a=2, b=1, ang=0):
self.center = (x, y)
self.lengths = (a, b)
self.angle = ang
# self.eps = create_ellipse(self.center, self.lengths, self.angle) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pointcenter(x):\n return point(x)",
"def position_center(self, x, y):\n self.x = x\n self.y = y\n self.pos[0] = x - self.pos[2]/2\n self.pos[1] = y - self.pos[3]/2",
"def centre(self):\n n = len(self.point)\n return Point(\n sum(map(lambda p: p.x, sel... | [
"0.78420687",
"0.7752527",
"0.73069996",
"0.7299911",
"0.7250619",
"0.72369295",
"0.72164565",
"0.7210723",
"0.71982867",
"0.7185139",
"0.7099784",
"0.708817",
"0.70163774",
"0.69782156",
"0.69331396",
"0.686561",
"0.6857215",
"0.6835096",
"0.68258333",
"0.68115455",
"0.68063... | 0.0 | -1 |
r"""Returns the environment specifications. | def env_spec(self):
return self._env_spec | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env(self): # type: () -> t.List[str]\n return self.config['Env']",
"def get_all_environments():\n return ENVIRONMENTS",
"def get_env():\n from platform import python_version\n versions = {}\n versions['iris'] = iris.__version__\n versions['matplotlib'] = matplotlib.__version__\n v... | [
"0.72150844",
"0.6999463",
"0.6771723",
"0.6745352",
"0.6691489",
"0.6678972",
"0.66226715",
"0.66065156",
"0.66007906",
"0.6597381",
"0.6566392",
"0.65224934",
"0.6511557",
"0.65081227",
"0.6493413",
"0.64615345",
"0.6457394",
"0.64555436",
"0.6437987",
"0.64350677",
"0.6419... | 0.7014562 | 3 |
r"""Returns a string representation of the policy network. | def __repr__(self):
string = self.__class__.__name__
string += f'\n\tNetwork: {self.network.__repr__()}'
string += f'\n\tRecurrent: {self.recurrent}'
return string | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def policy_repr(self, policy):\n return policy.__repr__()",
"def __str__(self):\n\n return \"Network: {0}\".format(self.topology)",
"def network_policy(self) -> 'outputs.NetworkPolicyResponse':\n return pulumi.get(self, \"network_policy\")",
"def __str__(self):\n representation_st... | [
"0.72983074",
"0.7222331",
"0.68801177",
"0.6872961",
"0.68525755",
"0.684979",
"0.68409806",
"0.67857635",
"0.67135197",
"0.6668393",
"0.6579513",
"0.6528173",
"0.65004265",
"0.64923114",
"0.64923114",
"0.63702154",
"0.6323191",
"0.63117546",
"0.63094455",
"0.629662",
"0.625... | 0.7208685 | 2 |
Check if the actual dtype is in expected_dtypes tuple | def valid_dtype_assertion(expected_dtypes, actual_dtype, name):
assert (actual_dtype in expected_dtypes), "Invalid dtype of {} should be {}".format(name, str(expected_dtypes)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dtype_equality(self):\r\n dtypes = get_numeric_types(with_complex=True)\r\n # Perform all pairwise comparisons of dtypes, making sure comparing\r\n # their string representation yields the same result.\r\n for dtype1_idx, dtype1 in enumerate(dtypes):\r\n for dtype2 i... | [
"0.78190494",
"0.7479696",
"0.7407937",
"0.7095204",
"0.70427704",
"0.70244956",
"0.69943213",
"0.6901867",
"0.68711364",
"0.6862474",
"0.67503256",
"0.6712344",
"0.66905665",
"0.6676588",
"0.66409034",
"0.66302294",
"0.66069466",
"0.6569878",
"0.6553351",
"0.65489155",
"0.65... | 0.80109257 | 0 |
this is for check a ndarray has valid of dtype and ndim. Parematers ndarray ndarray numpy the ndarray form which the properties will be obtained expected_dtypes dtypes tuple this are the set of valid types. expected_dimentions int tuple this are the set of valid ndim. name string the name for the assertion error messag... | def validate_ndarray(ndarray, expected_dtypes, expected_dimentions, name):
valid_dtype_assertion(expected_dtypes, ndarray.dtype, name)
valid_ndim_assertion(expected_dimentions, ndarray.ndim, name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_ndim_assertion(expected_dimentions, actual_dimention, name):\n\tassert (actual_dimention in expected_dimentions), \"Invalid ndim of {} should be {}\".format(name, str(expected_dimentions))",
"def test_shape(self, varname, varshape, ndim): \n if len(varshape) != ndim:\n raise ShapeErro... | [
"0.7493631",
"0.7208451",
"0.7202041",
"0.71171033",
"0.70398784",
"0.6981742",
"0.696444",
"0.67768437",
"0.6616017",
"0.6589878",
"0.6572059",
"0.65380645",
"0.6445883",
"0.64455783",
"0.6427266",
"0.63516784",
"0.63156116",
"0.6310805",
"0.6304929",
"0.630264",
"0.630053",... | 0.84904623 | 0 |
check if ndarray has 2 dimensions only and if it has float or int dtypes | def validate_common(ndarray, name):
validate_ndarray(ndarray,(np.float, np.int), (2,) , name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_1d_varray(arr):\r\n return len(arr.shape) < 2 or arr.shape[1] == 1",
"def is_array(a):\n try:\n shape = a.shape\n return len(shape) >= 1\n except AttributeError:\n return False",
"def _is_double(arr):\n\n # Figure out which dtype for data\n if arr.dtype == np.float32... | [
"0.73486024",
"0.6962764",
"0.6876656",
"0.6859714",
"0.6846378",
"0.68397707",
"0.67156184",
"0.6705501",
"0.66635436",
"0.66286635",
"0.6608184",
"0.65864426",
"0.6547088",
"0.65391356",
"0.65080184",
"0.6491807",
"0.6487964",
"0.6478655",
"0.6457786",
"0.64527905",
"0.6399... | 0.70410544 | 1 |
learning rate decay operation in tensorflow using inverse time decay | def learning_rate_decay(alpha, decay_rate, global_step, decay_step):
return tf.train.inverse_time_decay(
learning_rate=alpha,
global_step=global_step,
decay_steps=decay_step,
decay_rate=decay_rate,
staircase=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_rate_decay(a, d_rate, g_step, d_step):\n return tf.train.inverse_time_decay(a, g_step, d_step, d_rate, True)",
"def learning_rate_decay(alpha, decay_rate, global_step, decay_step):\n \"\"\"if staircase == True\n decayed_learning_rate = learning_rate /\n (1 + decay_rate * floor(global_ste... | [
"0.8160458",
"0.81257486",
"0.8022495",
"0.7905607",
"0.79044354",
"0.78837794",
"0.7382625",
"0.73541874",
"0.7349284",
"0.72894037",
"0.7162475",
"0.71500254",
"0.7060108",
"0.7059971",
"0.70368344",
"0.6989545",
"0.698429",
"0.68445927",
"0.68297213",
"0.6810631",
"0.67910... | 0.79120886 | 3 |
Check if begins with a major_version in . | def __contains__(self, database_version):
return any(
database_version.startswith(major_version) for major_version in self
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_stable_version(version):\n if not isinstance(version, tuple):\n version = version.split('.')\n last_part = version[-1]\n\n if not re.search('[a-zA-Z]', last_part):\n return True\n else:\n return False",
"def test_major(self):\n self.assertEqual(\"0\", self._version1... | [
"0.70387655",
"0.68408495",
"0.68149376",
"0.6742408",
"0.66870785",
"0.65280527",
"0.6484486",
"0.64315623",
"0.6398003",
"0.6384683",
"0.6338998",
"0.6332368",
"0.6262275",
"0.6248336",
"0.6242744",
"0.6227021",
"0.6134473",
"0.6107773",
"0.60859793",
"0.6068098",
"0.606650... | 0.6184875 | 16 |
Add the flag to specify password policy password change interval. | def AddPasswordPolicyPasswordChangeInterval(parser):
parser.add_argument(
'--password-policy-password-change-interval',
default=None,
type=arg_parsers.Duration(lower_bound='1s'),
required=False,
help="""\
Minimum interval after which the password can be changed, for example,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def AddPasswordPolicyReuseInterval(parser):\n parser.add_argument(\n '--password-policy-reuse-interval',\n type=arg_parsers.BoundedInt(lower_bound=0, upper_bound=100),\n required=False,\n default=None,\n help=(\n 'Number of previous passwords that cannot be reused. The valid rang... | [
"0.7057645",
"0.6974068",
"0.66888136",
"0.63394636",
"0.5967842",
"0.59546196",
"0.59208876",
"0.58907443",
"0.5755655",
"0.57435614",
"0.57421327",
"0.57052374",
"0.5672057",
"0.5627041",
"0.5622442",
"0.55982",
"0.5585433",
"0.55552644",
"0.5514934",
"0.5505389",
"0.548693... | 0.81387085 | 0 |
Adds the `timezone` flag to the parser. | def AddSqlServerTimeZone(parser):
parser.add_argument(
'--time-zone',
required=False,
help=(
'Set a non-default time zone. '
'Only available for SQL Server instances.'
),
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(timezone: str):\n utils.validate_timezone(timezone)\n config_file = variables.config_file\n\n if not utils.check_config():\n with open(config_file, \"w+\") as newfile:\n pass\n\n with open(config_file, \"r+\") as file:\n data: List = [line.rstrip() for line in file]\n\n... | [
"0.6048807",
"0.5776214",
"0.57642853",
"0.5586408",
"0.55384123",
"0.55141443",
"0.54885036",
"0.5443314",
"0.53075206",
"0.53068864",
"0.5224209",
"0.5182866",
"0.5160024",
"0.5160024",
"0.5160024",
"0.5160024",
"0.5160024",
"0.5137101",
"0.5120673",
"0.5115645",
"0.4994564... | 0.61372286 | 0 |
Function takes a datetime object and stringifies it down to MM/DD/YYYY format | def format_date(date):
try:
start_date = datetime.strftime(date, '%m/%d/%Y')
except (TypeError, ValueError) as e:
start_date = date
pass
return start_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_datetime_to_string(dt):\n\treturn '{0}-{1}-{2}'.format(dt.year, dt.month, dt.day)",
"def convert_datetime_to_string(dt):\n\treturn '{0}-{1}-{2}'.format(dt.year, dt.month, dt.day)",
"def format_datetime(dt):\r\n return dateformat.format(make_naive(dt), 'r')",
"def date_string(date):\n day = ... | [
"0.72869796",
"0.72869796",
"0.72654724",
"0.7132643",
"0.7095728",
"0.70856416",
"0.6984146",
"0.6919553",
"0.6877782",
"0.68449146",
"0.67412364",
"0.67404485",
"0.6740079",
"0.67383695",
"0.671576",
"0.66899014",
"0.66670173",
"0.66101336",
"0.6590086",
"0.657779",
"0.6571... | 0.67605406 | 10 |
Group an iterable into chunks of block_size. Adapted from | def grouper(iterable, block_size, fillvalue=None) -> list:
args = [iter(iterable)] * block_size
return zip_longest(*args, fillvalue=fillvalue) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunks(iterator, size):\n for index in range(0, len(iterator), size):\n yield iterator[index:index + size]",
"def chunker(iterable, size):\n for i in range(0, len(iterable), size):\n yield iterable[i:i + size]",
"def chunker(iterable, size):\n for i in range(0, len(iterable), size):\... | [
"0.8046457",
"0.79064894",
"0.79064894",
"0.79064894",
"0.789391",
"0.7888253",
"0.78606796",
"0.78534997",
"0.7852428",
"0.7807665",
"0.78022265",
"0.77985203",
"0.7760477",
"0.77162355",
"0.7696927",
"0.7684907",
"0.76686347",
"0.76675594",
"0.7664256",
"0.762519",
"0.76230... | 0.7657436 | 19 |
Adds and removes the given words from the query, returning the new ?q. | def modify_search(add=[], remove=[]):
query = request.args.get('q', '').split()
query = [x.strip() for x in query if x.strip()]
for word in remove:
if word in query:
query.remove(word)
for word in add:
if word and word not in query:
query.append(word)
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter(q_words):\n filtered_words = [\"how\",\"what\"]\n for word in q_words:\n if word in filtered_words:\n q_words.remove(word)",
"def removestopwords(query):\n wordlist = [word for word in query.split() if word not in stopwords.words('english')]\n return \" \".join(wordlist)"... | [
"0.64603466",
"0.63632005",
"0.6250111",
"0.6125075",
"0.6096852",
"0.6071776",
"0.5995022",
"0.58438754",
"0.57594866",
"0.5692303",
"0.5623006",
"0.56003267",
"0.55980396",
"0.5558742",
"0.5541352",
"0.5461948",
"0.54305816",
"0.5427023",
"0.541576",
"0.5401241",
"0.5363689... | 0.7439704 | 0 |
Return structure with list of ingredients (connected by this strategy paths) this strategy could turn into potion. Format of the structure | def want_to_use(self, plan):
# Get list of all ingredients available
# (we do not care about stones - i.e. multiple paths, these will be
# taken care later when brewing the potion)
ingredients = {}
for path in plan.get_paths_for_strat(self.id):
for cell in path:
for ingredient in plan[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getIngredients():\n ingredients = ['Whiskey', 'Tequila', 'Vodka', 'Blue Curacao', 'Orange Juice',\n 'Pineapple Juice', 'Cranberry Juice', 'Sour Mix']\n return ingredients",
"def get_ingredients(self):\n try:\n ingredients = self.soup.find_all(class_=\"ingredient-grou... | [
"0.58865327",
"0.5872826",
"0.58088017",
"0.56609994",
"0.5642955",
"0.55576724",
"0.5556588",
"0.55418646",
"0.54594487",
"0.54061735",
"0.53916126",
"0.5350365",
"0.53464746",
"0.5283408",
"0.5280605",
"0.52669126",
"0.52427673",
"0.5220994",
"0.5215416",
"0.51952523",
"0.5... | 0.5980633 | 0 |
Returns a batchnormalized version of x. | def normalize(self, x, train=True):
if train is not None:
mean, variance = tf.nn.moments(x, [0,1,2])
assign_mean = self.mean.assign(mean)
assign_variance = self.variance.assign(variance)
with tf.control_dependencies([assign_mean, assign_variance]):
return tf.nn.batch_norm_with_global... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _normalize(self, x):\n # TODO: imagenet normalization\n\n return x",
"def normalizerows(x):\n # Compute x_norm as the norm 2 of x. Use np.linalg.norm(..., ord=2, axis= ..., keepdims=True)\n x_norm = np.linalg.norm(x, ord=2, axis=1, keepdims=True)\n\n #Divide x by norm\n x = x / x_no... | [
"0.7273415",
"0.6906581",
"0.69053334",
"0.6804003",
"0.6702106",
"0.66830665",
"0.66705304",
"0.6640092",
"0.656571",
"0.6509811",
"0.6505604",
"0.6476248",
"0.64490956",
"0.64460343",
"0.64394903",
"0.6431902",
"0.64124984",
"0.64075226",
"0.63840616",
"0.63519806",
"0.6329... | 0.5964148 | 64 |
Returns a set of the solved cells within the puzzle. | def solved_cells(self) -> Set[Cell]:
return set(self.iter_solved_cells()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsolved_cells(self) -> Set[Cell]:\n\t\treturn set(self.iter_unsolved_cells())",
"def unsolved_cells(self) -> Set[Cell]:\n\t\treturn set(self.iter_unsolved_cells())",
"def iter_solved_cells(self):\n\t\treturn (\n\t\t\tcell for cell in\n\t\t\tself._cells\n\t\t\tif cell.value()\n\t\t)",
"def iter_solved_ce... | [
"0.7662385",
"0.7662385",
"0.7452958",
"0.7315246",
"0.6874305",
"0.6783004",
"0.6691106",
"0.66309947",
"0.66179585",
"0.6562532",
"0.6532909",
"0.65113026",
"0.64803386",
"0.64668894",
"0.6466478",
"0.64366716",
"0.64361703",
"0.6427201",
"0.64164346",
"0.64058936",
"0.6328... | 0.88874316 | 1 |
Returns a set of the unsolved cells within the puzzle. | def unsolved_cells(self) -> Set[Cell]:
return set(self.iter_unsolved_cells()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solved_cells(self) -> Set[Cell]:\n\t\treturn set(self.iter_solved_cells())",
"def solved_cells(self) -> Set[Cell]:\n\t\treturn set(self.iter_solved_cells())",
"def iter_unsolved_cells(self):\n\t\treturn (\n\t\t\tcell for cell in\n\t\t\tself._cells\n\t\t\tif not cell.value()\n\t\t)",
"def iter_unsolved_ce... | [
"0.8286306",
"0.8286306",
"0.78360254",
"0.7729228",
"0.76062495",
"0.7410148",
"0.68055063",
"0.66795325",
"0.66605866",
"0.65803957",
"0.65233576",
"0.6479214",
"0.6407047",
"0.6404423",
"0.6384383",
"0.6331265",
"0.6312287",
"0.62504005",
"0.62066376",
"0.6196511",
"0.6187... | 0.8960129 | 0 |
Retrieves a single cell given a location. | def get_cell(self, location: Hashable) -> Cell:
return self._location_to_cell_map.get(location, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cell(self, location):\n if 0 <= location[0] < self.boardSize and 0 <= location[1] < self.boardSize:\n return self.board[location[0]][location[1]]\n else:\n raise Exception(\"There is no cell at the given location\")",
"def get_cell(self, index, column):\n idx = ... | [
"0.8082742",
"0.736209",
"0.73140186",
"0.70865417",
"0.7082656",
"0.7052371",
"0.6962005",
"0.69540155",
"0.69432884",
"0.6920298",
"0.6893466",
"0.6889122",
"0.6838327",
"0.67824155",
"0.6779269",
"0.6689697",
"0.6649001",
"0.655728",
"0.6527815",
"0.6525578",
"0.6503857",
... | 0.8568169 | 0 |
Returns the word embedding dimension. | def get_dimension(self) -> int:
return self.embedder.get_dimension() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _embedding_dim(vocab_size):\n if not vocab_size or (vocab_size <= 0):\n raise ValueError(\"Invalid vocab_size %g.\" % vocab_size)\n return int(round(6.0 * math.sqrt(math.sqrt(vocab_size))))",
"def dimension(self):\n return self._dim",
"def input_dim(use_word_emb, embedding_dim, word_emb_enc_dim... | [
"0.76153374",
"0.7237442",
"0.7191883",
"0.7161444",
"0.71207756",
"0.71207756",
"0.71207756",
"0.71207756",
"0.7087317",
"0.7069829",
"0.70642155",
"0.7048754",
"0.7035747",
"0.70297676",
"0.70257556",
"0.6992874",
"0.6979675",
"0.6955945",
"0.6948382",
"0.69256014",
"0.6917... | 0.7833573 | 0 |
Embeds a batch of indices and returns a tensors with the embeddings and sequence lengths. | def _embed(self, index_batch: List[List[int]]) -> Tuple[FloatTensor, LongTensor]:
# Get lengths
lengths = LongTensor([len(sequence) for sequence in index_batch])
# TODO: switch to pytorch version 0.4.1 and add .item()
seq_len = lengths.max() if torch.__version__[:3] == '0.3' else lengths... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def embed(self, index_batch: List[List[int]]) -> Tuple[FloatTensor, LongTensor]:\n return self._embed(index_batch)",
"def embedding(self, seqs):\n batch_size, seqlen = seqs.shape\n seqs = np.reshape(seqs, (-1)) # convert to 1-d indexes [(batch_sz*seqlen)]\n embs = self.word2vec[seqs]... | [
"0.6865791",
"0.6635888",
"0.6587195",
"0.6567269",
"0.6499882",
"0.6358613",
"0.63392216",
"0.6330702",
"0.6308136",
"0.6270366",
"0.6195017",
"0.61304456",
"0.6113752",
"0.6086269",
"0.60836214",
"0.60664815",
"0.60590225",
"0.6053414",
"0.60495",
"0.60274565",
"0.6023334",... | 0.77606255 | 0 |
Embeds a batch of indices or words and returns a tensors with the embeddings and sequence lengths. | def embed(self, batch: Union[List[List[int]], List[List[str]]]) -> Tuple[FloatTensor, LongTensor]:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _embed(self, index_batch: List[List[int]]) -> Tuple[FloatTensor, LongTensor]:\n # Get lengths\n lengths = LongTensor([len(sequence) for sequence in index_batch])\n # TODO: switch to pytorch version 0.4.1 and add .item()\n seq_len = lengths.max() if torch.__version__[:3] == '0.3' els... | [
"0.7648917",
"0.70375705",
"0.6873677",
"0.6857521",
"0.67231464",
"0.67100847",
"0.66820925",
"0.6651017",
"0.6631687",
"0.6630108",
"0.6623632",
"0.6618058",
"0.6537013",
"0.6480419",
"0.6434556",
"0.6424245",
"0.6411057",
"0.6411057",
"0.6402744",
"0.6380323",
"0.63666266"... | 0.5946755 | 74 |
Embeds a batch of indices and returns a tensors with the embeddings and sequence lengths. | def embed(self, index_batch: List[List[int]]) -> Tuple[FloatTensor, LongTensor]:
return self._embed(index_batch) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _embed(self, index_batch: List[List[int]]) -> Tuple[FloatTensor, LongTensor]:\n # Get lengths\n lengths = LongTensor([len(sequence) for sequence in index_batch])\n # TODO: switch to pytorch version 0.4.1 and add .item()\n seq_len = lengths.max() if torch.__version__[:3] == '0.3' els... | [
"0.7760315",
"0.6634717",
"0.6587012",
"0.65664893",
"0.64994836",
"0.63582104",
"0.6339279",
"0.6329513",
"0.63075686",
"0.627123",
"0.61942405",
"0.61302567",
"0.61130947",
"0.6086139",
"0.60825896",
"0.6066114",
"0.6058864",
"0.60536265",
"0.60491276",
"0.60273635",
"0.602... | 0.68655646 | 1 |
Embeds a batch of words and returns a tensors with the embeddings and sequence lengths. | def embed(self, word_batch: List[List[str]]) -> Tuple[FloatTensor, LongTensor]:
return self.embed_with_info(word_batch)[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_embeddings(self, feed_seq_batch):\n # compute seq_length\n self.feed_per_seq_length = self.get_per_seq_length(feed_seq_batch)\n\n # compute embedding\n with tf.variable_scope(\"word_embedding\"):\n seq_embedding = tf.get_variable(\n name=\"seq_embeddin... | [
"0.74384314",
"0.7355198",
"0.71553797",
"0.7051582",
"0.70311373",
"0.69953597",
"0.69934255",
"0.692942",
"0.6918262",
"0.6799834",
"0.6793296",
"0.6765322",
"0.6707217",
"0.67010915",
"0.6691311",
"0.6691311",
"0.6666527",
"0.6658339",
"0.6647511",
"0.66373193",
"0.6630987... | 0.6405747 | 33 |
Encode given objects to binary wire format. If the Wire object was created using the keyvalue format list, the method accepts one dict object that contains all the objects to be encoded. Otherwise, the method accepts multiple objects (like Struct.pack()) and all objects will be encoded sequentially. | def encode(self, *stuff):
if self._kv_fmt:
result = self._encode_wire(stuff[0])
else:
result = self._encode_wire(stuff)
return result.getvalue() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_raw(objs):\n return RawWire().encode(objs)",
"def bencode(obj):\n\n l = [obj]\n s = []\n while len(l) > 0:\n item = l.pop(0)\n if isinstance(item, Raw):\n s.append(item.value())\n elif isinstance(item, (EndDict, EndList)):\n s.append(b'e')\n ... | [
"0.6480719",
"0.61870754",
"0.60920197",
"0.6076302",
"0.60423005",
"0.60284555",
"0.6017666",
"0.59362376",
"0.5920858",
"0.5892922",
"0.5813973",
"0.58070874",
"0.57661295",
"0.57661295",
"0.57402664",
"0.57038176",
"0.56728625",
"0.56202006",
"0.56185794",
"0.5606032",
"0.... | 0.5898135 | 9 |
Encode a string/binary stream into protobuf variable length by appending a special header containing the length of the string. Called internally in _encode_field() function | def _encode_str(self, string):
result = self._encode_vint(len(string))
result += string
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_length_header(data: bytes) -> bytes:\n length = str(len(data)).encode()\n header = (b'<length ' + length + b'>').ljust(32)\n return header + data",
"def StringSizer(field_number, is_repeated, is_packed):\n\n tag_size = _TagSize(field_number)\n local_VarintSize = _VarintSize\n local_len = len\... | [
"0.65909964",
"0.6124745",
"0.6104957",
"0.5997605",
"0.59296083",
"0.59088737",
"0.59040654",
"0.58986205",
"0.5870628",
"0.5809623",
"0.5755779",
"0.5714975",
"0.5579924",
"0.5550133",
"0.5547853",
"0.5510783",
"0.5496332",
"0.5457247",
"0.5451824",
"0.5446315",
"0.5445755"... | 0.5034728 | 59 |
Convert this object in a readeable string (for print) | def __str__(self):
OutLoss_str = ""
if self.parent is None:
OutLoss_str += "parent = None " + linesep
else:
OutLoss_str += "parent = " + str(type(self.parent)) + " object" + linesep
OutLoss_str += "loss_list = " + str(self.loss_list) + linesep + linesep
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_string(self):\r\n return self.__str__()",
"def to_str(self):\r\n return pprint.pformat(self.to_dict())",
"def to_str(self):\r\n return pprint.pformat(self.to_dict())",
"def to_str(self):\n return pprint.pformat(self.to_dict())",
"def to_str(self):\n return pformat(self... | [
"0.8144877",
"0.7979035",
"0.7979035",
"0.79750645",
"0.79745424",
"0.79745424",
"0.79745424",
"0.79745424",
"0.79745424",
"0.79745424",
"0.79745424",
"0.79745424",
"0.79745424",
"0.79745424",
"0.79745424",
"0.79745424",
"0.79745424",
"0.79745424",
"0.79745424",
"0.79745424",
... | 0.0 | -1 |
Create dataset objects for splits of the Lang8 dataset. | def splits(cls, exts, fields, path='./data/lang8', root='./data',
train='train', validation='val', test='test', **kwargs):
return super(USE, cls).splits(
path, root, train, validation, test, exts=exts, fields=fields, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateDataset(all_arrays):\n dataset = Dataset()\n\n dataset._addData(all_arrays[0])\n dataset._addData(all_arrays[1])\n dataset._addData(all_arrays[3])\n dataset._addData(all_arrays[5])\n dataset._addData(all_arrays[6])\n dataset._addData(all_arrays[9])\n dataset._addData(all_arrays[8]... | [
"0.6618969",
"0.6412341",
"0.63954335",
"0.6355365",
"0.6351754",
"0.6337537",
"0.6288371",
"0.6286841",
"0.62695956",
"0.6249996",
"0.62316424",
"0.6203456",
"0.6185784",
"0.61820006",
"0.6162178",
"0.61326635",
"0.6114518",
"0.60942835",
"0.6092213",
"0.60553503",
"0.604741... | 0.0 | -1 |
Some environments don't have an A/B setup. These can be managed using this method and the singleasg flag. | def handle_single_asg():
environment_asg = asg.describe_auto_scaling_groups(AutoScalingGroupNames=[args.environment], MaxRecords=1)
if args.zero:
if environment_asg["AutoScalingGroups"][0]["DesiredCapacity"] >= 1:
if args.lock_bucket_name:
lock_environment(args.lock_bucket_na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetupEnvironment(self):\n pass",
"def main():\n if args.lock_bucket_name:\n if check_for_lock(args.lock_bucket_name, args.environment):\n check_error(\"Environment is locked. Unable to proceed.\")\n\n if args.singleasg:\n return handle_single_asg()\n\n if args.instance_co... | [
"0.6361433",
"0.6360795",
"0.6283673",
"0.58549327",
"0.57797915",
"0.5747505",
"0.5747505",
"0.5747505",
"0.5747505",
"0.5747505",
"0.5747505",
"0.5747505",
"0.5747505",
"0.5747505",
"0.5747505",
"0.5747505",
"0.5747505",
"0.5687406",
"0.5655993",
"0.5641664",
"0.56059164",
... | 0.5839298 | 4 |
Test that middleware is ok when server is none in scope. | def test_behavior_with_scope_server_as_none(self):
def update_expected_server(expected):
expected[3]["attributes"].update(
{
"http.host": "0.0.0.0",
"host.port": 80,
"http.url": "http://0.0.0.0/",
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_behavior_with_scope_server_as_none(self):\n\n def update_expected_server(expected):\n expected[3][\"attributes\"].update(\n {\n SpanAttributes.HTTP_HOST: \"0.0.0.0\",\n SpanAttributes.NET_HOST_PORT: 80,\n SpanAttribu... | [
"0.67881715",
"0.6421726",
"0.62887543",
"0.627802",
"0.62571293",
"0.609614",
"0.60894525",
"0.6052777",
"0.60396963",
"0.59555256",
"0.58882743",
"0.58479136",
"0.58381426",
"0.58093685",
"0.5792621",
"0.57923585",
"0.57682794",
"0.5765627",
"0.5707247",
"0.56999034",
"0.56... | 0.68050337 | 0 |
Returns a serializable UTC timestamp. | def timestamp():
return time.time() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamp(self) -> datetime.datetime.timestamp:\n timestamp = datetime.datetime.utcfromtimestamp(int(self._timestamp) / 1000)\n return timestamp",
"def get_timestamp(self):\n return datetime.datetime.utcnow()",
"def _get_timestamp():\n return '{}Z'.format(\n datetime.... | [
"0.7534792",
"0.73521984",
"0.72671103",
"0.7242292",
"0.7191681",
"0.7159556",
"0.7143789",
"0.71327496",
"0.7105572",
"0.7097472",
"0.70772356",
"0.70772356",
"0.6982504",
"0.6974957",
"0.695182",
"0.6946475",
"0.693851",
"0.6937094",
"0.69138753",
"0.6892845",
"0.68432474"... | 0.62008613 | 95 |
Resolve a relative Blender path to a real filesystem path | def realpath(path):
if path.startswith('//'):
path = bpy.path.abspath(path)
else:
path = os.path.realpath(path)
path = path.replace('\\', '/')
path = os.path.realpath(path)
return path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolved(rpath):\r\n return realpath(abspath(rpath))",
"def resolve(self, path=''):\n path = self._sep.join([self.root] + path.split('/'))\n return realpath(path)",
"def rel_resolve(path):\n if os.path.isabs(path):\n return os.path.abspath(path)\n else:\n return os.path... | [
"0.71443504",
"0.7089094",
"0.70825225",
"0.7002833",
"0.69591784",
"0.68717974",
"0.67614764",
"0.6717818",
"0.6685627",
"0.66643894",
"0.6658922",
"0.66221786",
"0.6540084",
"0.6497672",
"0.6490021",
"0.6450036",
"0.64379096",
"0.64314705",
"0.6410739",
"0.6407725",
"0.6407... | 0.6880262 | 5 |
Plots the silhouette scores of the frame for each of the specified clusters. | def plot_silhouette_scores(frame, range_n_clusters, diversity_matrix, merges):
for n_clusters in range_n_clusters:
# Create a subplot with 1 row and 2 columns
fig, ax1 = plt.subplots(1, 1)
fig.set_size_inches(18, 7)
# The 1st subplot is the silhouette plot
# The silhouette c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_silhouette(sample_silhouette_values, n_clusters, labels, silhouette_avg):\n fig, ax = plt.subplots()\n\n y_lower = 10\n for i in range(n_clusters):\n # Aggregate the silhouette scores for samples belonging to\n # cluster i, and sort them\n ith_cluster_silhouette_values = \\\n... | [
"0.8037675",
"0.7823171",
"0.73707336",
"0.7062678",
"0.69883806",
"0.6941358",
"0.6689383",
"0.63975275",
"0.6334107",
"0.62856597",
"0.62112147",
"0.6175734",
"0.6061005",
"0.6044159",
"0.60095775",
"0.5978901",
"0.59724396",
"0.5941249",
"0.589615",
"0.5894953",
"0.5864557... | 0.8468193 | 0 |
Add defaults to the service. If the service rules are None or Empty, add default rule. If the operation is 'create', add default ttl and cache. | def _append_defaults(self, service_json, operation='create'):
# default origin rule
for origin in service_json.get('origins', []):
if origin.get('rules') is None:
# add a rules section
origin['rules'] = []
if origin.get('rules') == []:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_default_ops(op_name):\n _add_default_op(op_name)\n _add_default_reverse_op(op_name)",
"def __init__(__self__, *,\n default_action: str,\n ip_rules: Optional[Sequence['outputs.IPRuleResponse']] = None,\n virtual_network_rules: Optional... | [
"0.5655553",
"0.515327",
"0.5140459",
"0.50912434",
"0.49852654",
"0.48414034",
"0.47737116",
"0.47653344",
"0.4733586",
"0.47129753",
"0.47046983",
"0.46832877",
"0.4680678",
"0.46356103",
"0.46295312",
"0.46178746",
"0.4593103",
"0.45821074",
"0.45806965",
"0.45522276",
"0.... | 0.7724897 | 0 |
Set limit for number of services for a given project. | def services_limit(self, project_id, limit):
self.storage_controller.set_service_limit(
project_id=project_id,
project_limit=limit) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_services_limit(self, project_id):\n limit = self.storage_controller.get_service_limit(\n project_id=project_id)\n\n return {\n 'limit': limit\n }",
"def test_set_project_limits(self):\n pass",
"def limit_num_clients(self, limit_num_clients):\n\n ... | [
"0.6471788",
"0.64218056",
"0.6413854",
"0.6060075",
"0.60413957",
"0.59873587",
"0.596239",
"0.59554595",
"0.59497374",
"0.5947321",
"0.5947321",
"0.5947321",
"0.5882596",
"0.5846059",
"0.57915354",
"0.57868916",
"0.57765067",
"0.5770326",
"0.5769836",
"0.5739568",
"0.566119... | 0.8279682 | 0 |
Get the currently set limit on services for a given project. | def get_services_limit(self, project_id):
limit = self.storage_controller.get_service_limit(
project_id=project_id)
return {
'limit': limit
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def services_limit(self, project_id, limit):\n self.storage_controller.set_service_limit(\n project_id=project_id,\n project_limit=limit)",
"def limit(self):\n if self._limit:\n return self._limit\n else: # no custom limit, go with the default\n r... | [
"0.69445556",
"0.6309081",
"0.6216308",
"0.60979694",
"0.60979694",
"0.6012911",
"0.5990903",
"0.5957679",
"0.5948644",
"0.58482075",
"0.5815061",
"0.5800849",
"0.57906145",
"0.57872075",
"0.5773124",
"0.5751639",
"0.56718725",
"0.56718725",
"0.56032366",
"0.5512052",
"0.5497... | 0.79729736 | 0 |
Return the entity ID of the switch. | def entity_id(self):
return self._entity_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entity_id(self) -> str:\n return self._entity_id",
"def unique_id(self):\n return self.heater.id + \"_switch\"",
"def vswitch_id(self) -> str:\n return pulumi.get(self, \"vswitch_id\")",
"def vswitch_id(self) -> str:\n return pulumi.get(self, \"vswitch_id\")",
"def vswitch_i... | [
"0.723852",
"0.71669",
"0.6806833",
"0.6806833",
"0.6806833",
"0.6806833",
"0.6695719",
"0.6666511",
"0.66313595",
"0.66313595",
"0.66313595",
"0.6541845",
"0.64793843",
"0.645295",
"0.645295",
"0.645295",
"0.6290953",
"0.6275885",
"0.62664247",
"0.62664247",
"0.62664247",
... | 0.71207637 | 4 |
Return the name of the device if any. | def name(self):
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_name(self) -> Optional[str]:\n return pulumi.get(self, \"device_name\")",
"def device_name(self) -> Optional[str]:\n return pulumi.get(self, \"device_name\")",
"def name(self):\n return self._device.name",
"def name(self):\n return self._device.name",
"def name(self):... | [
"0.89726496",
"0.89726496",
"0.8584672",
"0.8584672",
"0.8584672",
"0.850212",
"0.84946066",
"0.84203684",
"0.8395054",
"0.8395054",
"0.8378909",
"0.8316349",
"0.8307453",
"0.8161342",
"0.81572443",
"0.8089769",
"0.80879545",
"0.8074055",
"0.8007309",
"0.7998442",
"0.79543054... | 0.0 | -1 |
Sets edge's flow to value. | def setFlow(self, edge, value):
self.flow[edge] = value
self.flow[edge[::-1]] = - value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increaseFlow(self, edge, value):\r\n self.flow[edge] += value\r\n self.flow[edge[::-1]] -= value",
"def flow(self, flow):\n\n self._flow = flow",
"def update_flow(self, flow):\r\n self.flow = flow",
"def set_cur_flow(self, flow):\n self.cur_flow = flow",
"def set_flow... | [
"0.7616722",
"0.6973972",
"0.68580323",
"0.6408602",
"0.61558783",
"0.5977393",
"0.5609222",
"0.5607507",
"0.5512434",
"0.54854566",
"0.5483543",
"0.54786694",
"0.5415533",
"0.5415083",
"0.5385193",
"0.53820366",
"0.5363754",
"0.5352125",
"0.5349089",
"0.5339413",
"0.5323319"... | 0.8860267 | 0 |
Returns the set of vertices in the network. | def vertices(self):
return self.adjacent.keys() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vertices(self):\n return self.graph.keys()",
"def vertices(self):\n return list(self._graph)",
"def vertices(self):\n return list(self.__graph.values())",
"def vertices(self):\n return list(self.graph_dict.keys())",
"def get_vertices(self):\n return self.vertList.... | [
"0.83619964",
"0.8278848",
"0.8200795",
"0.807417",
"0.80649745",
"0.8049677",
"0.8049677",
"0.8049677",
"0.8031431",
"0.80120116",
"0.79504377",
"0.7946476",
"0.7904752",
"0.78968763",
"0.7874545",
"0.78530294",
"0.78501725",
"0.7835366",
"0.78217286",
"0.78217286",
"0.78085... | 0.74099755 | 27 |
Returns the set of edges in the network. | def edges(self):
return self.capacity.keys() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edges(self):\n return self.graph.edges",
"def edges(self):\n return self._edges",
"def edges(self):\n return self._edges",
"def edges(self):\n return self._edges",
"def edges(self):\n return self._edges",
"def edges(self):\n return self._edges",
"def edges(... | [
"0.8154383",
"0.8021138",
"0.8021138",
"0.8021138",
"0.8021138",
"0.8021138",
"0.8021138",
"0.79575926",
"0.7929279",
"0.7929279",
"0.7929279",
"0.7921978",
"0.7911033",
"0.78675926",
"0.78579855",
"0.78334796",
"0.78324443",
"0.78127414",
"0.7793253",
"0.7642598",
"0.7636273... | 0.6994174 | 44 |
Inserts a vertex into the network. | def addVertex(self, v):
self.adjacent.setdefault(v, list()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertex(self, vertex):\n if vertex.id not in self.vertices.keys():\n self.vertices[vertex.id] = vertex",
"def add_vertex(self, vertex):\n raise NotImplementedError",
"def add_vertex(self, vertex_id):\n pass # TODO",
"def add_vertex(self, vertex):\n if isinstance... | [
"0.7554058",
"0.7540286",
"0.743122",
"0.7246269",
"0.72370917",
"0.7207153",
"0.7160825",
"0.7091206",
"0.7058609",
"0.70448166",
"0.7021584",
"0.69741976",
"0.69234365",
"0.6866654",
"0.6859859",
"0.68437314",
"0.68398905",
"0.68398905",
"0.6832277",
"0.6803738",
"0.6791099... | 0.63629454 | 45 |
The public home page. Make it purty and awesome! | def index():
return jsonify({"redirect": "home"}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.now().year)",
"def home():\r\n return render_template(\r\n 'index.html',\r\n title='Home Page',\r\n year=datetime.now().year,\r\n )",
"def homepage():\n return render_template('h... | [
"0.8366394",
"0.8263978",
"0.8250246",
"0.82417727",
"0.8183773",
"0.8183773",
"0.8183773",
"0.8183773",
"0.8183773",
"0.8183773",
"0.8183773",
"0.8183773",
"0.8183773",
"0.8183773",
"0.81504107",
"0.81437725",
"0.80384356",
"0.8014083",
"0.8013399",
"0.79904073",
"0.79582405... | 0.0 | -1 |
return a salt from the database based on email. Otherwise send a random hash and keep it for that username (for security reasons). | def get_user_salt(self, email):
salt = self.get_password_element(email,'salt')
# if salt returns empty then we must insert one to table
pe = PasswordEngine()
if salt == '':
salt = pe.create_salt(email)
return salt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_salt(self):\n if not self.id and not self._salt:\n self._salt = b64encode(os.urandom(8))\n\n if isinstance(self._salt, str):\n self._salt = self._salt.encode('UTF-8')\n\n return self._salt",
"def get_salt():\n return os.urandom(32)",
"def test_user_hash_with_salt(self):\n ... | [
"0.66929895",
"0.66100025",
"0.641736",
"0.6234982",
"0.6233121",
"0.6197048",
"0.61675066",
"0.6157871",
"0.61479104",
"0.6111039",
"0.6084866",
"0.60674596",
"0.60665494",
"0.6007614",
"0.5907286",
"0.58952284",
"0.5883466",
"0.5859627",
"0.5855202",
"0.5855202",
"0.5840246... | 0.8192353 | 0 |
checks if user can be allowed to log in returns true if active, false otherwise. | def confirm_login_allowed(self, user):
# if the user has been disabled due to incorrect
# password retries or other.
if not user.is_active:
return False;
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _can_login(self):\n return all([self.user.is_active, self.status, self.status_detail == \"active\"])",
"def is_logged_in(self, params):\n email = self.credentials.get('email', '')\n password = self.credentials.get('password', '')\n if email != '' and password != '':\n r... | [
"0.74850535",
"0.7263313",
"0.7250036",
"0.7241304",
"0.71848375",
"0.7163512",
"0.71529865",
"0.7129357",
"0.7122476",
"0.7118163",
"0.7076311",
"0.7059655",
"0.6992689",
"0.69454676",
"0.69398195",
"0.69063956",
"0.6884993",
"0.6878017",
"0.6828764",
"0.6779906",
"0.6768289... | 0.7590802 | 0 |
Return a properly quoted string for use in PostgreSQL/PostGIS. | def getquoted(self):
if self.is_geometry:
# Psycopg will figure out whether to use E'\\000' or '\000'.
return b"%s(%s)" % (
b"ST_GeogFromWKB" if self.geography else b"ST_GeomFromEWKB",
sql.quote(self.ewkb).encode(),
)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quote(value):\n return DoubleQuotedScalarString(value)",
"def mysql_quote(x):\n if not x:\n return \"NULL\"\n x = x.replace(\"\\\\\", \"\\\\\\\\\")\n x = x.replace(\"'\", \"''\")\n x = x.replace(\"\\n\", \"\\\\n\")\n return \"'{}'\".format(x)",
"def wrap_with_in_single_quote(s):\n ... | [
"0.66940063",
"0.6535666",
"0.64561844",
"0.64561844",
"0.64361304",
"0.63675547",
"0.6357881",
"0.6355792",
"0.6295191",
"0.62618315",
"0.6259162",
"0.62564594",
"0.62517357",
"0.6249715",
"0.6229994",
"0.6216584",
"0.61803275",
"0.61727995",
"0.6152074",
"0.6148209",
"0.614... | 0.7788644 | 0 |
Root for the index page | def home():
return render_template('index.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_root():\r\n return render_template(\"index.html\"), 200",
"def root():\n return render_template('index.html')",
"def root():\n return render_template('index.html')",
"def root():\n return render_template('index.html')",
"def index(self):\n\t\treturn render_template('index.html')",
"de... | [
"0.8357706",
"0.826348",
"0.826348",
"0.826348",
"0.8042331",
"0.80163217",
"0.7997089",
"0.7964683",
"0.79166496",
"0.78900826",
"0.78799087",
"0.78799087",
"0.78580606",
"0.78511083",
"0.78336036",
"0.7790369",
"0.7790369",
"0.77723414",
"0.7759989",
"0.77298236",
"0.772066... | 0.0 | -1 |
Root returning the html page for the research by name | def SNB():
return render_template('search_beer_by_name.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index(name=None):\r\n return render_template('tree.html', name=name)",
"def get_root():\r\n return render_template(\"index.html\"), 200",
"def root():\n return render_template('index.html')",
"def root():\n return render_template('index.html')",
"def root():\n return render_template('ind... | [
"0.71518266",
"0.700399",
"0.650545",
"0.650545",
"0.650545",
"0.6463512",
"0.6368605",
"0.6345228",
"0.63226885",
"0.6291774",
"0.6291713",
"0.62788415",
"0.6246078",
"0.62454176",
"0.621216",
"0.6210487",
"0.62100434",
"0.62030065",
"0.61980915",
"0.61926126",
"0.61920464",... | 0.0 | -1 |
Root returning the html page for the research by type | def STB():
return render_template('search_beer_by_type.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_root():\r\n return render_template(\"index.html\"), 200",
"def search_page():\n return render_template('page_query.html', search_label=g_search_type)",
"def index(self):\n return self.html",
"def homepage():\n\n pagesClassIDs = {\n \"index\": {\n \"bannertitle\": [],... | [
"0.6528258",
"0.6225131",
"0.61879045",
"0.6095944",
"0.6085682",
"0.6076195",
"0.60468364",
"0.60460925",
"0.60460925",
"0.60460925",
"0.60121685",
"0.6006729",
"0.59876305",
"0.59860873",
"0.5931529",
"0.5903275",
"0.5890797",
"0.5873806",
"0.5872985",
"0.586577",
"0.584863... | 0.60617024 | 6 |
Root returning the html page for the research by type | def SBN():
return render_template('search_brass_by_name.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_root():\r\n return render_template(\"index.html\"), 200",
"def search_page():\n return render_template('page_query.html', search_label=g_search_type)",
"def index(self):\n return self.html",
"def homepage():\n\n pagesClassIDs = {\n \"index\": {\n \"bannertitle\": [],... | [
"0.6526285",
"0.6226549",
"0.61902714",
"0.6096911",
"0.6084493",
"0.6078524",
"0.6063341",
"0.60468006",
"0.6043495",
"0.6043495",
"0.6043495",
"0.60107815",
"0.60039276",
"0.5987566",
"0.5986067",
"0.5930123",
"0.5902945",
"0.5890474",
"0.5873914",
"0.587192",
"0.5865682",
... | 0.0 | -1 |
The orbital eccentricity of an astronomical object is a dimensionless parameter that determines the amount by which its orbit around another body deviates from a perfect circle. | def calculate_sun_earth_distance(doy):
#The eccentricity of the Earth's orbit is currently about 0.0167 (wiki)
ec=0.0167
d=1+ec*np.sin(2*np.pi*(doy-93.5)/365)
return d | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def orbital_eccentricity(self):\n return self._orbital_eccentricity",
"def eccentricity(self):\n return sqrt(self.f * 2 - self.f ** 2)",
"def eccentricity(self):\n return self.b / self.a",
"def get_eccentricity(self, ellipse):\r\n a = ellipse.get_width()\r\n b = ellipse.get... | [
"0.78280187",
"0.76185167",
"0.7463858",
"0.6899882",
"0.6563656",
"0.6526555",
"0.6514709",
"0.6452898",
"0.6407958",
"0.6333437",
"0.61290616",
"0.60394335",
"0.5935475",
"0.5917622",
"0.59019893",
"0.59010965",
"0.579957",
"0.5780833",
"0.5757291",
"0.57179886",
"0.5696562... | 0.0 | -1 |
Implements the sigmoid activation in numpy | def sigmoid(x):
return 1 / (1 + np.exp(-x)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(x: np.ndarray \n ) -> np.ndarray:\n return 1/(1+np.exp(-x))",
"def sigmoid(X,W,b):\n preActivation = np.dot(X, W) + b\n return (1.0)/(1.0 + np.exp(-preActivation))",
"def sigmoid_activation(x):\n return 1.0 / (1 + np.exp(-x))",
"def sigmoid(x):\r\n return 1 / (1 + ... | [
"0.8374216",
"0.8308304",
"0.8258762",
"0.8215258",
"0.8140216",
"0.8140216",
"0.8140216",
"0.8140216",
"0.8140216",
"0.8140216",
"0.8125962",
"0.81212926",
"0.81212926",
"0.80962545",
"0.8082652",
"0.8068939",
"0.80095696",
"0.80017805",
"0.79810584",
"0.79777354",
"0.797496... | 0.8150142 | 4 |
Implement the ReLU function. | def relu(x):
return np.maximum(0, x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activation_ReLU(self):\n self.value = max(0, self.value)",
"def ReLU(self, x):\n self.x = x\n output = np.maximum(0, x)\n return output",
"def ReLU(self, x):\r\n self.x = x\r\n return np.maximum(x, 0)",
"def grad_ReLU(self):\n y = self.x\n y[y<=0] = 0\n ... | [
"0.72822386",
"0.7271393",
"0.71400297",
"0.7136918",
"0.7124225",
"0.7032766",
"0.7023254",
"0.6991234",
"0.69314134",
"0.69034207",
"0.68043387",
"0.67393214",
"0.6721696",
"0.6683527",
"0.66653365",
"0.664197",
"0.6638399",
"0.66066414",
"0.66033936",
"0.6565422",
"0.65651... | 0.61091244 | 49 |
Implement the softmax function. | def softmax(Z):
eZ = np.exp(Z)
return eZ / np.sum(eZ, axis=0, keepdims=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(x):\n #pass # TODO: Compute and return softmax(x)\n return np.exp(x) / np.sum(np.exp(x), axis=0)",
"def softmax(x):\n pass # TODO: Compute and return softmax(x)\n\n exp_x = np.exp(x)\n sum_x = np.sum(exp_x, axis=0)\n softmax = exp_x/sum_x\n \n return softmax",
"def softmax(x)... | [
"0.85584295",
"0.84625924",
"0.8452701",
"0.84164464",
"0.84123904",
"0.83744955",
"0.83459204",
"0.8335037",
"0.8330551",
"0.83244663",
"0.83244663",
"0.83173364",
"0.83173364",
"0.83173364",
"0.83173364",
"0.83173364",
"0.83173364",
"0.83173364",
"0.83173364",
"0.83068174",
... | 0.0 | -1 |
Returns reproduction number r0 = alpha/beta | def r0(self):
return self.p[0] / self.p[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def beta_r(r):\n return 0.",
"def beta_r(r):\n return 1.",
"def __call__(self,r):\n return self._n0 * np.power(r / self._r0, self._beta)",
"def beta_r(r, beta):\n return beta",
"def paf_o_r(rr_o_r, alpha):\n return ((rr_o_r - 1) * (1 - alpha)) / ((rr_o_r - 1) * (1 - alpha) + ... | [
"0.72391975",
"0.71805656",
"0.6909802",
"0.67145646",
"0.6412786",
"0.6307231",
"0.6236341",
"0.62304246",
"0.60572386",
"0.6056758",
"0.6043486",
"0.6040426",
"0.6039224",
"0.60373014",
"0.59987295",
"0.5941348",
"0.5939329",
"0.5910442",
"0.59096754",
"0.5882093",
"0.58762... | 0.6232057 | 7 |
Compute the squared euclidean norm of the vector v. | def sqnorm(v):
res = 0
for elt in v:
for coef in elt:
res += coef ** 2
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def norm_l2(v):\n return np.sqrt((v**2).sum())",
"def l2_norm(v):\n res = 0\n for e in v:\n res += e * e\n return math.sqrt(res)",
"def _vector_norms(self, v):\n\n squared_norms = torch.sum(v * v, dim=2, keepdim=True)\n return torch.sqrt(squared_norms + _EPSILON)",
"def n... | [
"0.8256337",
"0.783814",
"0.78128004",
"0.7582021",
"0.75819105",
"0.75708133",
"0.7525605",
"0.75049424",
"0.7483431",
"0.7368641",
"0.73545384",
"0.73465276",
"0.73451006",
"0.7297845",
"0.7261151",
"0.72267026",
"0.71733826",
"0.71725035",
"0.7156548",
"0.7139824",
"0.7091... | 0.76999366 | 3 |
Cleans string from invalid xml chars | def clean_xml_text(text):
return ''.join(c for c in text if _is_valid_xml_char_ordinal(c)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_xml_string(s):\n return VALID_XML_CHARS_REGEX.sub(\"\", s)",
"def _strip_invalid_xml(s):\n if _badchars_re.search(s):\n return ''.join(c for c in s if c >= ' ' or c in '\\r\\n\\t')\n else:\n return s",
"def _strip_invalid_xml(s):\n if _badchars_re.search(s):\n return ''.join(c for c in... | [
"0.850719",
"0.83954096",
"0.83954096",
"0.72456557",
"0.72403455",
"0.7153767",
"0.7001954",
"0.6992978",
"0.6915952",
"0.68697107",
"0.68673575",
"0.6729717",
"0.6655226",
"0.6644862",
"0.6555121",
"0.65412164",
"0.63819826",
"0.63614637",
"0.63292074",
"0.6323433",
"0.6313... | 0.7633763 | 3 |
Return a list of actions that are legal on this state. | def legal_actions(self):
if self.player == TERMINAL: # is terminal
return []
elif self.player == CHANCE: # is chance
if self.phase == PREFLOP: # preflop
return [Action(deal=[i, j, k, l])
for i in range(52) for j in range(52)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def legal_actions(self):\n return self.env.legal_actions()",
"def getLegalActions(self, state):\n return self.actionFn(state)",
"def _get_legal_actions(self):\n return self.game.get_legal_actions()",
"def getLegalActions(self,state):\n return self.actionFn(state)",
"def get_lega... | [
"0.86598456",
"0.84084946",
"0.83560413",
"0.83224756",
"0.81030697",
"0.7812666",
"0.78039294",
"0.7793761",
"0.77919",
"0.77541554",
"0.7734792",
"0.77227455",
"0.76930875",
"0.762101",
"0.7573024",
"0.7525037",
"0.7471483",
"0.7354256",
"0.7349615",
"0.72938585",
"0.725578... | 0.75538623 | 15 |
Return a list of actions and the corresponding probs. | def chance_outcomes(self):
assert self.is_chance()
action_list = self.legal_actions()
dealed_card = [*self.hand[0], *self.hand[1], *self.pub] # dealed cards
if self.phase == PREFLOP: # preflop
prob_list = [1 for _ in action_list]
elif self.phase == FLOP: # flop
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_actions(self):\n return []",
"def get_list_of_actions(self):\n return self.actions",
"def get_actions(g: Game):\n\n act_actions = []\n act = [Income, ForeignAid, Coup, Tax, Assassinate, Exchange, Steal]\n\n opponents = g.get_opponents()\n\n if g.players[g.actio... | [
"0.669156",
"0.6659158",
"0.6619554",
"0.6562846",
"0.65305585",
"0.65180635",
"0.6503766",
"0.6484206",
"0.6476815",
"0.6440216",
"0.6364267",
"0.6362202",
"0.63411444",
"0.63346976",
"0.63285625",
"0.63285625",
"0.63285625",
"0.6326574",
"0.6315716",
"0.6312388",
"0.6238966... | 0.0 | -1 |
Return a string representing this private observation. | def to_string(self):
return ', '.join(INT2STRING_CARD[h] for h in self.hand) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return functools.reduce(\n lambda acc, v: acc + str(v[0]) + \" : \" + str(v[1][1]) + \" - lifetime \" + str(v[1][0]) + os.linesep,\n self.store.items(), \"\")",
"def toString(self) -> str:\n raise NotImplementedError",
"def as_string(self):\n retu... | [
"0.7195241",
"0.7195035",
"0.7160983",
"0.71200967",
"0.71088487",
"0.7105012",
"0.7085656",
"0.7056024",
"0.7056024",
"0.7056024",
"0.70475703",
"0.70475703",
"0.70475703",
"0.70475703",
"0.70475703",
"0.70448",
"0.7038035",
"0.7038035",
"0.7038035",
"0.7038035",
"0.7038035"... | 0.0 | -1 |
Return a string representing this public observation. | def to_string(self):
return '[%s], [%s]' % \
(', '.join(str(x) for x in self.pot),
', '.join(INT2STRING_CARD[p] for p in self.pub)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toString(self) -> str:\n raise NotImplementedError",
"def __str__(self):\n return self._metadata.__str__()",
"def __repr__(self):\n return self._metadata.__str__()",
"def __str__(self):\n return str(self.get_data())",
"def __repr__(self):\n\n return self._metadata.__s... | [
"0.7286663",
"0.72754484",
"0.7257532",
"0.7205884",
"0.71924204",
"0.71608627",
"0.71321154",
"0.7113907",
"0.7097717",
"0.7084852",
"0.7041585",
"0.7041585",
"0.7041585",
"0.7041585",
"0.7041585",
"0.7041585",
"0.7041585",
"0.7041585",
"0.7041585",
"0.7041585",
"0.7041585",... | 0.0 | -1 |
Compute average nDCG (normalized discounted cumulative gain) | def nDCG_at(prediction, target, k=10):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ndcg(pred, y_truth):\n dcg = get_dcg(pred, y_truth)\n idcg = get_dcg(np.concatenate((y_truth, np.zeros_like(pred)[:, :-1] - 1), axis=1), y_truth)\n ndcg = np.sum(dcg / idcg)\n\n return ndcg",
"def mean_average_ndcg(\n gold: Dict[str, Dict[str, float]],\n predicted: Dict[str, List[str]],... | [
"0.68196166",
"0.67877614",
"0.6786507",
"0.67483914",
"0.6706926",
"0.6672952",
"0.6605892",
"0.6601766",
"0.65506625",
"0.6514391",
"0.6454975",
"0.6448409",
"0.6432624",
"0.6382294",
"0.63631606",
"0.6317792",
"0.629096",
"0.6266701",
"0.62477076",
"0.622932",
"0.6205756",... | 0.5646432 | 78 |
Normal distribution for the posterior probability of inclusion. | def ppi_distribution(self, gamma, gamma0, lamb):
X = self.X[:, gamma > gamma0]
return Mvn(cov=(np.dot(X, X.T) + np.ones((self.N, self.N))) / lamb + np.eye(self.N)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stdProbabilityNorm(self):\n return 1./factorial(self.alpha-1)",
"def stdProbabilityNorm(self):\n return 0.5",
"def prior_distribution(self):\n out = self.model.forward(self.inducing_points)\n return MultivariateNormal(out.mean, out.lazy_covariance_matrix.evaluate_kernel())",
"def stdP... | [
"0.7288866",
"0.7156303",
"0.7147321",
"0.6952753",
"0.6805589",
"0.68048084",
"0.6798995",
"0.6757132",
"0.67323875",
"0.66942495",
"0.66304487",
"0.66272825",
"0.65637046",
"0.65617716",
"0.6555045",
"0.6549794",
"0.65467924",
"0.65259063",
"0.64878446",
"0.64718825",
"0.64... | 0.0 | -1 |
Returns the objects related to the object passed. The objects returned are objects that have a ForeignKey or ManyToMany relation to this object. {% admin_related_objects object as varname %} | def do_related_objects(parser, token):
argv = token.contents.split()
argc = len(argv)
if argc != 4:
raise TemplateSyntaxError('Tag %s takes three arguments.' % argv[0])
if argv[2] != "as":
raise TemplateSyntaxError(
'Second argument must be "as" for tag %s' % argv[0]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_related_objects(self):\n result = []\n if self['name'] != None:\n tmp = ObjectDefinition.objects.filter(use__has_field=self['name'], object_type=self['object_type'])\n for i in tmp: result.append(i)\n return result",
"def _get_related_objects(obj, parent_class=F... | [
"0.7277074",
"0.6809379",
"0.66162425",
"0.6217961",
"0.6126145",
"0.59880346",
"0.5941555",
"0.58775675",
"0.5863266",
"0.5788864",
"0.56160843",
"0.55274665",
"0.5517525",
"0.54975504",
"0.5474582",
"0.5471203",
"0.53758085",
"0.53443545",
"0.5307552",
"0.5295954",
"0.52535... | 0.6006163 | 5 |
The home page for Blog. | def index(request):
return render(request, 'blogs/index.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n return render_template(\n 'home.html',\n title='Home Page',\n year=datetime.now().year,\n )",
"def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.now().year)",
"def home():\r\n return render_template(\r\n 'in... | [
"0.7877367",
"0.7829973",
"0.78166866",
"0.77540886",
"0.7737848",
"0.7737848",
"0.7737848",
"0.7737848",
"0.7737848",
"0.7737848",
"0.7737848",
"0.7737848",
"0.7737848",
"0.7737848",
"0.769471",
"0.7604955",
"0.7565687",
"0.7541694",
"0.74914604",
"0.7477588",
"0.7474028",
... | 0.7288314 | 32 |
Returns total number of syllables in book. | def count_syllables(book):
d = dict(cmudict.entries())
with open(book, 'r') as myfile:
booky = myfile.read().lower()
tokenized_book = nltk.word_tokenize(booky)
count = 0
for word in tokenized_book:
count += ( nsly(word, d))
return count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_syllables(target_text):\n\n splited_text = target_text.split()\n count = 0\n for word in splited_text:\n count = count + word_syllables(word)\n return count",
"def count_syllables(words):\n\n\n count = 0\n\n for word in words:\n word_count = count_syllables_in_word(word)... | [
"0.7785605",
"0.7716621",
"0.7569649",
"0.74869156",
"0.7369434",
"0.7332177",
"0.71132255",
"0.7098898",
"0.6956114",
"0.6907962",
"0.67964697",
"0.67526793",
"0.65769607",
"0.6537315",
"0.633141",
"0.62938714",
"0.62645036",
"0.61257887",
"0.60993916",
"0.6010342",
"0.59880... | 0.83955956 | 0 |
Return the length of the results list. | def __len__(self):
return len(self.results) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def results_length(self):\n return len(self.results)",
"def _get_count(results):\n return len(results)",
"def getLength(self):\r\n return len(self.list)",
"def length(self):\n return self.list.length()",
"def __len__(self, *args, **kwargs):\n return len(self._list(*args, ... | [
"0.8703001",
"0.8500213",
"0.77787054",
"0.77677786",
"0.775763",
"0.77503043",
"0.7737082",
"0.7737082",
"0.7685653",
"0.7632525",
"0.7629249",
"0.7500672",
"0.7446326",
"0.74389046",
"0.74316484",
"0.73641866",
"0.73487544",
"0.7341843",
"0.73321754",
"0.7311379",
"0.729135... | 0.8273012 | 2 |
Return a string type name for a list of devices. | def device_type(devices):
num_of_types = len({type(device) for device in devices})
if num_of_types == 1:
return devices[0].list_type.replace("_", " ").title()
elif num_of_types == 0:
return None
else:
raise ValueError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_key(self):\n # Disable this false positive\n # pylint: disable=comparison-with-callable\n if self == SimulatorControlType.DEVICE_TYPE:\n return \"devicetypes\"\n # pylint: enable=comparison-with-callable\n return self.value + \"s\"",
"def _get_types_string(t... | [
"0.68663234",
"0.68302613",
"0.67525816",
"0.67525816",
"0.672367",
"0.6685629",
"0.6634362",
"0.6559478",
"0.65497625",
"0.65267897",
"0.6487262",
"0.6464025",
"0.62769574",
"0.62418765",
"0.62371314",
"0.6230899",
"0.6222495",
"0.6182982",
"0.6177325",
"0.6144248",
"0.61317... | 0.75406253 | 0 |
Compare model identifier strings. | def model_identifier_cmp(model_string_one, model_string_two):
# pylint: disable=invalid-name
VersionIdentifier = namedtuple("VersionIdentifier",
("model", "major", "minor"))
# pylint: enable=invalid-name
model_string_one = model_string_one.split("/")[1].lstrip()
mo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_model_identifier_value(self):\n \n model_identifier = get_model()[1]\n \n # Check to make sure the model_name is 'iMac14,2'\n self.assertEqual(model_identifier, 'iMac14,2')",
"def test_model__identifier_type(self):\n \n model_identifier = get_model()[1]\n... | [
"0.6978288",
"0.6195448",
"0.60066795",
"0.58812845",
"0.57837003",
"0.5781809",
"0.5748857",
"0.5743592",
"0.5714698",
"0.57058364",
"0.56209207",
"0.55575925",
"0.5555534",
"0.5514833",
"0.5497304",
"0.5472849",
"0.54555964",
"0.54188746",
"0.539017",
"0.5377118",
"0.537338... | 0.7887567 | 0 |
Get the names of any nested groups in a group, or an empty set. | def get_nested_groups_names(group):
return (
criterion.findtext("value")
for criterion in group.findall("criteria/criterion") if
criterion.findtext("name") in ("Computer Group", "Mobile Device Group")
and criterion.findtext("search_type") == "member of") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_group_names(self):\r\n return self.groups.keys()",
"def get_nested_groups(self, conn, group: str) -> typing.List[str]:\n nested_groups = list()\n conn.search(\n search_base=self.group_search_base,\n search_filter=self.group_search_filter.format(group=group),\n ... | [
"0.6943205",
"0.65895677",
"0.6354785",
"0.6294683",
"0.62127006",
"0.62059605",
"0.6205548",
"0.612196",
"0.61022216",
"0.60745037",
"0.6058621",
"0.60310787",
"0.5952286",
"0.59136707",
"0.5886393",
"0.58781046",
"0.58683187",
"0.584674",
"0.58396715",
"0.58263063",
"0.5823... | 0.7611141 | 0 |
Test whether a computer or mobile device belongs to any groups. | def has_no_group_membership(device):
excluded_groups = ("All Managed Clients",
"All Managed Servers",
"All Managed iPads",
"All Managed iPhones",
"All Managed iPod touches")
if isinstance(device, jss.Computer):
x... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_group(self) -> bool:\n return (\n self.all_icon is not None and\n self.all_name is not None\n )",
"def is_group(self, group_name):\n\n return group_name in self._group",
"def _check_groups_support(self, groups=()):\n available_groups = set(self.df[self.col_... | [
"0.666216",
"0.6541967",
"0.63930845",
"0.6351154",
"0.63273305",
"0.62523836",
"0.62077874",
"0.62074536",
"0.61606187",
"0.60732967",
"0.6069908",
"0.6068061",
"0.60592157",
"0.60402966",
"0.6002687",
"0.5984734",
"0.59696704",
"0.5957372",
"0.59441864",
"0.5908097",
"0.588... | 0.72874963 | 0 |
Return one of 11 possible emojis depending on how crufty. | def get_cruftmoji(percentage):
level = [
# Master
("\xf0\x9f\x99\x8f \xf0\x9f\x8d\xbb \xf0\x9f\x8d\x95 \xf0\x9f\x91\xbe "
"\xf0\x9f\x8d\x95 \xf0\x9f\x8d\xbb \xf0\x9f\x99\x8f"),
# Snakes on a Plane
"\xf0\x9f\x90\x8d \xf0\x9f\x90\x8d \xe2\x9c\x88\xef\xb8\x8f",
# Furry ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def use_external_emojis(_) -> int:\n return 1 << 18",
"def use_external_emojis(_) -> int:\n return 1 << 18",
"def errors_icons(self):\n msg_errors_lifes = ''\n for i in range(0,5):\n if self.letters_wrong <= i:\n msg_errors_lifes += ' ♥ '\n else:... | [
"0.6567025",
"0.6567025",
"0.63375485",
"0.62036496",
"0.6143666",
"0.592608",
"0.5862783",
"0.5780232",
"0.57539773",
"0.57539773",
"0.572507",
"0.56711566",
"0.564871",
"0.56272715",
"0.5622032",
"0.5613696",
"0.5585724",
"0.55744916",
"0.55687547",
"0.5506249",
"0.5479322"... | 0.6120045 | 5 |
Fix too short version names by appending a '.0'. | def fix_version_counts(version_counts):
result = {}
ignored = ("", "No Version Inventoried")
for version in version_counts:
if version.count(".") < 2 and version not in ignored:
updated_version = "%s.0" % version
else:
updated_version = version
result[updated_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_leading_zeros(version: str) -> str:\n return \".\".join(str(int(i)) for i in version.split(\".\"))",
"def _fix_version(name, version):\n version = sanitise_utf8(version)\n if version.lower().startswith(name.lower()):\n version = version[len(name):].lstrip()\n # Some engines unfortuna... | [
"0.7199843",
"0.68201214",
"0.6550065",
"0.6427278",
"0.63743716",
"0.6311715",
"0.6076412",
"0.5989712",
"0.5967203",
"0.59001505",
"0.589873",
"0.5888319",
"0.583895",
"0.5811692",
"0.5759875",
"0.5753049",
"0.57237196",
"0.5696573",
"0.5650381",
"0.56372654",
"0.5625773",
... | 0.55303335 | 26 |
convert absolute coordonate to 4 Bytes value | def translateCoord(self,absX,absY):
rawConvertedX=hex(absX*(16**4-1)/self.maxX).upper()[2:]
rawConvertedY=hex(absY*(16**4-1)/self.maxY).upper()[2:]
return {'x':rawConvertedX,'y':rawConvertedY} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xyz_to_offset(x, y, z):\n\t\tv = y + (z % 16) * 128 + (x % 16) * 128 * 16\n\t\treturn v",
"def position_gazebo_to_px4(position_x, position_y, position_z):\n return (position_y, position_x, -position_z)",
"def to_pygame(coords):\r\n return (coords[0], HEIGHT - coords[1])",
"def _coord_byval(coord: ... | [
"0.66070604",
"0.6244187",
"0.61635894",
"0.6148397",
"0.611203",
"0.60815185",
"0.6060567",
"0.6018708",
"0.59008324",
"0.589413",
"0.5856754",
"0.58427817",
"0.5830466",
"0.5777125",
"0.57556987",
"0.5745004",
"0.57238126",
"0.57170296",
"0.56844836",
"0.56825894",
"0.56577... | 0.64513665 | 1 |
Computes the accuracy over the k top predictions for the specified values of k | def accuracy(output, target, topk=(1, )):
with torch.no_grad():
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, -1).expand_as(pred))
res = []
for k in topk:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topk_accuracy(y, y_pred, k=2):\n pred = []\n for i in range(len(y)):\n if y[i] in y_pred[i][:k]:\n pred.append(1)\n else:\n pred.append(0)\n return sum(pred) / len(pred)",
"def accuracy(y_pred, y_actual, topk=(1, )):\n maxk = max(topk)\n batch_size = y_actua... | [
"0.8331214",
"0.8284662",
"0.82381004",
"0.8229767",
"0.82202226",
"0.81864446",
"0.81847763",
"0.8175173",
"0.8171541",
"0.81699467",
"0.81664646",
"0.81645083",
"0.81637454",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"... | 0.0 | -1 |
Restore weights and optimizer (if needed ) for resuming job. | def restore_snapshot(net, snapshot ):
checkpoint = torch.load(snapshot, map_location=torch.device('cpu'))
print("Checkpoint Load Compelete")
if 'state_dict' in checkpoint:
net = forgiving_state_restore1(net, checkpoint['state_dict'])
else:
net = forgiving_state_restore1(net, checkpoint)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _restore(self, checkpoint):\n checkpoint_path = os.path.join(checkpoint, \"model_weights\")\n self.model.load_weights(checkpoint_path)",
"def restore(self):\n\n self.brain.restore_checkpoint()",
"def restore(self):\n # For multi-worker training, it should not restore a model in ... | [
"0.7119056",
"0.70205605",
"0.6907856",
"0.68798095",
"0.6837659",
"0.6772707",
"0.6730122",
"0.65198785",
"0.6509292",
"0.6508566",
"0.64382255",
"0.6432103",
"0.63515466",
"0.63054734",
"0.6265027",
"0.6233326",
"0.6201555",
"0.6145458",
"0.6145122",
"0.61347353",
"0.612845... | 0.0 | -1 |
Check whether the given string represents a valid python version | def _is_python_version(s: str) -> bool:
return s.startswith("2") or s.startswith("3") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_py_version(self, cur_version):\n\n # convert cur_version to string, in case of erroneous type being passed\n cur_version = str(cur_version)\n\n acceptable_python_versions_regex = r\"(^(2\\.[6-9])(\\.?\\d{1,2})?$)|(^(3\\.[3-9])(\\.?\\d{1,2})?$)\"\n pyversions_regex_compiled = r... | [
"0.74447066",
"0.7330632",
"0.7022275",
"0.6937966",
"0.6863343",
"0.6863179",
"0.6793033",
"0.677648",
"0.67668253",
"0.6706832",
"0.6671179",
"0.66470045",
"0.66288424",
"0.65482163",
"0.6381573",
"0.637296",
"0.6329869",
"0.6312826",
"0.6312826",
"0.6312826",
"0.62636757",... | 0.81249535 | 0 |
Get the path for active python in the given directory | def get_path(cls, directory: Path) -> Path:
if directory.is_dir() is False:
raise Failure(f"{directory} is not a valid directory")
os.chdir(directory)
s = run([cls.command, "which", "python"])
path = Path(s)
if not path.exists():
raise Failure(f"No inst... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_python_path():\n\n return get_executable_path('python')",
"def pythonDir():\n return os.path.join(os.environ['HARNESSEDJOBSDIR'], 'python')",
"def get_current_directory():\n\treturn os.path.dirname(os.path.abspath(__file__))",
"def find_path():\n __dir_path__ = os.path.dirname(os.path.realpa... | [
"0.7562546",
"0.7083301",
"0.70489687",
"0.69727075",
"0.69444495",
"0.6939245",
"0.68965137",
"0.68411326",
"0.6833725",
"0.6819511",
"0.6788487",
"0.6765462",
"0.6740548",
"0.66992974",
"0.66988534",
"0.66935587",
"0.6669517",
"0.6659536",
"0.6639811",
"0.66193503",
"0.6602... | 0.6841182 | 7 |
Helper to get queried attribute. | def get_attr(name):
userDoc = get_user()
_idx = userDoc.index.get(name, None)
if _idx is not None:
return userDoc.attributes[_idx]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attr(self, location, attr, default=None):\r\n return self.get_attrs(location).get(attr, default)",
"def get_attribute(self, attribute):\r\n return self.connection.get_instance_attribute(self.id, attribute)",
"def get(self, att):\n return getattr(self, att)",
"def GetAttribute(sel... | [
"0.70982933",
"0.7097095",
"0.70338535",
"0.70269656",
"0.69855034",
"0.69594824",
"0.69408405",
"0.69294626",
"0.69254637",
"0.69254637",
"0.69254637",
"0.68924475",
"0.6887434",
"0.6845008",
"0.681378",
"0.68136615",
"0.6806163",
"0.67859304",
"0.6744062",
"0.6744062",
"0.6... | 0.69464725 | 6 |
Should return an http status 404 and an error message. | def test_list_monitorings_project_not_found(self):
project_id = "unk"
deployment_id = util.MOCK_UUID_1
rv = TEST_CLIENT.get(
f"/projects/{project_id}/deployments/{deployment_id}/monitorings"
)
result = rv.json()
expected = {
"message": "The specif... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found():\n return HttpError(404)",
"def not_found(self, error):\n return jsonify({'error': 'NOT FOUND'}), 404",
"def not_found(error): # pylint: disable=unused-argument\n response = jsonify(\n {\"success\": False, \"error_code\": 404, \"message\": \"Not Found\"}\n )\n return resp... | [
"0.86022556",
"0.82611316",
"0.82373637",
"0.82098895",
"0.8153758",
"0.8137346",
"0.808005",
"0.8071249",
"0.80642635",
"0.8042712",
"0.80237705",
"0.7994343",
"0.7963002",
"0.7930394",
"0.79154456",
"0.79148245",
"0.7886975",
"0.7877872",
"0.78738564",
"0.7865025",
"0.78615... | 0.0 | -1 |
Should return an http status 404 and an error message. | def test_list_monitorings_deployment_not_found(self):
project_id = util.MOCK_UUID_1
deployment_id = "unk"
rv = TEST_CLIENT.get(
f"/projects/{project_id}/deployments/{deployment_id}/monitorings"
)
result = rv.json()
expected = {
"message": "The spe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found():\n return HttpError(404)",
"def not_found(self, error):\n return jsonify({'error': 'NOT FOUND'}), 404",
"def not_found(error): # pylint: disable=unused-argument\n response = jsonify(\n {\"success\": False, \"error_code\": 404, \"message\": \"Not Found\"}\n )\n return resp... | [
"0.8601373",
"0.82612085",
"0.8237346",
"0.8210479",
"0.8152887",
"0.81378824",
"0.8080897",
"0.80714935",
"0.8064683",
"0.80421686",
"0.8023202",
"0.79937464",
"0.7961655",
"0.7928829",
"0.7915655",
"0.79152226",
"0.78884727",
"0.7876903",
"0.78733194",
"0.7863459",
"0.78610... | 0.0 | -1 |
Should return an http status 404 and an error message. | def test_create_monitoring_project_not_found(self):
project_id = "unk"
deployment_id = util.MOCK_UUID_1
task_id = util.MOCK_UUID_1
rv = TEST_CLIENT.post(
f"/projects/{project_id}/deployments/{deployment_id}/monitorings",
json={
"taskId": task_id,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found():\n return HttpError(404)",
"def not_found(self, error):\n return jsonify({'error': 'NOT FOUND'}), 404",
"def not_found(error): # pylint: disable=unused-argument\n response = jsonify(\n {\"success\": False, \"error_code\": 404, \"message\": \"Not Found\"}\n )\n return resp... | [
"0.8601373",
"0.82612085",
"0.8237346",
"0.8210479",
"0.8152887",
"0.81378824",
"0.8080897",
"0.80714935",
"0.8064683",
"0.80421686",
"0.8023202",
"0.79937464",
"0.7961655",
"0.7928829",
"0.7915655",
"0.79152226",
"0.78884727",
"0.7876903",
"0.78733194",
"0.7863459",
"0.78610... | 0.0 | -1 |
Should return an http status 404 and an error message. | def test_create_monitoring_deployment_not_found(self):
project_id = util.MOCK_UUID_1
deployment_id = "unk"
task_id = util.MOCK_UUID_1
rv = TEST_CLIENT.post(
f"/projects/{project_id}/deployments/{deployment_id}/monitorings",
json={
"taskId": task_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found():\n return HttpError(404)",
"def not_found(self, error):\n return jsonify({'error': 'NOT FOUND'}), 404",
"def not_found(error): # pylint: disable=unused-argument\n response = jsonify(\n {\"success\": False, \"error_code\": 404, \"message\": \"Not Found\"}\n )\n return resp... | [
"0.86022556",
"0.82611316",
"0.82373637",
"0.82098895",
"0.8153758",
"0.8137346",
"0.808005",
"0.8071249",
"0.80642635",
"0.8042712",
"0.80237705",
"0.7994343",
"0.7963002",
"0.7930394",
"0.79154456",
"0.79148245",
"0.7886975",
"0.7877872",
"0.78738564",
"0.7865025",
"0.78615... | 0.0 | -1 |
Should return an http status 404 and an error message. | def test_delete_monitoring_project_not_found(self):
project_id = "unk"
deployment_id = util.MOCK_UUID_1
monitoring_id = util.MOCK_UUID_1
rv = TEST_CLIENT.delete(
f"/projects/{project_id}/deployments/{deployment_id}/monitorings/{monitoring_id}"
)
result = rv.j... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found():\n return HttpError(404)",
"def not_found(self, error):\n return jsonify({'error': 'NOT FOUND'}), 404",
"def not_found(error): # pylint: disable=unused-argument\n response = jsonify(\n {\"success\": False, \"error_code\": 404, \"message\": \"Not Found\"}\n )\n return resp... | [
"0.8601373",
"0.82612085",
"0.8237346",
"0.8210479",
"0.8152887",
"0.81378824",
"0.8080897",
"0.80714935",
"0.8064683",
"0.80421686",
"0.8023202",
"0.79937464",
"0.7961655",
"0.7928829",
"0.7915655",
"0.79152226",
"0.78884727",
"0.7876903",
"0.78733194",
"0.7863459",
"0.78610... | 0.0 | -1 |
Should return an http status 404 and an error message. | def test_delete_monitoring_deployment_not_found(self):
project_id = util.MOCK_UUID_1
deployment_id = "unk"
monitoring_id = util.MOCK_UUID_1
rv = TEST_CLIENT.delete(
f"/projects/{project_id}/deployments/{deployment_id}/monitorings/{monitoring_id}"
)
result = r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found():\n return HttpError(404)",
"def not_found(self, error):\n return jsonify({'error': 'NOT FOUND'}), 404",
"def not_found(error): # pylint: disable=unused-argument\n response = jsonify(\n {\"success\": False, \"error_code\": 404, \"message\": \"Not Found\"}\n )\n return resp... | [
"0.86022556",
"0.82611316",
"0.82373637",
"0.82098895",
"0.8153758",
"0.8137346",
"0.808005",
"0.8071249",
"0.80642635",
"0.8042712",
"0.80237705",
"0.7994343",
"0.7963002",
"0.7930394",
"0.79154456",
"0.79148245",
"0.7886975",
"0.7877872",
"0.78738564",
"0.7865025",
"0.78615... | 0.0 | -1 |
Should return an http status 404 and an error message. | def test_delete_monitoring_monitoring_not_found(self):
project_id = util.MOCK_UUID_1
deployment_id = util.MOCK_UUID_1
monitoring_id = "unk"
rv = TEST_CLIENT.delete(
f"/projects/{project_id}/deployments/{deployment_id}/monitorings/{monitoring_id}"
)
result = r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found():\n return HttpError(404)",
"def not_found(self, error):\n return jsonify({'error': 'NOT FOUND'}), 404",
"def not_found(error): # pylint: disable=unused-argument\n response = jsonify(\n {\"success\": False, \"error_code\": 404, \"message\": \"Not Found\"}\n )\n return resp... | [
"0.8601373",
"0.82612085",
"0.8237346",
"0.8210479",
"0.8152887",
"0.81378824",
"0.8080897",
"0.80714935",
"0.8064683",
"0.80421686",
"0.8023202",
"0.79937464",
"0.7961655",
"0.7928829",
"0.7915655",
"0.79152226",
"0.78884727",
"0.7876903",
"0.78733194",
"0.7863459",
"0.78610... | 0.0 | -1 |
Returns true if the provided object implements the Iterator protocol. | def is_iterable_object(maybe_iterable: Any) -> TypeGuard[Iterable[Any]]:
return isinstance(maybe_iterable, Iterable) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_iterator(obj: Any) -> bool:\n if isinstance(obj, collections.abc.Iterator):\n return True\n else:\n try:\n return iter(obj) is obj\n except TypeError:\n return False",
"def is_iterator(obj):\n return isinstance(obj, collections.Iterator)",
"def isiter(... | [
"0.8337663",
"0.8299476",
"0.80922854",
"0.8057298",
"0.7657138",
"0.74885035",
"0.72379875",
"0.7170091",
"0.71605206",
"0.7148956",
"0.7131922",
"0.7047104",
"0.69412667",
"0.691677",
"0.6825715",
"0.680818",
"0.67591816",
"0.66951716",
"0.66315585",
"0.66218334",
"0.656737... | 0.6146083 | 33 |
Choose one of the available spaces at random. | def move(self, board):
return self.prng.choice(board.available()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_move(self):\n available_idx = self.get_empty_cells(self.game_board)\n return random.choice(available_idx)",
"def computer_generate(self):\n return choice[random.randrange(3)]",
"def random_legal_move():\n return random.choice(legal_moves())",
"def set_random_pos(self, which... | [
"0.6644468",
"0.65745157",
"0.65449625",
"0.64980185",
"0.6402974",
"0.63817537",
"0.6332596",
"0.63188535",
"0.62858623",
"0.62836856",
"0.6280182",
"0.6275261",
"0.6240819",
"0.62334204",
"0.6229517",
"0.6214013",
"0.6209196",
"0.62025917",
"0.62025917",
"0.6199751",
"0.618... | 0.0 | -1 |
This displays the model by name on the admin page. | def __str__(self):
return "{}".format(self.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"",
"def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"",
"def __str__(self):\n return '%s%s' % (self.name, ' - %s' % self.model ... | [
"0.6695711",
"0.6695711",
"0.6662807",
"0.65950143",
"0.65140057",
"0.64212745",
"0.64084584",
"0.6307663",
"0.63022935",
"0.62886703",
"0.6280314",
"0.6266664",
"0.6224261",
"0.61994815",
"0.61883676",
"0.61868787",
"0.61868787",
"0.61868787",
"0.61868787",
"0.61868787",
"0.... | 0.0 | -1 |
This displays the model by name on the admin page. | def __str__(self):
return "{}".format(self.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"",
"def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"",
"def __str__(self):\n return '%s%s' % (self.name, ' - %s' % self.model ... | [
"0.6695711",
"0.6695711",
"0.6662807",
"0.65950143",
"0.65140057",
"0.64212745",
"0.64084584",
"0.6307663",
"0.63022935",
"0.62886703",
"0.6280314",
"0.6266664",
"0.6224261",
"0.61994815",
"0.61883676",
"0.61868787",
"0.61868787",
"0.61868787",
"0.61868787",
"0.61868787",
"0.... | 0.0 | -1 |
The dimensions of precisionrecall pairs and the threshold array as returned by the precision_recall_curve do not match. See | def precision_recall_curve_padded_thresholds(*args, **kwargs):
precision, recall, thresholds = precision_recall_curve(*args, **kwargs)
pad_threshholds = len(precision) - len(thresholds)
return np.array(
[
precision,
recall,
np.pad(
thresholds.ast... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision_recall(conf_matrix):\n tp_count, fp_count, fn_count, tn_count = conf_matrix[0][0], conf_matrix[0][1], conf_matrix[1][0], conf_matrix[1][1]\n\n precision = tp_count / (tp_count + fp_count)\n recall = tp_count / (tp_count + fn_count)\n\n return precision, recall",
"def get_recall_precisio... | [
"0.7177185",
"0.7045364",
"0.7026384",
"0.6845471",
"0.68372846",
"0.6829216",
"0.6818164",
"0.67471033",
"0.6685049",
"0.6655031",
"0.64583284",
"0.6440449",
"0.6434439",
"0.64254624",
"0.6418355",
"0.63954383",
"0.63170344",
"0.6279185",
"0.6272634",
"0.62675256",
"0.625429... | 0.7098985 | 1 |
return interpolated value at x_value. | def return_interpolated(self, x_value):
return(self.interpolator(x_value)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value(self, x):\n if isinstance(x, (float,int)):\n return self._values[x >= self._boundaries[:-1]][-1]\n else:\n a = array([self._values[xi >= self._boundaries[:-1]][-1]\n for xi in x])\n return a",
"def forward(self, x):\n\n x, _ = ... | [
"0.62994534",
"0.62738",
"0.625843",
"0.62478894",
"0.6244222",
"0.60957986",
"0.6045555",
"0.60391104",
"0.59283876",
"0.59247386",
"0.5880117",
"0.587197",
"0.5866072",
"0.5864174",
"0.58335346",
"0.5822205",
"0.5817974",
"0.57609636",
"0.5758676",
"0.5747015",
"0.57192165"... | 0.8097388 | 0 |
Subclass in order to add the rule to the slider item. | def setParentItem(self, slider):
slider.add_playhead(self)
super(PlayHead, self).setParentItem(slider) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handlerAddStyleRuleBased(self):\r\n label = self.lineEditStyleRuleBasedLabel.text()\r\n rule = self.lineEditStyleRuleBasedRule.text()\r\n minScale = self.lineEditStyleRuleBasedMinScale.text()\r\n maxScale = self.lineEditStyleRuleBasedMaxScale.text()\r\n color = self.styleRule... | [
"0.6723161",
"0.63749236",
"0.6139047",
"0.6133178",
"0.60384727",
"0.59751016",
"0.5967557",
"0.5820276",
"0.57753646",
"0.5770467",
"0.5737536",
"0.558499",
"0.5513774",
"0.5493107",
"0.54557705",
"0.54520506",
"0.54223937",
"0.5417049",
"0.5415537",
"0.5415537",
"0.5415537... | 0.6001417 | 5 |
Returns the value to which the specified key is mapped, or 1 if this map contains no mapping for the key | def get(self, key: int) -> int:
index = key % 10000
head = self.array[index]
while head.next:
head = head.next
if head.key == key:
return head.value
break
return -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, key: int) -> int:\n if key not in self.map:\n return -1\n return self.map[key]",
"def get(self, key: int) -> int:\n if key in self.hashmap.keys():return self.hashmap[key]\n else:return -1",
"def get(self, key: int) -> int:\n sh = key % 37\n if ... | [
"0.800388",
"0.79098475",
"0.762993",
"0.75650334",
"0.7556994",
"0.7529803",
"0.75259614",
"0.7493149",
"0.73738897",
"0.7294419",
"0.72940016",
"0.72216845",
"0.72175443",
"0.7181078",
"0.71774393",
"0.71633786",
"0.6980779",
"0.69289523",
"0.67850846",
"0.6757027",
"0.6734... | 0.65512466 | 24 |
Performs an inference procedure for the variable assignment. For P6, you do not need to modify this method. | def inference(csp, variable):
return ac3(csp, csp.constraints[variable].arcs()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def infer(self):\n self.eval()",
"def inference(self):\n raise NotImplementedError",
"def __inferences(self, assigned_var, assigned_value, unassigned_vars, do_forward_checking):\n if do_forward_checking:\n return self.__forward_check(assigned_var, assigned_value, unassigned_vars... | [
"0.6580878",
"0.6569979",
"0.62071455",
"0.60597503",
"0.5969006",
"0.5884746",
"0.58129644",
"0.5805516",
"0.5692675",
"0.56916887",
"0.56907713",
"0.55483824",
"0.550083",
"0.54945976",
"0.54705995",
"0.54051304",
"0.53417045",
"0.52972716",
"0.5278558",
"0.5272839",
"0.526... | 0.5018627 | 42 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.