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 |
|---|---|---|---|---|---|---|
Gets a Github Token with read permission to repositories | def get_read_token(repo_names: List[str]) -> None:
github_app = get_default_app()
print(github_app.get_read_token(repo_names)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_github_credendial(cls) -> 'ApiCredential':\n return cls.select_token_for_api(GITHUB_API_NAME)",
"def get_read_token(self, repo_names: List[str]) -> str:\n permissions = {\"contents\": \"read\", \"metadata\": \"read\"}\n return self.get_access_token(repo_names, permissions)",
"def _get_... | [
"0.7387772",
"0.7310122",
"0.7079352",
"0.67610556",
"0.6747762",
"0.65138876",
"0.64705503",
"0.6427944",
"0.63560885",
"0.6353343",
"0.63503027",
"0.62757635",
"0.61785406",
"0.6149585",
"0.61333126",
"0.6116818",
"0.60957575",
"0.6039983",
"0.59864056",
"0.597834",
"0.5973... | 0.7279384 | 2 |
A function wrapper for building a learning rate scheduler. | def build_lr_scheduler(
optimizer, lr_scheduler='single_step', stepsize=1, gamma=0.1, max_epoch=1
):
if lr_scheduler not in AVAI_SCH:
raise ValueError(
'Unsupported scheduler: {}. Must be one of {}'.format(
lr_scheduler, AVAI_SCH
)
)
if lr_scheduler =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_learning_rate_scheduler(learning_rate_config, optimizer, last_step=-1):\n lr_scheduler = None\n learning_rate_type = learning_rate_config.name \n if learning_rate_type == 'constant_learning_rate': \n\n lr_scheduler = learning_schedules.Constant(\n optimizer, last_step=last_s... | [
"0.7849696",
"0.7779848",
"0.7745376",
"0.7688309",
"0.7579843",
"0.74913406",
"0.74640185",
"0.74192744",
"0.73198134",
"0.73039937",
"0.72971547",
"0.71846557",
"0.7142559",
"0.71160966",
"0.7096039",
"0.70351356",
"0.7002144",
"0.69859546",
"0.6950903",
"0.6946901",
"0.689... | 0.67938167 | 25 |
Guesses a colour, returns the default if no match is found | def guess_colour(dbo, s):
s = str(s).lower()
guess = db.query_int(dbo, "SELECT ID FROM basecolour WHERE LOWER(BaseColour) LIKE '%" + db.escape(s) + "%'")
if guess != 0: return guess
return configuration.default_colour(dbo) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_color(search=None): \r\n if search: c = choice(search_color(search))\r\n else: c = choice(THECOLORS.values())\r\n \r\n #debug: print type(c), c # returns Color()\r\n return c \r\n #todo: exception on color search fail? OR just default to white.\r",
"def switch_color(color):\n r... | [
"0.6791012",
"0.6592608",
"0.6582971",
"0.647639",
"0.6476061",
"0.6469066",
"0.6398306",
"0.6297382",
"0.6289832",
"0.6283404",
"0.62643576",
"0.62418836",
"0.6221776",
"0.6208019",
"0.6178082",
"0.6163309",
"0.6141463",
"0.6132341",
"0.60855573",
"0.6077534",
"0.6070446",
... | 0.7375512 | 0 |
Initialize a DaCeimplemented multihead attention PyTorch module. | def __init__(self, N: int, P: int, H: int, csdfg_fwd: CompiledSDFG,
csdfg_bwd: CompiledSDFG):
super().__init__()
class DaceMHAFunction(torch.autograd.Function):
@staticmethod
def forward(ctx, Q, K, V, WQ, WK, WV, WO, BQ, BK, BV, BO, scaler):
B, S... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, nheads, d_model):\n super(MultiheadAttention, self).__init__()\n assert d_model % nheads == 0\n self.d_head = d_model // nheads\n self.nheads = nheads\n self.Q_fc = nn.Linear(d_model, d_model, bias=False)\n self.K_fc = nn.Linear(d_model, d_model, bias=Fa... | [
"0.7738021",
"0.7225716",
"0.7188873",
"0.71433127",
"0.6949075",
"0.6805467",
"0.67051935",
"0.66981596",
"0.66740984",
"0.66501826",
"0.65999836",
"0.65987265",
"0.65954155",
"0.6575898",
"0.65744156",
"0.6553042",
"0.652043",
"0.64934283",
"0.6457721",
"0.64190143",
"0.640... | 0.0 | -1 |
Returns seconds which is time scale. If interval is a number or None then it will be returned as is. | def get_seconds(interval):
if type(interval) is str:
interval_array = interval.split(' ')
try:
seconds = int(interval_array[0]) * TIME_SCALES[interval_array[1]]
except KeyError:
raise ValueError(
"Valid time scales are: {}".format(list(TIME_SCALES.keys... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interval_in_seconds(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"interval_in_seconds\")",
"def interval_in_seconds(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"interval_in_seconds\")",
"def seconds(input=None):\n return int(get(input))",
"def tes... | [
"0.7456817",
"0.7456817",
"0.6764808",
"0.6740406",
"0.65838325",
"0.65742934",
"0.6473396",
"0.6360262",
"0.6293837",
"0.6252214",
"0.6231419",
"0.61289465",
"0.611509",
"0.60646194",
"0.6055807",
"0.6055807",
"0.6032851",
"0.59701806",
"0.5958458",
"0.5955375",
"0.5934544",... | 0.85071343 | 0 |
Create a product from the json data returned from the Product Search API. | def _fromResponse(product_search, res):
# Make sure that product_labels is in dictionary format
productLabels = {x.key: x.value for x in res.product_labels}
return ProductSearch.Product(product_search,
res.name.split('/')[-1],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_product():\n mongo = MongoClient(Config.MONGO_URI)\n db_operations = mongo.db.product\n data = request.get_json(force=True) or {}\n if 'title' not in data or 'description' not in data or 'params' not in data:\n return bad_request(t['empty_field'])\n new_prod... | [
"0.7498883",
"0.70483845",
"0.70462334",
"0.7044836",
"0.701214",
"0.6864494",
"0.67393345",
"0.6659015",
"0.66534173",
"0.66290975",
"0.6561353",
"0.6543359",
"0.6532279",
"0.6494103",
"0.64888674",
"0.64522445",
"0.63930166",
"0.6344582",
"0.6324028",
"0.62965256",
"0.62424... | 0.74443066 | 1 |
Get last time this product set was indexed. If the index time is earlier than the time you last added a product, it will not appear in search results until the Product Set reindexes. | def indexTime(self):
productSet = self.productSearch.productClient.get_product_set(name=self.productSetPath)
return productSet.index_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time(self):\r\n return self._idx",
"def time(self):\n ret = self._iamcache.get(\"time\")\n if ret is None:\n ret = self._iamcache[\"time\"] = (\n self.index[self].unique(level=self.time_col).rename(\"time\")\n )\n return ret",
"def last_docum... | [
"0.66522974",
"0.6182011",
"0.6089155",
"0.6050553",
"0.5941267",
"0.5927229",
"0.59171355",
"0.58857304",
"0.5860285",
"0.58460665",
"0.5834782",
"0.5805024",
"0.5805018",
"0.58038545",
"0.57632357",
"0.57454723",
"0.57153594",
"0.5638861",
"0.5636076",
"0.5619813",
"0.56198... | 0.8193868 | 0 |
Outputs A modified so that i roots as heap Running time O(log n) where n = len(A) i | def max_heapify(self, A, i):
left = 2*i + 1
right = 2*i + 2
largest = i
if left < len(A) and A[left] > A[largest]:
largest = left
if right < len(A) and A[right] > A[largest]:
largest = right
if largest != i:
A[i], A[largest] = A[largest... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buildHeap(A):\n n = len(A)\n for i in range(n/2-1, -1, -1):\n heapify(A, i, n)",
"def build_heap(self, A: list):\n self.size = len(A)\n med = (self.size // 2) - 1 #Mid point of array\n for i in range(0, med + 1): #Reverse iteration\n self.heapify(A, med - i) #Reve... | [
"0.79016423",
"0.7454378",
"0.7124237",
"0.7110272",
"0.7069974",
"0.6971415",
"0.69335365",
"0.68902016",
"0.6851346",
"0.6814442",
"0.6814442",
"0.68043345",
"0.67402476",
"0.66724306",
"0.6638959",
"0.6593657",
"0.6581417",
"0.65676486",
"0.6556157",
"0.6555345",
"0.652151... | 0.62143147 | 40 |
Find the unique elements of an array. Returns the sorted unique elements of an array. There are two optional | def unique(array, return_index=True, sort_method='heapsort', eqtest=None):
# Sort out array input
try:
array = array.flatten()
except AttributeError:
array = numpy.asanyarray(array).flatten()
if array.size == 0:
return array, numpy.empty(0, numpy.bool)
# Set default equality... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_of_an_array(an_array):\n temp_array=an_array.copy()\n u=[]\n for i in range(temp_array.shape[0]):\n for j in range(temp_array.shape[1]):\n if temp_array[i][j] not in u:\n u.append(temp_array[i][j])\n return sorted(u)",
"def get_uniques(array):\n uniques ... | [
"0.7895159",
"0.77486396",
"0.76251596",
"0.7546038",
"0.72094685",
"0.70403975",
"0.6956301",
"0.67612815",
"0.67004484",
"0.6602756",
"0.6551391",
"0.6526171",
"0.6505714",
"0.65007806",
"0.64474136",
"0.6394503",
"0.6385466",
"0.6381785",
"0.6340869",
"0.6312722",
"0.62444... | 0.6896009 | 7 |
Generate a resampled dataset. The locations of the resampled points are uniformly distributed over the range specified in `dataset_bounds`, which defaults to the range of dataset values supplied. | def resample(self, nsamples, dataset_bounds=None, derivative=0):
if dataset_bounds is None:
dataset_bounds = self.dataset_bounds
resampled_dataset = numpy.linspace(dataset_bounds[0],
dataset_bounds[1], nsamples)
resampled_data = super(ReSampler, self).__call__(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rasterio_resample(dataset: Dataset, target_resolution: float, new_nodata: object = 'auto',\n resampling_method: Optional[rio_warp.Resampling] = rio_warp.Resampling.nearest,\n output_datatype: Optional[np.dtype] = np.float32) -> Dataset:\n\n # Detect if resolution is... | [
"0.6177836",
"0.5973422",
"0.573592",
"0.5733487",
"0.56775",
"0.5676367",
"0.5605578",
"0.56042117",
"0.55405045",
"0.5480263",
"0.54776436",
"0.5419227",
"0.53671426",
"0.533729",
"0.53324777",
"0.5328067",
"0.5327083",
"0.5310376",
"0.5303807",
"0.52804357",
"0.5250357",
... | 0.79123914 | 0 |
Is the user allowed to view the preview? Users are only allowed to view the preview if they are authenticated, active and staff. | def allowed_to_preview(user):
if (
user.is_authenticated and
user.is_active and
user.is_staff
):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_view(self, user):\r\n return True",
"def can_be_viewed_by(self,user):\n return True",
"def is_user_allowed(self, user):\n return user.is_staff",
"def can_display(self, course, settings, is_user_authenticated, is_user_staff): # pylint: disable=unused-argument\r\n return Tr... | [
"0.7940508",
"0.7478894",
"0.7212289",
"0.72064805",
"0.71978396",
"0.7196774",
"0.71805835",
"0.71690965",
"0.71659327",
"0.7146282",
"0.71011174",
"0.7052857",
"0.7052857",
"0.7052857",
"0.70442736",
"0.70260257",
"0.70224893",
"0.7004919",
"0.69929826",
"0.6981269",
"0.691... | 0.9033856 | 0 |
foldr(function, start, iterable) > object Like foldl, but starts from the end of the iterable and works back toward the beginning. For example, foldr(subtract, 0, [1, 2, 3]) == 2, but foldl(subtract, 0, [1, 2, 3] == 6 foldr(add, 0, [1, 2, 3]) is equivalent to add(1, add(2, add(3, 0))) | def foldr(func, start, itr):
return _foldr(func, start, iter(itr)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def foldl(func, start, itr):\n return _foldl(func, start, iter(itr))",
"def foldr(link, fn, z):\n \"*** YOUR CODE HERE ***\"",
"def test_foldr(self):\n self.assertEqual(irc._foldr(operator.sub, 0, [1, 2, 3, 4]), -2)\n\n def insertTop(l, x):\n l.insert(0, x)\n return l\... | [
"0.67027456",
"0.63476676",
"0.6247557",
"0.6058404",
"0.5948072",
"0.56335634",
"0.55745715",
"0.5551692",
"0.49912998",
"0.49440706",
"0.48623773",
"0.48449233",
"0.48414975",
"0.48338562",
"0.4824202",
"0.4808052",
"0.4808052",
"0.4808052",
"0.4808052",
"0.4808052",
"0.478... | 0.7946261 | 0 |
Return the version as a Python package version string. | def get_package_version():
major, minor, micro, patch, tag, relnum = __version_info__
version = '%s.%s' % (major, minor)
if micro or patch:
version += '.%s' % micro
if patch:
version += '.%s' % patch
if tag != 'final':
version += '%s%s' % (
{
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getVersionString():\n return str(version_gen.major) + \".\" + str(version_gen.minor) + \".\" + str(version_gen.compilation)",
"def get_version_from_package() -> str:\n path = join(dirname(__file__), \"__init__.py\")\n path = normpath(abspath(path))\n with open(path) as f:\n for line in f:\... | [
"0.781467",
"0.7790437",
"0.7787523",
"0.7787523",
"0.7773163",
"0.77701145",
"0.7719859",
"0.7705339",
"0.77032787",
"0.76754713",
"0.76419526",
"0.7596152",
"0.755743",
"0.75404084",
"0.7529081",
"0.7506281",
"0.7482529",
"0.7471795",
"0.7460003",
"0.745641",
"0.7394729",
... | 0.8149712 | 0 |
Return whether this is a released version. | def is_release():
return VERSION[-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_release(self):\n # version string: N.N.N.N is for release.\n return bool(re.match(r'^[\\d.]+$', self.version))",
"def is_stable(self) -> bool:\n return not self.is_prerelease",
"def is_0_release(release: str) -> bool:\n if release == \"current_branch\":\n return False\n ... | [
"0.82170546",
"0.76478016",
"0.7483884",
"0.68960065",
"0.6733261",
"0.67243564",
"0.66759247",
"0.66672075",
"0.6560802",
"0.6552664",
"0.65391153",
"0.6336297",
"0.62675583",
"0.6216027",
"0.620669",
"0.61960965",
"0.61671126",
"0.61387235",
"0.6137363",
"0.61221856",
"0.61... | 0.8087608 | 1 |
Convert categorical columns to numeric and leave numeric columns as they are. You can force to convert a numerical column if it is included in ``col_list``. | def convert_cols_categorical_to_numeric(df, col_list=None):
if col_list is None:
col_list = []
ret = pd.DataFrame()
for column_name in df.columns:
column = df[column_name]
if column.dtype == "object" or column_name in col_list:
col_dict = _get_nominal_integer_dict(column)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_related_cols_categorical_to_numeric(df, col_list):\n ret = pd.DataFrame()\n values = None\n for c in col_list:\n values = pd.concat([values, df[c]], axis=0)\n values = pd.Series(values.unique())\n col_dict = _get_nominal_integer_dict(values)\n for column_name in df.columns:... | [
"0.79088426",
"0.7642333",
"0.6625366",
"0.6624571",
"0.6557332",
"0.63496464",
"0.63183826",
"0.62436324",
"0.6232082",
"0.6209288",
"0.62018126",
"0.6144933",
"0.61349154",
"0.612278",
"0.60727715",
"0.6001036",
"0.5993495",
"0.5970217",
"0.59602475",
"0.5944174",
"0.586604... | 0.8218717 | 0 |
Return a human readable representation of the model instance. | def __str__(self):
return "{}".format(self.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"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}\"",... | [
"0.79865694",
"0.778825",
"0.778825",
"0.7578485",
"0.7573961",
"0.7508439",
"0.73869205",
"0.725669",
"0.725669",
"0.72521317",
"0.7250976",
"0.72447103",
"0.72447103",
"0.7238946",
"0.72377145",
"0.72135806",
"0.7196659",
"0.71778005",
"0.7177506",
"0.7173099",
"0.7172897",... | 0.0 | -1 |
Pytest fixture that returns an instance of our application. This fixture provides a Flask application context for tests using AIPscan's test configuration. This pattern can be extended in additional fixtures to, e.g. load state to the test database from a fixture as needed for tests. | def app_instance(scope="session"):
app = create_app("test")
with app.app_context():
db.create_all()
yield app
db.drop_all() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def application(self):\n if not ApplicationFixture._test_app:\n app = self.APP_CLASS()\n app.run_tests()\n ApplicationFixture._test_app = app\n return ApplicationFixture._test_app",
"def app(request) -> Application:\n global fixture\n if fixture is None:\n ... | [
"0.79039025",
"0.7801236",
"0.76804936",
"0.7636006",
"0.754516",
"0.75273347",
"0.7445035",
"0.7436987",
"0.7408242",
"0.7408242",
"0.7408242",
"0.7362214",
"0.73253214",
"0.73009616",
"0.7276295",
"0.7256131",
"0.72402483",
"0.72310114",
"0.7145677",
"0.7133663",
"0.7084221... | 0.6280047 | 79 |
Decay learning rate by a factor of 0.1 every lr_decay_epoch epochs. | def lr_scheduler(optimizer, epoch, init_lr=0.1, lr_decay_epoch=50):
if epoch % lr_decay_epoch == 0 and epoch > 1:
for param_group in optimizer.param_groups:
param_group['lr'] = param_group['lr'] * 0.1
return optimizer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step_decay(epoch):\n # initial_lrate = 1.0 # no longer needed\n #drop = 0.5\n #epochs_drop = number_epoch_drop\n #lrate = init_lr * math.pow(drop,\n #math.floor((1+epoch)/epochs_drop))\n lr = learning_rate\n if epoch >= 60:\n lr *= 1e-1\n print('Learning rate: ', lr)\n return ... | [
"0.8265673",
"0.8176528",
"0.7809839",
"0.7760489",
"0.77189094",
"0.76933736",
"0.76933736",
"0.7603879",
"0.75849223",
"0.75524855",
"0.7522515",
"0.7496741",
"0.7487734",
"0.7466154",
"0.74090105",
"0.7394152",
"0.7390487",
"0.7389569",
"0.73847216",
"0.7382017",
"0.737469... | 0.0 | -1 |
r"""VGG 11layer model (configuration "A") with batch normalization | def vgg11_bn(tensorized, **kwargs):
return _vgg('vgg11_bn', 'A', True, tensorized, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vgg_16(input_shape=(224, 224, 3), output_shape=1000):\n model = Sequential()\n \n # layer 1 ~ 2 (filter: 64)\n model.add(Input(shape=input_shape))\n model.add(ZeroPadding2D((1, 1)))\n model.add(Conv2D(64, (3, 3), activation='relu'))\n model.add(ZeroPadding2D((1, 1)))\n model.add(Conv2D(... | [
"0.63343036",
"0.6301366",
"0.62520427",
"0.62272805",
"0.613026",
"0.6120089",
"0.6074802",
"0.604904",
"0.6002232",
"0.5981637",
"0.5957494",
"0.5925203",
"0.5921616",
"0.59177893",
"0.5885133",
"0.5881805",
"0.5881126",
"0.5859649",
"0.58332133",
"0.5830654",
"0.58207077",... | 0.5499433 | 52 |
r"""VGG 13layer model (configuration "B") | def vgg13(tensorized, **kwargs):
return _vgg('vgg13', 'B', False, tensorized, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vgg16_bn(pretrained,**kwargs):\n model = VGG(make_layers(cfg['D'], batch_norm=True), **kwargs)\n if pretrained:\n model_dict = paddle.load('./pre_model/vgg16_bn.paddle')\n model.set_state_dict(model_dict)\n return model",
"def build_vgg():\n input_shape = (256, 256, 3)\n\n vgg = ... | [
"0.7417273",
"0.7358805",
"0.71849257",
"0.7068711",
"0.7062855",
"0.7034622",
"0.6955577",
"0.69236857",
"0.69051826",
"0.68416125",
"0.6832739",
"0.679886",
"0.67929447",
"0.67903084",
"0.677913",
"0.6745863",
"0.6682856",
"0.66722745",
"0.66622055",
"0.6655325",
"0.6618266... | 0.6384021 | 33 |
r"""VGG 13layer model (configuration "B") with batch normalization | def vgg13_bn(tensorized, **kwargs):
return _vgg('vgg13_bn', 'B', True, tensorized, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vgg16_bn(pretrained,**kwargs):\n model = VGG(make_layers(cfg['D'], batch_norm=True), **kwargs)\n if pretrained:\n model_dict = paddle.load('./pre_model/vgg16_bn.paddle')\n model.set_state_dict(model_dict)\n return model",
"def vgg16_bn(model_dir, tag, num_classes, use_cls, batchnorm=Tr... | [
"0.675105",
"0.668015",
"0.65448433",
"0.65107876",
"0.6317424",
"0.62681973",
"0.6262993",
"0.62345195",
"0.6140339",
"0.61170226",
"0.60969716",
"0.6079978",
"0.6053814",
"0.60280806",
"0.6006328",
"0.59780127",
"0.5970936",
"0.5963233",
"0.59627765",
"0.59568864",
"0.59411... | 0.59750515 | 16 |
r"""VGG 16layer model (configuration "D") | def vgg16(tensorized, **kwargs):
return _vgg('vgg16', 'D', False, tensorized, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vgg16(pretrained=False, **kwargs):\n if pretrained:\n kwargs['init_weights'] = False\n model = VGG(make_layers(cfg['D']), **kwargs)\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['vgg16']), strict=False)\n return model",
"def vgg16(pretrained=False, **kwargs)... | [
"0.7846702",
"0.7750838",
"0.7494097",
"0.7290834",
"0.728988",
"0.7278858",
"0.7208758",
"0.71020895",
"0.70957595",
"0.70930266",
"0.7090617",
"0.70656466",
"0.7037565",
"0.6998147",
"0.69132566",
"0.6874201",
"0.68395877",
"0.67944306",
"0.6782617",
"0.6760838",
"0.6693204... | 0.7033001 | 13 |
r"""VGG 19layer model (configuration "E") | def vgg19(tensorized, **kwargs):
return _vgg('vgg19', 'E', False, tensorized, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_vgg():\n input_shape = (256, 256, 3)\n\n vgg = keras.applications.VGG19(include_top = False , input_shape = input_shape , weights=\"imagenet\")\n features = vgg.get_layer(index = 9).output\n\n model = keras.Model(inputs=[vgg.inputs], outputs=[features])\n return model",
"def vgg19(pretr... | [
"0.7450215",
"0.725738",
"0.7146659",
"0.70677775",
"0.6981094",
"0.6942171",
"0.69413054",
"0.6924377",
"0.6896415",
"0.6737178",
"0.6705817",
"0.66975707",
"0.6687772",
"0.6680752",
"0.6666037",
"0.66647756",
"0.6663939",
"0.6647204",
"0.66166615",
"0.65478873",
"0.6547373"... | 0.6294502 | 34 |
Given a list of text in `docs` and `text` string, returns list of cosine similarity scores to `text`. Order of elements are left unchanged (i.e. identical to `docs`). | def spacy_similarity(docs: List[Doc],
text: str,
nlp: Language,
norm: Union[None, str] = "l2") -> List[float]:
def normalise(norm):
def _normalise(v):
# Numba linear algebra operations are only supported on
# contiguous ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def similarity_sort(texts: List[str]) -> List[str]:\n df = cluster_text(texts, n=len(texts) // 2)\n return df[\"text\"].tolist()",
"def get_cosine_similarity(doc1, doc2):\n count_vectorizer = CountVectorizer(stop_words='english')\n sparse_matrix = count_vectorizer.fit_transform(raw_documents=[doc1, d... | [
"0.7035016",
"0.664993",
"0.6488469",
"0.6478475",
"0.63879997",
"0.63519377",
"0.6335327",
"0.6290351",
"0.6283186",
"0.62252986",
"0.6222077",
"0.6214643",
"0.620023",
"0.6143089",
"0.6132577",
"0.6113776",
"0.603951",
"0.60035855",
"0.59926087",
"0.5991115",
"0.59810495",
... | 0.7778315 | 0 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
print('Hello! Let\'s explore some US bikeshare data!')
global city
global month
global day
global filter_type
# get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs
city = func.city()
# get user input for month... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)",
"def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f... | [
"0.66714007",
"0.65354675",
"0.64593667",
"0.6374057",
"0.6348314",
"0.63097656",
"0.62868035",
"0.6259136",
"0.62316",
"0.62130964",
"0.62050414",
"0.6181105",
"0.6171822",
"0.61686903",
"0.6158568",
"0.61582303",
"0.61532456",
"0.61444426",
"0.6131269",
"0.610484",
"0.61025... | 0.0 | -1 |
Plots a graph with multiple sub graphs comparing the rgb, depth, predicted segmentation masks and true segmentation masks. Grid size is N x 4 where N is the number of images | def visualize_predicted_and_true_segment_masks(rgb_imgs, xyz_imgs, seg_masks, label_imgs):
N = rgb_imgs.shape[0]
fig_index = 1
for i in range(N):
num_objs = max(np.unique(seg_masks[i,...]).max(), np.unique(label_imgs[i,...]).max()) + 1
rgb = rgb_imgs[i].astype(np.uint8)
dep... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_final_grid(generated_images):\n\n fig = plt.figure(figsize=(8, 6))\n fig.subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=0.001, hspace=0.001)\n\n for ind in range(GRID_IMGS):\n ax = fig.add_subplot(GRID_SIZE, GRID_SIZE, ind + 1, xticks=[], yticks=[])\n ax.imshow... | [
"0.6807857",
"0.67092204",
"0.66868794",
"0.66748035",
"0.6654014",
"0.66539896",
"0.6612457",
"0.66122705",
"0.6606631",
"0.6559218",
"0.65118986",
"0.6500644",
"0.6459903",
"0.64494926",
"0.6436244",
"0.64262897",
"0.642465",
"0.6410225",
"0.6375877",
"0.6359972",
"0.632367... | 0.7108965 | 0 |
Add headers to both force latest IE rendering engine or Chrome Frame, and also to cache the rendered page for 10 minutes. | def add_header(r):
r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
r.headers["Pragma"] = "no-cache"
r.headers["Expires"] = "0"
r.headers['Cache-Control'] = 'public, max-age=0'
return r | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-age=60'\n return response",
"def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, m... | [
"0.82235825",
"0.82227623",
"0.82227623",
"0.82227623",
"0.82227623",
"0.8196081",
"0.81635857",
"0.81635857",
"0.81635857",
"0.81635857",
"0.81635857",
"0.81635857",
"0.81635857",
"0.81635857",
"0.81635857",
"0.81635857",
"0.81635857",
"0.81635857",
"0.81635857",
"0.81635857",... | 0.7153332 | 41 |
Returns cumulative probability of PZ be at z<zx | def cPofZ(self,arr,zx):
f_obs,sigma = arr
#results=np.zeros((self.ngals))#((arr.size))
# cdfs = np.cumsum(np.array([[self.getpdf(f_obs[n],sigma[n],z,self.dz)
# for z in np.arange(0.,zx+self.dz,self.dz)] for n in range(self.ngals)]),
# axis=1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zprob(z):\r\n Z_MAX = 6.0 # maximum meaningful z-value\r\n if z == 0.0:\r\n x = 0.0\r\n else:\r\n y = 0.5 * math.fabs(z)\r\n if y >= (Z_MAX*0.5):\r\n x = 1.0\r\n elif (y < 1.0):\r\n w = y*y\r\n x = ((((((((0.000124818987 * w\r\n ... | [
"0.73087686",
"0.70842916",
"0.6887331",
"0.68194115",
"0.67901695",
"0.6704391",
"0.6670286",
"0.6591631",
"0.6451923",
"0.635069",
"0.6302918",
"0.6191376",
"0.61723053",
"0.6163703",
"0.61430144",
"0.6140031",
"0.6140031",
"0.61102474",
"0.60625744",
"0.6056325",
"0.604385... | 0.6892628 | 2 |
Private slot to handle the selection of a new item. current current item (QListWidgetItem) previous previous current item (QListWidgetItem) | def on_changeLists_currentItemChanged(self, current, previous):
self.filesList.clear()
if current is not None:
changelist = current.text()
if changelist in self.changeListsDict:
self.filesList.addItems(
sorted(self.changeListsDict[changelist])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_selected_new_item(self, item):\n pass",
"def onDown():\n currentIndex = selector.currentRow()\n if currentIndex != selector.count() - 1 and currentIndex != -1:\n selector.blockSignals(True)\n currentItem = selector.takeItem(currentIndex)\n selector.ins... | [
"0.7513481",
"0.6768842",
"0.6470026",
"0.64383554",
"0.6244756",
"0.619092",
"0.61850244",
"0.61775196",
"0.6117539",
"0.609892",
"0.60579616",
"0.6000564",
"0.6000564",
"0.59953976",
"0.58837116",
"0.58424276",
"0.5819235",
"0.5810847",
"0.5806027",
"0.58038753",
"0.5801416... | 0.5367755 | 70 |
Find template with name 'name'. Raises ImageNotFoundError if no matches found Raises MultipleItemsError if multiple matches found | def get_template(self, name):
matches = self.find_templates(name=name)
if not matches:
raise ImageNotFoundError('template with name {}'.format(name))
if len(matches) > 1:
raise MultipleItemsError('multiple templates with name {}'.format(name))
return matches[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_template(self ,template_name):\n\n found = False\n for template in self.templates:\n if template['name'] == template_name:\n found = True\n return template\n if not found:\n return None",
"def get_template(self, name):\n for ... | [
"0.6945496",
"0.68991673",
"0.6494248",
"0.6355712",
"0.60253173",
"0.60180885",
"0.59760123",
"0.59271055",
"0.58866334",
"0.5823712",
"0.57881737",
"0.5752271",
"0.5741054",
"0.57409245",
"0.573715",
"0.5697654",
"0.5690854",
"0.56666136",
"0.5650215",
"0.56326455",
"0.5621... | 0.7713046 | 0 |
Returns an interface to jemalloc, if it is being used. Note that this will always return None until `setup_jemalloc_stats` has been called. | def get_jemalloc_stats() -> Optional[JemallocStats]:
return _JEMALLOC_STATS | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _setup_jemalloc_stats() -> None:\n\n global _JEMALLOC_STATS\n\n # Try to find the loaded jemalloc shared library, if any. We need to\n # introspect into what is loaded, rather than loading whatever is on the\n # path, as if we load a *different* jemalloc version things will seg fault.\n\n # We l... | [
"0.7011987",
"0.62765425",
"0.49401045",
"0.48440894",
"0.46719196",
"0.463091",
"0.46102256",
"0.4589038",
"0.4589038",
"0.45807928",
"0.4573026",
"0.45585936",
"0.45533615",
"0.453966",
"0.452625",
"0.45081803",
"0.44919103",
"0.44817075",
"0.44783935",
"0.44358346",
"0.441... | 0.790305 | 0 |
Returns the transport used by the client instance. | def transport(self) -> Debugger2Transport:
return self._client.transport | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transport(self):\n return self._transport",
"def transport(self) -> TraceServiceTransport:\n return self._client.transport",
"def transport(self) -> ServiceControllerTransport:\n return self._client.transport",
"def transport(self) -> MetadataServiceTransport:\n return self._c... | [
"0.82946277",
"0.7887542",
"0.773594",
"0.773068",
"0.76806635",
"0.7674273",
"0.76357967",
"0.7558095",
"0.7551682",
"0.75303864",
"0.7488142",
"0.7436853",
"0.7423566",
"0.7368433",
"0.73340607",
"0.721926",
"0.7109823",
"0.7102308",
"0.68808985",
"0.68144",
"0.6671675",
... | 0.74958986 | 10 |
Return a 64bit integer sum of `a` and `b`. | def add64(a,b):
return(np.add(a, b, dtype=np.uint64)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum(self, a, b):\n return int(a) + int(b)",
"def getSum(self, a, b):\n result = 0\n carry = 0\n carry_on = {(0,0,0), (0,0,1), (1,0,0), (0,1,0)}\n\n for i in range(32):\n a_lsb = a & 1\n b_lsb = b & 1\n cur = a_lsb ^ b_lsb ^ carry\n ... | [
"0.7238301",
"0.7202057",
"0.71946514",
"0.70317316",
"0.69063276",
"0.6799196",
"0.65338504",
"0.6489076",
"0.6452163",
"0.6278054",
"0.6239498",
"0.6239498",
"0.62079734",
"0.6204399",
"0.6171214",
"0.61511624",
"0.6073832",
"0.6044258",
"0.6043731",
"0.6019592",
"0.6012571... | 0.7815626 | 0 |
Handles the 'name' trait being changed. | def _name_changed ( self, name ):
self.name_last = parse_name( name )[-1]
self.inputs_changed() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateName(self,name):\n self.name = name",
"def update_name(self, new_name):\r\n self.__name = new_name",
"def update_name(self, new_name):\r\n self.__name = new_name",
"def _name_changed(self):\n self._named = True",
"def name(self, new_name: str) -> None:\n raise N... | [
"0.7672329",
"0.75915074",
"0.75915074",
"0.75472456",
"0.7476408",
"0.73970574",
"0.73875964",
"0.7337446",
"0.7288328",
"0.72266525",
"0.71830803",
"0.71830803",
"0.71830803",
"0.71830803",
"0.71830803",
"0.7179159",
"0.7176058",
"0.7147122",
"0.7147122",
"0.71463996",
"0.7... | 0.7549502 | 3 |
Returns all of the valid TemplateChoices for this item. | def _get_choices ( self, context, path = '' ):
choices = []
gdc = context.get_data_context
for name in context.data_contexts:
next_path = path_for( path, name )
choices.append( TemplateChoice( choice_value = next_path ) )
choices.extend( self._get_choices(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_template_base_dir_choices() -> list[tuple[str, str]]:\n # handle predefined choices\n choices, seen = [], set()\n for template_name in TemplateName:\n choices.append((template_name.value, template_name.label))\n seen.add(template_name.value)\n\n # handle custom choices via setting... | [
"0.6461884",
"0.6456121",
"0.6404085",
"0.6115306",
"0.5937474",
"0.59354246",
"0.5895824",
"0.5861698",
"0.5845247",
"0.5829795",
"0.5829795",
"0.58060676",
"0.5790772",
"0.57362115",
"0.573581",
"0.5681031",
"0.566594",
"0.5636224",
"0.5634196",
"0.5586595",
"0.5557848",
... | 0.6017236 | 4 |
The following test checks the indegree centrality after a perturbation. The perturbation here considered is the perturbation of element '1'. In this case, we have no fault resistant nodes. However, we expect the same behavior due to the presence of isolating nodes '2' and '3'. | def test_indegree_centrality_after_element_perturbation_isolating():
F = FaultDiagnosis("tests/TOY_graph_nofaultresistant.csv")
F.simulate_element_perturbation(["1"])
indeg_cen_after_element_perturbation = {
'2': 0.0,
'3': 0.0,
'4': 0.058823529411764705,
'5': 0.0588235294117... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_indegree_centrality_after_element_perturbation():\n F = FaultDiagnosis(\"tests/TOY_graph.csv\")\n F.simulate_element_perturbation([\"1\"])\n\n indeg_cen_after_element_perturbation = {\n '2': 0.0,\n '3': 0.0,\n '4': 0.058823529411764705,\n '5': 0.058823529411764705,\n ... | [
"0.7879507",
"0.7879507",
"0.7842305",
"0.7707125",
"0.7707125",
"0.75150806",
"0.74334776",
"0.74273926",
"0.7347573",
"0.7328123",
"0.7301626",
"0.70492756",
"0.70174694",
"0.70174694",
"0.69969606",
"0.6988527",
"0.68336815",
"0.68336815",
"0.6782312",
"0.6773642",
"0.6660... | 0.78318405 | 3 |
Get the offset as a timedelta, for easy comparison. | def timedelta(self) -> datetime.timedelta:
factor = -1 if self.negative else 1
return datetime.timedelta(
hours=factor * self.hours, minutes=factor * self.minutes
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_offset():\n offset = datetime.date.today() - start_day\n return int(offset.days) - 4",
"def tzoffset(self):\n return _tzoffset(self._tz, self._t)",
"def get_tz_offset(self) -> float:\n return self.AD.tz.utcoffset(self.datetime()).total_seconds() / 60",
"def get_utc_offset():\n ... | [
"0.6713109",
"0.66918886",
"0.65473336",
"0.64523727",
"0.61912215",
"0.6132214",
"0.6039608",
"0.6028964",
"0.5975602",
"0.59472054",
"0.58999306",
"0.5890619",
"0.5888217",
"0.5843602",
"0.583069",
"0.5819811",
"0.5803744",
"0.5781076",
"0.57463247",
"0.57434416",
"0.570293... | 0.60606915 | 6 |
Convert a timezone to a 7 bit number. | def db_value(self, timezone: Timezone) -> int:
if timezone is None:
return
value = 0
if timezone.negative:
value |= 1 << 7
value |= timezone.hours << 2
value |= timezone.minutes // 15
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def python_value(self, value: int) -> Timezone:\n if value is None:\n return\n negative = bool(value & (1 << 7))\n hours = (value & 0b111100) >> 2\n minutes = 15 * (value & 0b11)\n return Timezone(negative, hours, minutes)",
"def CONST_WEEK_TIMESTAMP() -> int:\n r... | [
"0.5981354",
"0.554924",
"0.5452481",
"0.53214604",
"0.532089",
"0.5171898",
"0.5146727",
"0.5018446",
"0.50127614",
"0.49972627",
"0.49889615",
"0.49862227",
"0.49818563",
"0.497037",
"0.49410826",
"0.49385312",
"0.4925128",
"0.49083793",
"0.49037898",
"0.48927668",
"0.48868... | 0.59130245 | 1 |
Convert a 7 bit number to a timezone. | def python_value(self, value: int) -> Timezone:
if value is None:
return
negative = bool(value & (1 << 7))
hours = (value & 0b111100) >> 2
minutes = 15 * (value & 0b11)
return Timezone(negative, hours, minutes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_timezone(val):\n if not val:\n return\n\n if val == \"Z\" or val == \"+00:00\":\n return pytz.utc\n\n negative = val.startswith(\"-\")\n minutes = int(val[-2:])\n minutes += int(val[1:3]) * 60\n\n if negative:\n minutes = 0 - minutes\n return pytz.FixedOffset(mi... | [
"0.5343798",
"0.5321895",
"0.5274781",
"0.5274595",
"0.5247163",
"0.5234778",
"0.5225324",
"0.5220339",
"0.5195",
"0.5132745",
"0.5061499",
"0.5051551",
"0.5014996",
"0.50057214",
"0.49548548",
"0.4942697",
"0.49375725",
"0.493591",
"0.49073786",
"0.48835564",
"0.48753184",
... | 0.6344209 | 0 |
Check if the ingress has whitelisting applied | def _has_ingress_white_list(ingress):
return bool(ingress.metadata.annotations.get("ingress.kubernetes.io/whitelist-source-range", False)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowAnyIngressLabel(self):\n if (self.ingresslabels != None):\n return False\n elif self.layer == None:\n return True # no layer means no restrictions\n return self.layer.allowAnyIngressLabel()",
"def is_whitelisted(self, fkey):\n return fkey in self.whi... | [
"0.6444836",
"0.62690973",
"0.62633574",
"0.61521405",
"0.6029823",
"0.59656906",
"0.5914481",
"0.5875368",
"0.58705884",
"0.5862475",
"0.57623476",
"0.57623476",
"0.5715468",
"0.5715274",
"0.5699382",
"0.569812",
"0.56584543",
"0.5490444",
"0.54850715",
"0.5469639",
"0.54215... | 0.8497023 | 0 |
Return a time series data frame for the system. getTS() The amplitude for this vdp model is defined as euclidean distance from the origin to (x,x_c) coordinates in phase space. The unwrapped phase estimate is taken as the 1arctan of the phase plane coordinates. This is transformed so that it is comparible with the Hann... | def getTS(self):
light_ts = list(map(self.Light, self.ts))
Amplitude = np.sqrt(self.results[:, 0] ** 2 + self.results[:,
1] ** 2) # define the amplitude as the sqrt of each coordinate squared
# Need to extract a phase in radians
wr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ts_df(self):\n df = pd.DataFrame(self.ts_list)\n df.columns = self.col_names\n df.sort_values(by=self.col_names[0], inplace=True)\n df.reset_index(drop=True, inplace=True)\n\n return df",
"def getTs(self):\n\n if not self.ts:\n raise ValueError('No tim... | [
"0.62096477",
"0.6005086",
"0.56925464",
"0.5556752",
"0.5546154",
"0.548506",
"0.54716647",
"0.5388256",
"0.53614265",
"0.5359223",
"0.5316178",
"0.5294731",
"0.5292079",
"0.5261317",
"0.5250192",
"0.5243125",
"0.5240519",
"0.52296275",
"0.5204694",
"0.5204473",
"0.5191647",... | 0.7726515 | 0 |
Compute normalized distance between two points. Computes || b a || / ( ||b|| + ||a||) | def normalized_distance(_a, _b) -> float:
b = _b.astype(int)
a = _a.astype(int)
norm_diff = np.linalg.norm(b - a)
norm1 = np.linalg.norm(b)
norm2 = np.linalg.norm(a)
return norm_diff / (norm1 + norm2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(a: Point, b: Point) -> float:\n return math.sqrt(math.pow(b.x - a.x, 2) + math.pow(b.y - a.y, 2))",
"def dist(a,b): # compute distance between two points a & b\n return mag(sub(a,b))",
"def dist(self, point_a, point_b):\n args = {\"point_a\": point_a, \"point_b\": point_b}\n d... | [
"0.78225106",
"0.76464",
"0.76007164",
"0.753602",
"0.75065213",
"0.74843013",
"0.7479239",
"0.74299127",
"0.7427393",
"0.73945844",
"0.7378862",
"0.7342669",
"0.7323923",
"0.73131454",
"0.72983736",
"0.72686255",
"0.7267749",
"0.72349983",
"0.71939397",
"0.71939397",
"0.7190... | 0.8145575 | 0 |
Return a string formatted value in scientific notation with dec_places decimal accuracy | def format_value(val, dec_places=4):
val_str = "{:.{dec}E}".format(val, dec=dec_places)
if val_str.endswith('+00'):
val_str = "{:.{dec}f}".format(val, dec=dec_places)
return val_str | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scientific(x):\n return '{:.2e}'.format(x)",
"def HighPrecisionE(number):\n\n return \"%.22e\" % number",
"def scientific_notation(value, error):\n if value is None:\n return ''\n\n if error is None or error == 0:\n value_str = '{0:f}'.format(value)\n return value_str\n\n ... | [
"0.80515766",
"0.77364135",
"0.7533539",
"0.7273046",
"0.7239724",
"0.721607",
"0.7074467",
"0.698191",
"0.68399125",
"0.678488",
"0.67526996",
"0.674336",
"0.66769737",
"0.66744",
"0.6634346",
"0.66097474",
"0.6587332",
"0.6529958",
"0.6522293",
"0.6510616",
"0.64891046",
... | 0.7804895 | 1 |
Create or update a new snippet instance, given a dictionary of deserialized field values. Note that if we don't define this method, then deserializing data will simply return a dictionary of items. | def restore_object(self, attrs, instance=None):
if instance:
# Update existing instance
instance.name = attrs.get('name', instance.name)
instance.slug = attrs.get('slug', instance.slug)
instance.ended_at = attrs.get('ended_at', instance.ended_at)
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self, validated_data: dict) -> Snippet:\n return Snippet.objects.create(**validated_data)",
"def create(self, validated_data):\n return Snippet.objects.create(**validated_data)",
"def create(self, validated_data):\r\n return Snippet.objects.create(**validated_data)",
"def upda... | [
"0.6594524",
"0.63039815",
"0.62710834",
"0.62425506",
"0.5754719",
"0.5750553",
"0.56346077",
"0.5492632",
"0.52352047",
"0.51870894",
"0.514702",
"0.51469946",
"0.51469946",
"0.5141249",
"0.5128281",
"0.50850135",
"0.5079387",
"0.50423217",
"0.50039977",
"0.4973844",
"0.495... | 0.0 | -1 |
Constructor for the MapReduceInstance_RunInfo class | def __init__(self,
end_time=None,
error_message=None,
execution_start_time_usecs=None,
files_processed=None,
map_done_time_usecs=None,
map_input_bytes=None,
mappers_spawned=None,
num_m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(self, runInfo, inputs, initDict) :\n super().initialize(runInfo, inputs, initDict)\n for metricIn in self.assemblerDict['Metric']:\n self.metricsDict[metricIn[2]] = metricIn[3]",
"def __init__(self) -> None:\n self.metrics = {}\n self.current = None\n self.run = Non... | [
"0.6380462",
"0.6375715",
"0.6247472",
"0.62450147",
"0.617444",
"0.61201507",
"0.611566",
"0.6082178",
"0.6050306",
"0.6041231",
"0.60366374",
"0.60295945",
"0.6003835",
"0.59818983",
"0.5962807",
"0.5918063",
"0.5907289",
"0.5900278",
"0.58873427",
"0.5879062",
"0.58634037"... | 0.63578385 | 2 |
Creates an instance of this model from a dictionary | def from_dictionary(cls,
dictionary):
if dictionary is None:
return None
# Extract variables from the dictionary
end_time = dictionary.get('endTime')
error_message = dictionary.get('errorMessage')
execution_start_time_usecs = dictionary.get('e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction... | [
"0.8318104",
"0.8168106",
"0.8168106",
"0.8119619",
"0.8089429",
"0.7978183",
"0.79495466",
"0.79227656",
"0.7898806",
"0.7894103",
"0.7887986",
"0.78827816",
"0.78821284",
"0.7876549",
"0.7858773",
"0.78385323",
"0.78039247",
"0.78039247",
"0.78039247",
"0.78039247",
"0.7803... | 0.0 | -1 |
Return the ``q``th percentile of the flattened input tensor's data. | def percentile(field, q):
# https://gist.github.com/spezold/42a451682422beb42bc43ad0c0967a30
# Note that ``kthvalue()`` works one-based, i.e. the first sorted value
# indeed corresponds to k=1, not k=0! Use float(q) instead of q directly,
# so that ``round()`` returns an integer, even if q is a np.float... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def percentile(t: torch.tensor, q: float):\n # Note that ``kthvalue()`` works one-based, i.e. the first sorted value\n # indeed corresponds to k=1, not k=0! Use float(q) instead of q directly,\n # so that ``round()`` returns an integer, even if q is a np.float32.\n k = 1 + round(.01 * float(q) * (t.num... | [
"0.802458",
"0.77174544",
"0.77174544",
"0.7706333",
"0.765127",
"0.76453716",
"0.73305327",
"0.7006668",
"0.6945124",
"0.69359267",
"0.6853341",
"0.6850928",
"0.68455553",
"0.6844253",
"0.6713556",
"0.66916794",
"0.6688679",
"0.6682355",
"0.6682355",
"0.6682355",
"0.6679008"... | 0.76507 | 5 |
Render the main application HTML. | def render_app_html(webassets_env, service_url, api_url, sentry_public_dsn, ga_tracking_id=None, websocket_url=None,
extra=None):
if extra is None:
extra = {}
template = jinja_env.get_template('app.html.jinja2')
assets_dict = app_html_context(api_url=api_url, service_url=service... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n return render_template(\"main.html\")",
"def main():\n return render_template(\"main.html\")",
"def main():\n return render_template('index.html')",
"def main():\n return render_template('index.html')",
"def main_page():\n return render_template(\"index.html\")",
"def main():... | [
"0.8040502",
"0.8040502",
"0.78164375",
"0.78164375",
"0.77684045",
"0.7760138",
"0.7581798",
"0.75438654",
"0.74974716",
"0.74974716",
"0.749576",
"0.7349171",
"0.732377",
"0.731516",
"0.7308571",
"0.7295578",
"0.72350323",
"0.71800244",
"0.7171516",
"0.71515983",
"0.7145346... | 0.0 | -1 |
Calculate distance between frame x and frame y | def _dist(x, y):
return np.sqrt(np.mean(np.square(x - y))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance_to(self, x, y):\n\t\tdx = x - self.x\n\t\tdy = y - self.y\n\t\treturn math.sqrt((dx**2)+(dy**2))",
"def distance(self, x: int, y: int) -> float:\n return math.sqrt((x - self.x) ** 2 + (y - self.y) ** 2)",
"def distance_from_origin(self):\n return ((self.x ** 2) + (self.y ** 2)) ** 0.... | [
"0.70870423",
"0.6930818",
"0.6632677",
"0.6632677",
"0.6632677",
"0.6632677",
"0.6632677",
"0.6632677",
"0.6632677",
"0.6628522",
"0.66148895",
"0.65900624",
"0.65882623",
"0.65192425",
"0.65041596",
"0.64875257",
"0.6441675",
"0.6415044",
"0.63962644",
"0.6391456",
"0.63679... | 0.6213811 | 36 |
Computes A^T x, from matvec(x) = A x, where A is square. | def _rmatvec(matvec, x):
transpose = jax.linear_transpose(matvec, x)
return transpose(x)[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _matvec(x):\n return _normal_matvec(matvec, x)",
"def matvec(self, x):\n return self * x",
"def matTimesVec(M, x):\n return [dot(m, x) for m in M]",
"def vecTimesMat(x, M):\n return [dot(m, x) for m in transpose(M)]",
"def par_dot_csr_matvec(A, x):\n y = np.empty(x.size, common_type(... | [
"0.72115356",
"0.720185",
"0.69253814",
"0.65750885",
"0.63390213",
"0.6301195",
"0.6271896",
"0.6217136",
"0.62079525",
"0.620576",
"0.6089397",
"0.60784954",
"0.60462683",
"0.6013263",
"0.5990948",
"0.5927727",
"0.59206253",
"0.59152585",
"0.5892022",
"0.58196",
"0.5794338"... | 0.60355127 | 13 |
Computes A^T A x from matvec(x) = A x, where A is square. | def _normal_matvec(matvec, x):
matvec_x, vjp = jax.vjp(matvec, x)
return vjp(matvec_x)[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _matvec(x):\n return _normal_matvec(matvec, x)",
"def matvec(self, x):\n return self * x",
"def matTimesVec(M, x):\n return [dot(m, x) for m in M]",
"def vecTimesMat(x, M):\n return [dot(m, x) for m in transpose(M)]",
"def par_dot_csr_matvec(A, x):\n y = np.empty(x.size, common_type(... | [
"0.72337806",
"0.71057475",
"0.69410944",
"0.66324484",
"0.63984936",
"0.6291739",
"0.62806356",
"0.6274974",
"0.6260389",
"0.62165517",
"0.6165218",
"0.61278427",
"0.60823613",
"0.60263705",
"0.6011927",
"0.59777105",
"0.58783704",
"0.5873439",
"0.5818907",
"0.5817301",
"0.5... | 0.6226011 | 9 |
create JWT token that the user can use to verify its account. | def gen_verification_token(self, user):
exp_date = timezone.now() + timedelta(days=3)
payload = {
'user': user.username,
'exp': int(exp_date.timestamp()),
'type': 'email_confirmation'
}
token = jwt.encode(payload, settings.SECRET_KEY, algorithm='HS256'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_auth_token():\n data = get_request_data(request)\n address = data.get(\"address\")\n expiration = int(data.get(\"expiration\"))\n\n pk = get_provider_private_key(use_universal_key=True)\n token = jwt.encode({\"exp\": expiration, \"address\": address}, pk, algorithm=\"HS256\")\n token =... | [
"0.8302828",
"0.81517154",
"0.7971868",
"0.77963245",
"0.77766126",
"0.76949567",
"0.7694069",
"0.7645974",
"0.7624117",
"0.76219726",
"0.7611875",
"0.75912756",
"0.75737184",
"0.75734884",
"0.75429565",
"0.75415915",
"0.7523603",
"0.7517176",
"0.7505542",
"0.7412252",
"0.741... | 0.7055786 | 42 |
Builds a cache with a limit of max_size entries. If the limit is exceeded, the Least Recently Used entry is discarded. If max_size==0, the cache is unbounded (no LRU rule is applied). | def __init__(self,max_size=0):
object.__init__(self)
self._maxsize=max_size
self._dict={}
self._lock=Lock()
# Header of the access list
if self._maxsize:
self._head=Entry(None)
self._head._previous=self._head
self._head._next=self._he... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def memoize(maxsize=None, *args, **kwargs):\n return _coconut.functools.lru_cache(maxsize, *args, **kwargs)",
"def create_cache(\n size: int,\n) -> t.Optional[t.MutableMapping[t.Tuple[weakref.ref, str], \"Template\"]]:\n if size == 0:\n return None\n\n if size < 0:\n return {}\n\n re... | [
"0.66527325",
"0.6426182",
"0.6325625",
"0.6076972",
"0.5985083",
"0.5978231",
"0.5870382",
"0.58548075",
"0.5841563",
"0.57960916",
"0.57781285",
"0.5763253",
"0.5760883",
"0.57591397",
"0.57375854",
"0.56210893",
"0.5582009",
"0.5576067",
"0.5538315",
"0.55045676",
"0.54742... | 0.5857961 | 7 |
Return the content of the file as a string. Override this for better behaviour. | def build(self, name, opened, entry):
try:
return opened.read()
finally:
opened.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content(self) -> str:\n if self._content is None:\n with open(self.name, mode='r', encoding='utf-8') as f:\n self._content = f.read()\n return self._content",
"def get_file_content(self):\n s = StringIO.StringIO()\n\n s.write(self.get_header())\n s... | [
"0.80516917",
"0.79702",
"0.7834177",
"0.7596998",
"0.7590219",
"0.75639707",
"0.75399745",
"0.7533267",
"0.74935967",
"0.74918514",
"0.7481167",
"0.74656886",
"0.7398642",
"0.7395637",
"0.7359344",
"0.7357124",
"0.7347776",
"0.7294735",
"0.72773266",
"0.72639775",
"0.7213648... | 0.0 | -1 |
Update and return an existing `SpecificationCategory` instance | def update(self, instance, validated_data):
instance.name = validated_data.get('name', instance.name)
instance.car = validated_data.get('car', instance.car)
instance.save()
return instance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def update_recipe_category(category: str, new_category: CategoryIn, session: Session = Depends(generate_session)):\n\n try:\n return db.categories.update(session, category, new_category.dict())\n except Exception:\n raise HTTPException(status.HTTP_400_BAD_REQUEST)",
"def create(self, va... | [
"0.6036423",
"0.5787956",
"0.5687996",
"0.55973935",
"0.55802065",
"0.5566578",
"0.5541771",
"0.5484012",
"0.54825187",
"0.5472111",
"0.54710746",
"0.5344318",
"0.53398746",
"0.53051615",
"0.529188",
"0.5278128",
"0.52741796",
"0.5246606",
"0.5209006",
"0.51540685",
"0.512874... | 0.0 | -1 |
init the Rowland circle geometry plus design of the system | def __init__(self, Rm=500, theta0=35, d=dSi111,\
aW=25, aWext=32., rSext=10., aL=97.,\
bender=(40., 60., 100.), actuator=(269., 135.),\
showInfos=False):
self.rc = RcHoriz(Rm=Rm, theta0=theta0, d=d,\
aW=aW, aWext=aWext, rSext=rSext, aL... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initBlock(self):\r\n \r\n self.std.Print('Setting up GrfNodeCore', fg, bg, style, src)\r\n\r\n tag = self.label + '-circle'\r\n\r\n obj = []\r\n\r\n obj.append(gfxcircle.GfxCircle(sheetCanvas=self.sheetCanvas, tag=tag, center=self.center,\r\n size=self.__size, m... | [
"0.68503547",
"0.6496401",
"0.63973564",
"0.6391397",
"0.6287716",
"0.6179951",
"0.6129178",
"0.6079575",
"0.60679394",
"0.60258937",
"0.60257286",
"0.60257286",
"0.60203034",
"0.6017973",
"0.5993932",
"0.59621227",
"0.59390754",
"0.59154886",
"0.5891009",
"0.5857311",
"0.585... | 0.0 | -1 |
refresh all positions with new Rm and theta0 (optional) | def set_rm(self, Rm, theta0=None, showInfos=None):
if theta0 is None: theta0 = self.rc.theta0
self.rc.Rm = Rm
self.rc.set_theta0(theta0, showInfos=showInfos) #to refresh positions
self.rs0 = self.rc.Rs #store Rs for updated Rm/theta0
self.sb = self.get_sb() #self.rc.Rs is updated... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reload_positions(self):\n self._initial_position = load_pose_from_npz(self._target_filename,\n self._actuator_name, str(self._target_number), 'initial')\n self._target_position = load_pose_from_npz(self._target_filename,\n self._actuator_name, str(self._target_numbe... | [
"0.59542954",
"0.5888523",
"0.58273983",
"0.5799219",
"0.57740283",
"0.57430166",
"0.5737932",
"0.5708261",
"0.56877005",
"0.56605995",
"0.56389266",
"0.5633231",
"0.5630402",
"0.5628269",
"0.5591292",
"0.55690736",
"0.5559921",
"0.55458266",
"0.55388707",
"0.55243164",
"0.55... | 0.659718 | 0 |
get the orthogonal projection of a 3d point on plane | def get_projection_point(self, point, plane, test=False):
return point_on_plane_projection(point, plane, test=test) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def proj3d(v):\n v = normalize(v)\n x, y, z, w = v\n return np.array([x, y, z]) / (1 + 1e-8 - w) # avoid divide by zero",
"def get_proj(self):\n relev, razim = np.pi * self.elev/180, np.pi * self.azim/180\n\n xmin, xmax = self.get_xlim3d()/self.pbaspect[0]\n ymin, ymax = self.get_ylim3d()/self... | [
"0.72587126",
"0.6987389",
"0.6894955",
"0.68236035",
"0.6650149",
"0.6607312",
"0.658716",
"0.65253586",
"0.65022165",
"0.6463207",
"0.64425963",
"0.6430746",
"0.6430746",
"0.64168096",
"0.63893336",
"0.6339403",
"0.6337584",
"0.6319232",
"0.62830335",
"0.6272326",
"0.626964... | 0.7156698 | 1 |
Generate a perspective matrix for far This is basically a replacement for gluPerspective( fov, aspect, near, far ) fov field of view in degrees (for compatability) aspect width/height (float) near near clipping plan in unitsdistance (float) far ignored, compatability with gluPerspective, this is always taken as inifini... | def pinfPerspective( fov, aspect, near, far=None ):
result = zeros( (4,4),'d')
# need the cotangent of the field-of-view
cotFOV = 1/tan(fov)
result[0,0] = cotFOV/aspect
result[1,1] = cotFOV
result[2,2:4] = -1
result[3,2] = -2*near
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perspective(self, fovy, aspect, near, far):\r\n\r\n top = near * math.tan(fovy * math.pi / 360.0)\r\n bottom = -top\r\n left = bottom * aspect\r\n right = top * aspect\r\n\r\n return self.frustum(left, right, bottom, top, near, far)",
"def get_perspective_matrix(fov_d... | [
"0.75744873",
"0.74618435",
"0.71077126",
"0.69498205",
"0.66489667",
"0.66463286",
"0.66343534",
"0.6626029",
"0.65930706",
"0.6539518",
"0.6510223",
"0.5936317",
"0.59024364",
"0.5876194",
"0.58702123",
"0.5858835",
"0.58233964",
"0.57397807",
"0.5694659",
"0.56865",
"0.568... | 0.74998903 | 1 |
The relative path of a node and this repository. | def rel_node_path(self, node):
return os.path.relpath(node.path, self.path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rel_path(self) -> str:\n return os.path.dirname(self._filepath_oracle.filepath())",
"def path(self) -> str:\n self.__verify_repo_initialized()\n return str(self._repo_path.parent)",
"def nodePath(self):\n ret = libxml2mod.xmlGetNodePath(self._o)\n return ret",
"def _Get... | [
"0.71066153",
"0.69842476",
"0.69365895",
"0.68181455",
"0.67865956",
"0.67167205",
"0.67003435",
"0.66988",
"0.66872007",
"0.66872007",
"0.66872007",
"0.66872007",
"0.66872007",
"0.66744506",
"0.6581204",
"0.6482866",
"0.64728814",
"0.64434314",
"0.6439672",
"0.64382744",
"0... | 0.85467654 | 0 |
Return the next item from the iterator. | def __next__(self) -> T:
buffer = self._buffer
if buffer:
return buffer.popleft()
else:
return next(self._iterator) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __next__(self):\n \n if self.i == len(self.data):\n raise StopIteration\n item = self.data[self.i]\n self.i += 1\n return item",
"def get_next_item(self):\n pass",
"def next(self):\n nxt = self.readentry()\n if nxt is None:\n rai... | [
"0.8154286",
"0.80917937",
"0.80530316",
"0.78972983",
"0.78338754",
"0.7789642",
"0.77538663",
"0.7703747",
"0.7664916",
"0.7661208",
"0.76073277",
"0.7546426",
"0.7536777",
"0.7497758",
"0.74917847",
"0.74917847",
"0.74917847",
"0.74917847",
"0.74917847",
"0.74917847",
"0.7... | 0.0 | -1 |
Get a list of currently loaded `Config`s. | def configs(self) -> list[Config]:
return self._configs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configs(self):\n return self._configs",
"def gather_configs(self):\n configs = []\n for what in self.order:\n for key in self.plugins[what]:\n mgr = self.plugins[what][key]\n c = mgr.config(what='get')\n if c is not None:\n ... | [
"0.7270811",
"0.72301435",
"0.71363217",
"0.7046203",
"0.70267314",
"0.6997996",
"0.69400656",
"0.69071966",
"0.68151677",
"0.6787089",
"0.67708415",
"0.6761417",
"0.6757037",
"0.67358243",
"0.6728499",
"0.6723536",
"0.6681277",
"0.6646923",
"0.66256005",
"0.66068035",
"0.658... | 0.7417294 | 0 |
Get the path to ZeroBot's data directory. | def data_dir(self) -> Path:
return self._data_dir | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data_dir():\n return Path(current_app.config[\"USER_DIR\"]) / \"data\"",
"def get_data_path():\n return os.getcwd() + \"/data/\"",
"def getDataPath():\n\treturn \"..\" + os.sep + \"data\" + os.sep",
"def data_dir():\n return os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')",
... | [
"0.8446696",
"0.8410059",
"0.83191204",
"0.8262391",
"0.8209076",
"0.81263274",
"0.805745",
"0.8019447",
"0.7929177",
"0.7869809",
"0.7848955",
"0.7837167",
"0.7837167",
"0.78177834",
"0.78075594",
"0.7784005",
"0.77818483",
"0.7770792",
"0.77665",
"0.77510655",
"0.7746682",
... | 0.80170304 | 8 |
Closes a module database connection. Modules should call this method instead of the `close` method on their `Connection` object so that Core may clean up any references to the object. | async def database_disconnect(self, module_id: str):
try:
await self._db_connections[module_id].close()
del self._db_connections[module_id]
except KeyError:
raise ModuleNotLoaded(f"Module {module_id} is not loaded.", mod_id=module_id) from None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_db_connection(cls):\n db.close()",
"def close_connection(self):\n if self.cursor is None and self.database is None:\n # if we don't have an open connection, do nothing\n return\n self.cursor.close()\n self.database.close()",
"def close_database(self):... | [
"0.78487724",
"0.74998206",
"0.74980885",
"0.74885345",
"0.73238695",
"0.72956955",
"0.7227428",
"0.7212614",
"0.7175097",
"0.71687365",
"0.7139028",
"0.7138443",
"0.71354014",
"0.712859",
"0.70897734",
"0.7084821",
"0.7063069",
"0.7051071",
"0.7037445",
"0.7030043",
"0.70300... | 0.69350255 | 31 |
A jurisdiction with Web01 in url should have a parsed URL that removes "Web01" from the URL | def test_parsed_url_web01_stripped(self):
# Construct a Jurisdiction for Arkansas 2014 General Election
url = 'https://results.enr.clarityelections.com/AR/53237/149294/Web01/en/summary.html'
jurisdiction = Jurisdiction(url=url, level='state')
self.assertNotIn('Web01', jurisdiction.parsed... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFilteredUrl(self, url):\n url = url.split('#')[0]\n if url.startswith('/wiki'):\n return ('https://en.wikipedia.org' + url)\n if 'en.wikipedia.org/wiki/' not in url:\n return ('https://en.wikipedia.org/wiki' + url)\n return url",
"def processUrl(url):\n ... | [
"0.66650254",
"0.6463221",
"0.6458684",
"0.6411748",
"0.6411423",
"0.6403579",
"0.63397956",
"0.63165855",
"0.6298673",
"0.6268589",
"0.6264505",
"0.6244958",
"0.6239063",
"0.61998516",
"0.6162777",
"0.61618084",
"0.61471224",
"0.6116817",
"0.61041415",
"0.61041415",
"0.61041... | 0.79530567 | 0 |
Checks to see if bullets have hit targets. Updates scores and removes dead items. | def check_collisions(self):
# NOTE: This assumes you named your targets list "targets"
for big_rock in self.rocks:
for bullet in self.bullets:
# Make sure they are both alive before checking for a collision
if bullet.alive and big_rock.alive:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_collisions(self):\r\n\r\n # NOTE: This assumes you named your targets list \"targets\"\r\n\r\n for bullet in self.bullets:\r\n for target in self.targets:\r\n\r\n # Make sure they are both alive before checking for a collision\r\n if bullet.alive and... | [
"0.808712",
"0.78685707",
"0.7581321",
"0.71715426",
"0.7093116",
"0.7073589",
"0.70089424",
"0.69819325",
"0.6949155",
"0.6933009",
"0.6898275",
"0.68842924",
"0.6857828",
"0.6819182",
"0.68058896",
"0.6720051",
"0.6688832",
"0.6676222",
"0.663791",
"0.66371304",
"0.6616897"... | 0.6897173 | 11 |
Puts the current key in the set of keys that are being held. You will need to add things here to handle firing the bullet. | def on_key_press(self, key: int, modifiers: int):
if self.ship.alive:
self.held_keys.add(key)
if key == arcade.key.SPACE:
# TODO: Fire the bullet here!
bullet = Bullet()
bullet.fire(self.ship.angle, self.ship.center)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_key_press(self, key: int, modifiers: int):\n if self.ship.alive:\n self.held_keys.add(key)\n\n if key == arcade.key.SPACE:\n bullet = Bullet(self.ship.angle, self.ship.center.x, self.ship.center.y)\n self.bullets_list.append(bullet)",
"def on_key_... | [
"0.73024654",
"0.71880454",
"0.65400505",
"0.6481568",
"0.64715964",
"0.6459044",
"0.64037365",
"0.63643533",
"0.63238823",
"0.6319505",
"0.6291781",
"0.6282269",
"0.62529784",
"0.625201",
"0.62192965",
"0.62192965",
"0.62023604",
"0.61852956",
"0.6171418",
"0.6153834",
"0.61... | 0.7320494 | 0 |
Computes the precision for the specified values of k 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 = [] | def accuracy(output, target): # , topk=(1,)):
correct = 0
batch_size = target.size(0)
for i in range(batch_size):
tar = target[i].data.cpu().numpy()
pred = output[i].data.cpu().numpy()
if (tar) == np.argmax(pred):
correct += 1
return float(correct/batch_size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(output, target, topk=(1,)):\n maxk = max(topk)\n batch_size = target.size(0)\n\n _, pred = output.topk(maxk, 1, True, True)\n pred = pred.t()\n correct = pred.eq(target.view(1, -1).expand_as(pred))\n\n res = []\n for k in topk:\n correct_k = correct[:k].view(-1).float().su... | [
"0.9115542",
"0.8273608",
"0.8093568",
"0.8027956",
"0.80217004",
"0.80217004",
"0.80163985",
"0.8011357",
"0.80079514",
"0.8002287",
"0.7987176",
"0.7981424",
"0.7969961",
"0.79673743",
"0.7966353",
"0.79649156",
"0.79649156",
"0.79649156",
"0.79649156",
"0.79649156",
"0.796... | 0.0 | -1 |
Get the nth output. This will be used for connecting this output to the input of another module. Whatever is returned by this object MUST have an Update() method. However you choose to implement it, the Update() should make sure that the whole chain of logic resulting in the data object has executed so that the data ob... | def get_output(self, idx):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_layer_n_output(self, n, data):\n\n intermediate_layer_model = Model(inputs=self.model.input,\n outputs=self.model.layers[n].output)\n intermediate_output = intermediate_layer_model.predict(data)\n return intermediate_output",
"def get_layer_n_o... | [
"0.681908",
"0.681908",
"0.681908",
"0.63481975",
"0.62882274",
"0.6266888",
"0.62581336",
"0.6235678",
"0.6160396",
"0.6139418",
"0.6128426",
"0.6117038",
"0.6115608",
"0.61129725",
"0.6103343",
"0.61011755",
"0.6070049",
"0.6069314",
"0.60688037",
"0.60659903",
"0.6063304",... | 0.68717355 | 0 |
Returns current configuration of module. This should return a pickle()able object that encapsulates all configuration information of this module. The default just returns self._config, which is None by default. You can override get_config() and set_config(), or just make sure that your config info always goes via self.... | def get_config(self):
# make sure that the config reflects the state of the underlying logic
self.logic_to_config()
# and then return the config struct.
return self._config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(self) -> Dict[str, Any]:\n if self.config is None:\n self.config = self.load_config()\n\n return self.config",
"def get_config(self) -> Dict[str, Any]:\n if self.config is None:\n self.config = self.load_config()\n\n return self.config",
"def get... | [
"0.81143945",
"0.81143945",
"0.8078268",
"0.7882795",
"0.78656054",
"0.7782018",
"0.7782018",
"0.7762519",
"0.7762519",
"0.7762519",
"0.7762519",
"0.7762519",
"0.7762519",
"0.7762519",
"0.7762519",
"0.7762519",
"0.7762519",
"0.7762519",
"0.7762519",
"0.7762519",
"0.7762519",
... | 0.81540185 | 0 |
Set run id for experiment. | def set_run(self, run_id: str):
self.run_id = run_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_id(self):\n raise NotImplementedError()",
"def setup(self, run, run_id):\n\n raise NotImplementedError",
"def run_id(self) -> str:\n return self._step_execution_context.run_id",
"def run_id(self):\n if self._run_id is not None:\n return self._run_id\n run = ... | [
"0.6331276",
"0.6289599",
"0.6189492",
"0.6146995",
"0.613545",
"0.6113242",
"0.61072356",
"0.61024463",
"0.6075926",
"0.606038",
"0.60467964",
"0.6017267",
"0.6002455",
"0.59917843",
"0.59770507",
"0.5900296",
"0.5876527",
"0.5868977",
"0.5858208",
"0.5829603",
"0.5828417",
... | 0.8194618 | 0 |
Get a new pgframe object from the wrapped graph object. | def _generate_pgframe(self, node_prop_types=None, edge_prop_types=None,
node_filter=None, edge_filter=None):
return graph_tool_to_pgframe(
self.graph, node_prop_types=node_prop_types,
edge_prop_types=edge_prop_types) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pgframe_to_graph_tool(pgframe, directed=True):\n graph = gt.Graph(directed=directed)\n\n # Add nodes\n graph.add_vertex(pgframe.number_of_nodes())\n\n # Encode original node id's as a new property `@label`\n prop = graph.new_vertex_property(\n \"string\", vals=pgframe._nodes.index)\n g... | [
"0.62872344",
"0.62538594",
"0.6065963",
"0.5387635",
"0.5386343",
"0.535984",
"0.53034806",
"0.5290252",
"0.5165699",
"0.5132457",
"0.5109525",
"0.5041663",
"0.50308704",
"0.49889103",
"0.49789298",
"0.49631593",
"0.49562874",
"0.49312428",
"0.4924124",
"0.4912302",
"0.49078... | 0.5627066 | 3 |
Get the opposite direction to the one specified. | def opposite(direction):
return (direction+2)%4 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def opposite(self):\n if self.direction == 8: return Direction(8)\n n = self.direction + 4\n if n >= 8: n -= 8\n return Direction(n)",
"def get_direction_backwards(self, direction):\r\n return direction_backwards[direction]",
"def opposite(self):\n if self == self.EAST... | [
"0.82954293",
"0.78264445",
"0.7694165",
"0.74472415",
"0.73675305",
"0.7192908",
"0.7021444",
"0.6757454",
"0.6756536",
"0.6682565",
"0.66636866",
"0.66576535",
"0.65451837",
"0.65402687",
"0.652046",
"0.6462221",
"0.64339495",
"0.64159703",
"0.6338639",
"0.6332242",
"0.6312... | 0.7395814 | 4 |
Get the number of rows in this maze. | def get_nrows(self):
return self.nrows | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_rows(self):\n if self.number_of_columns():\n return self._number_of_rows\n else:\n return 0",
"def rows(self) -> int:\n return self.__squares.__len__()",
"def get_row_count(self):\n\t\treturn self.iter_n_children(None)",
"def getNumRows(self):\n ... | [
"0.8065674",
"0.7605544",
"0.75839937",
"0.7550477",
"0.75169176",
"0.7507785",
"0.7507785",
"0.7493737",
"0.7403451",
"0.7343553",
"0.73332006",
"0.7320504",
"0.73039526",
"0.7302027",
"0.7289958",
"0.7268313",
"0.7172276",
"0.7151576",
"0.71329355",
"0.7117828",
"0.71078914... | 0.7103179 | 22 |
Get the number of columns in this maze. | def get_ncols(self):
return self.ncols | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ncolumns(self):\n return self.__ncols",
"def n_cols(self):\n ch = self.children\n return 1 if not ch else sum([c.n_cols for c in ch])",
"def num_cols(self):\n return len(self.rows[0])",
"def columns(self) -> int:\n return self.__squares[0].__len__()",
"def num_cols(se... | [
"0.8071063",
"0.80709946",
"0.7989396",
"0.79877925",
"0.79652107",
"0.7914604",
"0.76453346",
"0.7642129",
"0.7611825",
"0.7581515",
"0.7468458",
"0.74653405",
"0.74458045",
"0.74328476",
"0.7422949",
"0.7398103",
"0.7397688",
"0.73901284",
"0.73478353",
"0.73343307",
"0.723... | 0.74092275 | 16 |
Get the end cell of this maze. | def get_end_cell(self):
return (self.end_row, self.end_col) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_end_node(self) -> MazeCell:\n return self._end_node",
"def findEnd(maze):\n final_Position = 0\n for i in range(0, len(maze)):\n for j in range(0, len(maze[0])):\n if maze[i][j] == '.':\n final_Position = i * len(maze[0]) + j\n return final_Pos... | [
"0.8780055",
"0.69453984",
"0.6916037",
"0.68668157",
"0.6854134",
"0.68447965",
"0.6794274",
"0.67857593",
"0.67741",
"0.6772599",
"0.6725976",
"0.66654474",
"0.6637268",
"0.6608814",
"0.6580767",
"0.6525401",
"0.64986277",
"0.64675057",
"0.6457178",
"0.64547575",
"0.6439617... | 0.81635135 | 1 |
Draw a path in the maze. This method draws a path through the sequence of cells specified by path. The path is drawn as a line joining the centers of the cells in the order they appear in path; the line is given the color C{color}. | def draw_path(self, path, color):
half_width = self.cell_width/2
half_height = self.cell_height/2
# List of coordinates corresponding to the center of each
# cell in the path, in a form acceptable to cvs.create_line.
coord_list = []
for cell in path:
coord_l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_path(self, path):\n for path_point in path:\n arcade.draw_lrtb_rectangle_filled(\n left = path_point[0] - 3,\n right = path_point[0] + 3,\n bottom = abs(path_point[1] + 3 - SCREEN_HEIGHT),\n top = abs(path_point[1] - 3 - SCREEN_... | [
"0.70254314",
"0.68869674",
"0.68448305",
"0.66557",
"0.63272965",
"0.60230833",
"0.5990763",
"0.5972572",
"0.58943367",
"0.5867718",
"0.5777874",
"0.5754116",
"0.57433164",
"0.5739783",
"0.57218695",
"0.5637876",
"0.5630486",
"0.5625403",
"0.56165",
"0.5614929",
"0.56037366"... | 0.83404523 | 0 |
Generates a safe filename that is unlikely to collide with existing objects in Google Cloud Storage. ``filename.ext`` is transformed into ``filenameYYYYMMDDHHMMSS.ext`` | def _safe_filename(filename):
filename = secure_filename(filename)
date = datetime.datetime.utcnow().strftime("%Y-%m-%d-%H%M%S")
basename, extension = filename.rsplit('.', 1)
return "{0}-{1}.{2}".format(basename, date, extension) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_filename(filename: str) -> str:\n return f\"{str(uuid.uuid4())}.{get_extension(filename)}\"",
"def _safe_filename(filename):\n date = datetime.datetime.utcnow().strftime(\"%Y-%m-%d-%H%M%S\")\n basename, extension = filename.rsplit('.', 1)\n return \"{0}-{1}.{2}\".format(basename, date, e... | [
"0.8051683",
"0.76883185",
"0.76821464",
"0.76653725",
"0.7337239",
"0.7305871",
"0.72462344",
"0.7231017",
"0.72304237",
"0.72159994",
"0.7132826",
"0.7096136",
"0.7081943",
"0.7056506",
"0.70259917",
"0.69658434",
"0.69578105",
"0.69435066",
"0.6924882",
"0.6911021",
"0.687... | 0.7509315 | 4 |
Request a DELETE LOCAL action | def __handle_action_delete_local(self, file_name: str):
# value is double encoded
file_name = unquote(file_name)
command = Controller.Command(Controller.Command.Action.DELETE_LOCAL, file_name)
callback = WebResponseActionCallback()
command.add_callback(callback)
self.__c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _delete(self, *args, **kwargs):\n return self._request('delete', *args, **kwargs)",
"def delete(self, *args, **kwargs):\n self.request(\"delete\", *args, **kwargs)",
"def delete(self):\r\n return http.Request('DELETE', '{0}'.format(\r\n self.get_url())), pars... | [
"0.7384338",
"0.732763",
"0.7325789",
"0.72367567",
"0.7233924",
"0.7210971",
"0.7202911",
"0.7200737",
"0.71663547",
"0.71227825",
"0.7119012",
"0.7119012",
"0.7119012",
"0.7119012",
"0.7119012",
"0.7119012",
"0.7119012",
"0.7119012",
"0.7119012",
"0.7119012",
"0.7119012",
... | 0.0 | -1 |
Tests the default option of properties. | def testDefault(self):
for val in (1, {}, 'test', None):
prop = make_prop(default=val)
self.assertEqual(val, prop.interpret(recipe_api.PROPERTY_SENTINEL, {})) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_should_return_none_for_defaults(self):\r\n default_spec = {\r\n 'type': 'defaults',\r\n 'spec_type': 'property',\r\n 'functional': True\r\n }\r\n\r\n assert 'property' not in self.spec_parser._defaults\r\n assert self.spec_parser.parse_statement... | [
"0.7462565",
"0.7457675",
"0.7291311",
"0.7116405",
"0.703369",
"0.69905543",
"0.6955457",
"0.65332913",
"0.64178056",
"0.6393374",
"0.6393374",
"0.6393374",
"0.63918966",
"0.6328085",
"0.63202673",
"0.62699956",
"0.626532",
"0.62403846",
"0.6229158",
"0.6225812",
"0.62227184... | 0.774593 | 0 |
Tests that properties can pick up values from environment. | def testFromEnviron(self):
prop = make_prop(default='def', from_environ='ENV_VAR')
# Nothing is given => falls back to hardcoded default.
self.assertEqual('def', prop.interpret(recipe_api.PROPERTY_SENTINEL, {}))
# Only env var is given => uses it.
self.assertEqual(
'var', prop.interpret(rec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dev_props(name, properties):\n assert properties['x']\n assert properties['y']",
"def test_read_props(self):\n basic_test_runner(self, 'read_props')",
"def test_get_environment_attribute(self):\n\n config = EnvironmentConfig()\n config.environment = {\"a_field\": \"a_value\"... | [
"0.71338564",
"0.6963545",
"0.6835958",
"0.6814102",
"0.6801935",
"0.6751958",
"0.6683329",
"0.63902354",
"0.6388913",
"0.6374609",
"0.63606745",
"0.63392234",
"0.62623185",
"0.625828",
"0.62348086",
"0.6187986",
"0.6184467",
"0.61626345",
"0.61269975",
"0.61101747",
"0.61095... | 0.7581173 | 0 |
Get a random element from the set. | def getRandom(self):
n = len(self.keys)
while n > 0:
index = random.randint(0, n - 1)
my_key = self.keys[index]
if my_key in self.ds:
return my_key
else:
self.keys[index] = self.keys[n - 1]
self.keys.pop()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getRandom(self):\n return self.nums[random.randint(0, len(self.nums) - 1)]\n\n # Your RandomizedSet object will be instantiated and called as such:\n # obj = RandomizedSet()\n # param_1 = obj.insert(val)\n # param_2 = obj.remove(val)\n # param_3 = obj.getRandom()",
"... | [
"0.7703242",
"0.72931343",
"0.7218611",
"0.6870737",
"0.68438596",
"0.6831954",
"0.6775109",
"0.67205936",
"0.6701239",
"0.66633993",
"0.6633367",
"0.66202724",
"0.66111916",
"0.6597498",
"0.6564292",
"0.6475166",
"0.64615905",
"0.64409477",
"0.64128685",
"0.63991153",
"0.639... | 0.73851275 | 1 |
for independent variable x and y, percentiles are given after resampling | def get_percentile(self, q):
return self.sum_stat_sample_delta.get_percentile(q) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_percentile_bounds_vs_x(sps, x, y, q=25, nbins=15, pcol='blue', scol='orange', sorted=True, line_alpha=1):\n if min(x) == max(x):\n return\n bins = np.linspace(min(x), max(x), nbins + 1)\n\n if not sorted:\n inds = np.argsort(x)\n x = x[inds]\n y = y[inds]\n\n inds =... | [
"0.6408679",
"0.629561",
"0.62342966",
"0.6112837",
"0.6087539",
"0.5984435",
"0.58791053",
"0.5831784",
"0.5826569",
"0.5821777",
"0.57692796",
"0.5756256",
"0.57036126",
"0.5696323",
"0.567178",
"0.56645226",
"0.5660805",
"0.5616063",
"0.5614366",
"0.557153",
"0.5569295",
... | 0.53345835 | 65 |
for independent variable x and y, percentiles are given after resampling | def get_percentile(self, q):
return self.sum_stat_sample_ratio.get_percentile(q) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_percentile_bounds_vs_x(sps, x, y, q=25, nbins=15, pcol='blue', scol='orange', sorted=True, line_alpha=1):\n if min(x) == max(x):\n return\n bins = np.linspace(min(x), max(x), nbins + 1)\n\n if not sorted:\n inds = np.argsort(x)\n x = x[inds]\n y = y[inds]\n\n inds =... | [
"0.6408679",
"0.629561",
"0.62342966",
"0.6112837",
"0.6087539",
"0.5984435",
"0.58791053",
"0.5831784",
"0.5826569",
"0.5821777",
"0.57692796",
"0.5756256",
"0.57036126",
"0.5696323",
"0.567178",
"0.56645226",
"0.5660805",
"0.5616063",
"0.5614366",
"0.557153",
"0.5569295",
... | 0.5435174 | 40 |
Applies the patch on the main image and returns the mask and bounding box as well. | def apply_patch_on_the_image(img, patch, count=5, offset=150):
mask = np.zeros(shape=img.shape)
boxes = []
prev = (0, 0)
gen = gencoordinates(img.shape[0], img.shape[1])
for i in range(count):
rnd = random.choice([x for x in range(100)])
x_offset = rnd + p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calcmask(self, *args, **kwargs):\n return _image.image_calcmask(self, *args, **kwargs)",
"def get_mask(self, index):\n if not self.masked:\n return None\n \n x, y = self.location_of(index)\n # Do not take patches from out of bounds spaces\n #if x > img_w ... | [
"0.6651828",
"0.6356996",
"0.6293321",
"0.620217",
"0.6134846",
"0.6112564",
"0.6105306",
"0.6087283",
"0.60775584",
"0.60405445",
"0.5965456",
"0.59376836",
"0.5929721",
"0.5901859",
"0.58827364",
"0.58625907",
"0.5861938",
"0.5826377",
"0.5826043",
"0.5740866",
"0.5698757",... | 0.62756723 | 3 |
This function changes learning rate to new value. Since learning rate is shared variable, we should use set_value(). | def change_lr(self, new_lr):
# do
self.lr.set_value(float(new_lr)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_learning_rate(session, lr_update, lr_placeholder, new_lr):\n session.run(lr_update, feed_dict={lr_placeholder: new_lr})",
"def _update_learning_rate(self):\r\n\r\n self.n_steps += 1\r\n lr = self.factor * self._get_lr_scale()\r\n for param_group in self._optimizer.param_groups:\r... | [
"0.7587773",
"0.737875",
"0.7320322",
"0.72316295",
"0.7159801",
"0.714057",
"0.7125382",
"0.7114639",
"0.7104667",
"0.7104667",
"0.7095801",
"0.7085539",
"0.69651103",
"0.6876685",
"0.6863759",
"0.6858237",
"0.6857306",
"0.6849106",
"0.6847716",
"0.68458945",
"0.6836044",
... | 0.72119653 | 4 |
Get the reward of one round Only reward the player agent if player wins | def _get_reward(self, player_score, opponent_score):
return player_score - opponent_score | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reward(self, player, winning_state):\n if winning_state == \"Tie\":\n return 1\n elif winning_state == \"Resume\":\n return -1\n else:\n if player == \"agent\":\n return 10\n else:\n return -10",
"def reward(self, ... | [
"0.81357235",
"0.7982517",
"0.76592034",
"0.75622046",
"0.7515008",
"0.74958193",
"0.7494599",
"0.74475443",
"0.74376804",
"0.7395006",
"0.7372123",
"0.73709",
"0.73486215",
"0.73458314",
"0.7295311",
"0.7287587",
"0.7287037",
"0.7268536",
"0.7241892",
"0.7218869",
"0.7183708... | 0.7534283 | 4 |
Get the min/max exp_states | def eval_exp_table(self):
maximum = max(self.exp_states, key=self.exp_states.get)
minimum = min(self.exp_states, key=self.exp_states.get)
print(maximum, self.exp_states[maximum])
print(minimum, self.exp_states[minimum]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_energy_range(self):\n\n e0_min = self.network.isomers[0].E0\n e0_max = e0_min\n\n for isomer in self.network.isomers[1:]:\n E0 = isomer.E0\n if E0 < e0_min:\n e0_min = E0\n if E0 > e0_max:\n e0_max = E0\n for reacta... | [
"0.5951384",
"0.57576567",
"0.5755593",
"0.55911875",
"0.554417",
"0.5529356",
"0.54989904",
"0.5489958",
"0.54418206",
"0.5384079",
"0.5348396",
"0.5348102",
"0.5329108",
"0.53245866",
"0.5315933",
"0.5314198",
"0.5304732",
"0.5283992",
"0.52822924",
"0.5276161",
"0.5272851"... | 0.7456573 | 0 |
Generates a 1d vector of gaussian sampled random values | def latent_space(size):
n = torch.randn(size, 100)
return n | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussianOneSample(self, mu=0., sig=1., size=1):\n\n thisSample = np.random.normal(mu, sig, size)\n\n return thisSample",
"def generate_gaussian():\n amp = 10 * numpy.random.chisquare(3)\n width = numpy.random.chisquare(3)\n mean = numpy.random.uniform(-10 + width, 10 - width)\n x = ... | [
"0.7531607",
"0.75252485",
"0.74670124",
"0.7418167",
"0.7407269",
"0.73067445",
"0.722988",
"0.7201072",
"0.7039607",
"0.69457895",
"0.6935208",
"0.6903772",
"0.6903736",
"0.68891704",
"0.687811",
"0.67878044",
"0.6787457",
"0.6770878",
"0.6764252",
"0.67415416",
"0.6699636"... | 0.0 | -1 |
Tensor containing zeros, with shape = size | def zeros_target(size):
data = torch.zeros(size, 1)
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zeros(*shape, **kwargs):\n return Tensor(np.zeros(shape), **kwargs)",
"def zeros(shape, dtype=np.float32, constant=False):\n return Tensor(np.zeros(shape, dtype), constant=constant)",
"def empty(*shape, **kwargs):\n return Tensor(np.empty(shape), **kwargs)",
"def zeros_like(tensor):\n ... | [
"0.87667",
"0.84801996",
"0.8066345",
"0.7980073",
"0.7807127",
"0.77943003",
"0.773544",
"0.76278424",
"0.7525455",
"0.75128853",
"0.7445225",
"0.7443453",
"0.7431369",
"0.7306292",
"0.72193164",
"0.7216728",
"0.720948",
"0.71908844",
"0.7190392",
"0.7187298",
"0.7168906",
... | 0.7814327 | 4 |
The ID of the region where you want to create the endpoint group. | def endpoint_group_region(self) -> pulumi.Input[str]:
return pulumi.get(self, "endpoint_group_region") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endpoint_group_region(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"endpoint_group_region\")",
"def endpoint_group_region(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"endpoint_group_region\")",
"def endpoint_group_id(self) -> pulumi.Output[str]:\n return... | [
"0.7425972",
"0.7222339",
"0.7147273",
"0.70097053",
"0.6935099",
"0.69308335",
"0.64095736",
"0.64095736",
"0.64095736",
"0.64095736",
"0.64095736",
"0.6184079",
"0.61478764",
"0.6104096",
"0.6073776",
"0.6073776",
"0.6073776",
"0.6070011",
"0.6070011",
"0.6040642",
"0.60322... | 0.7517218 | 0 |
The name of the endpoint group. The `basic_endpoint_group_name` must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (). The name must start with a letter. | def basic_endpoint_group_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "basic_endpoint_group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def basic_endpoint_group_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"basic_endpoint_group_name\")",
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"def name(self):\n return f\"{self._group.friendly_name} {GROUP_SUFFIX}\"",
"def _grou... | [
"0.8399732",
"0.65698206",
"0.6502387",
"0.6308308",
"0.6273647",
"0.6273647",
"0.6244117",
"0.62051815",
"0.61892086",
"0.61769843",
"0.61769843",
"0.61509496",
"0.61246926",
"0.6089578",
"0.6067637",
"0.60505724",
"0.6022867",
"0.60113996",
"0.5995482",
"0.5995482",
"0.5995... | 0.8519382 | 0 |
The name of the endpoint group. The `basic_endpoint_group_name` must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (). The name must start with a letter. | def basic_endpoint_group_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "basic_endpoint_group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def basic_endpoint_group_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"basic_endpoint_group_name\")",
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"def name(self):\n return f\"{self._group.friendly_name} {GROUP_SUFFIX}\"",
"def _grou... | [
"0.8398607",
"0.65688246",
"0.6502841",
"0.63093257",
"0.62720245",
"0.62720245",
"0.62427723",
"0.6202981",
"0.6186801",
"0.61766994",
"0.61766994",
"0.6151415",
"0.6123497",
"0.6090226",
"0.6067784",
"0.6050186",
"0.60213447",
"0.6010108",
"0.59953934",
"0.59953934",
"0.599... | 0.85182226 | 1 |
The ID of the region where you want to create the endpoint group. | def endpoint_group_region(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "endpoint_group_region") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endpoint_group_region(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"endpoint_group_region\")",
"def endpoint_group_region(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"endpoint_group_region\")",
"def endpoint_group_id(self) -> pulumi.Output[str]:\n return pulumi.ge... | [
"0.7517218",
"0.7425972",
"0.7147273",
"0.70097053",
"0.6935099",
"0.69308335",
"0.64095736",
"0.64095736",
"0.64095736",
"0.64095736",
"0.64095736",
"0.6184079",
"0.61478764",
"0.6104096",
"0.6073776",
"0.6073776",
"0.6073776",
"0.6070011",
"0.6070011",
"0.6040642",
"0.60322... | 0.7222339 | 2 |
Get an existing BasicEndpointGroup resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
accelerator_id: Optional[pulumi.Input[str]] = None,
basic_endpoint_group_name: Optional[pulumi.Input[str]] = None,
description: Optional[pulumi.Input[str]] = None... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n databases: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,\n location: Optional[pulumi.Input[str]] = None,\n name: Optional[pulumi.Input[str]] =... | [
"0.6077914",
"0.5409428",
"0.5348675",
"0.52237904",
"0.5164421",
"0.5163234",
"0.51078993",
"0.5092026",
"0.5065578",
"0.50340295",
"0.50162876",
"0.50142306",
"0.50052065",
"0.5003553",
"0.5003553",
"0.4933673",
"0.49094382",
"0.48629972",
"0.4845772",
"0.47883108",
"0.4779... | 0.74842507 | 0 |
The name of the endpoint group. The `basic_endpoint_group_name` must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (). The name must start with a letter. | def basic_endpoint_group_name(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "basic_endpoint_group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def basic_endpoint_group_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"basic_endpoint_group_name\")",
"def basic_endpoint_group_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"basic_endpoint_group_name\")",
"def group_name(self) -> str:\n ret... | [
"0.85190666",
"0.85190666",
"0.65703756",
"0.6504761",
"0.63105655",
"0.62737054",
"0.62737054",
"0.6240665",
"0.62051535",
"0.6188521",
"0.6177619",
"0.6177619",
"0.6152473",
"0.6125156",
"0.6091694",
"0.60679746",
"0.6051146",
"0.6023272",
"0.6011264",
"0.5996545",
"0.59965... | 0.8399789 | 2 |
The ID of the region where you want to create the endpoint group. | def endpoint_group_region(self) -> pulumi.Output[str]:
return pulumi.get(self, "endpoint_group_region") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endpoint_group_region(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"endpoint_group_region\")",
"def endpoint_group_region(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"endpoint_group_region\")",
"def endpoint_group_id(self) -> pulumi.Output[str]:\n return ... | [
"0.7516322",
"0.7221384",
"0.7145687",
"0.7010394",
"0.6935785",
"0.69293815",
"0.6407801",
"0.6407801",
"0.6407801",
"0.6407801",
"0.6407801",
"0.6184805",
"0.6148318",
"0.61042744",
"0.60719585",
"0.60719585",
"0.60719585",
"0.6067021",
"0.6067021",
"0.6038862",
"0.603256",... | 0.74248034 | 1 |
Get a synthesizer configuration setting (instance attribute). | def get(self, key):
return getattr(self, key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config(self):\n return self[CONFIG_KEY]",
"def config(self):\n return self.namespace['config']",
"def _get_config(self):\n return self.__config",
"def _get_config(self):\n return self.__config",
"def _get_config(self):\n return self.__config",
"def _get_config(self):\n return se... | [
"0.6328491",
"0.6241151",
"0.6049961",
"0.6049961",
"0.6049961",
"0.6049961",
"0.6049961",
"0.6049961",
"0.6049961",
"0.6049961",
"0.6049961",
"0.6049961",
"0.6049961",
"0.6049961",
"0.6049961",
"0.6049961",
"0.6049961",
"0.6049961",
"0.6049961",
"0.6049961",
"0.6049961",
"... | 0.0 | -1 |
Return the hardware/firmware version. | async def version(self):
self.do("version")
return (await self.read(7)).strip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def firmware_version(self):\n return self._get_system_status()[\"firmware\"]",
"def hardware_version(self):\n return self.data.get('hw_ver')",
"def hw_version(self) -> str | None:\n return self.status.get(\"FIRMWARE\")",
"def hardware_version(self) -> str:\n return self.camera_info[\"... | [
"0.88212645",
"0.8802406",
"0.8747833",
"0.8554766",
"0.8509336",
"0.83752495",
"0.8351811",
"0.8285166",
"0.82011724",
"0.8198387",
"0.81854486",
"0.8129188",
"0.8079057",
"0.8062407",
"0.7945479",
"0.792709",
"0.786665",
"0.7840188",
"0.78077006",
"0.77164555",
"0.76591927"... | 0.7071856 | 46 |
Finds all bags that can contain bag of bag_color | def find_all_containers(bags, color):
containers = set(bags[color])
for container in bags[color]:
containers.update(find_all_containers(bags, container))
return containers | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_outer_bags(bag_requirements: dict, current_inner_bag: str) -> List:\n return [color for color, sub_bags in bag_requirements.items() if sub_bags.get(current_inner_bag, False)]",
"def find_all_contained(bags, color, multiplier=1):\n bags_contained = sum([multiplier * v for v in bags[color].values()])... | [
"0.72859114",
"0.70975226",
"0.64789695",
"0.6281314",
"0.6268277",
"0.6236848",
"0.6176387",
"0.61660624",
"0.5977398",
"0.5967847",
"0.5956627",
"0.5947883",
"0.59432274",
"0.5925873",
"0.58505464",
"0.5684628",
"0.5659618",
"0.5531975",
"0.5486276",
"0.54467094",
"0.537903... | 0.69189525 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.