query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Return a list of all biomass precursors excluding ATP and H2O. | def find_biomass_precursors(reaction):
return [met for met in reaction.reactants
if met.id != 'atp_c' or met.id != 'h2o_c'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_residues(residues, biomolecule='PROTEIN'):\n biomolecule = biomolecule.strip().upper()\n standard_residues = []\n for res in residues:\n if res.get_resname().strip() in STANDARD_RESIDUES[biomolecule]:\n if not res.id[0].strip(): standard_residues.append(res) # filter out hetro... | [
"0.57958704",
"0.5735736",
"0.57199425",
"0.56032115",
"0.5497999",
"0.5462872",
"0.5445692",
"0.54334193",
"0.5404111",
"0.536359",
"0.5326811",
"0.5268405",
"0.5261754",
"0.5260519",
"0.52512157",
"0.52512157",
"0.52016413",
"0.5143108",
"0.5097513",
"0.5085446",
"0.5076226... | 0.76983833 | 0 |
Return boolean if biomass reaction includes growthassociated maintenance. | def gam_in_biomass(reaction):
left = set(["atp_c", "h2o_c"])
right = set(["adp_c", "pi_c", "h_c"])
return (
left.issubset(met.id for met in reaction.reactants) and
right.issubset(met.id for met in reaction.products)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_maintenance_active(self):\n pass",
"def isOn(self):\r\n return len(self.__agenda)>2",
"def hasActiveConfiguration(self):\n cal = self.request.get('form.widgets.calendarConfig')\n if cal is not None:\n if cal == ['non actif'] or cal == ['bloque']:\n r... | [
"0.65516186",
"0.6234557",
"0.61008626",
"0.60124373",
"0.6002799",
"0.5968936",
"0.58891225",
"0.58844316",
"0.5869086",
"0.58469754",
"0.5845207",
"0.5828297",
"0.5802893",
"0.57705647",
"0.57699484",
"0.5731509",
"0.57268125",
"0.5725466",
"0.5711255",
"0.57090855",
"0.568... | 0.0 | -1 |
Return list of possible direct biomass precursor metabolites. | def find_direct_metabolites(model, reaction):
transport_reactions = set(helpers.find_transport_reactions(model))
exchange_reactions = set(model.exchanges)
biomass_reactions = set(helpers.find_biomass_reaction(model))
combined_set = transport_reactions | exchange_reactions | biomass_reactions
precur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_biomass_precursors(reaction):\n return [met for met in reaction.reactants\n if met.id != 'atp_c' or met.id != 'h2o_c']",
"def get_process_modifiers(self):\n if micp_info.Info().is_processor_mcdram_available():\n return ['numactl', '--membind=1']\n else:\n ... | [
"0.6745549",
"0.561581",
"0.5512711",
"0.5422519",
"0.5346028",
"0.5289717",
"0.52687013",
"0.52617943",
"0.5231936",
"0.52080196",
"0.51465666",
"0.5122647",
"0.51208055",
"0.5107657",
"0.5105142",
"0.51000875",
"0.5085231",
"0.5048862",
"0.5048809",
"0.5044997",
"0.49852502... | 0.55994654 | 2 |
Project 3D joint coordinates to 2D image plane using camera intrinsic parameters. | def project_joints(x, intrinsics):
while intrinsics.dim() < x.dim():
intrinsics.unsqueeze_(1)
f = intrinsics[..., :2]
c = intrinsics[..., 2:4]
_x = torch.clamp(x[:, :, :2] / x[:, :, 2:], -1, 1)
if intrinsics.shape[-1] == 9:
k = intrinsics[..., 4:7]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_points(self, points_3d, camera):\n batch_size = points_3d.shape[0]\n device = points_3d.device\n cam_t = torch.stack([camera[:, 1], camera[:, 2], 2 * self.focal_length / (self.img_res * camera[:, 0] + 1e-09)], dim=-1)\n camera_center = camera.new_zeros([batch_size, 2])\n ... | [
"0.68925303",
"0.66907066",
"0.64373773",
"0.63866615",
"0.63323796",
"0.62515014",
"0.62096316",
"0.62036407",
"0.61683196",
"0.6151695",
"0.6141714",
"0.61289465",
"0.60840166",
"0.59890497",
"0.5974053",
"0.59147084",
"0.59063995",
"0.5904831",
"0.58895195",
"0.58652973",
... | 0.5436457 | 63 |
We create a horizontal gradient line with the shape (1, image.shape[1], 3)) The values are incremented from 0 to 1, if reverse is False, otherwise the values are decremented from 1 to 0. | def vertical_gradient_line(image, reverse=False):
number_of_columns = image.shape[1]
if reverse:
C = np.linspace(1, 0, number_of_columns)
else:
C = np.linspace(0, 1, number_of_columns)
C = np.dstack((C, C, C))
return C | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gradXY(image):\n\treturn image[:-1,:-1]-image[:-1,1:],image[:-1,:-1]-image[1:,:-1]",
"def flip_horizontal(picture: Image) -> Image:\r\n \r\n hflip = copy(picture)\r\n width = get_width(picture)\r\n height = get_height(picture)\r\n \r\n for x in range(width):\r\n for y in range(height... | [
"0.6066866",
"0.5928203",
"0.587014",
"0.5861202",
"0.57668185",
"0.5742842",
"0.5677034",
"0.5651147",
"0.5610111",
"0.55945265",
"0.54815406",
"0.547332",
"0.54527104",
"0.5410856",
"0.53613013",
"0.53600246",
"0.53427076",
"0.53351766",
"0.5324365",
"0.53230137",
"0.531605... | 0.75392103 | 0 |
This is a test for SDC11273. First, it creates a large (~6MB) file and puts it on the SFTP server. Then, it creates a pipeline with SFTP origin and S3 destination, with whole file format, and runs until the single record (file) is complete. Then, it asserts the S3 bucket contents are correct. It passes only if the new ... | def test_sftp_origin_whole_file_to_s3(sdc_builder, sdc_executor, sftp, aws):
sftp_file_name = get_random_string(string.ascii_letters, 10) + '.txt'
raw_text_data = get_random_string(string.printable, 6000000)
sftp.put_string(os.path.join(sftp.path, sftp_file_name), raw_text_data)
s3_bucket = aws.s3_buck... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_s3_whole_file_transfer(sdc_builder, sdc_executor, aws):\n s3_key = f'{S3_SANDBOX_PREFIX}/{get_random_string()}/'\n s3_dest_key = f'{S3_SANDBOX_PREFIX}/{get_random_string()}/'\n data = 'Completely random string that is transfered as whole file format.'\n\n # Build pipeline.\n builder = sdc_b... | [
"0.74351275",
"0.6691175",
"0.63518316",
"0.6236795",
"0.62040716",
"0.6117077",
"0.6047765",
"0.60346115",
"0.5965132",
"0.5948178",
"0.593876",
"0.5923927",
"0.59144896",
"0.59015715",
"0.5900285",
"0.5899149",
"0.58582693",
"0.5841244",
"0.58241713",
"0.5814957",
"0.575601... | 0.78550535 | 0 |
Gets the assessment Id associated with this learning objective. | def get_assessment_id(self):
if not self.has_assessment():
raise IllegalState()
else:
return Id(self._my_map['assessmentId']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assignment_id(self):\n return self.assignment.AssignmentId",
"def getId(self):\n return _libsbml.Objective_getId(self)",
"def assessment_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"assessment_name\")",
"def get_objective_id(self):\n return Id(self._m... | [
"0.6642637",
"0.65614617",
"0.6370965",
"0.63376397",
"0.6332876",
"0.6223702",
"0.607873",
"0.60680634",
"0.60680634",
"0.6041768",
"0.6017208",
"0.59313357",
"0.5910461",
"0.5890122",
"0.5840722",
"0.58372885",
"0.57736814",
"0.57574743",
"0.57292515",
"0.5729178",
"0.56783... | 0.81356394 | 0 |
Gets the assessment associated with this learning objective. | def get_assessment(self):
if not self.has_assessment:
raise IllegalState()
else:
raise Unimplemented() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assessment_mode(self) -> str:\n return pulumi.get(self, \"assessment_mode\")",
"def assessment_mode(self) -> str:\n return pulumi.get(self, \"assessment_mode\")",
"def vulnerability_assessment(self) -> pulumi.Output['outputs.VulnerabilityAssessmentNoteResponse']:\n return pulumi.get(se... | [
"0.65343404",
"0.65343404",
"0.65219253",
"0.6506116",
"0.6489979",
"0.6367347",
"0.63660854",
"0.6252827",
"0.61373776",
"0.61005443",
"0.6007981",
"0.5947849",
"0.58661455",
"0.5859983",
"0.5730712",
"0.5514165",
"0.5506593",
"0.54918236",
"0.54513454",
"0.5448177",
"0.5442... | 0.7574991 | 0 |
Tests if this objective has a knowledge dimension. | def has_knowledge_category(self):
return 'knowledgeCategoryId' in self._my_map and bool(self._my_map['knowledgeCategoryId']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_dimension(self, dim):\n\n return self.units.dimensions == dim",
"def haveDimension(self, dim):\r\n haveIt = False\r\n try:\r\n self.data.getDimensionValue(dim, 0)\r\n haveIt = True\r\n except:\r\n # Assume it's not there...\r\n pass\... | [
"0.7374034",
"0.7167167",
"0.6464031",
"0.624237",
"0.6037031",
"0.60339147",
"0.5926595",
"0.5894677",
"0.582687",
"0.5720824",
"0.5712355",
"0.5705048",
"0.5695953",
"0.5632669",
"0.5575956",
"0.5514025",
"0.54873383",
"0.5477059",
"0.54733807",
"0.5470373",
"0.54612905",
... | 0.66293156 | 2 |
Gets the grade associated with the knowledge dimension. | def get_knowledge_category(self):
if not self.has_knowledge_category():
raise IllegalState()
else:
return Grade(self._get_grade_map(self._my_map['knowledgeCategoryId'])), | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_grade(self):\n return self.__grade_value",
"def get_grade(course_det):\n return course_det[1]",
"def get_grade(self) -> int :\n return self.grade",
"def getGrade(self, difficulty):\n \n grade = skillToGrade(self.skill, difficulty)\n self.grades.append(grade)\n ... | [
"0.6941088",
"0.64507806",
"0.6420301",
"0.60025054",
"0.59466237",
"0.59265697",
"0.5720963",
"0.5717198",
"0.5622739",
"0.5611627",
"0.5521429",
"0.5421381",
"0.5406702",
"0.5398836",
"0.53584665",
"0.5352342",
"0.5303565",
"0.52809507",
"0.5273532",
"0.5271184",
"0.5252672... | 0.62194717 | 3 |
Sets the knowledge category. | def set_knowledge_category(self, grade_id=None):
if grade_id is None:
raise NullArgument()
metadata = Metadata(**settings.METADATA['knowledge_category_id'])
if metadata.is_read_only():
raise NoAccess()
if self._is_valid_input(grade_id, metadata, array=False):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def category(self, category):\n\n self._category = category",
"def category(self, category):\n\n self._category = category",
"def category(self, category):\n\n self._category = category",
"def category(self, category):\n\n self._category = category",
"def category(self, category... | [
"0.7458612",
"0.7458612",
"0.7458612",
"0.7458612",
"0.7458612",
"0.7401796",
"0.7384905",
"0.7365358",
"0.7064898",
"0.66198015",
"0.6593707",
"0.6463852",
"0.645841",
"0.64550716",
"0.64291894",
"0.6343262",
"0.6333563",
"0.62660813",
"0.6213503",
"0.60899633",
"0.6087105",... | 0.69289 | 9 |
Gets the ObjectiveFormRecord corresponding to the given objective record Type. | def get_objective_form_record(self, objective_record_type=None):
if not self.has_record_type():
raise Unsupported()
else: # This should never get called:
raise Unimplemented() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_objective_bank_form_record(self, objective_bank_record_type=None):\n if not self.has_record_type():\n raise Unsupported()\n else: # This should never get called:\n raise Unimplemented()",
"def get_resource_form_record(self, resource_record_type):\n return self.... | [
"0.80720466",
"0.7705257",
"0.7587062",
"0.72468305",
"0.6697328",
"0.6664385",
"0.66308576",
"0.6441732",
"0.59116095",
"0.57678586",
"0.56603503",
"0.56586057",
"0.5556165",
"0.5521336",
"0.5437601",
"0.54052943",
"0.53123784",
"0.53061265",
"0.5253121",
"0.519227",
"0.5151... | 0.83414364 | 0 |
Tests if this is an asset based activity. | def is_asset_based_activity(self):
return bool(self._my_map['assetIds']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_asset(self):\n return self.hasLabel('Asset')",
"def asset(self, vid):\n return self.V(vid).is_asset()",
"def is_asset(cls, *args):\n return cls.graph_traversal(None, None, Bytecode()).is_asset(*args)",
"def is_asset(self, is_asset):\n\n self._is_asset = is_asset",
"def is... | [
"0.78188884",
"0.73406416",
"0.7086247",
"0.64520824",
"0.6357475",
"0.63310826",
"0.6330663",
"0.6272163",
"0.62702364",
"0.6245925",
"0.60219854",
"0.5967062",
"0.5827391",
"0.5784867",
"0.5775628",
"0.56968284",
"0.5677322",
"0.5631384",
"0.5631384",
"0.5551603",
"0.539837... | 0.8065672 | 0 |
Tests if this is a course based activity. | def is_course_based_activity(self):
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_course_page(self):\n return isinstance(self, CoursePage)",
"def isCourseObject(self):\n return 'Course' == self.ecparent.Type()",
"def is_activity_only(self):\n return self._tag == 'activity_only'",
"def is_assessment_based_activity(self):\n return 'assessmentIds' in self._... | [
"0.6793866",
"0.67838776",
"0.66691107",
"0.66495574",
"0.62008977",
"0.612934",
"0.60941565",
"0.59827954",
"0.5884095",
"0.5836396",
"0.5757889",
"0.57519835",
"0.5724637",
"0.57008284",
"0.5688545",
"0.56494904",
"0.56477106",
"0.56068224",
"0.5527585",
"0.5516525",
"0.550... | 0.872512 | 0 |
Gets the Ids of any assessments associated with this activity. | def get_assessment_ids(self):
if not self.is_assessment_based_activity():
raise IllegalState()
else:
return [Id(a) for a in self._my_map['assessmentIds']] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_assessments(self):\n if not self.is_assessment_based_activity():\n raise IllegalState()\n else:\n raise Unimplemented()",
"def get_assessments_metadata(self):\n return Metadata(**settings.METADATA['assessment_ids'])",
"def get_assessment_id(self):\n if ... | [
"0.7233872",
"0.6964845",
"0.6374541",
"0.6013074",
"0.58448327",
"0.5773757",
"0.57615024",
"0.57615024",
"0.570874",
"0.56740475",
"0.5655042",
"0.5645156",
"0.5525477",
"0.552499",
"0.54987764",
"0.54950756",
"0.5451435",
"0.5443842",
"0.5423631",
"0.5396167",
"0.5381623",... | 0.82018507 | 0 |
Gets the activity record corresponding to the given Activity record Type. This method is used to retrieve an object implementing the requested record. The activityRecordType may be the Type returned in get_record_types() or any of its parents in a Type hierarchy where hasRecordType(activityRecordType) is true . | def get_activity_record(self, activity_record_type=None):
if not self.has_record_type():
raise IllegalState()
else: # This should never get called:
raise Unimplemented() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_activity_form_record(self, activity_record_type=None):\n if not self.has_record_type():\n raise Unsupported()\n else: # This should never get called:\n raise Unimplemented()",
"def get_resource_record(self, resource_record_type):\n return self._get_record(resou... | [
"0.7540905",
"0.7008964",
"0.66944313",
"0.6538669",
"0.6231104",
"0.6212383",
"0.61274374",
"0.59151334",
"0.585328",
"0.58433926",
"0.56949437",
"0.56703687",
"0.56179583",
"0.5602741",
"0.55559623",
"0.5450588",
"0.53009266",
"0.5278507",
"0.52009404",
"0.5150463",
"0.5124... | 0.78397167 | 0 |
Gets the ObjectiveBankFormRecord corresponding to the given objective bank record Type. | def get_objective_bank_form_record(self, objective_bank_record_type=None):
if not self.has_record_type():
raise Unsupported()
else: # This should never get called:
raise Unimplemented() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_objective_bank_record(self, objective_bank_record_type=None):\n if not self.has_record_type():\n raise IllegalState()\n else: # This should never get called.\n raise Unimplemented()",
"def get_objective_form_record(self, objective_record_type=None):\n if not se... | [
"0.7826927",
"0.7271696",
"0.7101726",
"0.67658734",
"0.6563335",
"0.63057494",
"0.5825965",
"0.5721738",
"0.56140697",
"0.55999047",
"0.5283518",
"0.5221119",
"0.5176915",
"0.51742876",
"0.5161492",
"0.5130868",
"0.50568664",
"0.50269663",
"0.49987432",
"0.49771217",
"0.4879... | 0.83583426 | 0 |
A generator that yields all the line segments defined by the given x_intercepts and y_intercepts | def __generate_streets(x_intercepts: list, y_intercepts: list) -> set:
for x_start, x_end in zip(x_intercepts[:-1], x_intercepts[1:]):
for y in y_intercepts:
yield {(x, y) for x in range(x_start, x_end + 1)}
for y_start, y_end in zip(y_intercepts[:-1], y_intercepts[1:]):
for x in x_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lines(self):\n for pair in pairs(self.points):\n yield Line(pair, shape=self)",
"def collect_lines(xy, BL, bs, climv):\n lines = [zip(xy[BL[i, :], 0], xy[BL[i, :], 1]) for i in range(len(BL))]\n line_segments = LineCollection(lines, # Make a sequence of x,y pairs\n ... | [
"0.6446194",
"0.6397008",
"0.6233588",
"0.6174291",
"0.61155194",
"0.5886049",
"0.5880862",
"0.58766943",
"0.58766943",
"0.58702433",
"0.58697176",
"0.58280903",
"0.57153934",
"0.5699626",
"0.5699626",
"0.5686722",
"0.5675488",
"0.56657934",
"0.5648185",
"0.5648185",
"0.56481... | 0.6517559 | 0 |
Initialize weights to small random numbers | def _initialize_weights(self, m):
self.rgen = np.random.RandomState(self.random_state)
self.w_ = self.rgen.normal(loc=0.0, scale=0.01, size=m)
self.b_ = 0
self.w_avg = self.rgen.normal(loc=0.0, scale=0.01, size=m)
self.b_avg = 0
def net_input(self, X):
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def WeightInitializer():\n return np.random.uniform(-1, 1)",
"def default_weight_initializer(self):\n self.biases = [np.random.randn(y, 1) for y in self.sizes[1:]]\n self.weights = [np.random.randn(y, x)/np.sqrt(x)\n for x, y in zip(self.sizes[:-1], self.sizes[1:])]",
"d... | [
"0.8100848",
"0.8068776",
"0.80308425",
"0.80295664",
"0.80119115",
"0.7992856",
"0.7959979",
"0.7863809",
"0.78448373",
"0.78436106",
"0.78232956",
"0.78061324",
"0.7748765",
"0.77222973",
"0.7698515",
"0.76639235",
"0.76473665",
"0.7612441",
"0.75119525",
"0.7465318",
"0.74... | 0.0 | -1 |
remove keys for None in a dict | def remove_none(obj: dict):
return remap(
obj, visit=lambda path, key, value: key is not None and value is not None
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_none_values(dict_):\r\n\r\n res = {}\r\n res.update((key, value) for key, value in dict_.iteritems() \\\r\n if value is not None)\r\n return res",
"def _drop_none_values(dictionary: Dict) -> Dict:\n return {key: value for key, value in dictionary.items() if value is not None... | [
"0.82495046",
"0.79773647",
"0.7931961",
"0.7829859",
"0.77204907",
"0.7718256",
"0.7649318",
"0.76283866",
"0.7588262",
"0.7562359",
"0.75241536",
"0.750417",
"0.7491085",
"0.7426536",
"0.7412663",
"0.73625547",
"0.72642994",
"0.72465754",
"0.7174093",
"0.7139355",
"0.712066... | 0.7989832 | 1 |
Initializes the Quadrature class. | def __init__(self, p_order=None):
self.p_order = p_order
self.alpha = 0
self.beta = 0
self.reference_interval = [-1, 1]
# Considering a homogeneous p-order
# Evaluate the weights and nodes of the
# element
if isinstance(p_order, int):
self.po... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_points_and_weights(self):\n if hasattr(self, 'corr'):\n corr = self.corr\n else:\n corr = None\n self.quadrature = Quadrature(parameters=self.parameters, basis=self.basis, \\\n points=self.inputs, mesh=self.mesh, corr=corr)\n quadrat... | [
"0.65137994",
"0.64531577",
"0.6368134",
"0.6234585",
"0.6188213",
"0.61857754",
"0.6152042",
"0.60638845",
"0.59702384",
"0.5876385",
"0.58467495",
"0.5843633",
"0.58128154",
"0.57972944",
"0.5795616",
"0.57577133",
"0.57242113",
"0.5722375",
"0.5720626",
"0.5712694",
"0.570... | 0.0 | -1 |
Explicitly close the resources opened by this logger. This will not shutdown the connection. | def close(self):
if self.cursor is None:
return
self.cursor.close()
self.cursor = None
self.app_id = None
self.iden_id = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __del__(self):\n if logging is not None:\n pass\n self.close()",
"def closePyLangLogger(self):\n pass",
"def close(self) -> None:\r\n self.flush()\r\n\r\n # if using multiple loggers, prevent closing in wrong order\r\n if sys.stdout is self:\r\n ... | [
"0.7496806",
"0.73352414",
"0.7307933",
"0.72517824",
"0.7225188",
"0.72103304",
"0.71749073",
"0.7031565",
"0.70200104",
"0.6987979",
"0.69870204",
"0.69284105",
"0.68399286",
"0.6828877",
"0.6745041",
"0.66982865",
"0.6696582",
"0.6670821",
"0.666879",
"0.66676784",
"0.6658... | 0.0 | -1 |
Update weights, if error was propagated, Otherwise raise an Exception | def update_weight(self, x_input: np.ndarray) -> None:
if self.layers[-1].delta is None:
raise ValueError("No derivative calculated yet")
layer_input = x_input.copy()
if np.ndim(x_input) == 1:
layer_input = layer_input.reshape(-1, 1)
for layer in self.layers:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_weights(self):\n\t\tpass",
"def update_weights(self):\n self._weights = self._weights + self.update_weights_value",
"def update_weights(self):\n\n self.weights -= self.loss_grads\n self.loss_grads = np.zeros(self.weights.shape)",
"def update_weights(self):\n self._weigh... | [
"0.7328815",
"0.69440365",
"0.6939921",
"0.6715235",
"0.6602632",
"0.6574782",
"0.6498688",
"0.6473813",
"0.6473813",
"0.6471709",
"0.6439115",
"0.6344394",
"0.63147104",
"0.6291633",
"0.6276353",
"0.62718606",
"0.62682086",
"0.6236627",
"0.62010187",
"0.61752367",
"0.6151433... | 0.0 | -1 |
Return a string representation of InteractingNetworks object. | def __str__(self):
return 'InteractingNetworks:\n' + Network.__str__(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n string = self.__class__.__name__\n string += f'\\n\\tNetwork: {self.network.__repr__()}'\n string += f'\\n\\tRecurrent: {self.recurrent}'\n \n return string",
"def __str__(self):\n return ('NodesNetwork('\n f'uris: {self.uris.array}, '\n ... | [
"0.7356223",
"0.71270823",
"0.7052343",
"0.6760983",
"0.67250127",
"0.6635086",
"0.6554532",
"0.6535611",
"0.6491274",
"0.6416931",
"0.63918525",
"0.63901615",
"0.63901615",
"0.6360634",
"0.6345693",
"0.63365734",
"0.6279053",
"0.6276405",
"0.6276405",
"0.62648726",
"0.625813... | 0.8119077 | 0 |
Return cross average path length. Return the average (weighted) shortest path length between two induced subnetworks. | def cross_average_path_length(self, node_list1, node_list2,
link_attribute=None):
path_lengths = InteractingNetworks.cross_path_lengths(
self, node_list1, node_list2, link_attribute)
return self._calculate_general_average_path_length(
path_lengths, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nsi_cross_average_path_length(self, node_list1, node_list2):\n shortest_paths = self.path_lengths()\n nsi_shortest_paths = shortest_paths + np.eye(len(shortest_paths))\n node_weights = self.node_weights\n\n Wi = sum(node_weights[node_list1])\n Wj = sum(node_weights[node_list1... | [
"0.7201922",
"0.6372152",
"0.6294768",
"0.62506956",
"0.62339646",
"0.61559874",
"0.61558014",
"0.6129608",
"0.6079888",
"0.600317",
"0.59997356",
"0.59734094",
"0.5972911",
"0.5968207",
"0.5951451",
"0.59366184",
"0.5897944",
"0.5831254",
"0.58196104",
"0.57786924",
"0.57772... | 0.7443204 | 0 |
Return the cross indegree sequence for the first given subnetwork with respect to the second given subnetwork Gives the number of links from nodes in subnetwork two to a specific node from subnetwork one. If a link attribute is specified, return the associated in strength. | def cross_indegree(self, node_list1, node_list2, link_attribute=None):
if link_attribute is None:
return np.sum(self.cross_adjacency(node_list2, node_list1), axis=0)
else:
return np.sum(self.cross_link_attribute(link_attribute, node_list2,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross_outdegree(self, node_list1, node_list2, link_attribute=None):\n if link_attribute is None:\n return np.sum(self.cross_adjacency(node_list1, node_list2), axis=1)\n else:\n return np.sum(self.cross_link_attribute(link_attribute, node_list1,\n ... | [
"0.68617254",
"0.6697209",
"0.6691624",
"0.64021796",
"0.6170976",
"0.6116689",
"0.6113899",
"0.60768616",
"0.6011476",
"0.5983567",
"0.5935274",
"0.58761084",
"0.5845821",
"0.5748525",
"0.5705162",
"0.56872064",
"0.5668624",
"0.5636214",
"0.5635567",
"0.56032497",
"0.5572544... | 0.7253527 | 0 |
Return the n.s.i. internal degree sequence of one induced subnetwork. | def nsi_internal_degree(self, node_list):
return self.nsi_cross_degree(node_list, node_list) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def out_degree_sequence(self):\n return sorted(self.out_degree_iterator(), reverse=True)",
"def in_degree_sequence(self):\n return sorted(self.in_degree_iterator(), reverse=True)",
"def internal_degree(self, node_list, link_attribute=None):\n if self.directed:\n return (self.int... | [
"0.6399984",
"0.62035215",
"0.6188613",
"0.6082148",
"0.5998026",
"0.5916472",
"0.58191043",
"0.5804131",
"0.5804131",
"0.5804131",
"0.580021",
"0.5745267",
"0.5742094",
"0.5741482",
"0.5711105",
"0.56720823",
"0.56642544",
"0.5660144",
"0.56482404",
"0.5629134",
"0.562388",
... | 0.6542551 | 0 |
Return n.s.i. cross average path length between two induced subnetworks. | def nsi_cross_average_path_length(self, node_list1, node_list2):
shortest_paths = self.path_lengths()
nsi_shortest_paths = shortest_paths + np.eye(len(shortest_paths))
node_weights = self.node_weights
Wi = sum(node_weights[node_list1])
Wj = sum(node_weights[node_list1])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross_average_path_length(self, node_list1, node_list2,\n link_attribute=None):\n path_lengths = InteractingNetworks.cross_path_lengths(\n self, node_list1, node_list2, link_attribute)\n\n return self._calculate_general_average_path_length(\n pat... | [
"0.71028334",
"0.6655218",
"0.6287405",
"0.6213193",
"0.60875815",
"0.60632396",
"0.602052",
"0.59938586",
"0.5989713",
"0.5979525",
"0.5964894",
"0.59523284",
"0.5899851",
"0.58926684",
"0.5872213",
"0.58591104",
"0.5853557",
"0.58117783",
"0.5809524",
"0.5794928",
"0.574966... | 0.6891874 | 1 |
Use a list of words as input and returns a list of lists containing the splitted words | def split_words(self,data=[None]):
content=[]
self.data=data
for i in data:
liste=list(i)
content.append(liste)
return content | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_words_from_word_list_split_by_space(word_list):\n words = generate_pairs_of_words(word_list)\n return words",
"def make_a_list_from(stuff):\n words_list = stuff.split(' ')\n return words_list",
"def split_by_words(term):\n if not term:\n return []\n # make all chars in lowe... | [
"0.7737638",
"0.7663598",
"0.7402622",
"0.71688724",
"0.71688724",
"0.71584094",
"0.7136583",
"0.7064171",
"0.7016089",
"0.7008221",
"0.69366103",
"0.6934038",
"0.69056183",
"0.6881351",
"0.6848036",
"0.6817374",
"0.6814704",
"0.6800414",
"0.6769051",
"0.67588454",
"0.6740506... | 0.717145 | 3 |
One hot encoder for lower_case characters, needs splitted_words as input list and returns a list of numpy matrices as output. Size default(26,26) | def on_hot_lower(self,splitted_words, description="basic on_hot method for lower_case characters"):
self.coder="on_hot_lower"
array=self.create_new_array()
array_storage=[]
for i in splitted_words:#iterate through every list
for letter in i:#iterate thorugh every letter ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_one_hot(s):\n all = []\n for c in s:\n x = np.zeros((INPUT_VOCAB_SIZE)) \n index = char_indices[c]\n x[index] = 1 \n all.append(x)\n return all",
"def chars_to_onehot(self, char_list):\n int_list = self.char_to_int(char_list)\n one_hot = np.zeros((len(sel... | [
"0.72979945",
"0.7090036",
"0.7063242",
"0.6986264",
"0.6829066",
"0.6811234",
"0.6781701",
"0.67309356",
"0.66756743",
"0.65819556",
"0.65310174",
"0.6498435",
"0.6437443",
"0.6386978",
"0.63847864",
"0.63767713",
"0.6360441",
"0.63566124",
"0.63503635",
"0.6338144",
"0.6325... | 0.7193992 | 1 |
One hot encoder for upper_case characters, needs splitted_words as input list and returns a list of numpy matrices as output. Size default (26,26) | def on_hot_upper(self,splitted_words,max_word_lenght=26):
self.coder="on_hot_upper"
array=self.create_new_array(shape=(max_word_lenght,26))
array_storage=[]
for i in splitted_words:#iterate through every list
for letter in i:#iterate thorugh every letter in i
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_hot(self,splitted_words,max_word_lenght=26):\r\n self.coder=\"on_hot_without_special_characters\"\r\n array=self.create_new_array(shape=(max_word_lenght,52))\r\n array_storage=[]\r\n for i in splitted_words:#iterate through every list\r\n for letter in i:#iterate thoru... | [
"0.73604965",
"0.71250874",
"0.7082025",
"0.69835657",
"0.6972506",
"0.6700941",
"0.67005014",
"0.66526514",
"0.6624024",
"0.65467364",
"0.6507672",
"0.6501952",
"0.6459474",
"0.64504945",
"0.6428481",
"0.64097506",
"0.6397952",
"0.6392504",
"0.6346916",
"0.63346905",
"0.6332... | 0.71616435 | 1 |
One hot encoder for lower_case and upper_case characters, needs splitted_words as input list and returns a list of numpy matrices as output. Size default (26,52) | def on_hot(self,splitted_words,max_word_lenght=26):
self.coder="on_hot_without_special_characters"
array=self.create_new_array(shape=(max_word_lenght,52))
array_storage=[]
for i in splitted_words:#iterate through every list
for letter in i:#iterate thorugh every letter i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_hot_all(self, splitted_words,max_word_lenght=26,disable_numbers=False):#all the on_hot* functions uses 0 and 1 to represent the letters\r\n array_storage=[]\r\n if self.special_characters_dic==True or None or False:\r\n raise ValueError(\"Please input a list of special characters to... | [
"0.7126376",
"0.7126297",
"0.70991945",
"0.6927962",
"0.6744174",
"0.66360587",
"0.6598117",
"0.658699",
"0.65793943",
"0.65405214",
"0.647673",
"0.64598423",
"0.6445679",
"0.64301884",
"0.63447386",
"0.63286334",
"0.63205093",
"0.6312435",
"0.630667",
"0.63061374",
"0.627244... | 0.7218221 | 0 |
Check if the request contains only allowed parameters. | def _check_for_unknown_params(self, params: MultiDict, search_filter: Dict[str, Any], whitelist: List[str]):
for param_name in params.keys():
if param_name not in whitelist:
raise SuperdeskApiError.badRequestError(message="Unexpected parameter ({})".format(param_name))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_request(self, request):\r\n auth_params = request.META.get(\"HTTP_AUTHORIZATION\", [])\r\n return self.is_in(auth_params) or self.is_in(request.REQUEST)",
"def use_request_params(self, request):\r\n if request.params is None:\r\n return False\r\n\r\n if isinsta... | [
"0.71045995",
"0.7042951",
"0.70055395",
"0.6996054",
"0.69736475",
"0.6894357",
"0.6881396",
"0.68803716",
"0.68687224",
"0.6812268",
"0.6800713",
"0.6800543",
"0.67303413",
"0.6698924",
"0.6691096",
"0.6639346",
"0.6611561",
"0.6571513",
"0.6569241",
"0.6469267",
"0.6464805... | 0.6391911 | 26 |
Convenience class for DSF via Power Mean as implemented in A. H. T. Nguyen, V. G. Reju and A. W. H. Khong, "Directional Sparse Filtering for Blind Estimation of UnderDetermined ComplexValued Mixing Matrices," in IEEE Transactions on Signal Processing, vol. 68, pp. | def __init__(
self,
x: Union[np.ndarray, tf.Tensor],
n_src: int,
fs: int,
p: float = -0.5,
*args,
**kwargs,
):
super().__init__(x, n_src, fs, *args, **kwargs)
self.loss_function = PowerMeanDSFLoss(
self.n_freq,
self.n_c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean(self):\n mean=np.zeros(self.shape)\n if self.Fourier:\n ind=self.mean_index()\n for di in np.ndindex(*self.shape):\n mean[di]=np.real(self.val[di][ind])/self.fft_coef\n else:\n for di in np.ndindex(*self.shape):\n mean[di]... | [
"0.53619355",
"0.5348722",
"0.53301483",
"0.5316224",
"0.5305573",
"0.5282133",
"0.52819604",
"0.52781945",
"0.5266388",
"0.5225255",
"0.5222453",
"0.5212757",
"0.5171122",
"0.5163225",
"0.51426405",
"0.5136142",
"0.5134675",
"0.5118269",
"0.5110455",
"0.51089215",
"0.5069662... | 0.56608105 | 0 |
Load BERT tokenizer and pretrained BERT model | def load_bert(filepath):
print('Loading BERT tokenizer...')
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased', do_lower_case=True)
print('Loading BERT model...')
model = BertForSequenceClassification.from_pretrained(filepath)
return model, tokenizer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_bert(self):\n self.hermes.info(\"Load the bert...\")\n model = load_trained_model_from_checkpoint(self.conf.bert[\"config\"], self.conf.bert[\"checkpoint\"])\n\n self.hermes.info(\"Build the tokenizer...\")\n tokenizer = self.poseidon.build_tokenizer()\n\n return model, ... | [
"0.8479199",
"0.7386486",
"0.7249519",
"0.71358055",
"0.69546133",
"0.6784964",
"0.6711362",
"0.67010075",
"0.6674242",
"0.6667431",
"0.6592937",
"0.6588446",
"0.6578198",
"0.6554031",
"0.6549547",
"0.65214914",
"0.6509392",
"0.65055263",
"0.6499394",
"0.6469126",
"0.64112604... | 0.8176811 | 1 |
Clean up sentences predicted by TRAM | def preprocess_sents(sentences_list):
prepocessed_sents = []
for s in sentences_list:
# Replace any new lines separating parts of the sentence
s = s.replace('\n', ' ')
# Replace any double spaces which might result from previous step with a single space
s = s.replace(' ', ' ')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocess_training_text(text, accented_chars=True, \n convert_num=False, extra_whitespace=True, \n lemmatization=True, lowercase=True, punctuations=True,\n remove_html=True, remove_num=True, special_chars=True, \n stop_wor... | [
"0.66483",
"0.6610308",
"0.6560805",
"0.65156615",
"0.64999056",
"0.6441422",
"0.6390791",
"0.63421345",
"0.62750226",
"0.6268545",
"0.6260416",
"0.62582344",
"0.6249562",
"0.6216647",
"0.61945015",
"0.6153019",
"0.6146119",
"0.6121467",
"0.6115479",
"0.6094056",
"0.60829186"... | 0.0 | -1 |
Conduct preprocessing requried for BERT and return the dataloader (MAX_LEN = 256). | def bert_preprocess(paragraphs, tokenizer):
MAX_LEN = 256
# Tokenize all of the sentences and map the tokens to thier word IDs.
input_ids, attention_masks = [], []
for para in paragraphs:
# `encode_plus` will:
# (1) Tokenize the sentence.
# (2) Prepend the `[CLS]` token to ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_bert_input(data, data_path, tokenizer):\n\n cache_fp = f\"{data_path[:data_path.rfind('.')]}_{type(tokenizer).__name__}_{str(BERT_MAX_LEN)}_cache\"\n if os.path.isfile(cache_fp): \n logger.info(\"Loading tokenized data from cache...\")\n all_samples = torch.load(cache_fp)\n ret... | [
"0.64270777",
"0.61228",
"0.587426",
"0.5799234",
"0.5790569",
"0.57412446",
"0.5706186",
"0.56913704",
"0.56802535",
"0.56499654",
"0.5594733",
"0.55877304",
"0.5559505",
"0.5542166",
"0.55126846",
"0.5482819",
"0.546877",
"0.54682857",
"0.5466533",
"0.5455236",
"0.5453935",... | 0.63489723 | 1 |
Return the start date of the card. | def __start_date(cls, card_info: Dict[str, str]) -> DateTime:
return cls.__parse_date_time(card_info["startAt"]) if "startAt" in card_info else datetime.datetime.max | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_date(self) -> str:\n return pulumi.get(self, \"start_date\")",
"def start_date(self) -> str:\n return pulumi.get(self, \"start_date\")",
"def start_date(self) -> str:\n return self._start_date",
"def start_date(self):\n return self.__start_date",
"def starting_date(sel... | [
"0.7952571",
"0.7952571",
"0.7846298",
"0.77803195",
"0.7772852",
"0.77365124",
"0.77365124",
"0.77365124",
"0.77365124",
"0.7435833",
"0.7435833",
"0.7301824",
"0.7269546",
"0.7159084",
"0.7115204",
"0.7090781",
"0.69825184",
"0.69815975",
"0.6819483",
"0.6807868",
"0.679707... | 0.7817195 | 3 |
Return the date of the last activity. | def __last_activity(cls, card_info: Dict[str, str]) -> DateTime:
last_activity_field = "dateLastActivity" if "dateLastActivity" in card_info else "createdAt"
return cls.__parse_date_time(card_info[last_activity_field]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lastdate(self):\n if hasattr(self, \"_lastdate\"):\n return self._lastdate\n else:\n return None",
"def last_time(self) -> datetime:\n return self.activities[-1].timestamp",
"def last_accessed_date(self) -> Optional[str]:\n return pulumi.get(self, \"last_ac... | [
"0.7831949",
"0.7819894",
"0.7584957",
"0.758037",
"0.7570654",
"0.7282484",
"0.71921486",
"0.71764076",
"0.70881844",
"0.6963618",
"0.69563514",
"0.68992054",
"0.6866762",
"0.6864526",
"0.6860993",
"0.68574214",
"0.6825473",
"0.68140346",
"0.6801996",
"0.67819023",
"0.674843... | 0.71543115 | 8 |
Return the HMAC of value using the key. | def getHMAC(key, value):
h = hmac.new(key, value, digestmod=DIGESTMOD)
return h.digest() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_hmac(message, key):\n h = HMAC.new(key)\n h.update(message)\n return h.hexdigest()",
"def _hmac(self, key, msg):\n return hmac.new(key, msg, digestmod=self.hashfunc).digest()",
"def hmac(self, key: bytes, data: bytes, algorithm: str = 'sha256') -> bytes:\n hmac_obj = hmac.HMAC(k... | [
"0.72432363",
"0.7114501",
"0.6532599",
"0.6511152",
"0.6495587",
"0.64238656",
"0.6406957",
"0.63932353",
"0.6226551",
"0.62131476",
"0.6176201",
"0.6110081",
"0.59243107",
"0.5883969",
"0.58340454",
"0.5802466",
"0.5800381",
"0.57056355",
"0.5700808",
"0.56694365",
"0.56590... | 0.821518 | 0 |
Return a function that computes the HMAC of its input using the key. | def getHMACFunc(key, hex=True):
h = hmac.new(key, digestmod=DIGESTMOD)
def hmac_fn(value):
h_tmp = h.copy()
h_tmp.update(value)
if hex:
return h_tmp.hexdigest()
else:
return h_tmp.digest()
return hmac_fn | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_hmac(message, key):\n h = HMAC.new(key)\n h.update(message)\n return h.hexdigest()",
"def getHMAC(key, value):\n h = hmac.new(key, value, digestmod=DIGESTMOD)\n return h.digest()",
"def _hmac(self, key, msg):\n return hmac.new(key, msg, digestmod=self.hashfunc).digest()",
"def ... | [
"0.7123131",
"0.6790628",
"0.6750735",
"0.62822956",
"0.6177741",
"0.61686087",
"0.6022326",
"0.6019707",
"0.6013283",
"0.58529747",
"0.5748545",
"0.5732605",
"0.56775594",
"0.56678545",
"0.566181",
"0.5642811",
"0.56354225",
"0.5585715",
"0.5565342",
"0.5560684",
"0.54718536... | 0.72541136 | 0 |
Creates a Node instance for given IP. | def get_by_ip(self, ip):
return Node(
id="fake-{ip}".format(ip=ip),
ip=ip,
extIp=ip,
az="nope",
name="local-{ip}".format(ip=ip),
state=NodeState.UNKNOWN
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self, ip): # pylint: disable=invalid-name\n return self.request(\"POST\", data={\"ip\": ip})",
"def create_node(self, address, service):\n node = create_node(address, service)\n node.id = address + \"_\" + service\n return node",
"def new_node(self, **kwargs):\n p... | [
"0.7423832",
"0.6415558",
"0.6336213",
"0.6087345",
"0.60813296",
"0.6067163",
"0.60639787",
"0.60565895",
"0.60488135",
"0.60180384",
"0.59670687",
"0.5955913",
"0.5950364",
"0.59466875",
"0.59335136",
"0.5916806",
"0.58742553",
"0.58732176",
"0.5865328",
"0.58258766",
"0.58... | 0.74628884 | 0 |
load ensemble results from PESTPPIES into a PESTstyle residuals `pandas.DataFrame` | def res_from_en(pst, enfile):
converters = {"name": str_con, "group": str_con}
obs = pst.observation_data
if isinstance(enfile, str):
df = pd.read_csv(enfile, converters=converters)
df.columns = df.columns.str.lower()
df = df.set_index("real_name").T.rename_axis("name").rename_axis(N... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_ensemble_prediction(trn_features, models, test_df):\n test_id: pd.Series = test_df.iloc[:, 0]\n test_features: pd.DataFrame = test_df.iloc[:, 1:]\n\n test_features = pd.concat([trn_features, test_features])\n\n clean_test_features, test_log = clean_features(test_features)\n clean_test_featu... | [
"0.58634746",
"0.5692554",
"0.5665205",
"0.5635699",
"0.5606117",
"0.5535102",
"0.55141354",
"0.54627514",
"0.54469603",
"0.5433912",
"0.5403045",
"0.5390994",
"0.53851455",
"0.5381984",
"0.5378283",
"0.53116316",
"0.5280333",
"0.5280053",
"0.5264877",
"0.5237455",
"0.5219722... | 0.4922853 | 70 |
create a PESTstyle residual dataframe filled with np.NaN for missing information | def res_from_obseravtion_data(observation_data):
res_df = observation_data.copy()
res_df.loc[:, "name"] = res_df.pop("obsnme")
res_df.loc[:, "measured"] = res_df.pop("obsval")
res_df.loc[:, "group"] = res_df.pop("obgnme")
res_df.loc[:, "modelled"] = np.NaN
res_df.loc[:, "residual"] = np.NaN
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _raw_residuals(self):\n if self.model.assortativity == 'positive':\n traj = self._solution[::-1]\n else:\n traj = self._solution\n\n # compute the residuals\n xi = np.linspace(traj[0, 0], traj[-1, 0], 10 * traj.shape[0])\n resids_arr = self.ivp.compute_r... | [
"0.64146763",
"0.61057717",
"0.6042294",
"0.574282",
"0.5729628",
"0.5697594",
"0.5687444",
"0.5623393",
"0.55841655",
"0.55088925",
"0.55032164",
"0.54698265",
"0.5445987",
"0.5445072",
"0.5429475",
"0.5426948",
"0.5426925",
"0.53864884",
"0.5384509",
"0.53674525",
"0.536361... | 0.59998584 | 3 |
Gets the write type based on if its a local install or not. | def get_writer(bucket_name, filename, header, is_local, region=None):
if is_local:
return CsvLocalWriter(filename, header)
if region is None:
region = CONFIG_BROKER["aws_region"]
return CsvS3Writer(region, bucket_name, filename, header) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_operation_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"write_operation_type\")",
"def write_operation_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"write_operation_type\")",
"def write_operation_type(self) -> Optional[pulumi.Input[str]]... | [
"0.6189821",
"0.6189821",
"0.6189821",
"0.6189821",
"0.6122112",
"0.6114476",
"0.5785667",
"0.56418693",
"0.5615467",
"0.5577305",
"0.5577305",
"0.5488006",
"0.54860187",
"0.54684687",
"0.54309505",
"0.54105026",
"0.54105026",
"0.54105026",
"0.54105026",
"0.54105026",
"0.5410... | 0.0 | -1 |
Check to see if header contains long or short column names | def use_long_headers(header_row, long_to_short_dict):
col_matches = 0
for value in header_row:
if FieldCleaner.clean_string(value) in long_to_short_dict:
col_matches += 1
# if most of column headers are in the long format,
# we'll treat the file as having long headers
return col_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_headers(self):\n for column in self.columns:\n if column.header:\n return True\n return False",
"def _check_headers(cursor, headers):\n all_columns = set(chain.from_iterable(_columns(cursor, table) for table in DATA_TABLES))\n for header in headers:\n ... | [
"0.71658945",
"0.70188004",
"0.68723935",
"0.67466646",
"0.67284423",
"0.668558",
"0.66694474",
"0.6509832",
"0.65063465",
"0.64343214",
"0.6389137",
"0.63614595",
"0.63504183",
"0.6274454",
"0.6269949",
"0.62549",
"0.6253838",
"0.62409395",
"0.62366104",
"0.6227819",
"0.6197... | 0.79979646 | 0 |
Returns a string representation of the object | def __repr__(self):
return f'<{self.__class__.__name__}({self.host})>' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return str(self.__dict__['_obj'])",
"def __str__(self):\n return str(self.obj)",
"def __str__(self):\n return str(self.serialize())",
"def __str__(self):\n return str(self.__dict__)",
"def __str__(self):\n return str(self.__dict__)",
"def to... | [
"0.8496137",
"0.8386435",
"0.8224842",
"0.8138184",
"0.8138184",
"0.81204075",
"0.8079092",
"0.8079092",
"0.8079092",
"0.8079092",
"0.8079092",
"0.8037008",
"0.80052894",
"0.7981489",
"0.7958595",
"0.7957255",
"0.7947918",
"0.7947179",
"0.7947179",
"0.7947179",
"0.7947179",
... | 0.0 | -1 |
Get the `ast_class` name. | def ast_class(cl):
return cl.__class__.__name__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ast_field_name(ast):\n replacements = {\n # We always rewrite the following field names into their proper underlying counterparts.\n TYPENAME_META_FIELD_NAME: '@class'\n }\n base_field_name = ast.name.value\n normalized_name = replacements.get(base_field_name, base_field_name)\n ... | [
"0.7372105",
"0.7051987",
"0.7029131",
"0.69425666",
"0.6876685",
"0.68166053",
"0.68010235",
"0.67310786",
"0.67310786",
"0.67256474",
"0.67162395",
"0.66835004",
"0.66787434",
"0.64659214",
"0.64155865",
"0.64099264",
"0.64060205",
"0.63799137",
"0.6376944",
"0.6354228",
"0... | 0.7966357 | 0 |
Return where this script resides, so we can load it! | def get_script_name(pidx):
suffix = ""
if pidx >= 200:
suffix = "200"
elif pidx >= 100:
suffix = "100"
return f"{BASEDIR}/scripts{suffix}/p{pidx}.py" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getScriptDirectory():\n\n\treturn os.path.dirname(os.path.realpath(__file__))",
"def get_script_directory():\n return os.path.dirname(__file__)",
"def getScriptPath():\n\treturn os.path.dirname(os.path.realpath(sys.argv[0]))",
"def location(self):\n\n p = os.path.abspath(__file__)\n pathSP =... | [
"0.82740355",
"0.82442063",
"0.79044676",
"0.77962744",
"0.76333356",
"0.7480763",
"0.74281996",
"0.73193383",
"0.728187",
"0.72762805",
"0.72762185",
"0.72339857",
"0.72318035",
"0.72244173",
"0.72077066",
"0.72077066",
"0.71712065",
"0.7169389",
"0.71431476",
"0.7138357",
"... | 0.0 | -1 |
Create an empty grid | def create_empty_grid(width, height):
return [[None] * width for _ in range(height)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_grid(grid):\r\n for i in range(4):\r\n grid.append([0,0,0,0])",
"def create_grid(self):\n return [[0] * self.width for _ in range(self.height)]",
"def create_grid(grid):\r\n for i in range(4):\r\n grid.append([0]*4)\r\n return grid",
"def create_grid(self):\n\n ... | [
"0.77958894",
"0.77434975",
"0.77160263",
"0.75517225",
"0.75087214",
"0.7385967",
"0.73751426",
"0.7335638",
"0.7319452",
"0.72873884",
"0.72742635",
"0.725597",
"0.72271776",
"0.72171783",
"0.7179671",
"0.717629",
"0.71696776",
"0.7161088",
"0.7147983",
"0.71425295",
"0.713... | 0.8119622 | 0 |
Return tuple indicating True or False for the available actions. | def get_action_value(self):
restart_current = self._restart_current.isChecked()
restart_all = self._restart_all.isChecked()
no_restart = not any([restart_all, restart_current])
return restart_all, restart_current, no_restart | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_available_actions(self, state):\n pass",
"def get_available_actions(self):\n return self.actions",
"def __bool__(self):\n return bool(self._actions)",
"def available_action(self):\n return range(self.actions)",
"def available_actions(speaker, action, args, soco_function, use... | [
"0.76670855",
"0.76214325",
"0.7519107",
"0.73692995",
"0.7121191",
"0.70496464",
"0.6913641",
"0.6787903",
"0.6787903",
"0.67575437",
"0.661375",
"0.65923303",
"0.65861964",
"0.65820926",
"0.6557679",
"0.6551875",
"0.6551875",
"0.6551875",
"0.65350854",
"0.6459647",
"0.64542... | 0.60995084 | 59 |
Set up the Ted5000 sensor. | def setup_platform(
hass: HomeAssistant,
config: ConfigType,
add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) -> None:
host: str = config[CONF_HOST]
port: int = config[CONF_PORT]
name: str = config[CONF_NAME]
url = f"http://{host}:{port}/api/LiveData.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup(hass, config):\n\n logger = logging.getLogger(__name__)\n\n try:\n import tellcore.telldus as telldus\n import tellcore.constants as tellcore_constants\n except ImportError:\n logger.exception(\n \"Failed to import tellcore\")\n return False\n\n core = t... | [
"0.63443303",
"0.632012",
"0.6197339",
"0.59792715",
"0.5947163",
"0.59017324",
"0.57913077",
"0.5760613",
"0.5739995",
"0.5698444",
"0.5682487",
"0.56790626",
"0.5641947",
"0.558986",
"0.55500424",
"0.5529571",
"0.5528343",
"0.5523171",
"0.5503764",
"0.5502016",
"0.55019486"... | 0.6912184 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, Single2HaObject):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.78162885 | 67 |
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 |
Test case for `fill_missing_value` | def test_fill_missing_value(self):
try:
# test_size need to be a positive float number
fill_missing_value(DATA, NEEDED, INPUTS, OUTPUT, test_size=-1.0)
raise Exception("Illegal input test failed!")
except AssertionError:
pass
try:
# n_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DealWithMissingValues(data_set: pd.DataFrame):\n data_set.fillna(method=\"pad\", inplace=True)",
"def test_missing_to_nan(self, input_data, value, expected):\n actual = data._missing_to_nan(input_data, value)\n pd.testing.assert_series_equal(actual, expected)\n self.assertIsNot(actual, input_data... | [
"0.70328194",
"0.70039386",
"0.6945673",
"0.6770058",
"0.67544574",
"0.6639893",
"0.66232646",
"0.66158724",
"0.66141605",
"0.6593362",
"0.6528976",
"0.64334536",
"0.6420946",
"0.6403951",
"0.6350329",
"0.62329566",
"0.61805856",
"0.6180002",
"0.6164286",
"0.6154791",
"0.6153... | 0.8081452 | 0 |
Return a timestamp in a format expected by the backend (milliseconds) | def local_timestamp():
# type: () -> int
now = datetime.utcnow()
timestamp_in_seconds = calendar.timegm(now.timetuple()) + (now.microsecond / 1e6)
timestamp_in_milliseconds = int(timestamp_in_seconds * 1000)
return timestamp_in_milliseconds | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_timestamp():\n\n # Convert timestamp to int after multiply by 1000 to get millisecond timestamp in int.\n return int(time.time() * 1000)",
"def _get_timestamp():\n return str(int(time.time()))",
"def _timestamp():\n moment = time.time()\n moment_us = repr(moment).split(\".\")... | [
"0.8014207",
"0.7861715",
"0.7837345",
"0.771206",
"0.7666514",
"0.75413775",
"0.7520725",
"0.7510079",
"0.7474817",
"0.74618",
"0.7459775",
"0.7413947",
"0.7413927",
"0.7402904",
"0.73776",
"0.7365594",
"0.73642755",
"0.73625356",
"0.73508704",
"0.7350192",
"0.73159385",
"... | 0.7248834 | 23 |
Get the count (can be partial of bin count) of a range. | def get_count(self, min_value, max_value):
index = self.get_bin_index(min_value)
current_start_value = self.values[index]
current_stop_value = self.values[index + 1]
count = 0
# Add total in this area:
count += self.counts[index]
if current_start_value != -float("... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def howmany_within_range(row, minimum, maximum):\n count = 0\n for n in row:\n if minimum <= n <= maximum:\n count = count + 1\n return count",
"def count_in_range(start, end, check):\n count = 0\n for val in range(start, end):\n if check(val):\n count += 1\n\n ... | [
"0.6994224",
"0.6967469",
"0.6776539",
"0.674147",
"0.6689619",
"0.665356",
"0.66204983",
"0.65548676",
"0.65225524",
"0.6289447",
"0.62741446",
"0.6265267",
"0.6192245",
"0.6138214",
"0.61285925",
"0.61014855",
"0.6090412",
"0.6087",
"0.6077163",
"0.6070377",
"0.6070377",
... | 0.7035503 | 0 |
Given a root and a relative path, resolve the relative path to get an absolute path and make sure the resolved path is a child to root. Cases where it could not be the case would be if the `relative_path` contains `..` or if one part of the relative path is a symlink going above the root. Return the absolute resolved p... | def clean_and_check_root_relative_path(root, relative_path):
# type: (str, str) -> str
if not os.path.isabs(root):
raise ValueError("Root parameter %r should an absolute path" % root)
if not root.endswith(os.sep):
root = root + os.sep
joined_path = os.path.join(root, relative_path)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolvePath(rootPath, relPath):\n\trelPath = relPath.lstrip(\"/\")\n\tfullPath = os.path.realpath(os.path.join(rootPath, relPath))\n\tif not fullPath.startswith(rootPath):\n\t\traise ValueError(\n\t\t\t\"Full path %s does not start with resource root %s\"%(fullPath, rootPath))\n\tif not os.path.exists(fullPath... | [
"0.67394084",
"0.6626614",
"0.65883636",
"0.6531372",
"0.6228857",
"0.61629975",
"0.610878",
"0.6081427",
"0.6061334",
"0.60553384",
"0.60314757",
"0.5961259",
"0.59606683",
"0.5952484",
"0.5951244",
"0.5892382",
"0.58913034",
"0.5870849",
"0.5870109",
"0.581268",
"0.57815623... | 0.8232753 | 0 |
Given a value, turn it into a valid filename. 1. Remove the spaces 2. Replace anything not alpha, '', '_', or '.' with '_' 3. Remove duplicate '_' | def safe_filename(filename):
string = str(filename).strip().replace(" ", "_")
string = re.sub(r"(?u)[^-\w.]", "_", string)
return re.sub(r"_+", "_", string) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str_to_filename(value):\n return \"\".join([\n c for c in value if c.isalpha() or c.isdigit() or c in '_-'\n ])",
"def clean(value):\r\n return re.sub('_+', '_', INVALID_CHARS.sub('_', value))",
"def sanitize_name(self, value):\n if self.sanitize_names:\n new_value = re.su... | [
"0.7878307",
"0.766788",
"0.7533418",
"0.7481409",
"0.7228067",
"0.70863",
"0.7033027",
"0.7003944",
"0.697655",
"0.69748944",
"0.6969824",
"0.6958328",
"0.6955489",
"0.69536066",
"0.69448787",
"0.68835413",
"0.686925",
"0.6867701",
"0.68434006",
"0.6838827",
"0.6818846",
"... | 0.7299767 | 4 |
Return whether a and b are equivalent modulo 2 | def _eq(a, b):
return (a - b) % 2 == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alternating_signs_of_2(a: int, b: int) -> bool:\r\n if a < 0 and b > 0:\r\n return True\r\n elif a > 0 and b < 0:\r\n return True\r\n else:\r\n return False",
"def divisible(a, b):\n return not a % b",
"def rem(self, a, b):\n return a % b",
"def rem(self, a, b):\n ... | [
"0.6970956",
"0.6943666",
"0.6881049",
"0.6881049",
"0.6842866",
"0.6788109",
"0.6678922",
"0.66567665",
"0.66229343",
"0.6620325",
"0.6511492",
"0.6489343",
"0.6467787",
"0.6452616",
"0.64441746",
"0.64384353",
"0.63876134",
"0.636583",
"0.6346998",
"0.63411915",
"0.63243157... | 0.7907928 | 0 |
Called before each test, setting up beets. | def setUp(self):
self.setup_beets() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.delegate = AlwaysHitDelegate(\"\")\n self.environment = BattleEnvironment()",
"def setUp(self):\n test_env_setup()",
"def _fixture_setup(self):\n pass",
"def setUp(self):\n\n self._set_up()",
"def setUp(self):\n pass #because we dont have a... | [
"0.753662",
"0.75313246",
"0.74122846",
"0.7407308",
"0.73752564",
"0.7333534",
"0.7333534",
"0.7298652",
"0.72360927",
"0.7230188",
"0.7226643",
"0.7207045",
"0.7207045",
"0.72019625",
"0.7185585",
"0.7179409",
"0.7168147",
"0.71582735",
"0.7153729",
"0.71502644",
"0.7133693... | 0.8907821 | 0 |
Sets the draft_metadata_service of this ComAdobeFdFpConfigFormsPortalDraftsandSubmissionConfigServiceProperties. | def draft_metadata_service(self, draft_metadata_service):
self._draft_metadata_service = draft_metadata_service | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draft_data_service(self, draft_data_service):\n\n self._draft_data_service = draft_data_service",
"def submit_metadata_service(self, submit_metadata_service):\n\n self._submit_metadata_service = submit_metadata_service",
"def pending_sign_metadata_service(self, pending_sign_metadata_service):... | [
"0.6565115",
"0.5262398",
"0.5123888",
"0.45115998",
"0.42755765",
"0.42716876",
"0.4237358",
"0.41954553",
"0.41954553",
"0.4131481",
"0.4090059",
"0.40895405",
"0.40754387",
"0.4014196",
"0.40044364",
"0.39117962",
"0.38790673",
"0.3844617",
"0.38369823",
"0.38335598",
"0.3... | 0.7808949 | 0 |
Sets the pending_sign_data_service of this ComAdobeFdFpConfigFormsPortalDraftsandSubmissionConfigServiceProperties. | def pending_sign_data_service(self, pending_sign_data_service):
self._pending_sign_data_service = pending_sign_data_service | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pending_sign_metadata_service(self, pending_sign_metadata_service):\n\n self._pending_sign_metadata_service = pending_sign_metadata_service",
"def draft_data_service(self, draft_data_service):\n\n self._draft_data_service = draft_data_service",
"def pending(self, pending):\n\n self._pe... | [
"0.71185136",
"0.5636329",
"0.55379486",
"0.53886676",
"0.52450347",
"0.520298",
"0.50519717",
"0.49722388",
"0.48614186",
"0.47563043",
"0.4598981",
"0.45963246",
"0.4592704",
"0.44529796",
"0.43469554",
"0.43461663",
"0.43237504",
"0.42976648",
"0.42865407",
"0.42802268",
"... | 0.79776376 | 0 |
Sets the pending_sign_metadata_service of this ComAdobeFdFpConfigFormsPortalDraftsandSubmissionConfigServiceProperties. | def pending_sign_metadata_service(self, pending_sign_metadata_service):
self._pending_sign_metadata_service = pending_sign_metadata_service | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pending_sign_data_service(self, pending_sign_data_service):\n\n self._pending_sign_data_service = pending_sign_data_service",
"def draft_metadata_service(self, draft_metadata_service):\n\n self._draft_metadata_service = draft_metadata_service",
"def pending_dynamic_workflow_info(self, pending... | [
"0.7394092",
"0.58989835",
"0.55077946",
"0.544409",
"0.52413714",
"0.50685215",
"0.50652707",
"0.4775824",
"0.46899325",
"0.46642706",
"0.46615627",
"0.4450696",
"0.44466808",
"0.43525887",
"0.43104473",
"0.42864308",
"0.4225832",
"0.41748792",
"0.4167411",
"0.4158038",
"0.4... | 0.8100465 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, ComAdobeFdFpConfigFormsPortalDraftsandSubmissionConfigServiceProperties):
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.8089139",
"0.8089139",
"0.8054507",
"0.79827213",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
... | 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 |
Plot quad grid lines on a single plot. | def grid(
self,
x: ArrayLike,
y: ArrayLike,
ax: figure | int = 0,
color: str = "black",
alpha: float = 0.1,
point_color: str | None = None,
quad_as_tri_alpha: float = 0,
) -> None:
fig = self._get_figure(ax)
x, y = self._grid_as_2d(x, y... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_grid(ax, flow, factor=10):\n grid = factor * flow[:, ::8, ::8]\n lin_range = np.linspace(0, 512, 64)\n x, y = np.meshgrid(lin_range, lin_range)\n x = x + grid[0, ...]\n y = y + grid[1, ...]\n y = y\n\n segs1 = np.stack((x, y), axis=2)\n segs2 = segs1.transpose(1, 0, 2)\n ax.add_... | [
"0.66499966",
"0.6565854",
"0.65647274",
"0.65503645",
"0.61691093",
"0.614246",
"0.6082381",
"0.60621077",
"0.60478806",
"0.5955713",
"0.5949098",
"0.5927671",
"0.5921979",
"0.5917963",
"0.59082866",
"0.5901336",
"0.58888596",
"0.5874082",
"0.58334076",
"0.58092475",
"0.5804... | 0.6506747 | 4 |
Retrieve the last time the worker participated from this cycle. | def last_participation(self, process: int, worker_id: str):
_cycles = self._cycles.query(fl_process_id=process.id)
last = 0
if not len(_cycles):
return last
for cycle in _cycles:
worker_cycle = self._worker_cycles.first(
cycle_id=cycle.id, worker... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getLastWorker(self):\n return self.entries[-1]",
"def get_last_time(self):\n \n return self._last",
"def get_last(self):\n self.accumulated_time_last = pg.time.get_ticks() - self.start_time_last\n return self.accumulated_time_last",
"def __last_time(self):\n if s... | [
"0.77485865",
"0.7221876",
"0.70861256",
"0.7071855",
"0.7042098",
"0.68895787",
"0.68709934",
"0.68061763",
"0.67272556",
"0.67180973",
"0.66973484",
"0.6649137",
"0.657877",
"0.657088",
"0.6529265",
"0.65142775",
"0.64380074",
"0.6435328",
"0.64177734",
"0.6412619",
"0.6406... | 0.65577346 | 14 |
Get the authorization header. | def get_authorization(self):
raise NotImplemented() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auth_header(self):\n return self._auth_header",
"def get_auth_header(self):\n if not self.verify():\n return None\n\n auth_val = self.encode_auth_header_val()\n if not auth_val:\n return None\n\n return {'Authorization': auth_val.replace('\\n', '')}",
... | [
"0.80733603",
"0.8066453",
"0.7939659",
"0.7873881",
"0.77610624",
"0.7731088",
"0.76738465",
"0.76651424",
"0.7602001",
"0.7539872",
"0.75398576",
"0.75372976",
"0.7414658",
"0.73658144",
"0.7280907",
"0.7098742",
"0.7098742",
"0.70225555",
"0.6979123",
"0.69547737",
"0.6949... | 0.0 | -1 |
Get the username and password for Basic authentication header. | def get_authorization(self):
auth = get_authorization_header()
if not auth:
return None
auth_type, auth_info = auth
if auth_type != b'basic':
return None
try:
username, password = base64.b64decode(auth_info).split(b':', 1)
except Ex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_basic_auth_header(self, request: Request) -> Tuple[str, str]:\n token = self.get_auth_token(request, \"Basic\")\n try:\n username, password = base64.b64decode(token.encode('ascii')).decode('utf-8').split(':')\n except Exception:\n raise TokenInvalidException\n ... | [
"0.79369974",
"0.78281486",
"0.76603544",
"0.75215846",
"0.72736526",
"0.72162646",
"0.71960145",
"0.7155524",
"0.7115108",
"0.7112131",
"0.7043556",
"0.69969535",
"0.69902986",
"0.69483715",
"0.6934084",
"0.69336903",
"0.69215417",
"0.69092816",
"0.68495834",
"0.6840067",
"0... | 0.65302664 | 33 |
Returns True if n is prime | def isPrime(n):
if n == 2:
return True
if n == 3:
return True
if n % 2 == 0:
return False
if n % 3 == 0:
return False
i = 5
w = 2
while i * i <= n:
if n % i == 0:
return False
i += w
w = 6 - w
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isprime(n):\r\n\treturn is_prime(n)",
"def isprime(n):\n\treturn is_prime(n)",
"def isprime(n):\n if n % 2 == 0:return False\n return all(n % i for i in range(3, int(n**0.5) + 1, 2))",
"def if_prime(cls, n):\n\n if (n <= 1):\n return False\n if (n <= 3):\n return... | [
"0.87481445",
"0.87189144",
"0.85801333",
"0.8577923",
"0.85306036",
"0.85021067",
"0.8500682",
"0.8486691",
"0.8485217",
"0.8479649",
"0.8474352",
"0.84675056",
"0.8406392",
"0.8404879",
"0.84000015",
"0.8386759",
"0.838279",
"0.83794594",
"0.83744454",
"0.8373067",
"0.83719... | 0.8135409 | 46 |
Should return a list of all parents of the given node, in the event that there is more than one. If the indicated node is a root node, return an empty list | def get_parents(self, node):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent_list(root_node: ast.AST, node: ast.AST):\n ans = []\n current = node\n while current is not None:\n current = get_parent(root_node, current)\n if current is not None:\n ans.append(current)\n return ans",
"def getnodeparents(self, node_p=None):\n node_p = sel... | [
"0.8030605",
"0.77630585",
"0.76826566",
"0.7495662",
"0.74353147",
"0.741193",
"0.73648554",
"0.7354108",
"0.7348811",
"0.73146695",
"0.7276632",
"0.7226196",
"0.71941656",
"0.7045495",
"0.6847749",
"0.6833503",
"0.680813",
"0.6803222",
"0.68015164",
"0.67677736",
"0.6767773... | 0.8054945 | 0 |
Returns all the nodes inserted so far in this tree. This returns the nodes in the order they were inserted. | def get_nodes(self):
return list(map(lambda x: x[0], self.__nodes)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ordered_nodes(self):\n nodes = []\n self.build_nodes_list(self.root, nodes)\n return nodes",
"def getNodes(self):\n return [ node for node in sorted(self._nodes.values()) ]",
"def get_nodes(self):\n all_nodes = [] \n if not self._root is None:\n all_... | [
"0.80123746",
"0.7568774",
"0.7547694",
"0.7476051",
"0.73511416",
"0.730089",
"0.72976816",
"0.72976816",
"0.7195356",
"0.71941024",
"0.71756196",
"0.7174892",
"0.71274877",
"0.709629",
"0.7071931",
"0.7052196",
"0.7036682",
"0.7036682",
"0.7036682",
"0.69805974",
"0.6964279... | 0.6642312 | 43 |
Gets the name of this AnalysisResultResults. | def name(self) -> str:
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self) -> str:\n\t\treturn self._raw_result['name']",
"def name(self):\n return self._output_name",
"def name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"name\")",
"def name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"name\")",
"def name(self) -> pulum... | [
"0.7141183",
"0.68581045",
"0.6831365",
"0.6831365",
"0.6831365",
"0.6831365",
"0.6831365",
"0.6831365",
"0.6831365",
"0.6831365",
"0.6831365",
"0.6831365",
"0.6831365",
"0.6831365",
"0.6831365",
"0.6831365",
"0.6831365",
"0.6831365",
"0.6831365",
"0.6831365",
"0.6831365",
... | 0.0 | -1 |
Sets the name of this AnalysisResultResults. | def name(self, name: str):
if name is None:
raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setResultsName(self, name, **kwargs):\n self.structure.set_name(name)\n return self",
"def setResultsName(self, name, **kwargs):\n return self",
"def set_name(self, a_name):\n self.set_parameter('name', a_name)\n return self",
"def setName(self, *args):\n return ... | [
"0.8390896",
"0.8341121",
"0.63919306",
"0.63867533",
"0.6383771",
"0.6381646",
"0.63616115",
"0.6334429",
"0.6334429",
"0.6334429",
"0.6334429",
"0.6334429",
"0.6317382",
"0.6317382",
"0.6307463",
"0.6291388",
"0.6279902",
"0.62622553",
"0.6257499",
"0.6234796",
"0.6234796",... | 0.0 | -1 |
Sets the fold_changes of this AnalysisResultResults. | def fold_changes(self, fold_changes: str):
self._fold_changes = fold_changes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fold_changes(self) -> str:\n return self._fold_changes",
"def setFolding (self, fold):\n if fold:\n self.srcEditor.activeFolding(fold)\n else:\n self.srcEditor.activeFolding(fold)",
"def log_fold_change(self, base=np.e, **kwargs):\n raise ValueError(\"This ... | [
"0.6177422",
"0.55169606",
"0.52760184",
"0.50761336",
"0.50565773",
"0.49770388",
"0.48292485",
"0.47613883",
"0.47584993",
"0.47488952",
"0.46828347",
"0.46539095",
"0.4647923",
"0.4631573",
"0.46203622",
"0.45037007",
"0.4491066",
"0.44797283",
"0.4475459",
"0.44610712",
"... | 0.81333274 | 0 |
Create instance of InstanceProfile from structured json data | def from_json(cls, json_data):
ro = cls()
ro._name = json_data['RoleName']
ro._id = json_data['RoleId']
ro._assume_role_policy_document = urllib.parse.unquote(json_data['AssumeRolePolicyDocument'])
ro._path = json_data['Path']
ro._arn = json_data['Arn'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_json(cls, json_data):\n ip = cls()\n ip._name = json_data['InstanceProfileName'] \n ip._id = json_data['InstanceProfileId'] \n ip._roles = []\n for role in json_data['Roles']:\n ip._roles.append(Role.from_json(role))\n ip._path = json_data['Path... | [
"0.7641542",
"0.6360388",
"0.62992644",
"0.6189637",
"0.6090309",
"0.60841066",
"0.60419583",
"0.5983451",
"0.59194136",
"0.580729",
"0.5787131",
"0.5780916",
"0.5773621",
"0.56837374",
"0.5671199",
"0.56549495",
"0.5645101",
"0.56335014",
"0.5597545",
"0.5586547",
"0.5578338... | 0.52121973 | 90 |
Create instance of InstanceProfile from structured json data | def from_json(cls, json_data):
ip = cls()
ip._name = json_data['InstanceProfileName']
ip._id = json_data['InstanceProfileId']
ip._roles = []
for role in json_data['Roles']:
ip._roles.append(Role.from_json(role))
ip._path = json_data['Path']
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(*args, **kwargs):\n\n factory = V2ProfileFactory()\n output = factory.create(export_json=True)\n click.echo(output)",
"def create(self, validated_data):\n request = self.context.get('request')\n profile = Profile(**validated_data)\n profile.user = request.user\n pr... | [
"0.63596565",
"0.62984645",
"0.61894023",
"0.60894084",
"0.60833997",
"0.6041046",
"0.59828407",
"0.5918215",
"0.58079785",
"0.5786598",
"0.5779447",
"0.5773541",
"0.5682626",
"0.56715816",
"0.56538904",
"0.564451",
"0.5633599",
"0.55968356",
"0.55860513",
"0.5578176",
"0.556... | 0.76424825 | 0 |
Given a contour, an an image fill that contour with white color in the image | def fillContour( self, img, contours, i):
cv2.drawContours(img, contours, i , self.WHITE, -1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fillContour(img, cnt, color = (255,255,0)):\n\tcv2.drawContours(img, [cnt], 0, color, -1)",
"def fillHoles(img):\n out,contour,hierarchy = cv2.findContours(img,cv2.RETR_CCOMP,cv2.CHAIN_APPROX_NONE)\n i=0\n for cnt in contour:\n cv2.drawContours(img,contour,i,255,-1)\n i+=1\n ... | [
"0.7413919",
"0.6772814",
"0.652293",
"0.6308153",
"0.62505877",
"0.62282604",
"0.60853255",
"0.6075149",
"0.60330856",
"0.60017204",
"0.5978948",
"0.59376776",
"0.5884713",
"0.5836772",
"0.5802734",
"0.57616615",
"0.5746706",
"0.5738171",
"0.5703671",
"0.5683482",
"0.5676145... | 0.7056379 | 1 |
Returns the date when this CRL was issued | def thisUpdate(self) -> datetime:
this_update = self['tbs_cert_list']['this_update'].native
return this_update | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_inbound_statement_details_issued_date(self):\n return self.get_text_from_element(self.inbound_statements_details_issued_date_locator, True)",
"def getCertificateExpireDate(self):\n cert = self.getLatestValidCertification()\n if cert == None:\n return ''\n date = cer... | [
"0.7305142",
"0.6886373",
"0.68468916",
"0.68448746",
"0.6826219",
"0.68157244",
"0.6797923",
"0.67736727",
"0.67736727",
"0.67736727",
"0.67612714",
"0.67612714",
"0.67612714",
"0.67612714",
"0.6682821",
"0.66443163",
"0.6635051",
"0.66133684",
"0.6601425",
"0.659472",
"0.65... | 0.0 | -1 |
MetroHealth83 Health services data for 83 metropolitan areas A dataset with 83 observations on the following 16 variables. `City` Name of the metropolitan area `NumMDs` Number of physicians `RateMDs` Number of physicians per 100,000 people `NumHospitals` Nmber of community hospitals `NumBeds` Number of hospital beds `R... | def metro_health83(path):
import pandas as pd
path = os.path.expanduser(path)
filename = 'metro_health83.csv'
if not os.path.exists(os.path.join(path, filename)):
url = 'http://dustintran.com/data/r/Stat2Data/MetroHealth83.csv'
maybe_download_and_extract(path, url,
save_fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_data(city='Chicago'):\n df = pd.read_csv('train.csv')\n df = df[df.City==city]\n\n # I will be using this dictionary to convert direction to degrees\n degrees = {'N':0, 'NE':45, 'E':90, 'SE':135, 'S':180, 'SW':225, 'W':270, 'NW':315}\n\n df[\"EntryHeading_deg\"] = df.EntryHeading.apply(lamb... | [
"0.6470939",
"0.59797823",
"0.5921573",
"0.5884961",
"0.58462864",
"0.58462864",
"0.58185494",
"0.58148885",
"0.5790309",
"0.5782852",
"0.57783294",
"0.57754445",
"0.57750475",
"0.57632923",
"0.5755553",
"0.57488567",
"0.57442683",
"0.57377154",
"0.57340294",
"0.5719696",
"0.... | 0.5397297 | 97 |
Simple colorness filter based on pixel thresholds. Default parameter is a "redness" filters. | def __init__(self, bgr_lb=[0, 0, 180], bgr_ub=[50, 50, 255], pixels_threshold=10000):
super(ColorFilter, self).__init__(bgr_lb, bgr_ub, pixels_threshold)
self.bgr_lb = np.array(bgr_lb).astype(np.uint8)
self.bgr_ub = np.array(bgr_ub).astype(np.uint8)
self.pixels_threshold = pixels_thresho... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_red_blue_filter(subtests):\n white_pixel = 255\n black_pixel = 0\n\n width = 100\n height = 100\n size = (width, height)\n\n # TestCase Red 0 Blue 255\n image = Image.new(\"RGBA\", size, (0, 0, 255))\n with subtests.test(msg=\"Red 0 Blue 255\", image=image):\n assert_color_a... | [
"0.6176795",
"0.60212445",
"0.5869135",
"0.58211464",
"0.58121204",
"0.5730858",
"0.5691243",
"0.56849724",
"0.5620007",
"0.56052464",
"0.55912536",
"0.5579205",
"0.5576762",
"0.55755764",
"0.55623865",
"0.5560785",
"0.55471677",
"0.5539451",
"0.5538807",
"0.5529697",
"0.5529... | 0.51684386 | 64 |
Converts an index (integer) in a token (string/unicode) using the vocab. | def id_to_token(self, index):
return self.decoder.get(index) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convert_id_to_token(self, index):\n return self.reverse_vocab.get(index, self.unk_token)",
"def _convert_id_to_token(self, index, return_unicode=True):\n token = self.sp_model.IdToPiece(index)\n return token",
"def _convert_id_to_token(self, index):\n if index in self.fairseq_i... | [
"0.76504004",
"0.66577786",
"0.6546384",
"0.65350676",
"0.6404568",
"0.6375889",
"0.6370274",
"0.6370274",
"0.6272747",
"0.62470657",
"0.6219838",
"0.6162691",
"0.6122522",
"0.6113642",
"0.6081953",
"0.60777116",
"0.60551715",
"0.6027793",
"0.6003488",
"0.6001299",
"0.5868207... | 0.67995644 | 1 |
create new database table if one doesn't exist | def _create_table(self):
query = f"""CREATE TABLE IF NOT EXISTS {TABLE}(
member_Id INT,
memberName VARCHAR(50),
amount INT,
date datetime NOT NULL,
time datetime NOT NULL,
status VARCHAR(20) N... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __createTableIfNotExists(self):\n query = \"SELECT name FROM sqlite_master WHERE type='table'\"\n results = self._cursor.execute(query)\n name_list = [name for r in results for name in r]\n\n if self.table_name not in name_list:\n # Timestamp is for the time from pythons ... | [
"0.7974503",
"0.7922466",
"0.7848161",
"0.7848161",
"0.778432",
"0.75700545",
"0.75684714",
"0.75456065",
"0.74840486",
"0.7456666",
"0.73890126",
"0.7379646",
"0.73777246",
"0.7363519",
"0.73607105",
"0.7344715",
"0.7329657",
"0.7308505",
"0.72966737",
"0.7266884",
"0.726280... | 0.0 | -1 |
Constructor for the Node class | def __init__(self, size=5):
self.frequency = 0
self.link = [None] * size # Size 4 + 1: 4- stands for A,B,C,D and 1- stands for $
self.index_next = 0
self.highest_freq = None
self.string = ""
self.index = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.root = Node('')",
"def __init__(self, nodes=None):\r\n self.nodes = nodes",
"def __init__(self):\n self.__root = Node()",
"def __init__(self):\n self.root = Node(\"\")",
"def __init__(self):\n self.root = Node(\"\")",
"def __init__(self):\n ... | [
"0.81775296",
"0.81322277",
"0.81101316",
"0.8100768",
"0.8100768",
"0.80920136",
"0.8082672",
"0.8061586",
"0.8061586",
"0.8061586",
"0.8054007",
"0.80519265",
"0.7960978",
"0.7871647",
"0.7829197",
"0.7790241",
"0.77830267",
"0.7768883",
"0.77623016",
"0.7748248",
"0.774712... | 0.0 | -1 |
constructor for the suffix trie | def __init__(self, genome):
self.root = Node_2()
self.genome = genome
self.create_trie(genome) # O(N^2)
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, s):\n s += '$'\n self.root = self.Node(None)\n self.root.out[s[0]] = self.Node(s) # trie for just longest suf\n # add the rest of the suffixes, from longest to shortest\n for i in xrange(1, len(s)):\n # start at root; we will walk down as far as we c... | [
"0.7381812",
"0.71769625",
"0.7128713",
"0.69967014",
"0.69052535",
"0.6889877",
"0.6807792",
"0.6759059",
"0.67220086",
"0.6713957",
"0.67139184",
"0.67139184",
"0.6666432",
"0.6660891",
"0.6640714",
"0.66331476",
"0.65779406",
"0.6567864",
"0.6567864",
"0.6505084",
"0.65047... | 0.6300745 | 54 |
Creating the suffix trie | def create_trie(self, genome):
i = 0
while i <= len(genome): # O(N)
current = self.root
self.create_trie_aux(current, genome, i) # O(N)
i += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_suffix_tree(text):\n tree = dict()\n tree[0] = {}\n head_node = 1\n\n # 例えば、ABC$ という文字列の場合、ABC$, BC$, C$, $ の順に処理\n for p in range(len(text)):\n suffix = text[p:]\n current_node = 0\n\n # サブ文字列の先頭から一文字ずつ処理\n i = 0\n while i < len(suffix):\n c = suffix[i]\n cur_str = suffix[i... | [
"0.73249996",
"0.6831297",
"0.66672844",
"0.66188914",
"0.65856326",
"0.64038783",
"0.6026783",
"0.5944187",
"0.5909362",
"0.59042484",
"0.5876109",
"0.5828793",
"0.5804953",
"0.5766279",
"0.575928",
"0.57571715",
"0.57038814",
"0.56772465",
"0.56765413",
"0.564184",
"0.56361... | 0.5504985 | 36 |
Return the filename of the source archive. | def get_archive_name(self):
return 'zlib-{}.tar.gz'.format(self.version) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getZipArchiveFileName(self):\n\n if self._mode == \"zip\":\n fullFile = java.io.File(self.getZipArchiveFullPath())\n return fullFile.getName()\n\n return \"\"",
"def get_filename(self):\n return self.get_package_name() + '.' + ARCH + \".rpm\"",
"def get_dest_name ... | [
"0.70069265",
"0.6908882",
"0.6898516",
"0.68885386",
"0.66964",
"0.66772336",
"0.66665006",
"0.6651776",
"0.66439885",
"0.6553653",
"0.65477693",
"0.6510783",
"0.65050805",
"0.6482418",
"0.64702255",
"0.64657086",
"0.64519",
"0.6449894",
"0.6441919",
"0.64375705",
"0.6431736... | 0.6685338 | 5 |
Get the installed version. | def _get_installed_version(self):
# We support native versions for everything except Windows.
if self.target_platform_name == 'android':
root_dir = self.android_ndk_sysroot
elif self.target_platform_name in ('ios', 'macos'):
root_dir = self.apple_sdk
elif self.ta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def installed_version(self):\n state = self.coordinator.data\n\n try:\n return dict_get(state, \"firmware_update_info.base.installed_version\")\n except KeyError:\n return None",
"def version(self):\n if self.installed and not self._version:\n output =... | [
"0.8125793",
"0.7932763",
"0.78101623",
"0.7777286",
"0.7694702",
"0.75738025",
"0.7570566",
"0.7548347",
"0.7475464",
"0.7462123",
"0.74356",
"0.74262404",
"0.7401643",
"0.7355286",
"0.7348772",
"0.73375887",
"0.73375887",
"0.73308986",
"0.7324174",
"0.7322161",
"0.73194456"... | 0.7615926 | 5 |
Closes an existing Obex session. | def destroy_session(self, session):
self._obex_client_proxy.proxy.RemoveSession(session.path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_session(self):\n self.sess.close()",
"def close(self):\n self.__session.close()",
"def close(self):\n self.__session.close()",
"def close(self):\n self.__session.close()",
"def close(self):\n self.__session.close()",
"def close(self):\n self.__session.c... | [
"0.7401606",
"0.73841405",
"0.73841405",
"0.73841405",
"0.73841405",
"0.73841405",
"0.73841405",
"0.73563546",
"0.7344161",
"0.7277941",
"0.7228517",
"0.7154117",
"0.7154117",
"0.7154117",
"0.7087863",
"0.6949775",
"0.6932694",
"0.6932016",
"0.6900655",
"0.686789",
"0.679901"... | 0.6076767 | 62 |
Get the currently persisted data for this basket. This will only access the storage once per request in usual circumstances. | def _load(self):
# This can happen when the object is not loaded yet
# Usually when __init__ calls super().__init__()
# and OrderSource starts initializing the instance attributes
if not hasattr(self, "_data"):
return
if self._data is None:
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_data(self):\n return self._store_data",
"def storage(self):\n return self._storage",
"def save(self):\n self.clean_empty_lines()\n stored_basket = self.storage.save(basket=self, data=self._data)\n self.dirty = False\n return stored_basket",
"def get_storage... | [
"0.73542637",
"0.6991091",
"0.68765724",
"0.68013436",
"0.66473114",
"0.6590945",
"0.6588963",
"0.6579336",
"0.65661633",
"0.6544065",
"0.6445292",
"0.6436913",
"0.6436913",
"0.6436913",
"0.6424606",
"0.6424606",
"0.6424606",
"0.6401025",
"0.63978684",
"0.63886887",
"0.635708... | 0.66663826 | 4 |
Get the line data (list of dicts). If the list is edited, it must be reassigned to ``self._data_lines`` to ensure the `dirty` flag gets set. | def _data_lines(self):
self._load()
return self._data.setdefault("lines", []) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fetch_data_lines(self) -> list:\n with open(self.full_path, \"rb\") as file:\n all_lines = file.readlines()\n return self._screen_invalid_lines(all_lines)",
"def get_lines( self ):\n return self._line_info",
"def get_lines( self ):\n return self._line_info",
"def g... | [
"0.64394635",
"0.64382476",
"0.64382476",
"0.62308776",
"0.6129356",
"0.60624135",
"0.595528",
"0.5926791",
"0.58782375",
"0.58579457",
"0.5843318",
"0.58162713",
"0.5741719",
"0.5729479",
"0.5705608",
"0.5656434",
"0.56496763",
"0.56412417",
"0.5637232",
"0.56331396",
"0.562... | 0.7013046 | 0 |
Get basket line by line id. | def get_basket_line(self, line_id):
if self._lines_by_line_id_cache is None:
self._cache_lines()
return self._lines_by_line_id_cache.get(line_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_line_by_line_id(self, line_id):\n for line in self._data_lines:\n if six.text_type(line.get(\"line_id\")) == six.text_type(line_id):\n return line\n return None",
"def get(self, line_id: int, **options) -> Dict:\n return self._call(f\"{line_id}\", **options... | [
"0.75571615",
"0.6451364",
"0.64235747",
"0.6417388",
"0.624498",
"0.61261904",
"0.60775733",
"0.6076206",
"0.5853761",
"0.58295953",
"0.5798469",
"0.57831764",
"0.5707144",
"0.56628996",
"0.5567079",
"0.5566567",
"0.55528146",
"0.55455804",
"0.55429333",
"0.55142814",
"0.549... | 0.8693362 | 0 |
Find basket data line by line id. | def find_line_by_line_id(self, line_id):
for line in self._data_lines:
if six.text_type(line.get("line_id")) == six.text_type(line_id):
return line
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_basket_line(self, line_id):\n if self._lines_by_line_id_cache is None:\n self._cache_lines()\n return self._lines_by_line_id_cache.get(line_id)",
"def searchForLine(lineId, attributes=['uuid']):\n returnedTagsForApi = {}\n for attr in attributes:\n returnedTagsForApi... | [
"0.7720059",
"0.6676511",
"0.6358584",
"0.63102365",
"0.629882",
"0.6280224",
"0.61356634",
"0.595328",
"0.5939389",
"0.58673155",
"0.5838896",
"0.569454",
"0.5673522",
"0.5671405",
"0.5592099",
"0.5585691",
"0.55563873",
"0.5537561",
"0.5511178",
"0.5507296",
"0.54868704",
... | 0.82005453 | 0 |
Creates the ``Decoder`` instance. This specifies the search strategy used to traverse the space spanned by the predictors. This method relies on the global ``args`` variable. | def create_decoder():
# Create decoder instance and add predictors
try:
decoder = decoding.DECODER_REGISTRY[args.decoder](args)
except Exception as e:
logging.fatal("An %s has occurred while initializing the decoder: %s"
" Stack trace: %s" % (sys.exc_info()[0],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, decoder_args):\n super(DijkstraDecoder, self).__init__(decoder_args)\n self.nbest = max(1, decoder_args.nbest)\n self.capacity = decoder_args.beam\n self.early_stopping = decoder_args.early_stopping",
"def __init__(self, decoder_args):\n super(CombiBeamDecode... | [
"0.6234625",
"0.6129889",
"0.5589002",
"0.5479988",
"0.54272306",
"0.5402592",
"0.5402592",
"0.5392692",
"0.52700436",
"0.5240299",
"0.52378535",
"0.5164279",
"0.5154518",
"0.5150388",
"0.51488394",
"0.5143839",
"0.5117767",
"0.51161593",
"0.510179",
"0.50953746",
"0.5075977"... | 0.67287 | 0 |
Get ennvironment target for the target. | def _get_env_target(self, target='default'):
return '{target}{env_postfix}'.format(
target=target,
env_postfix=self._env_postfix) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_target(self, ):\n return self.get_parameter('target')",
"def target(self) -> Optional[str]:\n return pulumi.get(self, \"target\")",
"def getTarget(self):\n return self._target",
"def target(self):\n return self._properties.get('target')",
"def get_target(self):\n ... | [
"0.6494402",
"0.63124126",
"0.6266898",
"0.62593776",
"0.6230681",
"0.6176865",
"0.6148963",
"0.60722876",
"0.5978676",
"0.59740484",
"0.5919661",
"0.58773935",
"0.58773935",
"0.58773935",
"0.58773935",
"0.58773935",
"0.58773935",
"0.58773935",
"0.58773935",
"0.58698726",
"0.... | 0.7737732 | 0 |
Test the `repr` method. | def test_repr(self, user_factory):
user = user_factory.get()
assert repr(user) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_repr(self, r, rep):\n assert repr(r) == rep",
"def test_repr(self):\n self.assertTrue(repr(self.obj1))\n self.assertTrue(repr(self.obj2))\n self.assertTrue(repr(self.obj3))\n self.assertTrue(repr(self.obj4))\n self.assertTrue(repr(self.obj5))",
"def test_repr(... | [
"0.8563912",
"0.7747066",
"0.7670223",
"0.75985116",
"0.757758",
"0.74265635",
"0.73891264",
"0.73497826",
"0.7264813",
"0.72540784",
"0.7180772",
"0.7174852",
"0.7117576",
"0.7067298",
"0.70293665",
"0.70281965",
"0.70247704",
"0.70091945",
"0.6987468",
"0.6937103",
"0.69308... | 0.5859717 | 95 |
Set rules based on the provided dict of rules. | def set_rules(rules, overwrite=True, use_conf=False):
init(use_conf=False)
_ENFORCER.set_rules(rules, overwrite, use_conf) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_rules(rules, overwrite=True, use_conf=False): # pragma: no cover\n init(use_conf=False)\n _ENFORCER.set_rules(rules, overwrite, use_conf)",
"def rule(self, rules):\n\n if not isinstance(rules, list):\n rules = [rules]\n\n for rule in rules:\n self.__addRule(rule... | [
"0.7021099",
"0.6978239",
"0.6766926",
"0.63070357",
"0.620527",
"0.6199171",
"0.61830163",
"0.60569745",
"0.59730506",
"0.5970087",
"0.5964937",
"0.5846258",
"0.58198684",
"0.5814933",
"0.58073574",
"0.5784316",
"0.5770152",
"0.5757518",
"0.56953996",
"0.5650548",
"0.5609344... | 0.699503 | 1 |
Whether or not roles contains 'admin' role according to policy setting. | def check_is_admin(context):
init()
# the target is user-self
target = default_target(context)
return _ENFORCER.authorize('context_is_admin', target, context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_admin(self):\n return Role.query.get(2) in self.roles",
"def is_admin():\n # TODO(felipemonteiro): Make this more robust via a context is admin\n # lookup.\n return CONF.patrole.rbac_test_role == CONF.identity.admin_role",
"def is_admin(self) -> bool:\n\n return current_app.config... | [
"0.8054524",
"0.7877663",
"0.75238925",
"0.72786576",
"0.72618526",
"0.70712554",
"0.7052046",
"0.7027679",
"0.6995479",
"0.6952314",
"0.69498765",
"0.69370526",
"0.69154674",
"0.69057536",
"0.6902796",
"0.6873862",
"0.68481904",
"0.68279123",
"0.6823126",
"0.6814061",
"0.680... | 0.6685274 | 33 |
Determine whether is_admin matches the requested value. | def __call__(self, target, creds, enforcer):
return creds['is_admin'] == self.expected | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_is_admin(user):\n return user in admins",
"def is_admin(self):\n if self.type == 1:\n return True\n else:\n return False",
"def check_is_admin(current_user):\n return current_user['isAdmin'] == True",
"def is_admin():\n # TODO(felipemonteiro): Make this m... | [
"0.7700878",
"0.7672315",
"0.76222646",
"0.7601075",
"0.75799584",
"0.7540485",
"0.74429554",
"0.74388325",
"0.7367466",
"0.73150426",
"0.729679",
"0.72717005",
"0.7238872",
"0.7238872",
"0.72164387",
"0.72080594",
"0.7191682",
"0.7169048",
"0.7126364",
"0.7122858",
"0.711977... | 0.6284174 | 84 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.