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 |
|---|---|---|---|---|---|---|
Returns a dictionary with the GPE parameters in useful units. Doesn't include g_R because it's always 2 g_C | def getOutputParams(self):
out = {}
out["g_C"] = self.ureg.Quantity(self.g_C, self.gBase).to(self.gOutput)
out["gamma_C"] = self.ureg.Quantity(self.gamma_C,
self.gammaBase).to(self.gammaOutput)
out["m"] = self.ureg.Quantity(self.m, self.mBase).... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getGPEParams(self):\n outKeysScaleDouble = ['R', 'gamma_C', 'gamma_R', 'g_C', 'g_R', 'k',\n 'Pth']\n outKeysScaleSingle = outKeysScaleDouble + ['gamma_nl']\n outKeysScale = outKeysScaleSingle if self.singleComp else\\\n outKeysScaleDouble\n ou... | [
"0.7850718",
"0.68217444",
"0.6816121",
"0.6493574",
"0.6449787",
"0.6404485",
"0.63119984",
"0.6262541",
"0.6209501",
"0.61578035",
"0.61576235",
"0.6048388",
"0.60229266",
"0.6021528",
"0.60084945",
"0.6008468",
"0.59624547",
"0.5955775",
"0.59389216",
"0.5899721",
"0.58855... | 0.66882426 | 3 |
Build and return a grid of k values. | def getkGrid(self, scaled=True):
if scaled:
return np.meshgrid(fft.fftshift(self.k_axis_scaled),
fft.fftshift(self.k_axis_scaled))
else:
return np.meshgrid(fft.fftshift(self.k_axis_unscaled),
fft.fftshift(self.k_axis_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_grid(m, n, k):\n \n grid = np.zeros(m*n)\n \n mine_indecies = np.arange(m*n)\n np.random.shuffle(mine_indecies)\n mine_indecies = mine_indecies[:k]\n \n #print('mine_indecies:', mine_indecies)\n #print(np.arange(m*n).reshape((m,n)))\n \n for i in mine_indecies:\n ma... | [
"0.7075329",
"0.67697376",
"0.6391498",
"0.63488615",
"0.63324875",
"0.62924665",
"0.6255701",
"0.6252804",
"0.6247572",
"0.6239883",
"0.6204219",
"0.6192332",
"0.6181079",
"0.61495215",
"0.61474454",
"0.61118424",
"0.6088116",
"0.60697156",
"0.60684764",
"0.60556644",
"0.603... | 0.6543828 | 2 |
Returns the total number of particles. Performs appropriate scaling on the wavefunction. Will be incorrect if a mask is used as it calculates the density and multiplies by the area, and the area of the mask is not taken into account. | def getTotalNumber(self, mask=None):
densityScaled = self.getDensity(scaled=True, mask=None)
area = (2 * self.max_XY_scaled) ** 2
return densityScaled.sum() * area | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_particles(self) -> int:\n return len(self.particles)",
"def _get_variable_size(self, variable):\n # If domain is empty then variable has size 1\n if variable.domain == []:\n return 1\n else:\n size = 0\n spatial_method = self.spatial_methods[va... | [
"0.63874435",
"0.6212051",
"0.5988009",
"0.5977875",
"0.59070784",
"0.5823244",
"0.57815266",
"0.5728237",
"0.56448466",
"0.5644277",
"0.563934",
"0.56374687",
"0.56021565",
"0.560171",
"0.5584195",
"0.55813205",
"0.5554803",
"0.5551341",
"0.55405337",
"0.5532804",
"0.5510413... | 0.65303165 | 0 |
Returns Name L. instead of Name Lastname | def short_name(value):
parts = value.split()
return "{} {}.".format(parts[0].capitalize(), parts[1][0].upper()) if (len(parts) > 1 and len(parts[1]) > 1) else value.capitalize() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_name(self):\r\n return ('%s %s' % ( self.first_name, self.last_name ))",
"def get_full_name(self):\n return self.name+self.last_name",
"def get_name(self):\n return \"%s %s\" % (\n self.first_name,\n self.last_name\n )",
"def name(self):\n retu... | [
"0.8104187",
"0.8072722",
"0.79345316",
"0.79010624",
"0.7815387",
"0.7795377",
"0.7774134",
"0.7757134",
"0.7706836",
"0.7706836",
"0.77030617",
"0.76436937",
"0.76341146",
"0.7621007",
"0.7621007",
"0.7621007",
"0.7621007",
"0.7621007",
"0.7621007",
"0.7621007",
"0.7621007"... | 0.0 | -1 |
20080315 exits the program. F12 doesn't work everywhere. | def program_exit(self, button_object):
sys.exit(0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exit_program():\n print(\"Good Bye! Happy Searching...\")",
"def exit_program():\n quit()",
"def program_close():\n\n print(\"\\n\")\n sys.exit(0)",
"def quit():\n\tsys.exit()",
"def quit_program():\n sys.exit()",
"def exit_program():\n print(\"Good bye\")\n sys.exit()",
"d... | [
"0.74110603",
"0.73978287",
"0.7312061",
"0.7251091",
"0.7176707",
"0.71757716",
"0.7149953",
"0.7149947",
"0.7034586",
"0.7017711",
"0.69524914",
"0.69437116",
"0.6921911",
"0.687581",
"0.68663555",
"0.68656814",
"0.6832273",
"0.6827461",
"0.68171704",
"0.68137634",
"0.67907... | 0.6476082 | 44 |
Returns a batch generator from given iterable. | def batch(iterable, k=3):
for i in range(0, len(iterable), k):
yield iterable[i:i + k] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch_iter(iterable: Iterable[T], size: int) -> Iterator[Tuple[T]]:\n # make sure we can deal with iterables like lists too\n sourceiter = iter(iterable)\n # call islice until it returns an empty tuple\n return iter(lambda: tuple(islice(sourceiter, size)), ())",
"def iter_batch(iterable, size) ->... | [
"0.7480106",
"0.7476053",
"0.7322057",
"0.725146",
"0.7250101",
"0.7227102",
"0.7223281",
"0.7135572",
"0.7091165",
"0.707344",
"0.69893426",
"0.69489074",
"0.6864842",
"0.67580765",
"0.67218846",
"0.6720041",
"0.67039275",
"0.65136236",
"0.64314866",
"0.64071006",
"0.6344718... | 0.0 | -1 |
Create a dialog with the available versions for the selected file | def show_version_dialog(self, items):
active = items[-1]
# Get available versions for active representation
representation_id = io.ObjectId(active["representation"])
representation = io.find_one({"_id": representation_id})
version = io.find_one({"_id": representation["parent"]}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selectFiles(self):\n\n filenames = []\n self.fileIDs = \"\"\n self.caseIDs = \"\" # clears any case selections\n cur = self.settings['conn'].cursor()\n cur.execute(\"select id, name, status from source\")\n result = cur.fetchall()\n for row in result:\n ... | [
"0.64281803",
"0.6041987",
"0.6036916",
"0.5994945",
"0.59818",
"0.59606487",
"0.59524536",
"0.5932464",
"0.5928005",
"0.5918951",
"0.58955806",
"0.58949",
"0.5894266",
"0.5877616",
"0.5876166",
"0.58419025",
"0.5835255",
"0.5821782",
"0.58144087",
"0.5800145",
"0.57850575",
... | 0.72485054 | 0 |
Compare keras and PyTorch 2D locally connected layers on randomly generated values. | def test_2d_local_convolution(batch_exp, input_height, input_width, in_channels, filters, drawer, is_first):
batch_size = 2 ** batch_exp
if is_first:
data_format = "channels_first"
else:
data_format = "channels_last"
kernel_height = drawer.draw(integers(min_value=1, max_value=input_heigh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_1d_local_convolution(batch_exp, input_height, in_channels, filters):\n batch_size = 2 ** batch_exp\n kernel_size = np.random.randint(1, input_height)\n input1_shape = (input_height, in_channels)\n input2_shape = (input_height, 1, in_channels)\n\n # First model\n keras_1d_model = keras.Se... | [
"0.6281223",
"0.59733313",
"0.5933799",
"0.58730173",
"0.5862152",
"0.5858294",
"0.57718223",
"0.5767314",
"0.5758968",
"0.5745146",
"0.5678787",
"0.56786495",
"0.5669622",
"0.5664885",
"0.562567",
"0.5624821",
"0.56153697",
"0.5606631",
"0.55669135",
"0.5561339",
"0.5558933"... | 0.6518162 | 0 |
Ensures that we have at most maxlength entries in the queue. | def remove_extra_events(self):
while len(self.queue) > self.maxlength:
self.pop_event() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_items_limit(self):\n if self.items_limit and self.items_limit == self.get_metadata('items_count'):\n raise ItemsLimitReached('Finishing job after items_limit reached:'\n ' {} items written.'.format(self.get_metadata('items_count')))",
"def isFull(se... | [
"0.6648656",
"0.6337085",
"0.6321444",
"0.61950505",
"0.61531174",
"0.61358315",
"0.60677713",
"0.59984916",
"0.5979079",
"0.5953718",
"0.5941158",
"0.5919835",
"0.59051156",
"0.5896797",
"0.58897007",
"0.587937",
"0.5866999",
"0.5804402",
"0.5800886",
"0.57922536",
"0.579034... | 0.631892 | 3 |
Initialize priors for alpha model. | def _get_model_priors(self):
if self._alpha_model_priors:
return self._alpha_model_priors
# sample the variables from their corresponding distributions
params = self._get_prior_params()
self._alpha_model_priors = self._params2probs(params)
return self._alpha_model_pri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_priors(self,alpha):\n\n\t\tassert type(alpha) == float\n\t\tself.alpha = alpha",
"def initAlpha(self):\n alpha = [ s.zeros(self.K,) for m in range(self.M) ]\n for m in range(self.M):\n tmp = bernoulli.rvs(p=0.5, size=self.K)\n tmp[tmp==1] = 1.\n tmp[tmp==0] ... | [
"0.72039974",
"0.68423367",
"0.67616177",
"0.66497135",
"0.6612628",
"0.64662236",
"0.6444452",
"0.64342886",
"0.64072996",
"0.6239595",
"0.62076503",
"0.6198442",
"0.61966157",
"0.6192988",
"0.6175415",
"0.6146863",
"0.60701567",
"0.6051262",
"0.60414547",
"0.6040242",
"0.60... | 0.6929691 | 1 |
dumps the codebook data to a temporary json file and reads it back into a Codebook, verifying that the data has not changed. | def test_codebook_loads_from_local_file() -> None:
# dump codebook to disk
codebook_data: List = codebook_json_data_factory()
with tempfile.TemporaryDirectory() as directory:
codebook_json: str = os.path.join(directory, 'simple_codebook.json')
with open(codebook_json, 'w') as f:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_codebook_serialization():\n # Create a codebook\n codebook_array = codebook_json_data_factory()\n codebook = Codebook.from_code_array(codebook_array)\n\n # Dump it to a temporary file\n with tempfile.TemporaryDirectory() as directory:\n json_codebook = os.path.join(directory, 'codebo... | [
"0.82893604",
"0.62761414",
"0.5880496",
"0.5812842",
"0.5586137",
"0.5491621",
"0.5469543",
"0.53979313",
"0.53907704",
"0.53843135",
"0.53796273",
"0.5353662",
"0.53296244",
"0.5329227",
"0.52981293",
"0.5285584",
"0.52771163",
"0.5258684",
"0.5247092",
"0.5246001",
"0.5237... | 0.67992 | 1 |
Return object from a local json file. | def _read_json(cls, file_name):
json_file = os.path.join(cls.module_dir, file_name)
with open(json_file, 'r', encoding='utf8') as f:
return json.load(f) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_json(fpath):\n with open(fpath, 'r') as f:\n obj = json.load(f)\n return obj",
"def load_from_json_file(filename):\n with open(filename, 'r') as f:\n obj = json.loads(f.read())\n return obj",
"def from_json(path: str):\n with open(path) as f:\n return json.load(... | [
"0.8042995",
"0.80118036",
"0.79886526",
"0.7905591",
"0.78925765",
"0.7865493",
"0.78175676",
"0.78163224",
"0.7742484",
"0.77409106",
"0.7737798",
"0.7726172",
"0.7721698",
"0.7713223",
"0.767876",
"0.767019",
"0.7655502",
"0.76495844",
"0.75983334",
"0.75831693",
"0.757987... | 0.7125673 | 99 |
Determine if a file contains a PNG format image. | def _is_png(filename):
return filename.endswith(b'.png') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_png(filename):\n return '.png' in filename",
"def isPng(self):\n\t\treturn self.extension == '.png'",
"def hasPng(self):\n\t\tif self.isPng:\n\t\t\treturn True\n\t\treturn textureFile( self.path.replace( self.extension, '.png' ) ).exists",
"def IsPng( self, data ):\n return data.startswith(b... | [
"0.84427327",
"0.82276314",
"0.78828007",
"0.7621157",
"0.73693615",
"0.71803254",
"0.7119139",
"0.71105397",
"0.686497",
"0.6853616",
"0.6851112",
"0.6830815",
"0.6783124",
"0.676359",
"0.67626125",
"0.67306715",
"0.67215955",
"0.6645763",
"0.66139954",
"0.6559522",
"0.65148... | 0.8384838 | 1 |
Gets a collection of `InputExample`s for the train set. | def get_train_examples(self, data_path):
return self.create_examples(self.read_data(data_path), 'train') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_train_inputs(self, example):\n return example",
"def get_train_examples(self):\n raise NotImplementedError()",
"def get_train_examples(self, input_file):\r\n raise NotImplementedError()",
"def _create_examples(self, data, set_type):\n examples = []\n for (i, elem) in en... | [
"0.73499966",
"0.7173421",
"0.7126833",
"0.65602446",
"0.64052176",
"0.63422555",
"0.6290186",
"0.6282746",
"0.625262",
"0.62499267",
"0.62466323",
"0.62466323",
"0.62466323",
"0.62466323",
"0.62466323",
"0.62466323",
"0.62466323",
"0.62466323",
"0.62466323",
"0.62466323",
"0... | 0.64204013 | 4 |
Gets a collection of `InputExample`s for the dev set. | def get_dev_examples(self, data_path):
return self.create_examples(self.read_data(data_path), 'dev') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dev_examples(self, input_file):\r\n raise NotImplementedError()",
"def get_train_inputs(self, example):\n return example",
"def get_examples(self, env):\n return self.fam.c_get_examples(self, env)",
"def get_dev_examples(self):\n raise NotImplementedError()",
"def _create_ex... | [
"0.68112403",
"0.6588688",
"0.655683",
"0.6552607",
"0.64272827",
"0.63816285",
"0.6255956",
"0.61930686",
"0.6094262",
"0.6054992",
"0.6051947",
"0.5994604",
"0.5994604",
"0.5994604",
"0.5994604",
"0.5994604",
"0.5994604",
"0.5994604",
"0.5994604",
"0.5994604",
"0.5994604",
... | 0.61160946 | 8 |
Gets a collection of `InputExample`s for the dev set. | def get_test_examples(self, data_path):
return self.create_examples(self.read_data(data_path), 'test') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dev_examples(self, input_file):\r\n raise NotImplementedError()",
"def get_train_inputs(self, example):\n return example",
"def get_examples(self, env):\n return self.fam.c_get_examples(self, env)",
"def get_dev_examples(self):\n raise NotImplementedError()",
"def _create_ex... | [
"0.68085253",
"0.6587386",
"0.6555576",
"0.6551477",
"0.64263123",
"0.63808954",
"0.6256121",
"0.6192293",
"0.61156076",
"0.60942835",
"0.6054705",
"0.60512304",
"0.5993767",
"0.5993767",
"0.5993767",
"0.5993767",
"0.5993767",
"0.5993767",
"0.5993767",
"0.5993767",
"0.5993767... | 0.0 | -1 |
batch should be a list of (input_ids, attention_mask, ,,, labels) tuples... Returns a padded tensor of sequences sorted from longest to shortest, | def collate_fn(self, batch):
batch = list(map(torch.stack, zip(*batch)))
max_seq_len = torch.max(torch.sum(batch[1], 1)).item()
for i in range(len(batch) - 1):
if batch[i].size()[1] > max_seq_len:
batch[i] = batch[i][:, :max_seq_len]
if self.truncate_lab... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, batch, PAD=utils.IGNORE_ID):\n # sort a list by sequence length (descending order) to use pack_padded_sequence\n batch.sort(key=lambda x: len(x[0]), reverse=True)\n # seperate inputs and labels\n input_seqs, label_seqs = zip(*batch)\n # padding\n lengths... | [
"0.7163531",
"0.7099176",
"0.69679254",
"0.69529986",
"0.6756594",
"0.66987205",
"0.6682819",
"0.66773313",
"0.66598177",
"0.66164947",
"0.6567942",
"0.6520292",
"0.6427749",
"0.6415434",
"0.641418",
"0.63865083",
"0.638241",
"0.636842",
"0.6367179",
"0.6350681",
"0.62758785"... | 0.6122819 | 31 |
Creates the OpenAPI schema of a protobuf enum. This method should generally not be called directly, but rather through `_CreateSchema` which takes care of errorverifications and caching. This enum type is guaranteed to be a leaf in a type traversal, so there is no need for the `visiting` set that `_CreateMessageSchema`... | def _CreateEnumSchema(
self,
descriptor: EnumDescriptor,
) -> None:
if self.schema_objs is None: # Check required by mypy.
raise AssertionError("OpenAPI type schemas not initialized.")
enum_schema_obj: EnumSchema = {
"type": "string",
}
if descriptor.values:
enum_sch... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_type_builder_handles_enums():\n schema = [\n SchemaObject(\n name=\"ClassWithEnums\",\n properties=[\n SchemaValue(name=\"string_value\", value_type=\"string\"),\n SchemaEnum(\n name=\"enumValue\",\n value_... | [
"0.6719811",
"0.6599794",
"0.6075684",
"0.59912544",
"0.5975134",
"0.5896237",
"0.5875701",
"0.583452",
"0.58110017",
"0.5788179",
"0.5747693",
"0.5531802",
"0.5503449",
"0.5435139",
"0.54326046",
"0.54181",
"0.541318",
"0.5385666",
"0.5378067",
"0.53579974",
"0.5354922",
"... | 0.7798937 | 0 |
Creates the OpenAPI schema of a `protobuf.map` field type. This method should generally not be called directly, but rather through `_CreateSchema` which takes care of errorverifications and caching. The OpenAPI Specification allows only maps with strings as keys, so, as a workaround, we state the actual key type in the... | def _CreateMapFieldSchema(
self,
field_descriptor: FieldDescriptor,
visiting: Set[str],
) -> None:
if self.schema_objs is None: # Check required by mypy.
raise AssertionError("OpenAPI type schemas not initialized.")
if field_descriptor is None: # Check required by mypy.
raise ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_data_schema_map(component_fields_map: Dict):\n # Build the schema for the current component:\n component_schema_list = [_create_component_schema(\n component_name, \n component_fields_map[component_name]\n ) for component_name in component_fields_map\n ]\n \n ... | [
"0.70539474",
"0.6550621",
"0.614268",
"0.60735655",
"0.6012065",
"0.5883792",
"0.5753647",
"0.5560785",
"0.5524348",
"0.5479426",
"0.54456574",
"0.5387864",
"0.53423005",
"0.5339842",
"0.53258586",
"0.525354",
"0.52506185",
"0.51248217",
"0.5079622",
"0.50774133",
"0.5070061... | 0.79918957 | 0 |
Create the OpenAPI description of the request body of a route. | def _GetRequestBody(
self,
body_params: Iterable[FieldDescriptor],
) -> Dict[str, Dict[str, Any]]:
if not body_params:
return {}
properties: (Dict[str, Union[SchemaReference, ArraySchema,
DescribedSchema]]) = dict()
for field_d in body_params:
fiel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_route(self, body, **kwargs):\n\n all_params = ['body', 'pretty']\n all_params.append('callback')\n\n params = locals()\n for key, val in iteritems(params['kwargs']):\n if key not in all_params:\n raise TypeError(\n \"Got an unexpec... | [
"0.5694898",
"0.559231",
"0.54416907",
"0.54199106",
"0.54142207",
"0.54142207",
"0.54142207",
"0.54142207",
"0.54142207",
"0.53777015",
"0.53223324",
"0.5317469",
"0.5315072",
"0.5287887",
"0.5283472",
"0.52789026",
"0.5267908",
"0.52640337",
"0.5248409",
"0.51969403",
"0.51... | 0.0 | -1 |
Create the OpenAPI description of all the routes exposed by the API. | def _GetPaths(self) -> Dict[str, Dict[Any, Any]]:
# The `Paths Object` `paths` field of the root `OpenAPI Object`.
paths_obj: DefaultDict[str, Dict[Any, Any]] = collections.defaultdict(dict)
router_methods = self.router.__class__.GetAnnotatedMethods()
for router_method in router_methods.values():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def routes_info():\n routes = []\n for rule in app.url_map.iter_rules():\n try:\n if rule.endpoint != 'static':\n if hasattr(app.view_functions[rule.endpoint], 'import_name'):\n import_name = app.view_functions[rule.endpoint].import_name\n ... | [
"0.7301886",
"0.7034423",
"0.6642344",
"0.65698695",
"0.6556227",
"0.63875616",
"0.6373961",
"0.6348092",
"0.62996066",
"0.62740743",
"0.6267349",
"0.6249288",
"0.6228894",
"0.620323",
"0.6197804",
"0.61928374",
"0.6169094",
"0.6149211",
"0.6134993",
"0.61348385",
"0.61346215... | 0.0 | -1 |
Get a `Reference Object` that points to a schema definition. All types (including protobuf primitives) are expected to have been previously defined in the `components` field of the root `OpenAPI Object` and are used via OpenAPI references. | def _GetReferenceObject(type_name: str) -> SchemaReference:
return {
"$ref": f"#/components/schemas/{type_name}",
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_objects_to_schema(obj: Type[Component]) -> ReferenceObject:\n cmp_type: str = 'schemas' # default component type\n if hasattr(obj, '__cmp_type__'):\n cmp_type = obj.__cmp_type__.lower() # type: ignore\n return create_reference(obj.__name__, cmp_type)",
"def load_resolved_schema(spec... | [
"0.73276913",
"0.6306394",
"0.6259517",
"0.6214883",
"0.62022203",
"0.6200327",
"0.6125941",
"0.60557944",
"0.5880234",
"0.58645314",
"0.57584035",
"0.5708567",
"0.57019466",
"0.5684206",
"0.56835943",
"0.56496507",
"0.56273186",
"0.5616322",
"0.5535785",
"0.5505755",
"0.5482... | 0.7680222 | 0 |
Create isolated GLibMainloop for testing. | def create_main_loop():
mainloop = GLib.MainLoop()
timed_out = False
def quit_cb(unused):
nonlocal timed_out # noqa
timed_out = True
mainloop.quit()
def run(timeout_seconds=5):
source = GLib.timeout_source_new_seconds(timeout_seconds)
source.set_callback(quit_c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _hijack_gtk(self):\n import gtk\n orig_mainloop = gtk.main\n dumb_ml = _DummyMainloop(orig_mainloop, self, GUI_GTK)\n gtk.mainloop = dumb_ml\n gtk.main = dumb_ml\n return orig_mainloop",
"def run_main_loop():\n mainloop = GObject.MainLoop()",
"def run_main(func)... | [
"0.6966901",
"0.6877103",
"0.68706",
"0.64604014",
"0.6342568",
"0.6328897",
"0.61797196",
"0.61230195",
"0.6083871",
"0.60399014",
"0.595101",
"0.5919368",
"0.5909658",
"0.58598155",
"0.58294046",
"0.58252156",
"0.5814254",
"0.58128524",
"0.5811267",
"0.57738817",
"0.5770902... | 0.7772405 | 0 |
Return shortest name that isn't a duplicate in names | def shortest_id(name, names):
if name in names:
names.remove(name)
for i, letter in enumerate(name):
for other_name in names:
if other_name[i:i+1] == letter:
break
else:
break
return name[0:i+1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shortest_first_name(names):\n names = dedup_and_title_case_names(names)\n # ...",
"def shortest_first_name(names):\n names = dedup_and_title_case_names(names)\n split_names = [name.split(' ') for name in names]\n first_name = [first for first, last in split_names]\n shortest = first_name[0]... | [
"0.73064417",
"0.7206192",
"0.70505625",
"0.6991117",
"0.68218654",
"0.631899",
"0.62436545",
"0.61499953",
"0.61269563",
"0.6109931",
"0.6076618",
"0.605574",
"0.60480314",
"0.59962744",
"0.59795004",
"0.59669495",
"0.5938029",
"0.58721155",
"0.5842744",
"0.58370364",
"0.581... | 0.7899247 | 0 |
Find parent that contains the given directory. | def parent_path_with_dir(directory, path=None):
return parent_path_with(lambda p: os.path.isdir(os.path.join(p, directory)), path=path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_parents(name, cwd):\n for pdir in parents(cwd):\n if name in os.listdir(pdir):\n return os.path.join(pdir, name)\n\n return None",
"def _search_parent_dir(file_name):\n\n current_dir = os.getcwd()\n parent_dir = os.path.dirname(current_dir)\n while current_dir != paren... | [
"0.7669899",
"0.73810625",
"0.73767257",
"0.73239344",
"0.7242181",
"0.7239223",
"0.716266",
"0.7157632",
"0.7086137",
"0.70064485",
"0.698701",
"0.6945117",
"0.68443024",
"0.68264854",
"0.6765613",
"0.6739631",
"0.6730234",
"0.6728239",
"0.67242384",
"0.6693877",
"0.6682993"... | 0.78719985 | 0 |
Find parent that contains the given directory. | def parent_path_with_file(name, path=None):
return parent_path_with(lambda p: os.path.isfile(os.path.join(p, name)), path=path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent_path_with_dir(directory, path=None):\n return parent_path_with(lambda p: os.path.isdir(os.path.join(p, directory)), path=path)",
"def search_parents(name, cwd):\n for pdir in parents(cwd):\n if name in os.listdir(pdir):\n return os.path.join(pdir, name)\n\n return None",
"... | [
"0.78719985",
"0.7669899",
"0.73810625",
"0.73767257",
"0.73239344",
"0.7242181",
"0.7239223",
"0.716266",
"0.7157632",
"0.7086137",
"0.70064485",
"0.698701",
"0.6945117",
"0.68443024",
"0.68264854",
"0.6765613",
"0.6739631",
"0.6730234",
"0.6728239",
"0.67242384",
"0.6693877... | 0.6629416 | 22 |
Function to confirm whether a filename is in the correct format. | def check_filename(filepath, filename_pattern):
filename_no_ext = filepath.stem
# Check whether it's .XLSX or .XLS
if filepath.suffix[1:].upper() not in ["CSV", "XLSX", "XLS"]:
logging.error("Not an Excel file.")
return False
else:
# Check the filename fits the pattern
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_filename_convention(filename):\n\n if \"eduhub\" in filename.lower():\n filename = filename.lower().split(\"eduhub_\")[1]\n\n filename = filename.replace(\" \", \"\")\n\n end_date_str = filename[:10]\n start_date_str = filename[11:11 + 10]\n\n try:\n end_date = datetime.datet... | [
"0.7838395",
"0.74854255",
"0.74549055",
"0.7437424",
"0.74162686",
"0.74104977",
"0.7251145",
"0.72374094",
"0.7196633",
"0.71336186",
"0.7058613",
"0.7042813",
"0.7025471",
"0.70051503",
"0.6975363",
"0.695483",
"0.6951584",
"0.6934237",
"0.692044",
"0.6916205",
"0.6910884"... | 0.7155307 | 9 |
Returns true if the input doesn't contain a digit, false otherwise | def must_contain_digit(cell):
# Check if it's nan first
if check_empty(cell):
return True
return not bool(re.search("\d", str(cell))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __has_numbers(self, input_string):\n return bool(re.search(r'\\d', input_string))",
"def is_digit(user_input):\n # If any characters is digit return boolean True else False\n if any(char.isdigit() for char in user_input):\n return True\n return False",
"def checknum(val):\n\n ... | [
"0.80777645",
"0.80650556",
"0.8013827",
"0.7821042",
"0.78063387",
"0.77900255",
"0.7677654",
"0.767431",
"0.7617895",
"0.7598658",
"0.7535511",
"0.7524242",
"0.75181556",
"0.75083596",
"0.7497233",
"0.7480166",
"0.74028385",
"0.7333482",
"0.7307253",
"0.72768253",
"0.725406... | 0.78644454 | 3 |
Returns true if the input is not numeric, false otherwise | def must_be_numeric(cell):
# Check if it's nan first
if check_empty(cell):
return True
# If it's not nan, check it's a number
return pd.isna(pd.to_numeric(str(cell), errors="coerce")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_numeric(self) -> bool:\n return False",
"def isnumeric(self):\n return isnumeric(self)",
"def isnumeric(number):\n try:\n float(number)\n return True\n except (TypeError, ValueError):\n return False",
"def is_valid_numeric(inString):\r\n return is_int(inStri... | [
"0.85859025",
"0.8471611",
"0.81847143",
"0.80658376",
"0.8029535",
"0.80215997",
"0.79827803",
"0.79692626",
"0.7963591",
"0.795195",
"0.78878665",
"0.78723246",
"0.7809853",
"0.78074193",
"0.7729517",
"0.77216184",
"0.7699051",
"0.76953095",
"0.76939106",
"0.76806766",
"0.7... | 0.758765 | 27 |
Returns true if the input contains anything other than [azAZ .09], false otherwise | def must_be_alphanumeric_space_period(cell):
# Check if it's nan first
if check_empty(cell):
return True
# If it's not nan, check it's a number
return not bool(re.match(r"^[a-zA-Z .0-9]+$", str(cell))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_zone(zone):\n return re.match(r'^[a-z0-9\\-]+$', zone)",
"def isvalid(str_input):\r\n if str_input == \"\":\r\n return True\r\n if str_input[0] not in [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"-\", \".\"]:\r\n return False\r\n dot_count = 0\r\n ... | [
"0.613873",
"0.6122553",
"0.60015863",
"0.58696204",
"0.5861901",
"0.58562565",
"0.5838757",
"0.5830771",
"0.5827449",
"0.57974565",
"0.5746627",
"0.57294655",
"0.5682413",
"0.5675208",
"0.5665849",
"0.56256306",
"0.5623488",
"0.5614661",
"0.5604637",
"0.5594502",
"0.55745494... | 0.0 | -1 |
Returns the difference between total and price qty | def check_total(price, qty, total):
# Convert the values to numbers
price = pd.to_numeric(price, errors="coerce")
qty = pd.to_numeric(qty, errors="coerce")
total = pd.to_numeric(total, errors="coerce")
# Get the difference in calculated total and actual total
if price and qty and total:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_subtotal(price, quantity):\n\n return price * quantity",
"def compute_total(price):\n\n quantity = 20\n return price * quantity",
"def get_total(self):\n\n total = super().get_total()\n if self.qty < 10:\n total += 3.00\n return total",
"def price_diff(self):... | [
"0.68462646",
"0.67616576",
"0.66024196",
"0.65258247",
"0.6478923",
"0.63898885",
"0.63308316",
"0.6310808",
"0.6301516",
"0.62760687",
"0.62595403",
"0.6253719",
"0.6214905",
"0.6205075",
"0.61934924",
"0.6190037",
"0.6164722",
"0.61549306",
"0.61507523",
"0.6145012",
"0.61... | 0.73031396 | 0 |
Returns True if the filename has an image type extension | def allowed_file(name):
valid_extensions = current_app.config['ALLOWED_EXTENSIONS']
return '.' in name and name.rsplit('.', 1)[1] in valid_extensions | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_image_file(filename, extensions):\n return filename.lower().endswith(extensions)",
"def is_image_file(filename):\r\n filename_lower = filename.lower()\r\n return any(filename_lower.endswith(ext) for ext in IMG_EXTENSIONS)",
"def is_image(filename: str) -> str:\n extension = filename.rsplit(\... | [
"0.856675",
"0.8419152",
"0.8388353",
"0.8386103",
"0.83302045",
"0.8309143",
"0.8292932",
"0.82577556",
"0.80867285",
"0.80211955",
"0.80183",
"0.7962871",
"0.7893068",
"0.78718925",
"0.78669745",
"0.7856298",
"0.77784455",
"0.77777106",
"0.777373",
"0.7769098",
"0.7731475",... | 0.0 | -1 |
Show 404 NOT FOUND page. | def page_not_found(e):
return render_template('404.html'), 404 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_not_found():\n return render_template(\"errors/404.html\"), 404",
"def page_not_found(e):\n return render_template(\"404.html\", page_title=404)",
"def page_not_found(e):\n return render_template(\"404.html\"), 404",
"def page_not_found(e):\n return render_template('404.html'), 404",
"... | [
"0.8532825",
"0.8522359",
"0.84847295",
"0.8478198",
"0.8478198",
"0.8457024",
"0.8426104",
"0.84258604",
"0.83979046",
"0.8348499",
"0.826447",
"0.82205737",
"0.8213493",
"0.8153094",
"0.8153094",
"0.8153094",
"0.8153094",
"0.8153094",
"0.8153094",
"0.8153094",
"0.8148781",
... | 0.84300005 | 6 |
Sets the is_current of this KgSnapshot. | def is_current(self, is_current):
self._is_current = is_current | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_current(self, current):\n self._current = current",
"def setCurrent(self, current):\n self.__current = current",
"def set_current(self, to):\n self.current = to",
"def is_current(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"is_current\")",
"def is_c... | [
"0.7290743",
"0.69969857",
"0.64055985",
"0.6374332",
"0.6220856",
"0.6111536",
"0.58438",
"0.5841508",
"0.58377314",
"0.57941025",
"0.5793994",
"0.57500505",
"0.5742804",
"0.57313156",
"0.56826913",
"0.5671424",
"0.56406945",
"0.5636471",
"0.5627926",
"0.5596016",
"0.5590859... | 0.8176992 | 0 |
Sets the name of this KgSnapshot. | def name(self, name):
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n self._name = name",
"def set_name(self, name):\n self.__name = name",
"def set_name(self, name):\n self.__name = name",
"def set_name(self, name: str):\n self._name = name",
"def set_name(self, _name):\n self.name = _name",
"def set_name(self... | [
"0.7702522",
"0.76433796",
"0.76433796",
"0.762874",
"0.75972825",
"0.7595424",
"0.7587061",
"0.7587061",
"0.7587061",
"0.7587061",
"0.7587061",
"0.7538208",
"0.75267124",
"0.7503101",
"0.74149364",
"0.73847127",
"0.7373864",
"0.7373864",
"0.73251015",
"0.72666395",
"0.723528... | 0.0 | -1 |
Sets the project_task_id of this KgSnapshot. | def project_task_id(self, project_task_id):
self._project_task_id = project_task_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task_id(self, task_id):\n self._task_id = task_id",
"def task_id(self, task_id):\n\n self._task_id = task_id",
"def set_project_id(self, project_id):\n self._project_id = project_id",
"def project_id(self, project_id):\n\n self._project_id = project_id",
"def project_id(self... | [
"0.7260574",
"0.7236703",
"0.7063555",
"0.6884079",
"0.6884079",
"0.6633034",
"0.63081044",
"0.6246645",
"0.5950057",
"0.5897112",
"0.5786243",
"0.5786243",
"0.5758504",
"0.57103425",
"0.5710253",
"0.5710253",
"0.5710253",
"0.5710253",
"0.57077056",
"0.5700057",
"0.5693284",
... | 0.81985027 | 0 |
Sets the task_type of this KgSnapshot. | def task_type(self, task_type):
self._task_type = task_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_task_input_type(self, task, input_id, type_):\n self._write_transaction(tx.set_task_input_type, task=task, input_id=input_id, type_=type_)",
"def set_execution_type(self, type):\n self.execution_type = type",
"def set_type(self, type: int):\r\n self.type = type\r\n self.canv... | [
"0.6400824",
"0.6316093",
"0.6175961",
"0.61083794",
"0.6074039",
"0.605438",
"0.605438",
"0.5981519",
"0.58521825",
"0.57791317",
"0.57791317",
"0.577171",
"0.5753683",
"0.5753683",
"0.5753683",
"0.5727037",
"0.57145405",
"0.5694585",
"0.5690552",
"0.56856865",
"0.56856865",... | 0.8088163 | 0 |
Sets the timestamp of this KgSnapshot. | def timestamp(self, timestamp):
self._timestamp = timestamp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamp(self, timestamp):\n \n self._timestamp = timestamp",
"def timestamp(self, timestamp: datetime):\r\n self._timestamp = timestamp",
"def set_timestamp(self, timestamp):\n self._set_sub_text('timestamp', text=str(xep_0082.datetime(timestamp)))\n return self",
"de... | [
"0.7591333",
"0.7528926",
"0.7318079",
"0.7137648",
"0.6971248",
"0.69696116",
"0.6926916",
"0.6920755",
"0.6847465",
"0.6826113",
"0.6818249",
"0.6679519",
"0.661784",
"0.6466579",
"0.6435526",
"0.63073903",
"0.62910855",
"0.6261787",
"0.6245467",
"0.62225413",
"0.62185794",... | 0.75630015 | 7 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, KgSnapshot):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, KgSnapshot):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Sets the category of this BeaconConceptCategory. | def category(self, category: str):
self._category = category | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def category(self, category):\n\n self._category = category",
"def category(self, category):\n\n self._category = category",
"def category(self, category):\n\n self._category = category",
"def category(self, category):\n\n self._category = category",
"def category(self, category... | [
"0.70995384",
"0.70995384",
"0.70995384",
"0.70995384",
"0.70995384",
"0.70305437",
"0.69609714",
"0.6905981",
"0.6878832",
"0.6269423",
"0.61838156",
"0.59096074",
"0.5873381",
"0.57511264",
"0.5745965",
"0.54416066",
"0.54415697",
"0.54221034",
"0.54145926",
"0.53416055",
"... | 0.6985241 | 6 |
Sets the local_category of this BeaconConceptCategory. | def local_category(self, local_category: str):
self._local_category = local_category | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def category(self, category):\n\n self._category = category",
"def category(self, category):\n\n self._category = category",
"def category(self, category):\n\n self._category = category",
"def category(self, category):\n\n self._category = category",
"def category(self, category... | [
"0.6279045",
"0.6279045",
"0.6279045",
"0.6279045",
"0.6279045",
"0.60944206",
"0.6066688",
"0.60527647",
"0.602453",
"0.5945988",
"0.5679506",
"0.5672166",
"0.5663304",
"0.561537",
"0.54851216",
"0.5474165",
"0.5406197",
"0.5336965",
"0.523652",
"0.523652",
"0.523652",
"0.... | 0.8369655 | 0 |
Gets the description of this BeaconConceptCategory. | def description(self) -> str:
return self._description | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def business_sub_cat_desc(self) -> str:\n return self._business_sub_cat_desc",
"def description(self) -> str:\n return self._search_in_properties(ATTR_DESCRIPTION)",
"def get_description(self):\n return self._description",
"def get_description(self):\n return self.__description",
... | [
"0.7153943",
"0.6525274",
"0.6496341",
"0.649628",
"0.6485454",
"0.6452043",
"0.6442025",
"0.6435617",
"0.6435617",
"0.6435617",
"0.6435617",
"0.6415947",
"0.64140254",
"0.6401679",
"0.63737863",
"0.6353183",
"0.6348548",
"0.6348548",
"0.6348548",
"0.6348548",
"0.6348548",
... | 0.6366889 | 22 |
Sets the description of this BeaconConceptCategory. | def description(self, description: str):
self._description = description | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_description(self, description):\n self._description = description",
"def set_description(self, description):\n self.description = description",
"def SetDescription(self, description):\n self.description = str(description)",
"def set_description(self, description):\n self._... | [
"0.70933855",
"0.7053868",
"0.7012328",
"0.7000475",
"0.69956076",
"0.6872106",
"0.6872106",
"0.6872106",
"0.6872106",
"0.68571407",
"0.68571407",
"0.68571407",
"0.68571407",
"0.68571407",
"0.68571407",
"0.68571407",
"0.68571407",
"0.68571407",
"0.68571407",
"0.68571407",
"0.... | 0.6711775 | 53 |
Returns the PortalConfiguration object | def getPortalConfiguration( self ):
return CustomDefinitions.portalConfiguration | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPortalObject( self ):\n return self",
"def get_configuration(self) -> dict:\n return self.config",
"def get_config(self):\n return self.config",
"def configuration(self):\n return self._config",
"def configuration(self):\n return self._configuration",
"def config... | [
"0.6311939",
"0.62730724",
"0.5981459",
"0.593728",
"0.5841987",
"0.5836132",
"0.58161825",
"0.57961315",
"0.5784917",
"0.57753175",
"0.57676524",
"0.5764525",
"0.5729738",
"0.5726465",
"0.57209766",
"0.57209766",
"0.57209766",
"0.57209766",
"0.57209766",
"0.57209766",
"0.572... | 0.80773133 | 0 |
Compute the nut needed to enforce the correct shear stress. | def nut(self, guess, sampledU, wallGradU):
magGradU = np.abs(wallGradU)
uTau = self.utau(guess, sampledU)
return np.max([0.0, uTau**2/magGradU - self.nu]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strain_distribution(self,na_z,phi):\r\n\t\treturn (self.mesh_center - na_z)*phi",
"def effective_stress(self):\n tau = self.deviatoric_stress_tensor()\n tu_xx = tau[0,0]\n tu_yy = tau[1,1]\n tu_zz = tau[2,2]\n tu_xy = tau[0,1]\n tu_xz = tau[0,2]\n tu_yz = tau[1,2]\n \n # S... | [
"0.61068374",
"0.5979786",
"0.59433585",
"0.5935773",
"0.5878371",
"0.5858223",
"0.58469015",
"0.5842259",
"0.5821676",
"0.5728545",
"0.5717622",
"0.5713515",
"0.5701803",
"0.5684088",
"0.5655602",
"0.5644621",
"0.5616248",
"0.5576319",
"0.5573751",
"0.55718327",
"0.55683255"... | 0.66536975 | 0 |
return the user's FirstName attribute | def getFirstName(self):
return self.FirstName | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_name(self, instance):\r\n return instance.user.first_name",
"def get_first_name(self) -> str:\n return self.first_name",
"def get_first_name(self):\n return self._first_name",
"def get_user_firstname():\n if not is_authenticated() or 'samlUserdata' not in session:\n r... | [
"0.8837501",
"0.8592428",
"0.8492364",
"0.83234894",
"0.8289283",
"0.8287808",
"0.8287808",
"0.8287808",
"0.82785463",
"0.82785463",
"0.82365304",
"0.8178356",
"0.8160002",
"0.81530106",
"0.8058206",
"0.805596",
"0.805596",
"0.79037255",
"0.785532",
"0.78440464",
"0.7823436",... | 0.8313274 | 4 |
return the user's LastName attribute | def getLastName(self):
return self.LastName | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_name(self, instance):\r\n return instance.user.last_name",
"def get_user_lastname():\n if not is_authenticated() or 'samlUserdata' not in session:\n return None\n\n lastname = session.get('samlUserdata', {}).get(SAML_ATTRIBUTES.get('last_name', None), False)\n\n return lastname[0]... | [
"0.86083156",
"0.8361105",
"0.8290995",
"0.8214303",
"0.8210174",
"0.8191879",
"0.8125725",
"0.8054238",
"0.8054238",
"0.8054238",
"0.8054238",
"0.8027048",
"0.8027048",
"0.80024",
"0.800165",
"0.800165",
"0.800165",
"0.800165",
"0.800165",
"0.79448605",
"0.7852887",
"0.784... | 0.80233395 | 13 |
return the user's Email attribute | def getEmail(self):
return self.Email | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_email(self):\n member = self.get_user()\n if member:\n return member.getProperty('email')",
"def email(self, instance):\r\n return instance.user.email",
"def get_email(obj):\r\n return obj.user.email",
"def get_email(self):\n return self.email",
"def e... | [
"0.8936723",
"0.84688866",
"0.8462436",
"0.8290934",
"0.8206341",
"0.82050496",
"0.813386",
"0.81047773",
"0.8090162",
"0.8023243",
"0.78194803",
"0.77114064",
"0.77114064",
"0.77114064",
"0.768923",
"0.76814735",
"0.76814735",
"0.76814735",
"0.76814735",
"0.7652601",
"0.7634... | 0.8126218 | 7 |
return the user's Group attribute | def getGroup(self):
return self.Group | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_group(self):\n\t\treturn self.variables.get('group')",
"def get_group(self):\n return self._group",
"def group(self):\n return self.properties.get('Group', None)",
"def get_group(self) -> Optional[str]:\n return self.group",
"def get_group(self, group_name):\n\n return self.... | [
"0.7707693",
"0.7614356",
"0.72589403",
"0.7250934",
"0.72227514",
"0.72198355",
"0.72198355",
"0.7166727",
"0.7166727",
"0.7166727",
"0.70901716",
"0.70329094",
"0.70311815",
"0.70023364",
"0.6961612",
"0.69336724",
"0.69158894",
"0.6869443",
"0.68277943",
"0.6802848",
"0.67... | 0.7480632 | 2 |
generate XML Payload for user's LastName | def LastNamePayload(self):
return "<lastname>%s</lastname>" % (self.LastName) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def FirstNamePayload(self):\n\t\treturn \"<firstname>%s</firstname>\" % (self.FirstName)",
"def UserNamePayload(self):\n\t\treturn \"<username>\" + self.Username + \"</username>\"",
"def get_full_name(self):\n # The user is identified by their email address\n return self.first_name+' '+self.last_... | [
"0.71527255",
"0.6928107",
"0.61153996",
"0.6069634",
"0.5992781",
"0.5921359",
"0.5903613",
"0.58533096",
"0.5826576",
"0.579074",
"0.578065",
"0.572257",
"0.56907386",
"0.5670609",
"0.56649625",
"0.56418633",
"0.5633301",
"0.56233084",
"0.5616939",
"0.5591511",
"0.5586126",... | 0.7777955 | 0 |
Apply histogram equalization to an input frame, threshold it and return the (binary) result. | def histo_image(image, verbose=False):
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
histo_global = cv2.equalizeHist(gray)
_, histo = cv2.threshold(histo_global, thresh=250,
maxval=255, type=cv2.THRESH_BINARY)
if verbose:
plt.imshow(histo, cmap='gray')
pl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_binary_image_array_from_equalized_grayscale(frame):\n\t\n\teq_global = cv2.equalizeHist(frame.gray)\n\t#_, th = cv2.threshold(eq_global, thresh=240, maxval=255, type=cv2.THRESH_BINARY)\n\t_, th = cv2.threshold(eq_global, thresh=240, maxval=255, type=cv2.THRESH_TOZERO)\n\treturn th",
"def histograma(frame... | [
"0.69535804",
"0.6947112",
"0.68407387",
"0.6572662",
"0.6499641",
"0.64854497",
"0.64544964",
"0.6449259",
"0.6337437",
"0.6235532",
"0.62102836",
"0.6164163",
"0.6140661",
"0.61269164",
"0.61156374",
"0.6074544",
"0.6071094",
"0.60690933",
"0.6029381",
"0.6011519",
"0.59868... | 0.569637 | 35 |
Residual function of the 7bar mechanism in Hairer, Vol. II, p. 533 ff, see also formula (7.11) written in residual form y,yp vector of dim 20, t scalar | def squeezer (t, y, yp, index):
# Inertia data
m1,m2,m3,m4,m5,m6,m7=.04325,.00365,.02373,.00706,.07050,.00706,.05498
i1,i2,i3,i4,i5,i6,i7=2.194e-6,4.410e-7,5.255e-6,5.667e-7,1.169e-5,5.667e-7,1.912e-5
# Geometry
xa,ya=-.06934,-.00227
xb,yb=-0.03635,.03273
xc,yc=.014,.072
d,da,e,ea=28.e-3,115.e-4,2.e-2,1421.e-5
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _residual(function, p, x, y, y_err):\n return (y - function(p, x)) / y_err",
"def residual(self, y,r):\n u,v,tt = self.split(y)\n fiu,fiv,fitt = self.problem.internal_forces(u,v,tt)\n R = np.concatenate((fiu,fiv,fitt))\n R = self.residualApplyBCs(R,y,r)\n return R",
... | [
"0.67233",
"0.65422815",
"0.6506902",
"0.6416965",
"0.639515",
"0.6385304",
"0.6381675",
"0.6371584",
"0.636781",
"0.6285296",
"0.61602527",
"0.61571497",
"0.61421365",
"0.60762",
"0.6074099",
"0.60676235",
"0.60212857",
"0.59432817",
"0.5924982",
"0.5901193",
"0.5878581",
... | 0.0 | -1 |
Clear the DB before each test | def setUp(self):
INFLUX_DB_NAME = 'test_device_parameters'
EmptyDBTestCase.client.create_database(INFLUX_DB_NAME)
EmptyDBTestCase.client.drop_database(INFLUX_DB_NAME)
EmptyDBTestCase.client.create_database(INFLUX_DB_NAME) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDown(self):\r\n empty_db()",
"def tearDown(self):\r\n empty_db()",
"def tearDown(self):\r\n empty_db()",
"def tearDown(self):\r\n empty_db()",
"def tearDown(self):\r\n empty_db()",
"def tearDown(self):\r\n empty_db()",
"def tearDown(self):\r\n te... | [
"0.8798867",
"0.8798867",
"0.8798867",
"0.8798867",
"0.8798867",
"0.8798867",
"0.86385655",
"0.86385655",
"0.86385655",
"0.86385655",
"0.86385655",
"0.86385655",
"0.86385655",
"0.86385655",
"0.86385655",
"0.83450496",
"0.8285623",
"0.8285623",
"0.82504004",
"0.8192769",
"0.81... | 0.0 | -1 |
Updates the weights and biases of each layer after 1 step. | def __update(self, learning_rate):
for layer in self.layers:
layer.weights.set_value((layer.weights - learning_rate * layer.dW).eval())
layer.biases.set_value((layer.biases - learning_rate * layer.db).eval()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step(self, layers, d_weights, d_biases, lr):\n for layer, d_W, d_b in zip(layers, d_weights, d_biases):\n layer.update(-lr * d_W, -lr * d_b)",
"def update_layers(self):\n\n # Para cada layer atualiza utilizando o gradiente descendente e o learning rate\n for layer in self.laye... | [
"0.75525016",
"0.7542897",
"0.7537849",
"0.72456473",
"0.71384066",
"0.7132953",
"0.7115692",
"0.7055472",
"0.69644135",
"0.6865738",
"0.6844634",
"0.67882",
"0.67845756",
"0.67368746",
"0.6686326",
"0.66069275",
"0.6548724",
"0.6523136",
"0.65193737",
"0.6511803",
"0.6507222... | 0.73765534 | 3 |
Gets the state of the given UID | def get_state(self, uid):
with self._directory_lock:
return self._directory[uid] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fusion_api_get_power_device_uid_state(self, uri=None, api=None, headers=None):\n return self.pd.get(uri=uri, api=api, headers=headers, param='/uidState')",
"def get_uid_state(self, id_or_uri):\n uri = self._client.build_uri(id_or_uri) + \"/uidState\"\n return self._client.get(uri)",
... | [
"0.7216132",
"0.7198761",
"0.6643929",
"0.62451434",
"0.5981806",
"0.58664286",
"0.58512264",
"0.58428437",
"0.58063066",
"0.5778787",
"0.57684267",
"0.57574713",
"0.5740207",
"0.57192063",
"0.56736386",
"0.5668144",
"0.56440777",
"0.5624796",
"0.55923843",
"0.55814064",
"0.5... | 0.7906417 | 0 |
Group a list of sids by asset type. | def group_by_type(self, sids):
return invert(self.lookup_asset_types(sids)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_list_by_seg(listToGroup, divs):\n \n # Get the list of ROI numbers:\n roiNums = []\n \n for div in divs:\n roiNums.append(div[0])\n \n uniqueRoiNums = list(set(roiNums))\n \n if len(uniqueRoiNums) == 1:\n groupedList = [listToGroup]\n else:\n grouped... | [
"0.543367",
"0.5419779",
"0.537403",
"0.52240384",
"0.5195806",
"0.50920296",
"0.50461966",
"0.50222504",
"0.5009072",
"0.4997727",
"0.4992955",
"0.492494",
"0.48930746",
"0.4873923",
"0.48176694",
"0.47980672",
"0.47942716",
"0.47888336",
"0.47738644",
"0.47728541",
"0.47630... | 0.79303586 | 0 |
Returns the max end_date of the bundle, which can be considered the date through which the bundle has been updated. | def get_bundle_end_date(self):
if not self._bundle_end_date:
max_date = self.engine.execute(
"""
SELECT
MAX(end_date)
FROM (
SELECT
end_date
FROM
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_date(self) -> Optional[str]:\n return pulumi.get(self, \"end_date\")",
"def end_date(self) -> Optional[str]:\n return pulumi.get(self, \"end_date\")",
"def maxend (self):\n\n maxend = self.list[0][\"period\"].end\n for actor in self.list:\n if maxend < actor[\"per... | [
"0.698069",
"0.698069",
"0.69506735",
"0.6863008",
"0.6863008",
"0.6834724",
"0.6829157",
"0.6829157",
"0.6829157",
"0.64990526",
"0.6376798",
"0.6358673",
"0.62911105",
"0.62539047",
"0.62537944",
"0.62097037",
"0.609568",
"0.6090409",
"0.6083556",
"0.6083556",
"0.6026758",
... | 0.82283455 | 0 |
Create an object to work with activities in Moodle | def __init__(self, resource_id, course):
self.id = resource_id
self.course = course | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activity():\n return {\n \"type\": \"class\",\n \"base\": None,\n \"is_abstract\": True,\n \"is_document\": True,\n \"pstr\": (\"{}\", (\"canonical_name\",)),\n \"properties\": [\n (\n \"alternative_names\",\n \"str\",\n ... | [
"0.66488516",
"0.63064915",
"0.62981164",
"0.6236334",
"0.61864614",
"0.6157177",
"0.6138245",
"0.609695",
"0.6035872",
"0.6002082",
"0.59810215",
"0.5980057",
"0.5942933",
"0.5918282",
"0.58903813",
"0.58572024",
"0.5789827",
"0.5747833",
"0.5747833",
"0.5719291",
"0.567016"... | 0.57071745 | 20 |
Extracts all the ngrams (min_order <= n <= max_order) from a sequence of tokens. | def extract_ngrams(line, min_order=1, max_order=NGRAM_ORDER) -> Counter:
ngrams = Counter()
tokens = line.split()
for n in range(min_order, max_order + 1):
for i in range(0, len(tokens) - n + 1):
ngram = ' '.join(tokens[i: i + n])
ngrams[ngram] += 1
return ngrams | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def n_grams(tokens, n):\n return zip(*[tokens[i:] for i in range(n)])",
"def build_ngrams(tokens, n=2):\n ngrams = zip(*(islice(group, idx, None) for idx, group in enumerate(tee(tokens, n))))\n return ngrams",
"def get_ngrams(tokens, min_n, max_n):\n all_ngrams = list()\n n_tokens = len(tokens)\... | [
"0.8024978",
"0.78923404",
"0.7772897",
"0.75658435",
"0.75516206",
"0.7496225",
"0.7459337",
"0.7409229",
"0.7395054",
"0.7372828",
"0.7341489",
"0.728606",
"0.7244324",
"0.7237867",
"0.72247565",
"0.7176616",
"0.7175382",
"0.71394616",
"0.71245074",
"0.71136826",
"0.7058883... | 0.71214175 | 19 |
Removes trailing and leading spaces and collapses multiple consecutive internal spaces to a single one. | def _clean(s):
return re.sub(r'\s+', ' ', s.strip()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeMultipleSpaces(self) -> None:\n self.text = re.sub('\\s+', ' ', self.text)",
"def strip_space():\n pass",
"def remove_extra_middle_spaces(x):\n\n return \" \".join(x.split())",
"def normalizeSpaces(strText, bDouble=False):\n if bDouble:\n strText = re.sub(r\"[ ]+\", r... | [
"0.72558427",
"0.6711633",
"0.66624594",
"0.66413605",
"0.6610696",
"0.648091",
"0.64774334",
"0.6447698",
"0.64351225",
"0.6410477",
"0.63379616",
"0.6328891",
"0.6328891",
"0.63281465",
"0.6314909",
"0.6309608",
"0.6290994",
"0.62829167",
"0.62772983",
"0.62564313",
"0.6249... | 0.6114575 | 25 |
Removes whitespaces from text. | def delete_whitespace(text: str) -> str:
return re.sub(r'\s+', '', text).strip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def del_whitespace(selfs, text):\n\t\treturn text.replace(' ', '')",
"def remove_whitespaces(text: str) -> str:\n return text.lstrip().rstrip()",
"def _remove_whitespaces(self, text: str) -> str:\n return \" \".join(re.sub(\"\\xa0\", \" \", str(text)).split())",
"def strip_whitespace(self, text... | [
"0.86838126",
"0.8675034",
"0.8633855",
"0.86304295",
"0.8411475",
"0.8411475",
"0.83974856",
"0.8298042",
"0.82968575",
"0.8263713",
"0.82000685",
"0.81772286",
"0.8139611",
"0.80707157",
"0.79711443",
"0.780916",
"0.77681553",
"0.77355963",
"0.7721737",
"0.7671981",
"0.7670... | 0.8493998 | 4 |
Removes empty values from given dict or list and from the nested dicts and lists in it. | def remove_empty_values(value_to_reduce: Union[Dict[str, Any], List, Any]):
if isinstance(value_to_reduce, dict):
reduced_dict = {}
for key, value in value_to_reduce.items():
if reduced_nested_value := remove_empty_values(value):
reduced_dict[key] = reduced_nested_value
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drop_empty_iters(obj: dict) -> dict:\n if not isinstance(obj, (dict, list)):\n return obj\n if isinstance(obj, list):\n return [v for v in (drop_empty_iters(member) for member in obj) if v]\n\n return {k1: v1 for k1, v1\n in ((k2, drop_empty_iters(v2)) for k2, v2 in obj.items(... | [
"0.7833042",
"0.783227",
"0.7805909",
"0.7686556",
"0.7592163",
"0.73572433",
"0.7275587",
"0.71933925",
"0.71886486",
"0.70961225",
"0.6991628",
"0.69260985",
"0.68998086",
"0.68902117",
"0.688705",
"0.68507457",
"0.6797812",
"0.67829996",
"0.67764336",
"0.6681253",
"0.66751... | 0.7512509 | 5 |
Apply any learning rate schedule | def learning_rate_schedule(epoch):
lr = 1.0
if config["distributed_lr_warmup_epoch"] > 0:
warmup_epochs = config["distributed_lr_warmup_epoch"]
max_factor = config["distributed_lr_warmup_factor"]
factor = 1.0 + (max_factor - 1.0) * min(epoch / warmup_epochs, 1.0)
lr *= factor
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_rate_schedule(current_epoch,\n current_batch,\n batches_per_epoch,\n batch_size):\n del current_batch, batches_per_epoch # not used\n initial_learning_rate = common.BASE_LEARNING_RATE * batch_size / 128\n learning_rate =... | [
"0.71842724",
"0.7105421",
"0.708403",
"0.7060563",
"0.6998408",
"0.69741774",
"0.69695526",
"0.6954532",
"0.6938114",
"0.6934634",
"0.6932708",
"0.680118",
"0.6799615",
"0.6797717",
"0.67853045",
"0.6775097",
"0.6756895",
"0.67081463",
"0.66917616",
"0.66838175",
"0.66666985... | 0.69542503 | 8 |
LazyFrames class from baselines. Openai baselines use this class for FrameStack environment wrapper. It is used for testing garage.envs.wrappers.AtariEnv. garge.envs.wrapper.AtariEnv is used when algorithms are trained using baselines wrappers, e.g. during benchmarking. | def __init__(self, frames):
self._frames = frames
self._out = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_atari(env, num_frames, device, action_stack=False):\n try:\n noop_action = env.get_action_meanings().index(\"NOOP\")\n except ValueError:\n print(\"Cannot find NOOP in env, defaulting to 0\")\n noop_action = 0\n env = AtariPreprocess(env)\n env = MaxAndSkipEnv(env, 4)\n ... | [
"0.57372487",
"0.5632466",
"0.54427993",
"0.54115176",
"0.5328847",
"0.5276243",
"0.52741313",
"0.5256866",
"0.5255422",
"0.5249921",
"0.5223",
"0.5223",
"0.5223",
"0.5223",
"0.5221185",
"0.5183078",
"0.5120798",
"0.51183414",
"0.5115729",
"0.5091818",
"0.50436074",
"0.5019... | 0.469264 | 54 |
Return the filtered queryset. | def queryset(self, request, queryset):
# 返回文章queryset里面 所有指定作者的文章
author_id = self.value()
if author_id:
return queryset.filter(author__id=author_id)
else:
return queryset | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter(cls, *args, **kwargs) -> models.QuerySet:\n return cls.objects.filter(*args, **kwargs)",
"def filter_queryset(self, queryset):\n for name, value in self.form.cleaned_data.items():\n queryset = self.filters[name].filter(queryset, value)\n # assert isinstance(queryset... | [
"0.82546276",
"0.77727586",
"0.7630478",
"0.7494909",
"0.74735",
"0.745792",
"0.735453",
"0.7293441",
"0.7265894",
"0.7225186",
"0.72147936",
"0.7201786",
"0.7201387",
"0.7179239",
"0.7151633",
"0.7148966",
"0.71282905",
"0.70891434",
"0.70767444",
"0.7075298",
"0.70645803",
... | 0.0 | -1 |
Ravel column or row vector or 1d numpy array, else raises an error | def column_or_row_or_1d(y: npt.NDArray) -> npt.NDArray:
shape = np.shape(y)
if (len(shape) == 1) or (len(shape) == 2 and (shape[1] == 1 or shape[0] == 1)):
return np.ravel(y)
else:
raise ValueError("bad input shape {0}".format(shape)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_array(arr: Arrayable) -> np.ndarray:\n if isinstance(arr, np.ndarray):\n return arr\n return np.array(arr)",
"def is_row_vec(x):\n return x.ndim == 2 and x.shape[0] == 1",
"def test_isarray_vrt(self):\n self.assertIsInstance(_test_array(landsat_vrt), np.ndarray)",
"def check_... | [
"0.6161116",
"0.61144376",
"0.60193723",
"0.59630084",
"0.59494996",
"0.5900787",
"0.58594954",
"0.5799679",
"0.5767909",
"0.57608664",
"0.567323",
"0.56447846",
"0.56230915",
"0.56192464",
"0.55989015",
"0.55773795",
"0.55606633",
"0.55545276",
"0.55535424",
"0.55413204",
"0... | 0.58381945 | 7 |
Check that a file has a valid extension. | def validate_ext(file: PathLike, extension: Union[str, tuple]) -> None:
if isinstance(extension, str):
extension = (extension,)
elif isinstance(extension, tuple):
if not all([isinstance(element, str) for element in extension]):
raise TypeError(
"Must specify all valid... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_allowed_extension(filename):\n return '.' in filename and filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS",
"def check_extension(f):\n parts = f.split('.')\n last = parts[len(parts) - 1]\n return last in allowed_extensions",
"def validate_extension(filename):\r\n split_tup = os.path.spl... | [
"0.86461383",
"0.83063054",
"0.8237249",
"0.81818193",
"0.81580704",
"0.8156099",
"0.8156099",
"0.8106743",
"0.8092042",
"0.8086752",
"0.8057663",
"0.80548745",
"0.80172235",
"0.8009554",
"0.80080676",
"0.79843044",
"0.7977585",
"0.7928603",
"0.7917303",
"0.7917303",
"0.79173... | 0.7412446 | 64 |
Sets the learning rate to the initial LR decayed by gamma every decay_interval epochs | def adjust_learning_rate_interval(optimizer, epoch, initial_lr, gamma, decay_interval):
lr = initial_lr * (gamma ** (epoch // decay_interval))
for param_group in optimizer.param_groups:
param_group['lr'] = lr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(optimizer, epoch, epochs_per_step=15, gamma=0.1):\n # Skip gamma update on first epoch.\n if epoch != 0 and epoch % epochs_per_step == 0:\n for param_group in optimizer.param_groups:\n param_group['lr'] *= gamma\n print(\"learning rate adjusted: {}\".form... | [
"0.78345734",
"0.78025424",
"0.7750293",
"0.7750293",
"0.77494687",
"0.77494687",
"0.7740171",
"0.7719793",
"0.7556482",
"0.75397265",
"0.7490762",
"0.74698824",
"0.74570864",
"0.74570733",
"0.7452261",
"0.74522084",
"0.74401295",
"0.74401295",
"0.7427305",
"0.74082327",
"0.7... | 0.7982583 | 0 |
The learning rate is decayed by decay_factor at each interval start | def adjust_learning_rate_schedule(optimizer, epoch, initial_lr, decay_factor, decay_epochs):
# Find the index of the current interval:
interval_index = len([mark for mark in decay_epochs if mark < epoch])
lr = initial_lr * (decay_factor ** interval_index)
for param_group in optimizer.param_groups:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lr_decay(step):\n return(alpha / (1 + decay_rate * step))",
"def decay_learning_rate(initial_learning_rate, i, n_iterations):\n return initial_learning_rate * np.exp(-i / n_iterations)",
"def learning_rate_decay(alpha, decay_rate, global_step, decay_step):\n epoc_number = int(global_st... | [
"0.80564743",
"0.7942144",
"0.77731234",
"0.7756402",
"0.7634839",
"0.7572285",
"0.75405115",
"0.7508083",
"0.7443605",
"0.7443605",
"0.7360634",
"0.73278457",
"0.72876614",
"0.7257079",
"0.72277445",
"0.72277445",
"0.72019786",
"0.72006875",
"0.71792716",
"0.7177504",
"0.716... | 0.7251196 | 14 |
The learning rate is decayed by decay_factor at each interval start | def adjust_prior_learning_rate_schedule(optimizer, epoch, initial_lr, decay_factor, decay_epochs):
# Find the index of the current interval:
interval_index = len([mark for mark in decay_epochs if mark < epoch])
lr = initial_lr * (decay_factor ** interval_index)
return lr
# for param_group in optim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lr_decay(step):\n return(alpha / (1 + decay_rate * step))",
"def decay_learning_rate(initial_learning_rate, i, n_iterations):\n return initial_learning_rate * np.exp(-i / n_iterations)",
"def learning_rate_decay(alpha, decay_rate, global_step, decay_step):\n epoc_number = int(global_st... | [
"0.8056259",
"0.7942156",
"0.7773281",
"0.7757518",
"0.76348484",
"0.7571639",
"0.7540684",
"0.75076544",
"0.744366",
"0.744366",
"0.7360396",
"0.7327945",
"0.72877556",
"0.7257816",
"0.7250906",
"0.72279924",
"0.72279924",
"0.7201953",
"0.7200242",
"0.7179795",
"0.7177032",
... | 0.7031749 | 29 |
Removes all of the whitespaceonly text descendants of a DOM node. | def remove_whitespace_nodes(node):
# prepare the list of text nodes to remove (and recurse when needed)
remove_list=[]
for child in node.childNodes:
if child.nodeType==dom.Node.TEXT_NODE and not child.data.strip():
# add this text node to the to-be-removed list
remove_list.append(chid)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_whitespace(doc):\n doc.xml_normalize() # Merge text nodes where possible\n for text in list(doc.xml_select('descendant::text()')):\n # If text node is all whitespace or empty, remove it.\n if not text.xml_value.strip():\n text.xml_parent.xml_remove(text)",
"de... | [
"0.7970466",
"0.76700556",
"0.6537946",
"0.65122193",
"0.64151025",
"0.64048624",
"0.63245744",
"0.6308241",
"0.6264427",
"0.6264427",
"0.62391204",
"0.62297523",
"0.62076235",
"0.61565185",
"0.6109875",
"0.61051124",
"0.6092248",
"0.60912395",
"0.60511714",
"0.6045875",
"0.6... | 0.8134277 | 0 |
Append a Spin Instruction to the instructions list | def spin(self, ref, speed, duration):
self.instructions.append(Spin(ref, speed, duration)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append(self,instr):\n self.instructions.append(instr)",
"def append_inst(self, inst):\n inst.basic_block = self\n self.insts.append(inst)",
"def prepend_inst(self, inst):\n inst.basic_block = self\n self.insts = [inst] + self.insts",
"def append(self, instructions):\n ... | [
"0.6422484",
"0.6239501",
"0.6126359",
"0.58886194",
"0.54964507",
"0.5494524",
"0.5447268",
"0.5425017",
"0.5353646",
"0.53360724",
"0.5330405",
"0.5216389",
"0.51328236",
"0.5116339",
"0.51017743",
"0.5096967",
"0.506742",
"0.506742",
"0.506742",
"0.506742",
"0.50218564",
... | 0.63404065 | 1 |
Compute derivative of N0 wrt cltt | def n0derivative_cltt(cl_array,bins,n0bins,clpp,norms,cls,cltt,clee,clbb,clte,NOISE_LEVEL,polnoise,lmin,LMAXOUT,LMAX_TT,Lstep,Lmin_out):
bins=bins-2
array1001=perturbe_clist(cl_array,bins,1.001)
array999=perturbe_clist(cl_array,bins,0.999)
N1001=[[],[],[],[],[]] #list of lists containing tt,ee,eb,te,tb
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fd_derivative(f, t):\n dfdt = np.empty_like(f)\n if (f.ndim == 1):\n _derivative(f, t, dfdt)\n elif (f.ndim == 2):\n _derivative_2d(f, t, dfdt)\n elif (f.ndim == 3):\n _derivative_3d(f, t, dfdt)\n else:\n raise NotImplementedError(\"Taking derivatives of {0}-dimension... | [
"0.64876807",
"0.64578795",
"0.64117104",
"0.6367806",
"0.63383526",
"0.6321075",
"0.6293117",
"0.6262458",
"0.6248179",
"0.62424976",
"0.6238325",
"0.62110084",
"0.61307436",
"0.61043876",
"0.6074347",
"0.6074231",
"0.6059623",
"0.6032652",
"0.60260195",
"0.6013493",
"0.5987... | 0.6143832 | 12 |
Compute derivative of N0 wrt clee | def n0derivative_clee(cl_array,bins,n0bins,clpp,norms,cls,cltt,clee,clbb,clte,NOISE_LEVEL,polnoise,lmin,LMAXOUT,LMAX_TT,Lstep,Lmin_out):
bins=bins-2
array1001=perturbe_clist(cl_array,bins,1.001)
array999=perturbe_clist(cl_array,bins,0.999)
N1001=[[],[],[],[],[]] #list of lists containing tt,ee,eb... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derivative(self, *args):\n if self.i_dim == 0:\n return np.ones_like(*args[0])\n else:\n return np.zeros_like(*args[0])",
"def deriv(func: Callable[[ndarrray], ndarray],\n input_: ndarray,\n delta: float = 0.001) -> ndarray:\n return (f... | [
"0.68023974",
"0.6555499",
"0.6555042",
"0.6552022",
"0.65451705",
"0.6531801",
"0.6510638",
"0.64263374",
"0.6422957",
"0.6402239",
"0.6380827",
"0.6360934",
"0.6343521",
"0.63067734",
"0.62788135",
"0.62657374",
"0.62632656",
"0.6230499",
"0.6227685",
"0.6202473",
"0.619109... | 0.0 | -1 |
Compute derivative of N0 wrt clbb | def n0derivative_clbb(cl_array,bins,n0bins,clpp,norms,cls,cltt,clee,clbb,clte,NOISE_LEVEL,polnoise,lmin,LMAXOUT,LMAX_TT,Lstep,Lmin_out):
bins=bins-2
array1001=perturbe_clist(cl_array,bins,1.001)
array999=perturbe_clist(cl_array,bins,0.999)
N1001=[[],[],[],[],[]] #list of lists containing tt,ee,eb,t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derivative(self, *args):\n if self.i_dim == 0:\n return np.ones_like(*args[0])\n else:\n return np.zeros_like(*args[0])",
"def dgdx(self, X):\n \n return 2*(X[0]) - 2",
"def derivative_activation(z):\n return activation(z) * (1 - activation(z))",
"def ... | [
"0.6581975",
"0.6221136",
"0.61958504",
"0.6169655",
"0.6144822",
"0.6119573",
"0.61161405",
"0.6107472",
"0.610064",
"0.60731584",
"0.6055345",
"0.6050307",
"0.60490286",
"0.5996474",
"0.59765524",
"0.59692657",
"0.59414864",
"0.5936173",
"0.5922756",
"0.58893883",
"0.588463... | 0.5885548 | 20 |
Append to self, accessible via Qt.QtCompat | def _add(object, name, value):
self.__added__.append(name)
setattr(object, name, value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append(self, *args, **kwargs): # real signature unknown\n pass",
"def append(self, *__args): # real signature unknown; restored from __doc__ with multiple overloads\n pass",
"def append(self, this):\n return self.add(this)",
"def add(self, widget, emit_signal=True):\n if widge... | [
"0.65796334",
"0.64575946",
"0.6453783",
"0.6152093",
"0.6087292",
"0.6062052",
"0.59720695",
"0.59594375",
"0.5958545",
"0.5951367",
"0.592891",
"0.5923208",
"0.5855097",
"0.5846969",
"0.5838879",
"0.5828375",
"0.58225685",
"0.5819053",
"0.57951695",
"0.5780458",
"0.5747266"... | 0.0 | -1 |
Set product real name from metadata | def _get_name_constellation_specific(self) -> str:
try:
if self.is_archived:
footprint_path = files.get_archived_path(self.path, r".*\.shp")
else:
footprint_path = next(self.path.glob("*.shp"))
except (FileNotFoundError, StopIteration):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_name(self, product_name):\n\n self._product_name = product_name",
"def setName(self, *args):\n return _libsbml.GeneProduct_setName(self, *args)",
"def on_product(self, model, fqname, event_name, key):\r\n self.product.SetLabel(\"%s %s\" % (self.model.article, self.model.sn))",
... | [
"0.71045184",
"0.696738",
"0.6710861",
"0.64893544",
"0.6482583",
"0.64698046",
"0.63077974",
"0.62751836",
"0.62600267",
"0.62404484",
"0.62199605",
"0.62092334",
"0.6163246",
"0.6160502",
"0.6140552",
"0.6136498",
"0.612368",
"0.61216",
"0.6103249",
"0.61008704",
"0.6012628... | 0.0 | -1 |
return [obj] if obj is not already a list (or optionally tuple) | def ensure_list(obj, allow_tuple=True):
if isinstance(obj, list):
return obj
elif allow_tuple and isinstance(obj, tuple):
return obj
elif not allow_tuple and isinstance(obj, tuple):
return list(obj)
else:
return [obj] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_tuple_or_list(obj):\n return obj if isinstance(obj, (list, tuple)) else [obj]",
"def listify(obj):\n return obj if isinstance(obj, (list, tuple, type(None))) else [obj]",
"def listify(obj):\n if obj is None:\n return []\n else:\n return obj if isinstance(obj, (list, tuple, type... | [
"0.87230766",
"0.8206822",
"0.81408274",
"0.81408274",
"0.81408274",
"0.76794064",
"0.76694584",
"0.75777143",
"0.7572117",
"0.7493603",
"0.74463767",
"0.71987975",
"0.71445036",
"0.713056",
"0.6989788",
"0.69660234",
"0.6923191",
"0.6812932",
"0.6695679",
"0.6691394",
"0.661... | 0.8257474 | 1 |
returns a list of neighbors (i.e. robots within 2m distance) to which messages can be sent | def get_neighbors(self):
return self.neighbors | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNeighbors(self):\n return self.neighbors",
"def get_neighbors(self):\n return self.neighbours_names",
"def get_neighbours(self):\n return []",
"def get_neighbors(self):\n # return the neighbors\n # if len(self.neighbors.keys()) != 0:\n # # print('\\n')... | [
"0.6978268",
"0.6961385",
"0.6739772",
"0.6712889",
"0.6706026",
"0.66756463",
"0.66396105",
"0.65957344",
"0.6586696",
"0.65731406",
"0.6562325",
"0.65210634",
"0.6452386",
"0.6394862",
"0.6390046",
"0.6368741",
"0.634328",
"0.6326712",
"0.6323698",
"0.6306396",
"0.62841284"... | 0.70840067 | 2 |
Checks to see if a type is a supported `typing._GenericAlias` object. | def _is_supported_generic(type_object):
return (
_is_typing_object(type_object)
and type_object.__origin__ in _supported_generic_types
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_typing_object(type_object):\n return type_object.__module__ == \"typing\"",
"def is_supported_type(type_object):\n return not _is_typing_object(type_object) or (\n _is_typing_object(type_object) and _is_supported_generic(type_object)\n )",
"def is_valid_type(type):\n return type in t... | [
"0.68817604",
"0.6678704",
"0.66427815",
"0.66109854",
"0.6603427",
"0.64130473",
"0.62900263",
"0.6158402",
"0.61382574",
"0.59297884",
"0.58728427",
"0.5830432",
"0.5818388",
"0.5799622",
"0.57499725",
"0.5723383",
"0.5714958",
"0.57146215",
"0.5698158",
"0.5590714",
"0.558... | 0.69860953 | 0 |
Checks if a typing is a `typing.Union` type. | def is_union_type(type_object):
return _is_supported_generic(type_object) and type_object.__origin__ == typing.Union | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_Union(tp):\n if tp is Union:\n return True\n try:\n # Python 3.6\n return tp.__origin__ is Union\n except AttributeError:\n try:\n return isinstance(tp, typing.UnionMeta)\n except AttributeError:\n return False",
"def _is_union(typeval: Typ... | [
"0.8520137",
"0.80197954",
"0.78856367",
"0.7494678",
"0.7381477",
"0.72591335",
"0.71349776",
"0.6724793",
"0.658861",
"0.65861315",
"0.6256634",
"0.6193959",
"0.5891901",
"0.58048284",
"0.56125265",
"0.55863357",
"0.55652004",
"0.5555517",
"0.5546027",
"0.54724485",
"0.5463... | 0.8276453 | 1 |
Returns if `type_a` is a subclass of `type_b`. | def is_type_subclass_of_type(type_a, type_b):
# Make sure these are types we support.
if _is_typing_object(type_a) and not _is_supported_generic(type_a):
raise ValueError(
f'Only the {" ".join(map(str, _supported_generic_types))} '
f"typing module types are supported, and not {t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_instance_of_type(object_a, type_a):\n\n return is_type_subclass_of_type(type(object_a), type_a)",
"def subclassof(c, b):\n try:\n return issubclass(c, b)\n except TypeError:\n return False",
"def PyType_IsSubtype(space, a, b):\n w_type1 = from_ref(space, rffi.cast(PyObject, a))... | [
"0.7774989",
"0.74467254",
"0.705597",
"0.7036289",
"0.68088675",
"0.67145413",
"0.65880305",
"0.6553159",
"0.6547101",
"0.65359646",
"0.65354574",
"0.65145546",
"0.64887744",
"0.64822286",
"0.6461966",
"0.64615726",
"0.6290949",
"0.6287131",
"0.6287131",
"0.6285983",
"0.6275... | 0.76797515 | 1 |
Returns if `object_a` is an instance of `type_a`. | def is_instance_of_type(object_a, type_a):
return is_type_subclass_of_type(type(object_a), type_a) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_kind_of_class(obj, a_class):\n return (isinstance(obj, a_class))",
"def is_kind_of_class(obj, a_class):\n\n return (isinstance(obj, a_class))",
"def is_kind_of_class(obj, a_class):\n return(isinstance(obj, a_class))",
"def is_kind_of_class(obj, a_class):\n return isinstance(obj, a_class)",... | [
"0.7474909",
"0.7462672",
"0.7462589",
"0.7455798",
"0.7455798",
"0.7455798",
"0.7455798",
"0.7455798",
"0.7455798",
"0.74344015",
"0.74051136",
"0.74051136",
"0.7397226",
"0.7393709",
"0.7391222",
"0.73343706",
"0.7216353",
"0.7167512",
"0.69747317",
"0.69496965",
"0.6937494... | 0.8760866 | 0 |
Sets the line_item_id of this LineItemReference. | def line_item_id(self, line_item_id):
self._line_item_id = line_item_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def item_id(self, item_id):\n\n self._item_id = item_id",
"def item_id(self, item_id):\n\n self._item_id = item_id",
"def item_id(self, item_id):\n\n self._item_id = item_id",
"def timesheet_line_id(self, timesheet_line_id):\n\n self._timesheet_line_id = timesheet_line_id",
"def... | [
"0.6670791",
"0.6670791",
"0.6670791",
"0.63354784",
"0.6159529",
"0.60259134",
"0.5955824",
"0.58524454",
"0.5796263",
"0.5763319",
"0.57630837",
"0.5706907",
"0.56914335",
"0.56406724",
"0.56311363",
"0.55684394",
"0.5507401",
"0.54775774",
"0.54713273",
"0.5464795",
"0.541... | 0.88453037 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, LineItemReference):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Introduce mutations at random to an array of genotype data for multiple individuals. For all alleles present draw mutations given error rate mu, then swap zeroes and ones in the array. | def mutations(self, mu):
# make a copy of the data, and make it an integer
new_alleles = np.copy(self.geno)
# for an array of the same shape as newAlleles, draw mutations at each
# position with probability mu.
vals = np.random.binomial(1, mu, self.size * self.nloci * 2)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mutate(self, mutations: int):\n\n # Thus, our objective is to sample in such a way that:\n # Na' = Na + x - y\n # NA' = NA + z - w\n # NAa' = NAa + (y + w) - (x + z)\n # Na', NA', NAa' >= 0\n # 0 <= x, y, z\n # x + y + z <= n\n\n # The algorithm here is a... | [
"0.62436587",
"0.6241599",
"0.62189317",
"0.6184892",
"0.6178246",
"0.6143742",
"0.6113754",
"0.6060669",
"0.60488343",
"0.60105413",
"0.5996578",
"0.59856915",
"0.5977345",
"0.59367913",
"0.5931497",
"0.5867592",
"0.5846127",
"0.5829716",
"0.58152497",
"0.5786167",
"0.577019... | 0.75534487 | 0 |
Tests that un logged_in user can not upload a passport photo into the system | def test_un_logged_in_user_can_not_upload_picture(self):
tmp_file = generate_image_for_testing()
response = self.client.post(self.user_passport_url,
data={'passport': tmp_file})
self.assertEqual(403, response.status_code) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cant_create_image_unauthorized(self):\n with tempfile.NamedTemporaryFile(suffix='.jpg') as ntf:\n img = Image.new('RGB', (10, 10))\n img.save(ntf, format='JPEG')\n ntf.seek(0)\n res = self.client.post(IMAGE_URL, data={'image': ntf},\n ... | [
"0.7230544",
"0.6910038",
"0.6883127",
"0.6824876",
"0.67882186",
"0.67511886",
"0.6747095",
"0.67354256",
"0.6707149",
"0.6673716",
"0.66349643",
"0.6633577",
"0.6629748",
"0.66277605",
"0.66199",
"0.6580746",
"0.6580746",
"0.6551383",
"0.65373176",
"0.6507834",
"0.6498966",... | 0.83933103 | 0 |
The privilege level of this option. | def priv_level(self):
return self._priv_level | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def privilege(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"privilege\")",
"def accesslevel(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"accesslevel\")",
"def permission_level(self):\n username = self.get_current_user()\n user = User.get_user... | [
"0.7100029",
"0.6692646",
"0.64797056",
"0.6475269",
"0.637371",
"0.637371",
"0.6334937",
"0.6267448",
"0.6267448",
"0.6247275",
"0.619882",
"0.619882",
"0.619882",
"0.619882",
"0.60751003",
"0.6019849",
"0.6019849",
"0.5981362",
"0.5973732",
"0.58696723",
"0.58281636",
"0.... | 0.7437839 | 0 |
Default initial value of this option. The field 'value' contains the current set value and could be different from this. | def default_value(self):
return self._default_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_value_to_default(self):\n self.setValue(self.default_value)",
"def default(self, value):\n # also easy\n self._default = value\n # all done\n return",
"def default_value(self, value: Any) -> None:\n self.sdc_resource.set_input_default_value(self, value)\n ... | [
"0.8002781",
"0.7746556",
"0.7684753",
"0.7676273",
"0.76620823",
"0.7626392",
"0.7622272",
"0.7591346",
"0.7546496",
"0.75450915",
"0.7497109",
"0.74777186",
"0.74777186",
"0.74777186",
"0.7471723",
"0.73181486",
"0.7305667",
"0.7258063",
"0.72235",
"0.7200443",
"0.71771437"... | 0.79765993 | 2 |
Value of the option. This field is optional in Data ONTAP ClusterMode, but required in Data ONTAP 7Mode. | def value(self):
return self._value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def opt_value(self):\n return self._opt_value",
"def data_option(self):\n if \"dataOption\" in self._prop_dict:\n return self._prop_dict[\"dataOption\"]\n else:\n return None",
"def OptionValue(self):\n if self.force_auto_sync:\n self.get('OptionValu... | [
"0.7358085",
"0.7101256",
"0.66300076",
"0.64864606",
"0.64160234",
"0.63221884",
"0.61803544",
"0.61378026",
"0.6057765",
"0.6006336",
"0.59945893",
"0.59724486",
"0.5965918",
"0.59562516",
"0.59484595",
"0.59207356",
"0.59017104",
"0.58778024",
"0.58317125",
"0.5829775",
"0... | 0.0 | -1 |
The name of the vserver to which this option belongs to. | def vserver(self):
return self._vserver | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_name(self) -> str:\n return pulumi.get(self, \"server_name\")",
"def server_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"server_name\")",
"def server_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"server_name\")",
"def server_name(self) -> pulum... | [
"0.73502445",
"0.7116458",
"0.7116458",
"0.7015148",
"0.7015148",
"0.6996557",
"0.6996557",
"0.6752923",
"0.6752923",
"0.6610439",
"0.6534793",
"0.6528321",
"0.65265214",
"0.6511934",
"0.6511934",
"0.64968145",
"0.6430972",
"0.6427551",
"0.6421338",
"0.6421338",
"0.64197296",... | 0.6848691 | 9 |
Takes a dict of objects and writes them to a json file | def write_tojson(data, filename) -> None:
with open("static/json/" + filename, "w") as out:
out.write(
json.dumps(
[data[datum].__dict__() for datum in data]
)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_json(obj_to_write: Any, filename: str):\n \n with open(filename, 'w') as json_file:\n json.dump(obj_to_write, json_file, indent=4)",
"def dict_2_json(obj, filename):\n\twith open('data/output/' + filename, 'w') as fp:\n\t\tjson.dump(obj, fp, indent=4)",
"def writeToJson(inputObj,fileLoc)... | [
"0.7919273",
"0.78765494",
"0.7745794",
"0.7562822",
"0.7545521",
"0.7508819",
"0.7499731",
"0.74908644",
"0.7482902",
"0.74497736",
"0.74438775",
"0.74152154",
"0.74140704",
"0.7397281",
"0.7394035",
"0.73935753",
"0.7378471",
"0.7367339",
"0.7355447",
"0.73380303",
"0.73351... | 0.7350575 | 19 |
Set up test data. | def setUp(self):
self.anime_link = "https://animepertutti.com/sword-art-online-alicization-war-of-underworld-sub-ita-streaming-download-z" #noqa | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n\n self.test_data_path = 'testing/test_data/'",
"def setUp(self):\n self.dataset = get_test_dataset()",
"def setUpTestData(cls):\n # volunteer user\n common.initialize_empty_volunteer()",
"def setUpTestData(cls):\n data_gen.run()",
"def setUpTestData(cls... | [
"0.83564",
"0.825977",
"0.82419825",
"0.8071621",
"0.8071621",
"0.8071621",
"0.8071621",
"0.7874065",
"0.7855246",
"0.783438",
"0.7805763",
"0.77781427",
"0.7761605",
"0.77067",
"0.7682978",
"0.76799023",
"0.7657977",
"0.76328367",
"0.76242405",
"0.7600356",
"0.7600356",
"0... | 0.0 | -1 |
Delete numbers assign zero | def delete_numbers(n, nums):
for i in range(len(nums)):
if nums[i] % n == 0:
nums[i] = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_first_zeros(digit_with_zeros): \n \n digit_without_zeros = \"\"\n\n snap = 1\n \n d = 0\n\n for d in digit_with_zeros:\n\n if d != \"0\":\n snap = 0\n if snap == 0:\n digit_without_zeros +=d\n \n return digit_without_z... | [
"0.68998",
"0.68438363",
"0.6843144",
"0.6751601",
"0.67102563",
"0.6616383",
"0.66012216",
"0.65953374",
"0.65825015",
"0.651108",
"0.6499132",
"0.6487839",
"0.6475147",
"0.6465351",
"0.6461205",
"0.64298797",
"0.64131445",
"0.6405458",
"0.63983935",
"0.6394734",
"0.6352576"... | 0.5744203 | 78 |
Computes the backward pass for an affine layer. | def affine_backward(dout, cache):
x, w, b = cache
dx, dw, db = None, None, None
dx = (dout@w.T).reshape(x.shape)
dw = x.reshape(x.shape[0], w.shape[0]).T@dout
db = np.sum(dout, axis=0)
return dx, dw, db | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affine_relu_backward(dout, cache):\n fc_cache, relu_cache = cache\n da = layers.relu_backward(dout, relu_cache)\n dx, dw, db = layers.affine_backward(da, fc_cache)\n return dx, dw, db",
"def affine_backward(dout, cache):\n x, w, b = cache\n dx, dw, db = None, None, None\n ###############... | [
"0.7518896",
"0.751513",
"0.7310849",
"0.73015374",
"0.73015374",
"0.73015374",
"0.73015374",
"0.7243401",
"0.7177609",
"0.7174102",
"0.7173503",
"0.71661735",
"0.71319",
"0.7106919",
"0.70978165",
"0.708432",
"0.70449376",
"0.70409757",
"0.6993727",
"0.6986414",
"0.6983679",... | 0.7068546 | 16 |
A naive implementation of the forward pass for a maxpooling layer. | def max_pool_forward_naive(x, pool_param):
out = None
N, C, H, W = x.shape
HH = pool_param['pool_height']
WW = pool_param['pool_width']
stride = pool_param['stride']
Hp = int(1 + (H-HH)/stride)
Wp = int(1 + (W-WW)/stride)
out = np.zeros((N,C,Hp,Wp))
for n in range(N):
for j in range(Hp):
for i in rang... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_pool_forward_naive(x, pool_param):\n out = None\n ###########################################################################\n # TODO: Implement the max pooling forward pass #\n ###########################################################################\n N,C,H,W ... | [
"0.78478473",
"0.77464086",
"0.75831836",
"0.75474185",
"0.74184185",
"0.74050933",
"0.7378611",
"0.7318571",
"0.72232896",
"0.71326613",
"0.7098723",
"0.70758176",
"0.6990659",
"0.69255495",
"0.69221073",
"0.68792313",
"0.68130654",
"0.68058133",
"0.6792034",
"0.6792034",
"0... | 0.7588915 | 2 |
Computes the forward pass for spatial group normalization. In contrast to layer normalization, group normalization splits each entry in the data into G contiguous pieces, which it then normalizes independently. Per feature shifting and scaling are then applied to the data, in a manner identical to that of batch normali... | def spatial_groupnorm_forward(x, gamma, beta, G, gn_param):
out, cache = None, None
eps = gn_param.get('eps',1e-5)
###########################################################################
# TODO: Implement the forward pass for spatial group normalization. #
# This will be extremely similar ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_group_norm(g, op, block):\n\n x = g.get_node(op.input(\"X\")[0])\n num_groups = op.attr(\"groups\")\n epsilon = op.attr(\"epsilon\")\n gamma = g.get_node(op.input(\"Scale\")[0])\n beta = g.get_node(op.input(\"Bias\")[0])\n out = _op.nn.group_norm(\n x,\n gamma=gamma,\n ... | [
"0.62656516",
"0.6253387",
"0.6230449",
"0.62261957",
"0.61918",
"0.61407506",
"0.6051247",
"0.60292524",
"0.60261565",
"0.5937506",
"0.5936976",
"0.58955026",
"0.58901954",
"0.58715427",
"0.58671856",
"0.5859988",
"0.58542496",
"0.5813486",
"0.5799587",
"0.5784742",
"0.57806... | 0.74237573 | 0 |
Get the community of the given node. | def _community(G, u, community):
node_u = G.node[u]
try:
return node_u[community]
except KeyError:
raise nx.NetworkXAlgorithmError('No community information') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def community(self):\n return self._community",
"def _get_extended_community(self):\n return self.__extended_community",
"def get_community_info(self, id=None):\n req = GetCommunityInfoRequest(self)\n req.id = id\n return req",
"def get_community(self, cid: str) -> list:\n\n ... | [
"0.7211206",
"0.64491975",
"0.6207706",
"0.6019823",
"0.59791446",
"0.59715825",
"0.5963718",
"0.5941627",
"0.59078217",
"0.5901871",
"0.5822366",
"0.55355686",
"0.5434611",
"0.53455025",
"0.53353053",
"0.5313788",
"0.5250636",
"0.52429265",
"0.5225958",
"0.51982737",
"0.5194... | 0.7078103 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.