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 |
|---|---|---|---|---|---|---|
Load model to checkpoint but only on master process. | def load_sharded_model(self,
model: nn.Module,
checkpoint_index_file: Path,
strict: bool = False,
use_safetensors: bool = False,
load_sub_module: bool = True):
raise NotImplemen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_checkpoint(self, session, model_dir):\n assert self.params.cp_load == True, (\"cp_load must be set to true to load a checkpoint\")\n self.loader.restore(session, model_dir)",
"def load_checkpoint(self, label):\n model_dir = os.path.join(\n config.results_dir, config.experiment_na... | [
"0.7732531",
"0.7497923",
"0.74906623",
"0.7299953",
"0.7174122",
"0.7171748",
"0.7166395",
"0.71531725",
"0.7143729",
"0.71170187",
"0.71103597",
"0.7053212",
"0.703806",
"0.7025165",
"0.7025165",
"0.69546914",
"0.6930705",
"0.6898904",
"0.6883613",
"0.68785155",
"0.68736947... | 0.6868787 | 22 |
Load optimizer to checkpoint but only on master process. | def load_sharded_optimizer(self, optimizer: Optimizer, index_file_path: str, size_per_shard: int):
raise NotImplementedError("Sharded optimizer checkpoint is not supported yet.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def try_create_optimizer_and_load_from_checkpoint(self) -> bool:\n self.create_optimizer()\n if self.checkpoint_path:\n return self.try_load_checkpoint_for_optimizer()\n return True",
"def load_checkpoint(self, checkpoint: Dict[str, OrderedDict]):\n self.model.load_state_di... | [
"0.67399657",
"0.65175366",
"0.6481467",
"0.6451632",
"0.64353454",
"0.63649136",
"0.63616705",
"0.6360887",
"0.6338248",
"0.6209401",
"0.61995876",
"0.61675566",
"0.6113121",
"0.61110824",
"0.61016494",
"0.6097181",
"0.60820603",
"0.6081128",
"0.60500103",
"0.6038734",
"0.60... | 0.61089265 | 14 |
Set the name of the parsing Node that created this Result | def set_name(self, name):
self.name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\r\n self.stream.set_node_name(self.node, name)",
"def set_token_name(self, name):\n output = self.copy()\n output.token_name = name\n return output",
"def set_parser_name(self, name):\n self.parser_name = name\n return self",
"def node_name(... | [
"0.75841993",
"0.6912986",
"0.69029915",
"0.6806919",
"0.6803843",
"0.67967385",
"0.6574238",
"0.65375024",
"0.65110886",
"0.64751524",
"0.64707845",
"0.64707845",
"0.6466671",
"0.64567053",
"0.64567053",
"0.64567053",
"0.64567053",
"0.64567053",
"0.64567053",
"0.64567053",
"... | 0.62597936 | 48 |
Get the error between two tensors. | def getTensorError(tA, pA):
# pA, tA are corresponding tensors from two models
pA_shape = np.shape(pA)
tA_shape = np.shape(tA)
assert (pA_shape == tA_shape), "Arrays must be same shape"
tA = tA.astype(np.float32)
pA = pA.astype(np.float32)
ss_err = np.sum((np.array(pA) - np.array(tA))**2)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def errorEMat(E1, E2):\n E1_normalized = E1 / E1[2][2];\n E2_normalized = E2 / E2[2][2];\n return torch.norm(E1_normalized - E2_normalized)",
"def getTensorRelativError(tA, pA):\n pA_shape = np.shape(pA)\n tA_shape = np.shape(tA)\n assert (pA_shape == tA_shape), \"Arrays must be same shape\"\n\... | [
"0.6851308",
"0.6368044",
"0.6339154",
"0.63320494",
"0.63067466",
"0.62678653",
"0.61501014",
"0.60810995",
"0.6073818",
"0.60530907",
"0.6034226",
"0.6026788",
"0.59979266",
"0.59870225",
"0.5972445",
"0.5936928",
"0.5893881",
"0.5843814",
"0.5842017",
"0.58418745",
"0.5825... | 0.7340421 | 0 |
Get the relative error between two tensors. | def getTensorRelativError(tA, pA):
pA_shape = np.shape(pA)
tA_shape = np.shape(tA)
assert (pA_shape == tA_shape), "Arrays must be same shape"
err = np.max(np.abs(np.array(pA)-np.array(tA)))
return err | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def abs_rel_err(a, b):\n abs_err = abs(a - b)\n # 1e-8 is to prevent division by zeros.\n # [] is to make sure that if a and b are float16, 1e-8 don't get\n # dowcasted to float16 as that give 0! This would add back the\n # division by zero\n rel_err = abs_err / np.maximum... | [
"0.7070318",
"0.7058726",
"0.70439625",
"0.686964",
"0.68568283",
"0.68568283",
"0.6809767",
"0.6709033",
"0.6652752",
"0.66004914",
"0.65238965",
"0.64120156",
"0.62821805",
"0.6243604",
"0.6238698",
"0.6216744",
"0.6188411",
"0.61812115",
"0.6165913",
"0.61275107",
"0.60983... | 0.6607955 | 9 |
Index or home view. | def index():
return render_template('public/index.html', title='Home') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\n return render_template('index.html', title='Home')",
"def index():\n\treturn render_template(\"index.html\", title=\"Home\")",
"def index():\r\n return render_template('home.html')",
"def index(self):\n return self.load_view('index.html')",
"def index(request):\n \n re... | [
"0.7930252",
"0.78621095",
"0.7787202",
"0.7728077",
"0.7711083",
"0.7695378",
"0.76901263",
"0.76792663",
"0.7677433",
"0.7651214",
"0.7646021",
"0.7642794",
"0.7636129",
"0.7622795",
"0.7622417",
"0.76153594",
"0.7610073",
"0.7607962",
"0.7607962",
"0.7607962",
"0.7607962",... | 0.77902216 | 2 |
Returns the next action the agent will take | def getAction(self, state):
global PacmanPosition
global targetList
PacmanPosition[self.index] = state.getPacmanPosition(self.index)
if self.actions.isEmpty():
food = state.getFood().asList()
self.food = food
global chaseFood
global indexQ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action(self):\n next_action = self.strategy.get_next_move(self)\n return next_action",
"def get_next_action(self):\n\n u = self.plan.pop(0)\n return u",
"def get_next_action(self):\n chosen_action = None\n while chosen_action is None:\n choice = input('A... | [
"0.8337207",
"0.79425484",
"0.79240257",
"0.75870395",
"0.7547049",
"0.73340666",
"0.73014915",
"0.7267236",
"0.7194915",
"0.71547794",
"0.71327364",
"0.7079289",
"0.70439297",
"0.69918877",
"0.6959046",
"0.6955211",
"0.69239324",
"0.69239324",
"0.6898673",
"0.6885382",
"0.68... | 0.0 | -1 |
Set the content disposition on the request for the given browser | def set_attachment_content_disposition(request, filename, file=None):
if not filename:
return
if file:
contenttype = get_contenttype(file)
request.response.setHeader("Content-Type", contenttype)
request.response.setHeader("Content-Length", file.getSize())
user_agent = reque... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_header_disposition(self, query, http_s_obj):\n if (query and (query.find('inline') != -1)) or (http_s_obj.getStatusCode() != 200):\n http_s_obj.setHeader('Content-Disposition', 'inline')",
"def add_attachment_header(self):\n if self.request.get('downloadfile') == 'true':\n ... | [
"0.63084453",
"0.6092416",
"0.59989315",
"0.5860379",
"0.5790448",
"0.5774427",
"0.5684136",
"0.5641723",
"0.56407547",
"0.5628785",
"0.5620237",
"0.53989863",
"0.5374477",
"0.53120273",
"0.52702826",
"0.514851",
"0.51352406",
"0.50970453",
"0.50950205",
"0.5087184",
"0.50427... | 0.70312536 | 0 |
Returns a Kindle representation of this clipping. | def get_kindle_strs(self):
# Title/author
title_line = '%s (%s)' % (self.title, self.author)
# Metadata line
highlight_type = '- Your %s' % (self.clip_type.capitalize())
if (self.loc_range[0] == self.loc_range[1]):
location_string = 'Location %d' % (self.loc_range[0]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return \"Kindle\"",
"def __repr__( self ):\n assert isinstance( self.level, int )\n assert isinstance( self.prop, WFF )\n assert isinstance( self.justification, Inference )\n\n return str( self )",
"def __repr__(self) -... | [
"0.66339135",
"0.6372856",
"0.61684513",
"0.61522156",
"0.6141068",
"0.6018614",
"0.6002715",
"0.599104",
"0.5985725",
"0.5982142",
"0.595775",
"0.59481376",
"0.59445125",
"0.5933353",
"0.5929913",
"0.5929913",
"0.5929913",
"0.5929913",
"0.5929913",
"0.5929913",
"0.5929913",
... | 0.0 | -1 |
this function resize an image to the form of (32,32,3) so we can use it to predict a label | def resize_image():
print("--- resizing the image ---")
if args.image:
img = cv2.imread(args.image)
img = cv2.resize(img, (32, 32))
img = np.array(img, dtype=np.uint8)
img = img.reshape(32, 32, 3) / 255
img = np.expand_dims(img, axis=0)
print("--- done res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __resize_to_32x(input_data):\n rate = 1\n while min(input_data['img'].shape[:2])>736:\n test_size = 736\n if input_data['img'].shape[0] > input_data['img'].shape[1]:\n if True: # input_data['img'].shape[1] < 512:\n rate = test_size / input_... | [
"0.6961564",
"0.6802056",
"0.67776597",
"0.67738414",
"0.67597014",
"0.6733074",
"0.66796327",
"0.6636147",
"0.66303736",
"0.6593752",
"0.6446807",
"0.64410007",
"0.64277697",
"0.6392486",
"0.63526917",
"0.6333598",
"0.6327292",
"0.6325336",
"0.63010293",
"0.6286308",
"0.6285... | 0.7169307 | 0 |
Sets the key_name of this SpecificationForGeneratingNewJWT. | def key_name(self, key_name):
if key_name is None:
raise ValueError("Invalid value for `key_name`, must not be `None`") # noqa: E501
self._key_name = key_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n\n\t\tif name is not None and not isinstance(name, str):\n\t\t\traise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: name EXPECTED TYPE: str', None, None)\n\t\t\n\t\tself.__name = name\n\t\tself.__key_modified['name'] = 1",
"def new_key(self, key_name=None):\r\n return self.key_c... | [
"0.61358225",
"0.6063089",
"0.5910918",
"0.5900349",
"0.5849605",
"0.58169544",
"0.57110494",
"0.56614965",
"0.5658275",
"0.5632519",
"0.5605085",
"0.5605085",
"0.5594095",
"0.5587525",
"0.5579479",
"0.5579479",
"0.55673796",
"0.55673796",
"0.55673796",
"0.5549426",
"0.554786... | 0.6861345 | 0 |
Sets the renewable of this SpecificationForGeneratingNewJWT. | def renewable(self, renewable):
if renewable is None:
raise ValueError("Invalid value for `renewable`, must not be `None`") # noqa: E501
self._renewable = renewable | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enable_renewal(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"enable_renewal\")",
"def auto_renew(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"auto_renew\")",
"def auto_renew(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"au... | [
"0.58849144",
"0.556695",
"0.556695",
"0.5540621",
"0.5540621",
"0.5502647",
"0.5308545",
"0.5284363",
"0.4981773",
"0.48047984",
"0.4670447",
"0.46561852",
"0.46309933",
"0.45135173",
"0.44519728",
"0.4429956",
"0.43552482",
"0.4323437",
"0.43200034",
"0.42922205",
"0.429222... | 0.7563471 | 0 |
Sets the exp_leeway of this SpecificationForGeneratingNewJWT. | def exp_leeway(self, exp_leeway):
if exp_leeway is None:
raise ValueError("Invalid value for `exp_leeway`, must not be `None`") # noqa: E501
self._exp_leeway = exp_leeway | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_exp(self, now, leeway):\n if 'exp' in self:\n exp = self['exp']\n if not _validate_numeric_time(exp):\n raise InvalidClaimError('exp')\n if exp < (now - leeway):\n raise ExpiredTokenError()",
"def expiration_interval(self, expirat... | [
"0.58585876",
"0.51945597",
"0.51466393",
"0.51151556",
"0.50470036",
"0.50240755",
"0.502101",
"0.49956575",
"0.49372005",
"0.49280885",
"0.48822057",
"0.48744205",
"0.48587435",
"0.48065987",
"0.47959462",
"0.4783084",
"0.47803807",
"0.47028363",
"0.46906674",
"0.46898457",
... | 0.7594964 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, SpecificationForGeneratingNewJWT):
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.80886984",
"0.80886984",
"0.8055307",
"0.7983415",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
... | 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 |
Assumes myList is sorted. Returns closest value to myNumber. If two numbers are equally close, return the smallest number. | def takeClosest(myList, myNumber):
pos = bisect_left(myList, myNumber)
if pos == 0:
return 0 #myList[0]
if pos == len(myList):
return len(myList)-1 #myList[-1]
before = myList[pos - 1]
after = myList[pos]
if after - myNumber < myNumber - before:
return pos #after
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def takeClosest(myList, myNumber):\r\n pos = bisect_left(myList, myNumber)\r\n if pos == 0:\r\n return myList[0]\r\n if pos == len(myList):\r\n return myList[-1]\r\n before = myList[pos - 1]\r\n after = myList[pos]\r\n if after - myNumber < myNumber - before:\r\n return after\... | [
"0.8772685",
"0.7691935",
"0.7656006",
"0.72884226",
"0.7015191",
"0.6731736",
"0.669658",
"0.6678727",
"0.6638377",
"0.66088545",
"0.65642154",
"0.6558308",
"0.64776385",
"0.645947",
"0.6438694",
"0.6437406",
"0.64111054",
"0.6387418",
"0.63685226",
"0.6354577",
"0.63341033"... | 0.85211307 | 1 |
Get a pipeline run by its run ID. | def get_pipeline_run(
self,
run_id: str,
**kwargs: Any
) -> _models.PipelineRun:
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kw... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pipeline_from_run(self, pipeline_run):\n db = self.mongo_client.metalearning\n collection = db.pipelines\n pipeline_doc = collection.find({\"$and\": [{\"id\": pipeline_run[\"pipeline\"][\"id\"]},\n {\"digest\": pipeline_run[\"pipeline\"][... | [
"0.7245278",
"0.70522374",
"0.6751429",
"0.6528091",
"0.6526137",
"0.6456435",
"0.6452748",
"0.638062",
"0.63381904",
"0.6243728",
"0.6226173",
"0.6198487",
"0.61949575",
"0.61212337",
"0.59183437",
"0.58938205",
"0.58918136",
"0.5836574",
"0.58059055",
"0.57862496",
"0.57474... | 0.7174154 | 1 |
Returns the same rate, regardless of time parameter. | def constantLearningRate(rate):
def function(t):
return rate
return function | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rate(self, t):\n return self.rates[bisect.bisect(self.change_times, t) - 1]",
"def get_current_rate(self):\n pass",
"def _set_rate(self):\r\n interval = self.data.iloc[2, 0] - self.data.iloc[1, 0]\r\n self.rate = int(1 / interval)",
"def rate(self, t, i):\n return n... | [
"0.7155598",
"0.6952967",
"0.67876124",
"0.67592096",
"0.670733",
"0.66939324",
"0.65198594",
"0.64456356",
"0.63431275",
"0.62840164",
"0.6271978",
"0.62042546",
"0.6202363",
"0.61726797",
"0.6139317",
"0.61059856",
"0.6078697",
"0.6030038",
"0.60108376",
"0.6009698",
"0.599... | 0.58388525 | 36 |
Decays the learning rate as 1/t^k per learning session. The parameter sets the initial learning rate. | def inverseTimeLearningRate(rate, k=1):
def function(t):
return float(rate)/t**k
return function | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_rate(self, t):\n # return self.init_learning_rate * (1 - t)\n return self.init_learning_rate / (1 + t)\n # return self.init_learning_rate * exp(-t)\n # return self.init_learning_rate * (.005 / self.init_learning_rate) ** t",
"def initialize_learning_rate(self):\n\n if ... | [
"0.8066345",
"0.77035606",
"0.75345445",
"0.7524547",
"0.7524547",
"0.730397",
"0.7193789",
"0.7193789",
"0.71910673",
"0.7186801",
"0.7176714",
"0.71579623",
"0.70692515",
"0.7061154",
"0.70542246",
"0.6979664",
"0.69645965",
"0.69572186",
"0.69533896",
"0.6937603",
"0.69061... | 0.0 | -1 |
At time t, selects the learning rate uniformly at random from the range [0, rate/t). | def randomInverseTimeLearningRate(rate):
def function(t):
return random() * float(rate)/t
return function | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_rate(self, t):\n # return self.init_learning_rate * (1 - t)\n return self.init_learning_rate / (1 + t)\n # return self.init_learning_rate * exp(-t)\n # return self.init_learning_rate * (.005 / self.init_learning_rate) ** t",
"def randomRateRelease(self, period):\n ... | [
"0.7406616",
"0.66404915",
"0.622515",
"0.6203199",
"0.61980635",
"0.6173167",
"0.6128291",
"0.6027133",
"0.6014907",
"0.59622556",
"0.5939536",
"0.58915985",
"0.58765066",
"0.5836535",
"0.5810874",
"0.58091944",
"0.58091944",
"0.5793605",
"0.5778658",
"0.5755053",
"0.5749369... | 0.7307091 | 1 |
At time t, returns the learning rate base^(t1). | def exponentialLearningRate(base):
def function(t):
return base ** (t-1)
return function | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_rate(self, t):\n # return self.init_learning_rate * (1 - t)\n return self.init_learning_rate / (1 + t)\n # return self.init_learning_rate * exp(-t)\n # return self.init_learning_rate * (.005 / self.init_learning_rate) ** t",
"def __learning_rate(self, lr0, epoch):\n ... | [
"0.87498677",
"0.7416464",
"0.71596324",
"0.6906604",
"0.6902787",
"0.68290406",
"0.68290406",
"0.6816075",
"0.66773695",
"0.6634997",
"0.6617983",
"0.65120894",
"0.651125",
"0.6492905",
"0.6433392",
"0.6354762",
"0.6352722",
"0.634686",
"0.6339156",
"0.6326837",
"0.628402",
... | 0.70100075 | 3 |
Get absolute path to resource, works for dev and for PyInstaller | def resource_path(relative_path):
base_path = getattr(sys, '_MEIPASS', os.path.dirname(os.path.abspath(__file__)))
return os.path.join(base_path, relative_path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_path():\n return os.path.join(os.path.dirname(__file__), \"resources\") + os.path.sep",
"def resourcePath(relative):\r\n try:\r\n # PyInstaller creates a temp folder and stores path in _MEIPASS\r\n base_path = sys._MEIPASS\r\n except Exception:\r\n base_path = os.pa... | [
"0.8369028",
"0.82811016",
"0.82484996",
"0.81395954",
"0.81144196",
"0.8099082",
"0.8094557",
"0.8080269",
"0.8068243",
"0.8067889",
"0.80630267",
"0.80630267",
"0.80630267",
"0.80630267",
"0.80630267",
"0.80630267",
"0.80630267",
"0.805744",
"0.80550295",
"0.8045351",
"0.80... | 0.7836314 | 48 |
Returns operating systems for devices | def getOperatingSystems(self, df: str = None, ts: str = None, cursor: str = None, pageSize: int = None):
params = {
'df': df,
'ts': ts,
'cursor': cursor,
'pageSize': pageSize
}
return self.api_get_request(f'{self.NINJA_API_QUERIES_OPERATING_SYSTEMS... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def describe_operating_systems():\n pass",
"def GetOperatingSystems(self, reason=None):\n query = []\n _AppendReason(query, reason)\n return self._SendRequest(HTTP_GET, \"/%s/os\" % GANETI_RAPI_VERSION,\n query, None)",
"def platform():\n return ['linux']",
"def get_s... | [
"0.81702226",
"0.7628078",
"0.7490968",
"0.74833226",
"0.7352467",
"0.7232143",
"0.7126971",
"0.71093285",
"0.7080197",
"0.70342654",
"0.6888589",
"0.6872518",
"0.68527526",
"0.6846049",
"0.68272907",
"0.68059766",
"0.6786525",
"0.6666222",
"0.66417044",
"0.66399705",
"0.6626... | 0.6008582 | 78 |
Returns list of processors | def getProcessors(self, df: str = None, ts: str = None, cursor: str = None, pageSize: int = None):
params = {
'df': df,
'ts': ts,
'cursor': cursor,
'pageSize': pageSize
}
return self.api_get_request(f'{self.NINJA_API_QUERIES_PROCESSORS}', params=pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_processors(self) -> ProcessorList:\n raise NotImplementedError()",
"def processor_ids(self):\n return self._processor_ids",
"def processors(self) -> Optional[Sequence['outputs.EncoderProcessorResponse']]:\n return pulumi.get(self, \"processors\")",
"def listify(self, processo... | [
"0.7432425",
"0.7188822",
"0.7046783",
"0.69714046",
"0.69411904",
"0.68256354",
"0.6747237",
"0.67460763",
"0.67397237",
"0.6636944",
"0.6631857",
"0.64458525",
"0.64427197",
"0.64257836",
"0.6294637",
"0.62701225",
"0.6154447",
"0.6153516",
"0.6146296",
"0.6146296",
"0.6107... | 0.58159506 | 37 |
Open a json file. | def openJson(self):
json_file = open(self.file, 'r')
json_data = json_file.read()
result = json.loads(json_data)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_json(path):\n with open(path, \"r\") as json_data_file:\n data = json.load(json_data_file)\n return data",
"def openFile(self, path):\n with open(path) as f:\n return json.load(f)",
"def load_json(file_name):\n return json.load(open(file_name))",
"de... | [
"0.8147477",
"0.81065434",
"0.745067",
"0.7224457",
"0.72164",
"0.7209884",
"0.72047883",
"0.72020733",
"0.71971786",
"0.719465",
"0.7159191",
"0.7111502",
"0.70659083",
"0.70519614",
"0.70426494",
"0.70236844",
"0.70231926",
"0.701603",
"0.7015173",
"0.7002824",
"0.7000986",... | 0.77036715 | 2 |
Computes a gradient clipping coefficient based on gradient norm. | def clip_grad(self, model, max_grad=10.):
total_norm = 0
for p in model.parameters():
if p.requires_grad:
modulenorm = p.grad.data.norm()
total_norm += modulenorm ** 2
total_norm = math.sqrt(total_norm)
norm = max_grad / max(total_norm, max_g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clip_gradient(parameters, clip):\n totalnorm = 0\n for p in parameters:\n modulenorm = p.grad.data.norm()\n totalnorm += modulenorm ** 2\n totalnorm = math.sqrt(totalnorm)\n return min(1, clip / (totalnorm + 1e-6))",
"def clip_gradient(model, clip_norm):\n totalnorm = 0\n for ... | [
"0.8192957",
"0.7836212",
"0.78191525",
"0.7812888",
"0.7684024",
"0.6941484",
"0.6935386",
"0.6885898",
"0.67271453",
"0.6653705",
"0.65643364",
"0.65286523",
"0.65286523",
"0.65286523",
"0.65286523",
"0.65286523",
"0.6526018",
"0.6459472",
"0.6434548",
"0.63848907",
"0.6342... | 0.64746755 | 17 |
r""" Gathers tensors from different GPUs on a specified device (1 means the CPU). | def gather(self, outputs, target_device=None, dim=0):
if not self.configer.get('network', 'gathered'):
if target_device is None:
target_device = list(range(torch.cuda.device_count()))[0]
return torch_gather(outputs, target_device, dim=dim)
else:
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_devices(args):\n global devices\n if args is not None:\n devices = [torch.device(i) for i in ast.literal_eval('[' + args + ']')]\n torch.cuda.set_device(devices[0])\n else:\n devices = [torch.device('cpu')]",
"def device_placement(self):\n if is_tf_available():\n ... | [
"0.6953633",
"0.65772754",
"0.65053016",
"0.6482273",
"0.63237464",
"0.63086706",
"0.6282448",
"0.62378764",
"0.62215096",
"0.6194322",
"0.6170956",
"0.6170956",
"0.6170956",
"0.6145486",
"0.613498",
"0.61330765",
"0.61266285",
"0.6121179",
"0.61100525",
"0.6102475",
"0.60967... | 0.568823 | 51 |
Sets the learning rate | def warm_lr(self, iters, scheduler, optimizer, backbone_list=(0, )):
if not self.configer.exists('lr', 'is_warm') or not self.configer.get('lr', 'is_warm'):
return
warm_iters = self.configer.get('lr', 'warm')['warm_iters']
if iters < warm_iters:
if self.configer.get('lr'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_learning_rate(self, rate):\n self.SGD.set_learning_rate(rate)",
"def adjust_lr(self):\n learning_rate = self.params.base_lr * (1 - float(self.epoch) / self.params.num_epoch) ** self.params.power\n for param_group in self.opt.param_groups:\n param_group['lr'] = learning_rat... | [
"0.8623272",
"0.76981455",
"0.7697208",
"0.7697208",
"0.7636927",
"0.758479",
"0.7572249",
"0.7514606",
"0.7490861",
"0.74744666",
"0.74288964",
"0.7413075",
"0.739503",
"0.73916996",
"0.73894364",
"0.73817927",
"0.73783433",
"0.7377333",
"0.7363047",
"0.7362884",
"0.7362884"... | 0.0 | -1 |
Caches and returns the final subtype instance. If refresh is set, the instance is taken from database, no matter if cached copy exists. | def get_subtype_instance(self, refresh=False):
if not self._subtype_instance or refresh:
instance = self.content_type.get_object_for_this_type(pk=self.pk)
self._subtype_instance = instance
return self._subtype_instance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get__(self, instance, cls=None):\n\n if cls is None:\n cls = type(instance)\n\n try:\n return vars(cls)[self.__cache_name__]\n except KeyError:\n result = super().__get__(instance, cls)\n setattr(cls, self.__cache_name__, result)\n r... | [
"0.5990304",
"0.58217543",
"0.5737326",
"0.57305115",
"0.5652957",
"0.56459147",
"0.55549663",
"0.55492777",
"0.55382437",
"0.5495881",
"0.5468105",
"0.54502916",
"0.54055315",
"0.5402896",
"0.5402222",
"0.5396081",
"0.5376101",
"0.53272885",
"0.5279705",
"0.52737594",
"0.526... | 0.7170661 | 0 |
Fetch significant stats from the database as json. | def _sorted_significant_states_json(
self,
hass,
start_time,
end_time,
entity_ids,
include_start_time_state,
significant_changes_only,
minimal_response,
):
timer_start = time.perf_counter()
with session_scope(hass=hass) as session:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stats():\n return jsonify(shorten.get_stats(get_db(), app.config['MINI_URL_BASE']))",
"def get_statistic():\n try:\n data = r.table('interests').run(g.rdb_conn)\n except Exception as e:\n add_to_log('error during get statistic', e)\n return e, 500\n else:\n results = [... | [
"0.75149906",
"0.6994248",
"0.66711736",
"0.6646828",
"0.6534282",
"0.64543486",
"0.6375305",
"0.6315301",
"0.6306239",
"0.62918735",
"0.62803036",
"0.62171555",
"0.6199833",
"0.61331266",
"0.6114852",
"0.6112559",
"0.60724825",
"0.6033473",
"0.60291433",
"0.60280424",
"0.593... | 0.0 | -1 |
Return a dict representation of the LazyState. Async friendly. To be used for JSON serialization. | def as_dict(self):
if self._last_changed:
last_changed_isoformat = self._last_changed.isoformat()
else:
last_changed_isoformat = process_timestamp_to_utc_isoformat(
self._row.last_changed
)
if self._last_updated:
last_updated_isofor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_json(self) -> Dict[str, Any]:\n return json.loads(self.get_state().to_json())",
"def __getstate__(self):\n return dict(self.items())",
"def __getstate__(self):\n return dict(self.items())",
"def to_state_json(self) -> Dict[str, Any]:\n return self.state_to_json()",
"def s... | [
"0.73689693",
"0.7290781",
"0.7290781",
"0.72045976",
"0.7179089",
"0.7007258",
"0.6970897",
"0.6933583",
"0.6912944",
"0.6884805",
"0.6861642",
"0.6841457",
"0.68081856",
"0.6802251",
"0.6783974",
"0.6774966",
"0.67631763",
"0.67283237",
"0.6713033",
"0.67099833",
"0.6678561... | 0.63948977 | 50 |
Generate COCO dataset (train/val, A/B) | def generate_coco_dataset(args):
args.data_root = Path(args.data_root)
args.save_root = Path(args.save_root)
args.save_root.mkdir()
generate_coco_dataset_sub(args, 'train', 'A', args.cat1)
generate_coco_dataset_sub(args, 'train', 'B', args.cat2)
generate_coco_dataset_sub(args, 'val', 'A', args.cat1)
generate_co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_train_coco_data(args):\n image_dir, annotation_file, data_dir = args.train_coco_image_dir, args.train_coco_annotation_file, args.train_coco_data_dir\n batch_size = args.batch_size\n basic_model = args.basic_model\n num_roi = args.num_roi\n\n coco = COCO(annotation_file)\n\n img_ids = ... | [
"0.7125079",
"0.69754833",
"0.6864203",
"0.6855541",
"0.67168444",
"0.6643378",
"0.6414278",
"0.6345772",
"0.6303074",
"0.6230644",
"0.6180055",
"0.6080744",
"0.6069362",
"0.6021222",
"0.6014553",
"0.6011518",
"0.59940857",
"0.59659386",
"0.5960097",
"0.59547234",
"0.59284866... | 0.8007143 | 0 |
Returns a child table attribute. | def __getitem__(self, ws_name):
doc_type, mappings = WS_MAPS[ws_name]
return [self._get_document(self.ids[ws_name][str(idx)], doc_type, row, mappings)
for idx, row in self._yield_rows(ws_name)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attribute(self):\n return getattr(self.parent_model, self.name)",
"def get_attribute(self, attr):\n super().get_attribute(attr) # Keep this line, it triggers the parent class method.\n return getattr(self, attr)",
"def getCustomAttribute(self):\n\t\treturn self.Attribute",
"def get_... | [
"0.70457464",
"0.6348191",
"0.6291945",
"0.60714346",
"0.60404575",
"0.60358614",
"0.60256374",
"0.5972633",
"0.5937167",
"0.58848095",
"0.58699137",
"0.5861298",
"0.58231026",
"0.58067",
"0.5778352",
"0.57580477",
"0.5749299",
"0.57461995",
"0.5713874",
"0.5677317",
"0.56652... | 0.0 | -1 |
take 1D float array of rewards and compute discounted reward | def discount_rewards(r):
discounted_r = np.zeros_like(r)
running_add = 0
for t in reversed(range(0, r.size)):
running_add = running_add * gamma + r[t]
discounted_r[t] = running_add
return discounted_r | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discount_rewards(rewards):\r\n discounted_r = np.zeros_like(rewards)\r\n running_add = 0\r\n for t in reversed(range(0, len(rewards))): \r\n running_add = running_add * reward_discount + rewards[t]\r\n discounted_r[t] = running_add\r\n return discounted_r",
"def discoun... | [
"0.8100923",
"0.78397125",
"0.7792625",
"0.7742053",
"0.7653779",
"0.75987715",
"0.7583268",
"0.75820553",
"0.7579539",
"0.7536054",
"0.75047183",
"0.7467692",
"0.7456702",
"0.7433794",
"0.7426565",
"0.74062765",
"0.73950297",
"0.7370545",
"0.73564714",
"0.7328519",
"0.720184... | 0.7519005 | 10 |
Initialise the checkout with a list of rules to be applied on total | def __init__(self, rules):
self.rules = set(rules)
self.products = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(\n self,\n stage: int,\n plain_rules: Dict[int, List[str]] = None,\n bob_rules: Dict[int, List[str]] = None,\n single_rules: Dict[int, List[str]] = None,\n start_row: Optional[str] = None,\n ) -> None:\n super().__init__(stage, start_row)\n\n ... | [
"0.5611341",
"0.55189717",
"0.55148447",
"0.54794216",
"0.54625905",
"0.5402394",
"0.53857243",
"0.5365979",
"0.5290905",
"0.5288645",
"0.5268438",
"0.52635777",
"0.52584773",
"0.5208588",
"0.51761276",
"0.51623064",
"0.5159061",
"0.51175576",
"0.51056504",
"0.5067046",
"0.50... | 0.6010401 | 0 |
Total price w/o any rule applied | def _grand_total(self):
count = 0
for product in self.products:
count += product.price
return count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_total(self):\n if self.total_price == 0:\n for discount in self.discounts:\n for item in self.items:\n item.add_discount(discount)\n\n for item in self.items:\n self.total_price += item.final_price()\n\n return self.... | [
"0.77475965",
"0.7433097",
"0.73820806",
"0.73668253",
"0.73540515",
"0.7348688",
"0.7289797",
"0.7227777",
"0.72225213",
"0.72101617",
"0.7165371",
"0.71441275",
"0.7137309",
"0.71013594",
"0.7063188",
"0.7048044",
"0.702949",
"0.70142484",
"0.7004916",
"0.6994921",
"0.69569... | 0.6831163 | 28 |
Save given date's settings to a json file. | def save_day_settings(dict=settings, date=TODAY_DATE):
with open(os.path.join(SETTINGS_DIR, "%s.json" % date), 'w') as f:
f.write(json.dumps(dict, indent=4, sort_keys=True))
logging.info("Settings for %s saved.", date) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, settings=None):\n json_string = json.dumps(self.variables)\n with open(self.filepath, 'w', encoding='utf-8') as fh:\n fh.write(json_string)",
"def writeSettingsFile(self, JSON, path=None):\n if path is not None:\n settingsFilePath = path\n else:\n ... | [
"0.7108022",
"0.6964258",
"0.6831306",
"0.67254615",
"0.6640823",
"0.66240954",
"0.66210556",
"0.65985805",
"0.65094876",
"0.6490496",
"0.648316",
"0.64607346",
"0.6420736",
"0.6419497",
"0.64144766",
"0.64143276",
"0.63692087",
"0.6336813",
"0.6333704",
"0.63257253",
"0.6318... | 0.8103306 | 0 |
Unload a config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
return await hass.config_entries.async_unload_platforms(
entry, (entry.options["group_type"],)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok",
"async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:\n hass.data.pop(DOMAIN)\n return True",
... | [
"0.697284",
"0.6888074",
"0.6779855",
"0.6747459",
"0.6689002",
"0.6657831",
"0.66162205",
"0.6603433",
"0.65925974",
"0.65595686",
"0.65411645",
"0.6507643",
"0.6507643",
"0.6507643",
"0.6507643",
"0.64977276",
"0.64931643",
"0.6486601",
"0.6486601",
"0.6486601",
"0.6486601"... | 0.6150584 | 60 |
Return the name of the group. | def name(self) -> str:
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"def get_group_name(self):\n return self.groupname",
"def group_name(self):\n\n return self._group_name",
"def group_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"group_name\")",
"... | [
"0.9161615",
"0.9002861",
"0.8926135",
"0.8765724",
"0.86816233",
"0.8484722",
"0.8400623",
"0.8400623",
"0.839688",
"0.83435595",
"0.82018495",
"0.79989296",
"0.79989296",
"0.7960032",
"0.7960032",
"0.7917622",
"0.7864769",
"0.77438986",
"0.7726005",
"0.7720718",
"0.7716633"... | 0.0 | -1 |
Return the state attributes for the group. | def extra_state_attributes(self) -> dict[str, Any]:
data = {ATTR_ENTITY_ID: self.tracking, ATTR_ORDER: self._order}
if not self.user_defined:
data[ATTR_AUTO] = True
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_attributes(self):\n return self._attributes",
"def state_attributes(self):\n return self._attributes",
"def device_state_attributes(self):\r\n return self.attributes",
"def device_state_attributes(self):\n return self.attr",
"def device_state_attributes(self):\n ... | [
"0.7805842",
"0.7805842",
"0.75074226",
"0.75012326",
"0.75012326",
"0.7439373",
"0.7423699",
"0.7423699",
"0.73912376",
"0.73853225",
"0.7333217",
"0.7333217",
"0.7333217",
"0.7333217",
"0.7333217",
"0.7333217",
"0.7333217",
"0.7333217",
"0.7333217",
"0.7333217",
"0.7333217"... | 0.0 | -1 |
Iterates over all Fragment objects in the default Model. The iteration is performed in order according the the parent Chain's chain_id, and the Fragment's position within the chain. | def iter_fragments(self):
if self.default_model is None:
raise StopIteration
for chain in self.default_model.chain_list:
for frag in chain.fragment_list:
yield frag | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_all_fragments(self):\n for model in self.model_list:\n for chain in model.chain_list:\n for frag in chain.fragment_list:\n yield frag",
"def iter_fragments(self):\n for chain in self.chain_list:\n for frag in chain.fragment_list:\n ... | [
"0.77844054",
"0.6945465",
"0.67310905",
"0.66359556",
"0.62076545",
"0.5949619",
"0.5822489",
"0.5611548",
"0.5611548",
"0.55379593",
"0.55369425",
"0.55141026",
"0.55031604",
"0.54758406",
"0.54438645",
"0.5352095",
"0.53253096",
"0.52775264",
"0.5264328",
"0.52189565",
"0.... | 0.8057021 | 0 |
Iterates over all Fragment objects in all Models. The iteration is performed in order according the the parent Chain's chain_id, and the Fragment's position within the chain. | def iter_all_fragments(self):
for model in self.model_list:
for chain in model.chain_list:
for frag in chain.fragment_list:
yield frag | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_fragments(self):\n if self.default_model is None:\n raise StopIteration\n\n for chain in self.default_model.chain_list:\n for frag in chain.fragment_list:\n yield frag",
"def iter_fragments(self):\n for chain in self.chain_list:\n for ... | [
"0.74701715",
"0.7341649",
"0.6558923",
"0.6475701",
"0.6211303",
"0.61447203",
"0.60382634",
"0.60277176",
"0.59790593",
"0.58230484",
"0.5801814",
"0.56988674",
"0.56964535",
"0.5667479",
"0.5627872",
"0.56211895",
"0.5608082",
"0.55822706",
"0.5524851",
"0.5524851",
"0.551... | 0.83503187 | 0 |
Returns True if the Structure contains amino or nucleic acids in the default Model. | def has_standard_residues(self):
for frag in self.iter_standard_residues():
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_amino_acid(self):\n return True",
"def is_amino_acid(self):\n return False",
"def is_nucleic_acid(self):\n return True",
"def is_nucleic_acid(self):\n return False",
"def isDna(self):\n from MolKit.PDBresidueNames import Nucleotides\n\n dnaRes = [x for x in ... | [
"0.6436614",
"0.63367456",
"0.6312981",
"0.6255471",
"0.61145955",
"0.6062824",
"0.59957457",
"0.59332347",
"0.5930868",
"0.5881763",
"0.57888526",
"0.57888526",
"0.5700993",
"0.5596108",
"0.5580886",
"0.5533166",
"0.5517482",
"0.5496105",
"0.5446605",
"0.5443125",
"0.5404931... | 0.0 | -1 |
Returns True if there are nonstandard residues in the default Model. | def has_non_standard_residues(self):
for frag in self.iter_non_standard_residues():
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_standard_residues(self):\n for frag in self.iter_standard_residues():\n return True\n return False",
"def is_standard_residue(self):\n return False",
"def is_standard_residue(self):\n return True",
"def is_standard_residue(self):\n return True",
"def is... | [
"0.7014657",
"0.6574301",
"0.64692485",
"0.64692485",
"0.5966651",
"0.59297574",
"0.5840176",
"0.5817673",
"0.58133197",
"0.58075404",
"0.5747055",
"0.5741116",
"0.5737345",
"0.5723113",
"0.57086885",
"0.5696602",
"0.5694368",
"0.56459004",
"0.56367296",
"0.56316483",
"0.5627... | 0.7546708 | 0 |
Iterates over all Atom objects in the default Model, using the default alt_loc. The iteration is preformed in order according to the Chain and Fragment ordering rules the Atom object is a part of. | def iter_atoms(self):
if self.default_model is None:
raise StopIteration
for chain in self.default_model.chain_list:
for frag in chain.fragment_list:
for atm in frag.atom_list:
yield atm | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_all_atoms(self):\n for model in self.iter_models():\n for atm in model.iter_all_atoms():\n yield atm",
"def iter_positions(self, use_all_models=False, include_alt_loc=False):\n for model in self.iter_models(use_all_models):\n for loc in model.iter_posit... | [
"0.6571608",
"0.64203185",
"0.6277812",
"0.61607176",
"0.6134329",
"0.61199933",
"0.5960482",
"0.59115666",
"0.5903381",
"0.58898723",
"0.5885597",
"0.58172387",
"0.5784468",
"0.57670814",
"0.57085043",
"0.56369746",
"0.55731905",
"0.5552522",
"0.55519307",
"0.5499107",
"0.54... | 0.7190907 | 0 |
Returns the atom with the same fragment_id and name as the argument atom, or None if it is not found. | def get_equivalent_atom(self, atom):
try:
return self.model_dict[atom.model_id].chain_dict[atom.chain_id].fragment_dict[atom.fragment_id].atom_dict[atom.name]
except KeyError:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_equivalent_atom(self, atom):\n try:\n return self.fragment_dict[atom.fragment_id].atom_dict[atom.name]\n except KeyError:\n return None",
"def get_equivalent_atom(self, atom):\n try:\n return self.chain_dict[atom.chain_id].fragment_dict[atom.fragment_... | [
"0.72393596",
"0.7038223",
"0.6950786",
"0.6612735",
"0.6424202",
"0.61082524",
"0.57513577",
"0.5590918",
"0.558874",
"0.5436254",
"0.53915113",
"0.5358918",
"0.53530777",
"0.53394175",
"0.53281796",
"0.5300084",
"0.52374166",
"0.52372336",
"0.5234496",
"0.5203988",
"0.51790... | 0.7009199 | 2 |
Iterates over all Bond objects. The iteration is preformed by iterating over all Atom objects in the same order as iter_atoms(), then iterating over each Atom's Bond objects. | def iter_bonds(self):
visited = {}
for atm in self.iter_atoms():
for bond in atm.iter_bonds():
if visited.has_key(bond):
continue
yield bond
visited[bond] = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_bonds(self):\n for bond in self.bond_list:\n yield bond",
"def iter_bonded_atoms(self):\n for bond in self.iter_bonds():\n partner = bond.get_partner(self)\n assert partner is not None\n yield partner",
"def iter_bonds(self):\n visited =... | [
"0.76242244",
"0.7590196",
"0.7506859",
"0.74073786",
"0.7249442",
"0.7235949",
"0.7170343",
"0.707269",
"0.7035386",
"0.6987405",
"0.6981776",
"0.6950094",
"0.6922508",
"0.680934",
"0.6783552",
"0.6718236",
"0.6661342",
"0.6587057",
"0.6476135",
"0.6476135",
"0.6265853",
"... | 0.7507923 | 4 |
Adds a Fragment instance | def add_fragment(self, fragment, delay_sort = False):
assert isinstance(fragment, Fragment)
assert fragment.model_id == self.model_id
## add new chain if necessary
try:
chain = self.chain_dict[fragment.chain_id]
except KeyError:
chain = Chain(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addfragment(self, fragment):\n self.__fragments.append(fragment)",
"def newfragment(self):\n newfragment = fragment()\n self.addfragment(newfragment)\n return newfragment",
"def add_fragment(self, fragment, delay_sort = False):\n assert isinstance(fragment, Fragment)\n ... | [
"0.8166209",
"0.73146725",
"0.7193431",
"0.69774455",
"0.694221",
"0.6916939",
"0.68800473",
"0.6475523",
"0.62595236",
"0.615505",
"0.60953164",
"0.6049626",
"0.60477597",
"0.60191905",
"0.6011175",
"0.59948504",
"0.5988308",
"0.5852612",
"0.57952094",
"0.5592566",
"0.558628... | 0.6944214 | 4 |
Returns the atom with the same fragment_id and name as the argument atom, or None if it is not found. | def get_equivalent_atom(self, atom):
try:
return self.chain_dict[atom.chain_id].fragment_dict[atom.fragment_id].atom_dict[atom.name]
except KeyError:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_equivalent_atom(self, atom):\n try:\n return self.fragment_dict[atom.fragment_id].atom_dict[atom.name]\n except KeyError:\n return None",
"def get_equivalent_atom(self, atom):\n try:\n return self.model_dict[atom.model_id].chain_dict[atom.chain_id].fr... | [
"0.7238712",
"0.70084894",
"0.69486654",
"0.66105044",
"0.64221835",
"0.6108329",
"0.575136",
"0.55911106",
"0.55888295",
"0.5434141",
"0.5392766",
"0.5363862",
"0.5350284",
"0.53370446",
"0.5329122",
"0.5304062",
"0.5240694",
"0.52366793",
"0.52340204",
"0.5204405",
"0.51823... | 0.70373595 | 1 |
Iterates over all Bond objects. The iteration is preformed by iterating over all Atom objects in the same order as iter_atoms(), then iterating over each Atom's Bond objects. | def iter_bonds(self):
visited = {}
for atm in self.iter_atoms():
for bond in atm.iter_bonds():
if visited.has_key(bond):
continue
yield bond
visited[bond] = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_bonds(self):\n for bond in self.bond_list:\n yield bond",
"def iter_bonded_atoms(self):\n for bond in self.iter_bonds():\n partner = bond.get_partner(self)\n assert partner is not None\n yield partner",
"def iter_bonds(self):\n visited =... | [
"0.76242244",
"0.7590196",
"0.7506859",
"0.74073786",
"0.7249442",
"0.7235949",
"0.7170343",
"0.707269",
"0.7035386",
"0.6987405",
"0.6981776",
"0.6950094",
"0.6922508",
"0.680934",
"0.6783552",
"0.6718236",
"0.6661342",
"0.6587057",
"0.6476135",
"0.6476135",
"0.6265853",
"... | 0.7507923 | 2 |
Sets the model_id of all contained objects. | def set_model_id(self, model_id):
assert isinstance(model_id, int)
if self.structure is not None:
chk_model = self.structure.get_model(model_id)
if chk_model is not None or chk_model != self:
raise ModelOverwrite()
self.model_id = model_id
for c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_model_id(self, model_id):\n assert isinstance(model_id, int)\n self.model_id = model_id\n\n for atm in self.iter_atoms():\n atm.set_model_id(model_id)",
"def set_model_id(self, model_id):\n assert isinstance(model_id, int)\n self.model_id = model_id\n\n ... | [
"0.80760324",
"0.7941755",
"0.7763619",
"0.64662385",
"0.63697916",
"0.63697916",
"0.63697916",
"0.63697916",
"0.63697916",
"0.63218546",
"0.63218546",
"0.6265717",
"0.62372184",
"0.61833364",
"0.6178816",
"0.617405",
"0.5962814",
"0.5914468",
"0.58980495",
"0.587143",
"0.579... | 0.7806016 | 2 |
Returns the atom with the same fragment_id and name as the argument atom, or None if it is not found. | def get_equivalent_atom(self, atom):
try:
return self.fragment_dict[atom.fragment_id].atom_dict[atom.name]
except KeyError:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_equivalent_atom(self, atom):\n try:\n return self.chain_dict[atom.chain_id].fragment_dict[atom.fragment_id].atom_dict[atom.name]\n except KeyError:\n return None",
"def get_equivalent_atom(self, atom):\n try:\n return self.model_dict[atom.model_id].ch... | [
"0.7039099",
"0.70103747",
"0.69524246",
"0.6613656",
"0.6425317",
"0.61100245",
"0.57532537",
"0.55917853",
"0.5589127",
"0.5437834",
"0.5391621",
"0.53585833",
"0.5352624",
"0.5339932",
"0.5330011",
"0.5299495",
"0.5238662",
"0.52377576",
"0.5236616",
"0.52059716",
"0.51791... | 0.72401434 | 0 |
Sets the model_id of all contained objects. | def set_model_id(self, model_id):
assert isinstance(model_id, int)
self.model_id = model_id
for frag in self.iter_fragments():
frag.set_model_id(model_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_model_id(self, model_id):\n assert isinstance(model_id, int)\n self.model_id = model_id\n\n for atm in self.iter_atoms():\n atm.set_model_id(model_id)",
"def set_model_id(self, model_id):\n assert isinstance(model_id, int)\n\n if self.structure is not None:\n... | [
"0.80760324",
"0.7806016",
"0.7763619",
"0.64662385",
"0.63697916",
"0.63697916",
"0.63697916",
"0.63697916",
"0.63697916",
"0.63218546",
"0.63218546",
"0.6265717",
"0.62372184",
"0.61833364",
"0.6178816",
"0.617405",
"0.5962814",
"0.5914468",
"0.58980495",
"0.587143",
"0.579... | 0.7941755 | 1 |
Sets the model_id of all contained objects. | def set_chain_id(self, chain_id):
assert isinstance(chain_id, str)
self.chain_id = chain_id
for frag in self.iter_fragments():
frag.set_chain_id(chain_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_model_id(self, model_id):\n assert isinstance(model_id, int)\n self.model_id = model_id\n\n for atm in self.iter_atoms():\n atm.set_model_id(model_id)",
"def set_model_id(self, model_id):\n assert isinstance(model_id, int)\n self.model_id = model_id\n\n ... | [
"0.80760324",
"0.7941755",
"0.7806016",
"0.7763619",
"0.64662385",
"0.63697916",
"0.63697916",
"0.63697916",
"0.63697916",
"0.63697916",
"0.63218546",
"0.63218546",
"0.6265717",
"0.62372184",
"0.61833364",
"0.6178816",
"0.617405",
"0.5962814",
"0.5914468",
"0.58980495",
"0.58... | 0.0 | -1 |
Returns True if there are no disagreements in the sequences of this segment and segment2. | def is_homolog(self, segment2):
hdict = {}
for fragment in self.fragment_list:
hdict[fragment.fragment_id] = fragment.res_name
for fragment in segment2.fragment_list:
if hdict.get(fragment.fragment_id, fragment.res_name) != fragment.res_name:
return Fals... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_degenerated(self):\n for interval in self.intervals:\n if not Interval.is_degenerated(interval):\n return False\n return True",
"def haveNoSameEdges(seg1,seg2,segmentsMeta):\n seg1Edges = segmentsMeta['edges'][seg1]\n seg2Edges = segmentsMeta['edges'][seg2]\n ... | [
"0.6329462",
"0.62636346",
"0.60784525",
"0.5864211",
"0.5746649",
"0.5736313",
"0.5700359",
"0.56096876",
"0.55909914",
"0.55862993",
"0.547457",
"0.5463274",
"0.54510754",
"0.5426253",
"0.5413815",
"0.5411194",
"0.54093844",
"0.5383126",
"0.5374711",
"0.5344362",
"0.5334990... | 0.5268122 | 26 |
Removes the current sequence mapping. | def remove_sequence(self):
self.sequence_fragment_list = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear(self):\n dict.clear(self)\n self._sequence = []",
"def remove(self) -> None:\n self.map.remove_ent(self)",
"def pop(self):\n try:\n self.mappings.pop()\n except IndexError:\n raise RuntimeError('stack is empty')",
"def clear(self):\n s... | [
"0.6930216",
"0.6928141",
"0.64540434",
"0.645049",
"0.63908243",
"0.63087076",
"0.6305047",
"0.62141913",
"0.62080556",
"0.620577",
"0.62008804",
"0.6199001",
"0.6161632",
"0.606276",
"0.5974799",
"0.59727436",
"0.5960612",
"0.5919852",
"0.5916345",
"0.59051687",
"0.59025097... | 0.6842336 | 2 |
Sets a new ID for the Chain, updating the chain_id for all objects in the Structure hierarchy. | def set_chain_id(self, chain_id):
## check for conflicting chain_id in the structure
if self.model is not None:
chk_chain = self.model.get_chain(chain_id)
if chk_chain is not None or chk_chain != self:
raise ChainOverwrite()
Segment.set_chain_id(self, cha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_chain_id(self, chain_id):\n assert isinstance(chain_id, str)\n self.chain_id = chain_id\n\n for atm in self.iter_atoms():\n atm.set_chain_id(chain_id)",
"def set_chain_id(self, chain_id):\n assert isinstance(chain_id, str)\n for atm in self.iter_alt_loc():\n ... | [
"0.8116328",
"0.8064047",
"0.78392196",
"0.6850862",
"0.6617248",
"0.65388036",
"0.641384",
"0.6268896",
"0.5981238",
"0.57870275",
"0.57644147",
"0.5730625",
"0.5610341",
"0.5601958",
"0.5581971",
"0.55680037",
"0.5527948",
"0.552404",
"0.5508026",
"0.5500154",
"0.5500154",
... | 0.79547215 | 2 |
Returns the atom with the same fragment_id and name as the argument atom, or None if it is not found. | def get_equivalent_atom(self, atom):
try:
return self.atom_dict[atom.name]
except KeyError:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_equivalent_atom(self, atom):\n try:\n return self.fragment_dict[atom.fragment_id].atom_dict[atom.name]\n except KeyError:\n return None",
"def get_equivalent_atom(self, atom):\n try:\n return self.chain_dict[atom.chain_id].fragment_dict[atom.fragment_... | [
"0.7238712",
"0.70373595",
"0.70084894",
"0.69486654",
"0.64221835",
"0.6108329",
"0.575136",
"0.55911106",
"0.55888295",
"0.5434141",
"0.5392766",
"0.5363862",
"0.5350284",
"0.53370446",
"0.5329122",
"0.5304062",
"0.5240694",
"0.52366793",
"0.52340204",
"0.5204405",
"0.51823... | 0.66105044 | 4 |
Iterates over all Bond objects. The iteration is preformed by iterating over all Atom objects in the same order as iter_atoms(), then iterating over each Atom's Bond objects. | def iter_bonds(self):
visited = {}
for atm in self.iter_atoms():
for bond in atm.iter_bonds():
if not visited.has_key(bond):
yield bond
visited[bond] = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_bonds(self):\n for bond in self.bond_list:\n yield bond",
"def iter_bonded_atoms(self):\n for bond in self.iter_bonds():\n partner = bond.get_partner(self)\n assert partner is not None\n yield partner",
"def iter_bonds(self):\n visited =... | [
"0.7624761",
"0.75907063",
"0.7508454",
"0.7508454",
"0.7508454",
"0.74064326",
"0.72489834",
"0.723517",
"0.71698916",
"0.7072134",
"0.70351225",
"0.6986831",
"0.69813913",
"0.6949789",
"0.69217837",
"0.68097657",
"0.67830014",
"0.67181987",
"0.6661006",
"0.6586812",
"0.6475... | 0.7507457 | 5 |
Sets the model_id of the Fragment and all contained Atom objects. | def set_model_id(self, model_id):
assert isinstance(model_id, int)
self.model_id = model_id
for atm in self.iter_atoms():
atm.set_model_id(model_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_model_id(self, model_id):\n assert isinstance(model_id, int)\n self.model_id = model_id\n\n for frag in self.iter_fragments():\n frag.set_model_id(model_id)",
"def set_model_id(self, model_id):\n assert isinstance(model_id, int)\n for atm in self.iter_alt_loc... | [
"0.84072846",
"0.72644734",
"0.7008253",
"0.6382039",
"0.61676383",
"0.6163073",
"0.6163073",
"0.6100062",
"0.6090761",
"0.6090761",
"0.6090761",
"0.6090761",
"0.6090761",
"0.6025688",
"0.60059816",
"0.5987123",
"0.5942781",
"0.5839366",
"0.5830791",
"0.581907",
"0.5811598",
... | 0.7613356 | 1 |
Sets the chain_id of the Fragment and all contained Atom objects. | def set_chain_id(self, chain_id):
assert isinstance(chain_id, str)
self.chain_id = chain_id
for atm in self.iter_atoms():
atm.set_chain_id(chain_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_chain_id(self, chain_id):\n assert isinstance(chain_id, str)\n self.chain_id = chain_id\n\n for frag in self.iter_fragments():\n frag.set_chain_id(chain_id)",
"def set_chain_id(self, chain_id):\n assert isinstance(chain_id, str)\n for atm in self.iter_alt_loc... | [
"0.86013395",
"0.7918495",
"0.7345212",
"0.6560239",
"0.64506704",
"0.6384256",
"0.6080135",
"0.6037253",
"0.58775616",
"0.5747613",
"0.573962",
"0.5616501",
"0.5576734",
"0.5404988",
"0.5314706",
"0.51976275",
"0.5158189",
"0.51369876",
"0.5085526",
"0.50338346",
"0.4993233"... | 0.80426913 | 1 |
Sets the fragment_id of the Fragment and all contained Atom objects. | def set_fragment_id(self, fragment_id):
assert isinstance(fragment_id, str)
if self.chain is not None:
chk_frag = self.chain.get_fragment(fragment_id)
if chk_frag is not None or chk_frag != self:
raise FragmentOverwrite()
self.fragment_id = fragment_id
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_fragment_id(self, fragment_id):\n assert isinstance(fragment_id, str)\n for atm in self.iter_alt_loc():\n atm.fragment_id = fragment_id",
"def set_model_id(self, model_id):\n assert isinstance(model_id, int)\n self.model_id = model_id\n\n for frag in self.ite... | [
"0.8299025",
"0.674106",
"0.67382485",
"0.64600277",
"0.5434006",
"0.5386989",
"0.5335702",
"0.53173053",
"0.52512574",
"0.5250653",
"0.5250254",
"0.5236827",
"0.5217528",
"0.514515",
"0.5141727",
"0.5141727",
"0.5141727",
"0.5141727",
"0.5141727",
"0.5141727",
"0.5141727",
... | 0.84287 | 0 |
Sets the res_name of the Fragment and all contained Atom objects. | def set_res_name(self, res_name):
assert isinstance(res_name, str)
self.res_name = res_name
for atm in self.iter_atoms():
atm.set_res_name(res_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_res_name(self, res_name):\n assert isinstance(res_name, str)\n for atm in self.iter_alt_loc():\n atm.res_name = res_name",
"def set_name(self,name):\r\n self._name = __name",
"def setResultsName(self, name, **kwargs):\n self.structure.set_name(name)\n retur... | [
"0.733608",
"0.5760923",
"0.57099515",
"0.5590014",
"0.55436856",
"0.55028874",
"0.5498679",
"0.5478947",
"0.54597276",
"0.5452883",
"0.54375386",
"0.54375386",
"0.54375386",
"0.54375386",
"0.54375386",
"0.54375386",
"0.54375386",
"0.54375386",
"0.54375386",
"0.54375386",
"0.... | 0.7596344 | 0 |
Returns True if this is a CIS amino acid, otherwise returns False. It uses calc_torsion_omega, and if there are missing atoms this method will return None. | def is_cis(self):
prev_res = self.get_offset_residue(-1)
if prev_res is None:
return None
prev_omega = prev_res.calc_torsion_omega()
if prev_omega is None:
return None
if abs(prev_omega) <= (math.pi/2.0):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_amino_acid(self):\n return True",
"def is_amino_acid(self):\n return False",
"def is_nucleic_acid(self):\n return True",
"def is_nucleic_acid(self):\n return False",
"def has_amino_acids(self):\n for frag in self.iter_amino_acids():\n return True\n ... | [
"0.698654",
"0.68997",
"0.66673905",
"0.6608147",
"0.5995854",
"0.59741664",
"0.5920113",
"0.5752127",
"0.5616784",
"0.5585354",
"0.5585354",
"0.5585354",
"0.5562848",
"0.55572647",
"0.5553399",
"0.55335313",
"0.5494851",
"0.5491952",
"0.54514265",
"0.53041565",
"0.529196",
... | 0.68098444 | 2 |
Returns the Fragment object of atom 2. | def get_fragment2(self):
return self.atom2.fragment | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fragment1(self):\n return self.atom1.fragment",
"def get_structure2(self):\n return self.atom2.fragment.chain.model.structure",
"def get_atom2(self):\n return self.atom2",
"def get_model2(self):\n return self.atom2.fragment.chain.model",
"def get_chain2(self):\n r... | [
"0.7362455",
"0.67976105",
"0.67952436",
"0.6439146",
"0.6259028",
"0.60689765",
"0.59627384",
"0.5822433",
"0.580266",
"0.580266",
"0.5710553",
"0.5576794",
"0.5576794",
"0.5519326",
"0.54803884",
"0.541384",
"0.5382002",
"0.53779745",
"0.5284315",
"0.52718025",
"0.5247128",... | 0.8554534 | 0 |
Returns the Structure object of atom 1. | def get_structure1(self):
return self.atom1.fragment.chain.model.structure | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_atom1(self):\n return self.atom1",
"def get_struct_by_full_object(self, name):\n return self.get_node_by_full_object(name).get_structure()",
"def get_structure2(self):\n return self.atom2.fragment.chain.model.structure",
"def structure(self):\n return self.struct",
"def ... | [
"0.7046759",
"0.64916193",
"0.62964755",
"0.6019694",
"0.58555704",
"0.5821949",
"0.57696795",
"0.576045",
"0.56986",
"0.5662142",
"0.5658227",
"0.5611622",
"0.5602974",
"0.5561662",
"0.5507366",
"0.550649",
"0.5463986",
"0.5313351",
"0.5299402",
"0.52798784",
"0.52798784",
... | 0.75833875 | 0 |
Adds the Segment object this AlphaHelix spans. If the AlphaHelix already has a Segment, then it is replaced. The Segment objects added to AlphaHelix objects must have the attribute segment.chain referencing the source Chain object the Segment was sliced from. | def add_segment(self, segment):
assert segment is None or isinstance(segment, Segment)
self.segment = segment
## just return if the segment is None
if segment is None:
return
## reset AlphaHelix description with the description derived
## from the new Segmen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_segment(self):\n copy = self.segments[-1]\n segment = Segment(copy.radius, copy.position.copy(),\n copy.heading_vector.copy())\n self.segments.append(segment)",
"def add_segment(self):\n last_seg = c.coords(self.segments[0].instance)\n x = last_... | [
"0.70865905",
"0.6975171",
"0.6945265",
"0.6869319",
"0.6724564",
"0.6294141",
"0.62364537",
"0.6192115",
"0.58524084",
"0.5698693",
"0.56048024",
"0.54806507",
"0.54786456",
"0.5428302",
"0.5347942",
"0.5308702",
"0.5281776",
"0.5278493",
"0.52748007",
"0.5247926",
"0.523293... | 0.7709651 | 0 |
Adds a Segment instance. | def add_strand(self, strand):
assert isinstance(strand, Strand)
assert strand not in self.strand_list
self.strand_list.append(strand)
strand.beta_sheet = self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_segment(self, segment):\n self.segments.append(segment)",
"def add_segment(self):\n last_seg = c.coords(self.segments[0].instance)\n x = last_seg[2] - SEG_SIZE\n y = last_seg[3] - SEG_SIZE\n self.segments.insert(0, Segment(x, y))",
"def add_segment(self):\n cop... | [
"0.8211295",
"0.7982387",
"0.7657211",
"0.74138796",
"0.73404324",
"0.6786",
"0.6408127",
"0.64019734",
"0.62970036",
"0.62118804",
"0.6097949",
"0.5932849",
"0.59049416",
"0.58330446",
"0.57616913",
"0.57351494",
"0.5610369",
"0.5577716",
"0.5531345",
"0.55114174",
"0.550208... | 0.0 | -1 |
Iterates over all child Strands objects. | def iter_strands(self):
return iter(self.strand_list) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n for child in self.children:\n yield child",
"def __iter__(self):\n\n for i in self._children:\n yield i",
"def __iter__(self):\n return iter(self.__children)",
"def __iter__(self):\n # top level can be assumed to be real structure dict\n... | [
"0.6410955",
"0.63763094",
"0.61037314",
"0.59908026",
"0.5987421",
"0.5967155",
"0.5885124",
"0.57414114",
"0.57049483",
"0.57049483",
"0.5702635",
"0.5689572",
"0.5677277",
"0.566176",
"0.564884",
"0.5634043",
"0.56206423",
"0.56167907",
"0.5596896",
"0.5592306",
"0.5512057... | 0.68406445 | 0 |
Return the given date `d` formatted using Django's current language combined with `Babel's date formatting | def format_date(d, fmt):
return babel_format_date(
d, fmt, locale=to_locale(translation.get_language())) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_date(d):\r\n # workaround because Django's dateformat utility requires a datetime\r\n # object (not just date)\r\n dt = aware_datetime(d.year, d.month, d.day, 0, 0, 0)\r\n return dateformat.format(dt, 'j M Y')",
"def l10n_format_date(ctx, date, format='long'):\n lang = get_locale(ctx['L... | [
"0.73796076",
"0.67876697",
"0.64062136",
"0.63828087",
"0.6348674",
"0.62431234",
"0.6227558",
"0.61226875",
"0.5982082",
"0.59608644",
"0.59431976",
"0.5915455",
"0.5908655",
"0.58708566",
"0.58669287",
"0.5822046",
"0.57983434",
"0.5769775",
"0.5750643",
"0.57242",
"0.5711... | 0.74758327 | 0 |
Return a string with a concise representation of the given date and time combination. | def when_text(d, t=None):
if d is None:
return ''
# fmt = 'yyyy MMM dd (EE)'
# txt = d.strftime(settings.SITE.date_format_strftime)
txt = format_date(d, 'EE ')
txt += dd.fds(d)
if t is not None:
txt += ' (%s)' % t.strftime(settings.SITE.time_format_strftime)
return txt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_datetime_str():\n return time.strftime(\"%Y-%m-%d %H:%M:%S\", time.localtime())",
"def timestr():\n return dt.strftime(dt.now(),'%H:%M:%S')",
"def datetime_to_str(time):\n return '{hour}:{min}:{second}:{millisecond}'.format(\n hour=time.hour,\n min=time.minute, \n second=t... | [
"0.7060694",
"0.7027236",
"0.6950821",
"0.69489",
"0.68381625",
"0.6824703",
"0.68106997",
"0.6781897",
"0.67657346",
"0.6749583",
"0.6720354",
"0.6707673",
"0.6699745",
"0.66568005",
"0.66327864",
"0.6627525",
"0.6623162",
"0.65841305",
"0.6553649",
"0.6553042",
"0.653721",
... | 0.6244424 | 53 |
Return a date or datetime obtained by adding `value` times this `unit` to the specified value `orig`. Returns None is `orig` is empty. This is intended for use as a `curried magic method` of a | def add_duration(unit, orig, value):
if orig is None:
return None
if unit.value == 's':
return orig + datetime.timedelta(seconds=value)
if unit.value == 'm':
return orig + datetime.timedelta(minutes=value)
if unit.value == 'h':
return orig ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_datetime(value):\n if value:\n return value\n return None",
"def step(self, value):\n self.real_time += pd.DateOffset(**{self.time_unit: value})\n self.simu_time += value\n logger.debug(\"NEW TIME\")",
"def adapt_timefield_value(self, value):\n if value is None... | [
"0.5544621",
"0.54459476",
"0.5218717",
"0.5042841",
"0.5028916",
"0.50012934",
"0.49911222",
"0.49771985",
"0.49518985",
"0.49307427",
"0.484572",
"0.48380786",
"0.4822773",
"0.48224956",
"0.48184317",
"0.47620907",
"0.4746328",
"0.47207078",
"0.46859813",
"0.4678754",
"0.46... | 0.6928695 | 0 |
Check the validity of the commit signature. Key needs to be already present. | def is_commit_signature_valid(self, commit: git.Commit) -> bool:
commit_status = self.get_commit_signature_status(commit)
if commit_status in VALID_SIGNATURE_STATUSES:
logger.debug(f"Commit {commit.hexsha!r} signature is valid.")
return True
logger.warning(f"Commit {comm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_signature_of_commit(\n self, commit: git.Commit, possible_key_fingerprints: List[str]\n ) -> bool:\n status = self.get_commit_signature_status(commit=commit)\n if status == CommitSignatureStatus.no_signature:\n logger.debug(\"Commit not signed.\")\n return Fa... | [
"0.71027005",
"0.6892153",
"0.6790849",
"0.6737893",
"0.6730578",
"0.66793597",
"0.66718143",
"0.6631091",
"0.65410113",
"0.65279716",
"0.651595",
"0.6510367",
"0.64816046",
"0.64591986",
"0.6441981",
"0.64407706",
"0.64036506",
"0.639633",
"0.63727486",
"0.6359969",
"0.63592... | 0.7477683 | 0 |
A string representation of the model. | def __str__(self):
return self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __repr__(self):\n\n mod = f\"{self.__class__.__name__} Model\"\n try:\n mod += f': {self.filename}'\n except AttributeError:\n pass\n s = [mod]\n for name, v in self.metadat... | [
"0.8567286",
"0.80320746",
"0.7939547",
"0.78144956",
"0.78115743",
"0.7782607",
"0.7757796",
"0.7757796",
"0.773894",
"0.77152467",
"0.7714009",
"0.7679083",
"0.7661709",
"0.765754",
"0.7645759",
"0.7645759",
"0.7628557",
"0.762749",
"0.75903344",
"0.75903344",
"0.7569605",
... | 0.0 | -1 |
Plot a bar chart of all job degree requierments for cities | def plot_degree_count_city_bar_chart(jobs, city_coords, include_others=False):
degree_city = pd.DataFrame()
degree_city['degree_classification'] = jobs['degree_classification']
# Find the closest city to all job gps coordinates
degree_city['closest_city'] =\
jobs[['latitude', 'longitude']]\
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def city_bargraph(self, plot_col):\n try:\n self.cit\n except AttributeError:\n self._init_cit()\n\n col = [self.cit.df[plot_col][city] for city in self.city_names]\n self.single_barplot(col=col, section_labels=self.city_names,\n title=plot_col + ' by Ci... | [
"0.68707544",
"0.64343184",
"0.6288555",
"0.60649693",
"0.58312947",
"0.58269274",
"0.57442945",
"0.56981975",
"0.55098784",
"0.5480394",
"0.541704",
"0.5245697",
"0.523771",
"0.5236855",
"0.5206712",
"0.51879257",
"0.5164225",
"0.5156246",
"0.5110861",
"0.50864017",
"0.50770... | 0.7145188 | 0 |
Parses a yaml file and returns a dictionary. | def _parse_from_yaml(self) -> Dict:
config_path = path.join(path.dirname(path.abspath(__file__)), self.config_file)
try:
with open(config_path, "r") as f:
config_dict = yaml.load(f, Loader=yaml.FullLoader)
return config_dict
except FileNotFoundError as fnfe:
raise FileNotFoundErr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_yaml(yaml_file: str) -> dict:\n with open(yaml_file, 'r', encoding=\"utf8\") as _file:\n _dict = yaml.safe_load(_file)\n logging.info(f\"Yaml file {yaml_file} parsed!\")\n\n return _dict",
"def read_yaml_file(filepath: str) -> Dict:\n return yaml.safe_load(read_file(filepath))",
... | [
"0.80108964",
"0.7730988",
"0.7694753",
"0.7635835",
"0.7545374",
"0.7527475",
"0.74641377",
"0.7415775",
"0.73946124",
"0.73829323",
"0.7331452",
"0.73247164",
"0.7272485",
"0.7211486",
"0.7199334",
"0.7137423",
"0.7128535",
"0.71169287",
"0.711554",
"0.7102173",
"0.7096417"... | 0.7919735 | 1 |
Gets instances from indexes in X_train and X_test from x_values. | def getInstances(X_train,X_test,x_values,y_values):
newTrain = []
yTrain = []
for i, train in enumerate(X_train): #loop through each train
newTrain.append([])
yTrain.append([])
for index in train: #loop through each index
newTrain[i].append(x_values[index])
y... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, idx):\n obj_idx, rel_idx = self.get_instance_idx(idx)\n\n observations = []\n observations.append(self.all_instances[obj_idx][rel_idx])\n\n for i in range(self.samples_per_instance - 1):\n observations.append(self.all_instances[obj_idx][np.random.randint... | [
"0.59535474",
"0.5931336",
"0.5917401",
"0.5910653",
"0.5910653",
"0.5805902",
"0.575574",
"0.57402307",
"0.5713961",
"0.5713961",
"0.57131815",
"0.5622923",
"0.56080997",
"0.56080997",
"0.5603822",
"0.56028914",
"0.5576543",
"0.5536329",
"0.5513278",
"0.54977703",
"0.5479032... | 0.74773294 | 0 |
Takes a 2D list and takes out one column of values (1D list). | def create_list(oldList):
#If list is empty...
#return empty list
if(oldList == []):
return []
#Index is assumed to be last value in list
index = len(oldList[0])-1
#Create new list
testList = []
for value in oldList:
testList.append(value[index])
return testList | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flatten_2D_list(list_2d):\n return [item for sub in list_2d for item in sub]",
"def row_to_col(lst_lst: List[List[Any]]) -> List[List[Any]]:\n head = (lambda x: x[0])\n tail = (lambda x: x[1:])\n if not lst_lst or not head(lst_lst): # c.f. the remark about recursion termination\n return [... | [
"0.7087539",
"0.6865393",
"0.63256556",
"0.6260773",
"0.6183991",
"0.6120687",
"0.59532666",
"0.5938039",
"0.5901599",
"0.5899338",
"0.5896017",
"0.5854601",
"0.58508",
"0.5846197",
"0.58326685",
"0.58287895",
"0.5819015",
"0.5796575",
"0.57870907",
"0.5768943",
"0.5746007",
... | 0.0 | -1 |
A helper function that returns a random subset of values of size num_values | def compute_random_subset(values, num_values):
shuffled = values[:]
random.shuffle(shuffled)
return shuffled[:num_values] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_subset(array, count):\n indices = np.random.permutation(len(array))[:count]\n return array[indices]",
"def _rand_subset(self, iterable, num_elems):\n\n lst = list(iterable)\n assert num_elems <= len(lst)\n\n out = []\n\n while len(out) < num_elems:\n elem =... | [
"0.7259221",
"0.6836088",
"0.6721495",
"0.6677648",
"0.6674213",
"0.6645181",
"0.6506879",
"0.6484982",
"0.6475684",
"0.6444866",
"0.6420681",
"0.6412568",
"0.6409575",
"0.6398051",
"0.63662684",
"0.63486934",
"0.6337236",
"0.63251704",
"0.631897",
"0.63083696",
"0.62962925",... | 0.9095285 | 0 |
Test a combination of positive and negative numbers | def test_negativenumbers(self):
result = ps.pairs([-4, 4, 0, -2, 0], 0)
self.assertEqual(result[0, 0], -4)
self.assertEqual(result[0, 1], 4)
self.assertEqual(result[1, 0], 0)
self.assertEqual(result[1, 1], 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pos_neg(a,b,negative):\r\n if negative:\r\n return (a<0 and b<0)\r\n else:\r\n return (a<0 and b<0) or (a>0 and b<0)",
"def truthiness(a: int, b: int, negative: bool=False) -> bool: # _1 [✅]\n if a < 0 and b < 0 and not negative or a >= 0 and b >= 0 and not negative:\n return ne... | [
"0.72826976",
"0.7038515",
"0.69722575",
"0.6964218",
"0.6812724",
"0.6804396",
"0.67196214",
"0.6683847",
"0.66161597",
"0.66106004",
"0.6518163",
"0.64883614",
"0.64696735",
"0.646715",
"0.646576",
"0.6460955",
"0.64353037",
"0.64202464",
"0.637493",
"0.6374579",
"0.6359933... | 0.6799251 | 6 |
Test that username is always unique. | def test_unique_username(self):
user = User(name="thealphadollar")
g.db.add(user)
g.db.commit()
user_field = Field("thealphadollar")
with self.assertRaises(ValidationError):
unique_username(None, user_field) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_username_not_unique(bot):\n expect_error(register, InputError, bot.username, \"abcdef\", \"a\", \"a\", \"a\")",
"def unique_username(cls, username):\n if not User.is_username_available(username):\n raise ValueError('Sorry, this username is already taken.')\n return username",... | [
"0.80182517",
"0.79382384",
"0.7615956",
"0.7591804",
"0.7523559",
"0.74420387",
"0.73609227",
"0.73088974",
"0.730186",
"0.7227529",
"0.7203885",
"0.716063",
"0.71528447",
"0.714162",
"0.7126055",
"0.7113494",
"0.7110838",
"0.7091261",
"0.70410997",
"0.7033135",
"0.7030378",... | 0.8090669 | 0 |
Apply reduce_sum for axes before binary einsum calculation if enable. | def solve_sum_einsum(parsed_vectors, vars):
def solve_sum_einsum_one_step(src_axes, used_by_other_axes, x):
dst_axes = []
for axis in src_axes:
if axis not in used_by_other_axes:
continue
dst_axes.append(axis)
summed_axis_indices = [i for i in range(l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reduce_sum_as_einsum(x: JaxExpression, params: Params) -> Einsum:\n axis = params['axes']\n x_shape = x.shape\n x_dims = ''.join(it.islice(einsum.einsum_letters(), len(x_shape)))\n out_dims = ''.join([x_dims[i] for i in range(len(x_shape)) if i not in axis])\n formula = f'{x_dims}->{out_dims}'\n return E... | [
"0.66120064",
"0.5900937",
"0.5863909",
"0.5822864",
"0.5799543",
"0.5747778",
"0.574291",
"0.57411665",
"0.5732698",
"0.5693254",
"0.5690587",
"0.56817657",
"0.5626647",
"0.5621404",
"0.55647904",
"0.55522895",
"0.5527044",
"0.5527044",
"0.5522186",
"0.54824775",
"0.54761744... | 0.5225931 | 34 |
Returns the serial number of the device. | def get_serial(self) -> str:
return self._get_string(openvr.Prop_SerialNumber_String) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_serial_number(self) -> str:\n return pulumi.get(self, \"device_serial_number\")",
"def device_serial_number(self) -> str:\n return pulumi.get(self, \"device_serial_number\")",
"def _usb_serial_number(self):\n return self.device.serial_number",
"def get_serial_number(self):\n\n... | [
"0.87695056",
"0.87695056",
"0.8233957",
"0.81772834",
"0.81415176",
"0.8036385",
"0.8031519",
"0.800225",
"0.79745066",
"0.7828631",
"0.7814782",
"0.77628064",
"0.77619374",
"0.77441037",
"0.7732498",
"0.7698762",
"0.7656526",
"0.7632053",
"0.7619039",
"0.75909567",
"0.75683... | 0.7893212 | 9 |
Returns the model number of the device. | def get_model(self) -> str:
return self._get_string(openvr.Prop_ModelNumber_String) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_number(self) -> Optional[str]:\n return self.profile_device.model_number",
"def get_model_number(self):\n raise DeviceException(DeviceException.FEATURE_NOT_IMPLEMENTED)",
"def model_number(self):\n return self._read(MX_MODEL_NUMBER)",
"def model(self):\n return self._dev... | [
"0.8478277",
"0.8339572",
"0.81381065",
"0.80139756",
"0.79341507",
"0.7863523",
"0.761809",
"0.7468275",
"0.746595",
"0.7448984",
"0.7398082",
"0.73656964",
"0.7133275",
"0.7038911",
"0.7006445",
"0.6956727",
"0.69201213",
"0.68621385",
"0.68621385",
"0.68198216",
"0.6799720... | 0.7891278 | 5 |
Returns the model name of the device. | def get_model_name(self) -> str:
return self._get_string(openvr.Prop_RenderModelName_String) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_name(self) -> str:\n return self.profile_device.model_name",
"def model(self) -> str:\n return self.camera_info[\"device_model\"]",
"def model(self):\n return self._device.device_data[self._uuid]['model']",
"def _get_model(self) -> str:\n return str(self.hass.data[DOMAIN... | [
"0.8797015",
"0.8100175",
"0.79832834",
"0.784064",
"0.78296834",
"0.7791327",
"0.7680753",
"0.7674621",
"0.7664132",
"0.76547414",
"0.764626",
"0.7572184",
"0.7572184",
"0.7572184",
"0.7544472",
"0.75438154",
"0.75132805",
"0.74727166",
"0.7455788",
"0.7419721",
"0.74151224"... | 0.8203561 | 1 |
Returns a boolean property of the device. | def _get_bool(self, prop_type) -> bool:
if prop_type in self._value_cache:
return self._value_cache[prop_type]
value = self._vr_system.getBoolTrackedDeviceProperty(
self._index, prop_type)[0]
self._value_cache[prop_type] = value
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_on(self):\n return bool(getattr(self.resource, self.variable))",
"def is_on(self):\n return self._device.state",
"def is_on(self):\n return self._device.is_on",
"def is_on(self):\n return self._device.is_on",
"def is_on(self):\n return self._device.is_on",
"def i... | [
"0.73062336",
"0.71136826",
"0.7083392",
"0.7083392",
"0.7083392",
"0.6973585",
"0.69377345",
"0.67495865",
"0.67299235",
"0.6729271",
"0.6729271",
"0.6669534",
"0.66575027",
"0.6613784",
"0.6598407",
"0.6595354",
"0.6593368",
"0.658854",
"0.65742767",
"0.6539631",
"0.6539631... | 0.6660747 | 12 |
Remove all background coloring from the given text. | def _remove_background_colors(text) -> StyledStr:
return _remove_regex(BACKGROUND_COLORS_REGEX, text) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _remove_text_colors(text) -> StyledStr:\n return _remove_regex(FOREGROUND_COLORS_REGEX, text)",
"def remove_color(text):\n color_reg = re.compile(r\"\\033\\[\\d*(;\\d*)*m\")\n return re.sub(color_reg, \"\", text)",
"def strip_ansi(text: str):\n return _ANSI_SEQUENCE_REGEX.sub('', text)",
"def... | [
"0.7960531",
"0.7309377",
"0.6520664",
"0.6501024",
"0.64988655",
"0.63488704",
"0.62063414",
"0.6042023",
"0.60416883",
"0.6033435",
"0.6033435",
"0.603037",
"0.5989337",
"0.59728533",
"0.59473336",
"0.5941468",
"0.5923147",
"0.5915581",
"0.58758897",
"0.5835364",
"0.5835364... | 0.8743405 | 0 |
Remove all foreground coloring from the given text. | def _remove_text_colors(text) -> StyledStr:
return _remove_regex(FOREGROUND_COLORS_REGEX, text) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_color(text):\n color_reg = re.compile(r\"\\033\\[\\d*(;\\d*)*m\")\n return re.sub(color_reg, \"\", text)",
"def _remove_background_colors(text) -> StyledStr:\n return _remove_regex(BACKGROUND_COLORS_REGEX, text)",
"def strip_ansi(text: str):\n return _ANSI_SEQUENCE_REGEX.sub('', text)",
... | [
"0.7887513",
"0.78362495",
"0.65937734",
"0.6583889",
"0.65180606",
"0.64110386",
"0.61906576",
"0.6161431",
"0.6127047",
"0.6124484",
"0.61020285",
"0.60903805",
"0.6077534",
"0.60672426",
"0.60500664",
"0.60236955",
"0.598951",
"0.5957482",
"0.591434",
"0.5907323",
"0.58450... | 0.84722686 | 0 |
Checks the user has access to the project. | def _verify_access(self, c_params: CommonParams) -> Squonk2AgentRv:
access_id: int = c_params.access_id
assert access_id
project: Optional[Project] = Project.objects.filter(id=access_id).first()
if not project:
msg = f'Access ID (Project) {access_id} does not exist'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_access_project(project, user):\n if project.deprecated_files:\n return False\n\n if project.access_policy == AccessPolicy.OPEN:\n return True\n elif project.access_policy == AccessPolicy.RESTRICTED:\n return user.is_authenticated and DUASignature.objects.filter(project=project... | [
"0.740577",
"0.73146886",
"0.72885513",
"0.71642786",
"0.6995063",
"0.6951719",
"0.6867028",
"0.6853472",
"0.6825927",
"0.68247986",
"0.68147147",
"0.67917633",
"0.67371225",
"0.6732672",
"0.67043674",
"0.66783905",
"0.66504574",
"0.66492796",
"0.6645541",
"0.6633199",
"0.662... | 0.6177324 | 87 |
Overloads `==` (equality) operator | def __eq__(self, other):
if not self._is_valid_operand(other):
return NotImplemented
# If we get a NodeContainer were comparing distance and if we get an
# Int were comparing node labels
if type(other) is NodeContainer:
return self.distance == other.distance
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def... | [
"0.80866915",
"0.80866915",
"0.80866915",
"0.80866915",
"0.80866915",
"0.80866915",
"0.80866915",
"0.80866915",
"0.80866915",
"0.80866915",
"0.80866915",
"0.80866915",
"0.80866915",
"0.80866915",
"0.80866915",
"0.80866915",
"0.80866915",
"0.80866915",
"0.80866915",
"0.80866915"... | 0.0 | -1 |
Creates a new annotator based on a Spacy model. | def __init__(self, name:str, model_path:str,
disabled:List[str]=["parser", "tagger", "lemmatizer", "attribute_ruler"]):
super(ModelAnnotator, self).__init__(name)
self.model = spacy.load(model_path, disable=disabled) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, nlp_model):\n\n self.__nlp_model: spacy = nlp_model\n self.__pipe_mode = False\n self.__documents = None\n self.__nlp_model.tokenizer = custom_tokenizer(self.__nlp_model.vocab)",
"def RDFAnnotationParser_createAnnotation():\n return _libsbml.RDFAnnotationParser_cre... | [
"0.550414",
"0.53988177",
"0.5323836",
"0.526136",
"0.52611303",
"0.5242493",
"0.5127945",
"0.5080185",
"0.5049395",
"0.50085557",
"0.4973626",
"0.495117",
"0.49363676",
"0.4893722",
"0.4865218",
"0.48631552",
"0.48414993",
"0.48390597",
"0.48123857",
"0.4808717",
"0.48071563... | 0.6118787 | 0 |
Annotates one single document using the Spacy NER model | def find_spans(self, doc: Doc) -> Iterable[Tuple[int, int, str]]:
# Create a new document (to avoid conflicting annotations)
doc2 = self.create_new_doc(doc)
# And run the model
for _, proc in self.model.pipeline:
doc2 = proc(doc2)
# Add the annotation
for ent... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def annotate(self,corpus):\n\n\t\tassert corpus.parsed == True, \"Corpus must already be parsed before entity recognition\"\n\n\t\tfor doc in corpus.documents:\n\t\t\tentityCount = len(doc.entities)\n\t\t\tfor sentence in doc.sentences:\n\t\t\t\twords = [ t.word for t in sentence.tokens ]\n\t\t\t\t\n\t\t\t\tfor i,... | [
"0.69004935",
"0.6078877",
"0.6063097",
"0.5986313",
"0.59607357",
"0.5923727",
"0.5911162",
"0.58893025",
"0.5889013",
"0.5886126",
"0.5806563",
"0.57972467",
"0.57279974",
"0.5658228",
"0.56302",
"0.5594309",
"0.5568479",
"0.55678",
"0.55627143",
"0.55410767",
"0.5512891",
... | 0.0 | -1 |
Converts a Tensor array into a numpy image array. | def tensor2im(input_image, imtype=np.uint8):
if not isinstance(input_image, np.ndarray):
if isinstance(input_image, torch.Tensor): # get the data from a variable
image_tensor = input_image.data
else:
return input_image
image_numpy = image_tensor[0].cpu().float().nump... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_tensor_to_numpy_img(tensor_img):\n\n img = tensor_img.to('cpu').clone().detach()\n img = img.numpy().squeeze(0)\n img = img.transpose(1, 2, 0)\n img = img * np.array((0.229, 0.224, 0.225)) + np.array((0.485, 0.456, 0.406))\n img = img.clip(0, 1)\n return img",
"def images_to_numpy(t... | [
"0.76706123",
"0.73970133",
"0.72891134",
"0.70688695",
"0.7039809",
"0.7034062",
"0.6989774",
"0.68511224",
"0.68485266",
"0.6814767",
"0.6798817",
"0.6775384",
"0.6773248",
"0.6742704",
"0.6710867",
"0.6661674",
"0.6646863",
"0.65954083",
"0.65807855",
"0.65459764",
"0.6499... | 0.58643043 | 95 |
Save a numpy image to the disk | def save_image(image_numpy, image_path, aspect_ratio=1.0):
image_pil = Image.fromarray(image_numpy)
h, w, _ = image_numpy.shape
if aspect_ratio > 1.0:
image_pil = image_pil.resize((h, int(w * aspect_ratio)), Image.BICUBIC)
if aspect_ratio < 1.0:
image_pil = image_pil.resize((int(h / as... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_img(img: np.ndarray, path: str) -> None:\n\n img_obj = Image.fromarray(img)\n img_obj.save(path)",
"def save_npimg(array: np.ndarray, path: str) -> None:\r\n img = Image.fromarray(array.squeeze())\r\n img.save(path)",
"def save_numpy_array(image_numpy, image_path):\n\n np.save(image_pat... | [
"0.8147427",
"0.805823",
"0.80290645",
"0.76396614",
"0.7499407",
"0.73602504",
"0.7349538",
"0.72928375",
"0.71834093",
"0.71678203",
"0.7089875",
"0.7088977",
"0.7059785",
"0.7059785",
"0.70420074",
"0.7023353",
"0.70053226",
"0.6992493",
"0.6944776",
"0.69285244",
"0.68913... | 0.0 | -1 |
Gaussian function used for creating perturbation. Creates the perturbation peak around a location x0,y0 | def gauss_pert(N,a):
x = np.arange(0,N,1,float)
y = x[:,np.newaxis]
# Choose the location of the peak
x0 = y0 = int(0.4*N)
# Choose the fwhm, 'width' of the perturbation
fwhm = N/15
return a*np.exp(-4*np.log(2) * ((x-x0)**2 + (y-y0)**2) / fwhm**2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussian(x, peak_x=.0, sigma=1.0, name=''):\n x = x.astype(np.float)\n variables = {'function': gaussian, 'peak_x': peak_x, 'sigma': sigma}\n y = np.exp((-1 * (x - peak_x)**2) / (2 * sigma**2))\n return packer(x, y, variables, name=name)",
"def fit_psf_to_gaussian(self, xx, yy, psf_data, x0, y0, ... | [
"0.65674037",
"0.6486555",
"0.643413",
"0.6389935",
"0.63432205",
"0.6258698",
"0.6251484",
"0.62351334",
"0.6231065",
"0.6194758",
"0.6194379",
"0.61929905",
"0.6159631",
"0.6145438",
"0.6134871",
"0.612496",
"0.61249214",
"0.6052718",
"0.6051462",
"0.604902",
"0.60488456",
... | 0.6184737 | 12 |
Converts a network mask to it's CIDR value. | def netmask_to_cidr(value):
return netaddr.IPAddress(value).netmask_bits() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cidr_to_netmask(value):\n return netaddr.IPNetwork(\"1.1.1.1/{}\".format(value)).netmask",
"def cidr_to_netmask(cidr):\n net_bits = cidr\n host_bits = 32 - int(net_bits)\n netmask = socket.inet_ntoa(struct.pack('!I', (1 << 32) - (1 << host_bits)))\n return netmask",
"def url_cidr_to_mask():\... | [
"0.6921795",
"0.6752013",
"0.6713901",
"0.6708845",
"0.66616327",
"0.66616327",
"0.637997",
"0.63790935",
"0.63314104",
"0.63314104",
"0.62714005",
"0.6265044",
"0.6265044",
"0.6233725",
"0.6219729",
"0.61788166",
"0.61530715",
"0.61530715",
"0.6114412",
"0.6075935",
"0.60653... | 0.80595076 | 0 |
return total amount of faces fitting certain column criteria | def groupby_cols(df, col_name):
for col in df:
if df[col].name not in cols_no_NA_option:
df = df.drop(df[col].name, 1)
continue
# group all robots according to list of column names
results = df.groupby(list(df))[col_name].count()
# order the results
results = results.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dimension(self):\r\n a = 0\r\n for x in self.faces():\r\n if (len(x) > a):\r\n a = len(x) \r\n return a-1",
"def num_faces(self):\n return self._top_exp.number_of_faces()",
"def n_facets(self):\n return self.n_inequalities()",
"def voxel_count(... | [
"0.6033948",
"0.6031048",
"0.5968154",
"0.59402627",
"0.5912435",
"0.59075296",
"0.5831347",
"0.57785577",
"0.57357115",
"0.57163924",
"0.56193584",
"0.5615859",
"0.56103504",
"0.5591",
"0.55835015",
"0.5527588",
"0.55242455",
"0.55179197",
"0.5515411",
"0.55131656",
"0.55052... | 0.0 | -1 |
return total amount of faces fitting certain column criteria | def groupby_cols_remove_x(df, col_list):
df = df[df != 'x']
# group all robots according to list of column names
results = df.groupby(col_list).size()
# order the results
results = results.sort_values(by='as_percent', ascending=False)
print(results)
# groupby_result.to_csv('groupby_results.t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dimension(self):\r\n a = 0\r\n for x in self.faces():\r\n if (len(x) > a):\r\n a = len(x) \r\n return a-1",
"def num_faces(self):\n return self._top_exp.number_of_faces()",
"def n_facets(self):\n return self.n_inequalities()",
"def voxel_count(... | [
"0.6033948",
"0.6031048",
"0.5968154",
"0.59402627",
"0.5912435",
"0.59075296",
"0.5831347",
"0.57785577",
"0.57357115",
"0.57163924",
"0.56193584",
"0.5615859",
"0.56103504",
"0.5591",
"0.55835015",
"0.5527588",
"0.55242455",
"0.55179197",
"0.5515411",
"0.55131656",
"0.55052... | 0.0 | -1 |
return total amount of faces fitting certain column criteria | def cluster_by_range(df, lower_bound):
global features_in_range
# get total number of robot faces in data set
total_rows = len(df)
# determine the upper bound percentage
upper_bound = 100 - lower_bound
# lists of which columns to fix and which to cluster
cols_to_fix = []
cols_to_cluster ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dimension(self):\r\n a = 0\r\n for x in self.faces():\r\n if (len(x) > a):\r\n a = len(x) \r\n return a-1",
"def num_faces(self):\n return self._top_exp.number_of_faces()",
"def n_facets(self):\n return self.n_inequalities()",
"def voxel_count(... | [
"0.6033948",
"0.6031048",
"0.5968154",
"0.59402627",
"0.5912435",
"0.59075296",
"0.5831347",
"0.57785577",
"0.57357115",
"0.57163924",
"0.56193584",
"0.5615859",
"0.56103504",
"0.5591",
"0.55835015",
"0.5527588",
"0.55242455",
"0.55179197",
"0.5515411",
"0.55131656",
"0.55052... | 0.0 | -1 |
Create the training and validation dataloaders. The data files must be structured as per the generic data loader for the torchvision.datasets.ImageFolder class. | def create_dataloaders(data_dir):
trng_dataset = datasets.ImageFolder(data_dir / TRNG_FOLDER,
transform=flowernet.trng_transform)
trng_dataloader = torch.utils.data.DataLoader(trng_dataset,
batch_size=64,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def creates_data_loader():\n dataset_faces = FaceDataset(\n IMG_DIR, transform=transform_train, face=True)\n\n dataset_no_faces = FaceDataset(\n IMG_DIR, transform=transform_train, face=False)\n\n datasets_faces_split = train_val_test(dataset_faces, 0.2, 0.0)\n datasets_no_faces_split = t... | [
"0.832243",
"0.81135046",
"0.77503383",
"0.77351886",
"0.7652867",
"0.76233387",
"0.76180875",
"0.74976593",
"0.74238706",
"0.7418275",
"0.7401153",
"0.73804843",
"0.7373783",
"0.7335088",
"0.73309803",
"0.72579914",
"0.72285944",
"0.71916854",
"0.71662843",
"0.7151166",
"0.7... | 0.77314764 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.