query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
test integrity of lensfuncs | def test_integrity_of_lensfuncs():
ra_source, dec_source = [120.1, 119.9, 119.9], [41.9, 42.2, 42.2]
id_source, z_sources = [1, 2, 3], [1, 1, 1]
galcat = GCData([ra_source, dec_source, z_sources, id_source],
names=('ra', 'dec', 'z', 'id'))
galcat_noz = GCData([ra_source, dec_source, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def constrained_lens_object_test():\n return # TODO",
"def test_empty_functions():",
"def test_func(self):\n self.rol_nu, self.functie_nu = rol_get_huidige_functie(self.request)\n return self.rol_nu == Rollen.ROL_RKO",
"def test_func(self):\n self.rol_nu, self.functie_nu = rol_get_huidi... | [
"0.71911365",
"0.62440103",
"0.6149517",
"0.61303365",
"0.61303365",
"0.6063063",
"0.5981402",
"0.59171146",
"0.5877134",
"0.5853375",
"0.58258003",
"0.5783082",
"0.5778321",
"0.5758383",
"0.57581913",
"0.5736935",
"0.56290174",
"0.5601555",
"0.5586469",
"0.5585186",
"0.55763... | 0.7345759 | 0 |
Emit a TiltBrushMesh as a .fbx file | def write_fbx_meshes(meshes, outf_name):
import FbxCommon
global n
(sdk, scene) = FbxCommon.InitializeSdkObjects()
docInfo = FbxDocumentInfo.Create(sdk, 'DocInfo')
docInfo.Original_ApplicationVendor.Set('Google')
docInfo.Original_ApplicationName.Set('Tilt Brush')
docInfo.LastSaved_ApplicationVendor.Set('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_mesh_to_scene(sdk, scene, mesh, contentid):\n global n\n name = contentid+\"_\"+str(n)\n n+=1\n # Todo: pass scene instead?\n fbx_mesh = FbxMesh.Create(sdk, name)\n fbx_mesh.CreateLayer()\n layer0 = fbx_mesh.GetLayer(0)\n\n # Verts\n\n fbx_mesh.InitControlPoints(len(mesh.v))\n if RELOCATE_BRUSHES... | [
"0.57807994",
"0.5658311",
"0.5514118",
"0.55071974",
"0.5486995",
"0.54793996",
"0.5456136",
"0.53425705",
"0.5301332",
"0.52909553",
"0.5270234",
"0.5237695",
"0.523486",
"0.5213622",
"0.51888585",
"0.5150404",
"0.5149121",
"0.5119107",
"0.5111576",
"0.5109182",
"0.51050895... | 0.6421982 | 0 |
Returns an instance of layer_class populated with the passed data, or None if the passed data is empty/nonexistent. fbx_mesh FbxMesh data list of Python data converter_fn Function converting data > FBX data layer_class FbxLayerElementXxx class allow_index Allow the use of eIndexToDirect mode. Useful if the data has man... | def create_fbx_layer(fbx_mesh, data, converter_fn, layer_class,
allow_index=False, allow_allsame=False):
# No elements, or all missing data.
if not allow_allsame and (len(data) == 0 or data[0] == None):
return None
layer_elt = layer_class.Create(fbx_mesh, "")
direct = layer_elt.GetDire... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_layer_from_data(\n self, data, meta: dict = None, layer_type: Optional[str] = None\n ) -> Union[layers.Layer, List[layers.Layer]]:\n\n layer_type = (layer_type or '').lower()\n\n # assumes that big integer type arrays are likely labels.\n if not layer_type:\n laye... | [
"0.50112885",
"0.48434955",
"0.48243156",
"0.4819249",
"0.46891117",
"0.4657353",
"0.46191707",
"0.46081787",
"0.4606792",
"0.46019274",
"0.45938307",
"0.4591017",
"0.4587841",
"0.45437902",
"0.45089364",
"0.4502997",
"0.44974574",
"0.44644302",
"0.4417328",
"0.44170654",
"0.... | 0.749724 | 0 |
Emit a TiltBrushMesh as a .fbx file | def add_mesh_to_scene(sdk, scene, mesh, contentid):
global n
name = contentid+"_"+str(n)
n+=1
# Todo: pass scene instead?
fbx_mesh = FbxMesh.Create(sdk, name)
fbx_mesh.CreateLayer()
layer0 = fbx_mesh.GetLayer(0)
# Verts
fbx_mesh.InitControlPoints(len(mesh.v))
if RELOCATE_BRUSHES is True:
print... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_fbx_meshes(meshes, outf_name):\n import FbxCommon\n global n\n (sdk, scene) = FbxCommon.InitializeSdkObjects()\n\n docInfo = FbxDocumentInfo.Create(sdk, 'DocInfo')\n docInfo.Original_ApplicationVendor.Set('Google')\n docInfo.Original_ApplicationName.Set('Tilt Brush')\n docInfo.LastSaved_Applicatio... | [
"0.6421982",
"0.5658311",
"0.5514118",
"0.55071974",
"0.5486995",
"0.54793996",
"0.5456136",
"0.53425705",
"0.5301332",
"0.52909553",
"0.5270234",
"0.5237695",
"0.523486",
"0.5213622",
"0.51888585",
"0.5150404",
"0.5149121",
"0.5119107",
"0.5111576",
"0.5109182",
"0.51050895"... | 0.57807994 | 1 |
Create an instance of the appropriate DriverFields class. | def create(node):
if 'pxe' in node.driver:
return PXEDriverFields(node)
else:
return GenericDriverFields(node) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, driver_id=None, driver_name=None, driver_username=None, group_id=None, active_hours=None, distance_miles=None):\n self.swagger_types = {\n 'driver_id': 'int',\n 'driver_name': 'str',\n 'driver_username': 'str',\n 'group_id': 'int',\n ... | [
"0.6246155",
"0.61800337",
"0.61791575",
"0.6076796",
"0.6052111",
"0.5822716",
"0.5822716",
"0.5808855",
"0.5806499",
"0.57641137",
"0.57590723",
"0.575509",
"0.5736178",
"0.5722595",
"0.5676521",
"0.5674144",
"0.56590664",
"0.5643891",
"0.5636804",
"0.5625566",
"0.56177884"... | 0.675215 | 0 |
Build a patch to clean up the fields. Build a jsonpatch to remove the fields used to deploy a node using the PXE driver. Note that the fields added to the Node's instance_info don't need to be removed because they are purged during the Node's tear down. | def get_cleanup_patch(self, instance, network_info):
patch = []
driver_info = self.node.driver_info
fields = ['pxe_deploy_kernel', 'pxe_deploy_ramdisk']
for field in fields:
if field in driver_info:
patch.append({'op': 'remove',
'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch(self, patch: 'ParsedNodePatch'):\n # explicitly pick out the parts to update so we don't inadvertently\n # step on the model name or anything\n self.patch_path: Optional[str] = patch.original_file_path\n self.description = patch.description\n self.columns = patch.column... | [
"0.5833851",
"0.54387647",
"0.53161323",
"0.5308292",
"0.53057593",
"0.5291944",
"0.52896684",
"0.50418466",
"0.50204057",
"0.50189215",
"0.50180817",
"0.49966675",
"0.4982653",
"0.49548486",
"0.48262063",
"0.47825527",
"0.47807696",
"0.47753072",
"0.47580788",
"0.4747456",
"... | 0.61141557 | 0 |
Announce that a Guardian is present and participating in the decryption. A guardian announces by presenting their id and their shares of the decryption | def announce(
self,
guardian_key: ElectionPublicKey,
tally_share: DecryptionShare,
ballot_shares: Dict[BallotId, Optional[DecryptionShare]] = None,
) -> None:
guardian_id = guardian_key.owner_id
# Only allow a guardian to announce once
if guardian_id in self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def announceVictory(self, secret):\n print\n print 'Congratulations, you won!'\n print 'The secret was', self._patternAsString(secret)",
"def __init__(self, id: MediatorId, context: CiphertextElectionContext):\n self.id = id\n self._context = context\n\n self._available_guardians = ... | [
"0.582533",
"0.5557873",
"0.5512743",
"0.5507302",
"0.5476017",
"0.54519093",
"0.53202593",
"0.5182001",
"0.51764214",
"0.5146798",
"0.5140071",
"0.51373684",
"0.51303846",
"0.5119418",
"0.5118891",
"0.51048017",
"0.5042007",
"0.502862",
"0.5018747",
"0.5009247",
"0.49957767"... | 0.67742515 | 0 |
Announce that a Guardian is missing and not participating in the decryption. | def announce_missing(self, missing_guardian_key: ElectionPublicKey) -> None:
missing_guardian_id = missing_guardian_key.owner_id
# If guardian is available, can't be marked missing
if missing_guardian_id in self._available_guardians:
log_info(f"guardian {missing_guardian_id} already... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def announceDefeat(self, secret):\n print\n print 'The secret was', self._patternAsString(secret)\n print 'Good luck next time.'",
"def announcement_complete(self) -> bool:\n # If a quorum not announced, not ready\n if len(self._available_guardians) < self._context.quorum:\n log... | [
"0.58553314",
"0.57337505",
"0.5612897",
"0.560702",
"0.54847354",
"0.54499567",
"0.5446442",
"0.5371012",
"0.5368873",
"0.53470826",
"0.53460366",
"0.53191644",
"0.5316383",
"0.5277391",
"0.52438956",
"0.5242183",
"0.5235716",
"0.52323836",
"0.52192914",
"0.5218823",
"0.5215... | 0.6825597 | 0 |
Check the guardian's collections of keys and ensure the public keys match for the guardians. | def validate_missing_guardians(
self, guardian_keys: List[ElectionPublicKey]
) -> bool:
# Check this guardian's collection of public keys
# for other guardians that have not announced
missing_guardians: Dict[GuardianId, ElectionPublicKey] = {
guardian_key.owner_id: guardi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_keys(self):",
"def test_get_vault_pubkeys(self):\n pass",
"def _mark_available(self, guardian_key: ElectionPublicKey) -> None:\n guardian_id = guardian_key.owner_id\n self._available_guardians[guardian_id] = guardian_key\n if guardian_id in self._missing_guardians:\n ... | [
"0.656638",
"0.6118209",
"0.6117767",
"0.5736818",
"0.5674042",
"0.5644052",
"0.5644052",
"0.5611311",
"0.5596352",
"0.55897516",
"0.55386865",
"0.5526499",
"0.5498718",
"0.5493973",
"0.54757196",
"0.54746425",
"0.5470865",
"0.5433283",
"0.5429705",
"0.5426194",
"0.5425677",
... | 0.7345174 | 0 |
Determine if the announcement phase is complete | def announcement_complete(self) -> bool:
# If a quorum not announced, not ready
if len(self._available_guardians) < self._context.quorum:
log_warning("cannot decrypt with fewer than quorum available guardians")
return False
# If guardians missing or available not account... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complete(self):\r\n\tif self.launch_time == INVALID_TIME:\r\n\t print \"Missing probe launch time\"\r\n return False\r\n if self.received_time == INVALID_TIME:\r\n print \"Missing probe received time\"\r\n return False\r\n if self.completion_time == INVALID_TIME:\r\n ... | [
"0.6999998",
"0.6992482",
"0.67897743",
"0.6674574",
"0.6674574",
"0.6674574",
"0.6653026",
"0.6585012",
"0.6531276",
"0.65302163",
"0.65053356",
"0.6484713",
"0.64822525",
"0.648192",
"0.6463993",
"0.6463993",
"0.64439446",
"0.64174515",
"0.6388434",
"0.6376656",
"0.6348414"... | 0.7045295 | 0 |
Get all missing guardian keys | def get_missing_guardians(self) -> List[ElectionPublicKey]:
return list(self._missing_guardians.values()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_missing_keys(self):\n REQUIRED_KEYS = [\n 'date_purchased', 'cost', 'supply_type_id'\n ]\n\n return [key for key in REQUIRED_KEYS if not key in self.request.data]",
"def get_all_keys(self):\r\n all_keys = []\r\n for i in range(len(self.hash_table)):\r\n ... | [
"0.68770504",
"0.64367205",
"0.63764375",
"0.6270475",
"0.6210099",
"0.6197781",
"0.6193092",
"0.61852306",
"0.6180603",
"0.6065254",
"0.6048809",
"0.59807223",
"0.5959751",
"0.59494805",
"0.59494805",
"0.59494805",
"0.59353304",
"0.5930684",
"0.5923307",
"0.58868974",
"0.587... | 0.7178857 | 0 |
Get the plaintext ballots for the election by composing each Guardian's decrypted representation of each selection into a decrypted representation This is typically used in the spoiled ballot use case. | def get_plaintext_ballots(
self, ciphertext_ballots: List[SubmittedBallot], manifest: Manifest
) -> Optional[Dict[BallotId, PlaintextTally]]:
if not self.announcement_complete():
return None
ballots = {}
for ciphertext_ballot in ciphertext_ballots:
ballot_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt_ballot(request, election):\n answers = utils.from_json(request.POST['answers_json'])\n ev = homomorphic.EncryptedVote.fromElectionAndAnswers(election, answers)\n return ev.ld_object.includeRandomness().toJSONDict()",
"def ballot(style: int=0, selections: int=1):\n from electionguard.ballot impo... | [
"0.58554375",
"0.5325896",
"0.5207152",
"0.5154259",
"0.5008811",
"0.5007595",
"0.49852347",
"0.49651465",
"0.49639687",
"0.4949063",
"0.49086976",
"0.4888981",
"0.48574132",
"0.4798207",
"0.47784427",
"0.47607154",
"0.4703008",
"0.47002637",
"0.46963128",
"0.4684944",
"0.467... | 0.603434 | 0 |
Save a guardians tally share. | def _save_tally_share(
self, guardian_id: GuardianId, guardians_tally_share: DecryptionShare
) -> None:
self._tally_shares[guardian_id] = guardians_tally_share | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _save_ballot_shares(\n self,\n guardian_id: GuardianId,\n guardians_ballot_shares: Dict[BallotId, Optional[DecryptionShare]],\n ) -> None:\n for ballot_id, guardian_ballot_share in guardians_ballot_shares.items():\n shares = self._ballot_shares.get(ballot_id)\n ... | [
"0.6563749",
"0.6405449",
"0.58664864",
"0.5676138",
"0.56715477",
"0.55901545",
"0.5457308",
"0.5369418",
"0.53318334",
"0.52285975",
"0.5217548",
"0.5194622",
"0.5175417",
"0.5175313",
"0.5162803",
"0.515835",
"0.51232004",
"0.5089258",
"0.5073541",
"0.5048337",
"0.5041926"... | 0.8110598 | 0 |
Save a guardian's set of ballot shares. | def _save_ballot_shares(
self,
guardian_id: GuardianId,
guardians_ballot_shares: Dict[BallotId, Optional[DecryptionShare]],
) -> None:
for ballot_id, guardian_ballot_share in guardians_ballot_shares.items():
shares = self._ballot_shares.get(ballot_id)
if share... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _save_tally_share(\n self, guardian_id: GuardianId, guardians_tally_share: DecryptionShare\n ) -> None:\n self._tally_shares[guardian_id] = guardians_tally_share",
"def save_spendings(cls, obj_spends):\n saved = []\n for spendable in cls.objects_by_public_ids(obj_spends.keys())... | [
"0.6902596",
"0.6148367",
"0.57347023",
"0.5711195",
"0.56837827",
"0.5447417",
"0.5353562",
"0.5324594",
"0.52954924",
"0.5295367",
"0.5265038",
"0.5256572",
"0.52448845",
"0.52070314",
"0.5184159",
"0.5165985",
"0.5149352",
"0.5137256",
"0.5122931",
"0.5104601",
"0.50585455... | 0.8120266 | 0 |
Shares are ready to decrypt. | def _ready_to_decrypt(self, shares: Dict[GuardianId, DecryptionShare]) -> bool:
# If all guardian shares are represented including if necessary
# the missing guardians reconstructed shares, the decryption can be made
return len(shares) == self._context.number_of_guardians | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_secretbox_enc_dec(self):\n # Encrypt with sk\n encrypted_data = nacl.secretbox_encrypt(data=self.unencrypted_data, sk=self.sk)\n\n # Decrypt with sk\n decrypted_data = nacl.secretbox_decrypt(data=encrypted_data, sk=self.sk)\n\n self.assertEqual(self.unencrypted_data, dec... | [
"0.56343186",
"0.56059015",
"0.5477447",
"0.54217756",
"0.54182905",
"0.5349618",
"0.5291257",
"0.5261999",
"0.52376384",
"0.51962686",
"0.51201797",
"0.509338",
"0.50894034",
"0.50799906",
"0.5072686",
"0.5069901",
"0.5068569",
"0.5067548",
"0.5057558",
"0.50247896",
"0.5017... | 0.66120946 | 0 |
Filter a guardian pair and compensated share dictionary by missing guardian. | def _filter_by_missing_guardian(
missing_guardian_id: GuardianId,
shares: Dict[GuardianPair, CompensatedDecryptionShare],
) -> Dict[GuardianId, CompensatedDecryptionShare]:
missing_guardian_shares = {}
for pair, share in shares.items():
if pair.designated_id == missing_guardian_id:
m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_filters(self):\n hurst_cut = 0\n coint_cut = 0\n half_life_cut = 0\n mean_cross_cut = 0\n\n # Create an empty list for pairs that pass the filter tests\n validated_pairs = []\n\n # Create all the pairs combination\n self.create_pair_differences()\n\... | [
"0.5403923",
"0.5347828",
"0.5332941",
"0.52487034",
"0.51304084",
"0.51096004",
"0.4979036",
"0.49620378",
"0.4936935",
"0.48941308",
"0.4885121",
"0.4884207",
"0.48600337",
"0.48543844",
"0.48430184",
"0.48405266",
"0.48250377",
"0.47959116",
"0.47757033",
"0.4758606",
"0.4... | 0.7508135 | 0 |
get_next_meeting() should return a python dict containing the following information, so we are going to check typing. { | def test_get_next_meeting():
result = schedule.get_next_meeting()
if result:
assert result['name'], 'Result has no `name` key'
assert result['date'], 'Result has not `date` key'
assert isinstance(result['name'], str), 'name is not a string'
assert isinstance(result['date'], arr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_next_ops_meeting():\n result = schedule.get_next_workshop()\n\n if result:\n assert result['name'], 'Result has no `name` key'\n assert result['date'], 'Result has not `date` key'\n\n assert isinstance(result['name'], str), 'name is not a string'\n assert isinstance(r... | [
"0.6528609",
"0.64965373",
"0.63113266",
"0.627768",
"0.6159643",
"0.6095551",
"0.59491503",
"0.5851391",
"0.58473885",
"0.5841733",
"0.5751022",
"0.57394284",
"0.5716486",
"0.56968844",
"0.56885016",
"0.56862277",
"0.56724775",
"0.5643332",
"0.56225157",
"0.5588407",
"0.5579... | 0.8068841 | 0 |
get_next_workshop() should return a python dict containing the following information, so we are going to check typing. { | def test_get_next_workshop():
result = schedule.get_next_workshop()
if result:
assert result['name'], 'Result has no `name` key'
assert result['date'], 'Result has not `date` key'
assert isinstance(result['name'], str), 'name is not a string'
assert isinstance(result['date'], a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_next_ops_meeting():\n result = schedule.get_next_workshop()\n\n if result:\n assert result['name'], 'Result has no `name` key'\n assert result['date'], 'Result has not `date` key'\n\n assert isinstance(result['name'], str), 'name is not a string'\n assert isinstance(r... | [
"0.70488495",
"0.5373865",
"0.5300034",
"0.51691806",
"0.51220554",
"0.4980754",
"0.4958214",
"0.48949805",
"0.48891985",
"0.48357743",
"0.48293915",
"0.48100075",
"0.47971192",
"0.47934902",
"0.47770557",
"0.47695372",
"0.47581443",
"0.47351307",
"0.4722332",
"0.47192368",
"... | 0.76277643 | 0 |
get_next_ops_meeting() should return a python dict containing the following information, so we are going to check typing. { | def test_get_next_ops_meeting():
result = schedule.get_next_workshop()
if result:
assert result['name'], 'Result has no `name` key'
assert result['date'], 'Result has not `date` key'
assert isinstance(result['name'], str), 'name is not a string'
assert isinstance(result['date']... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_next_meeting():\n result = schedule.get_next_meeting()\n\n if result:\n assert result['name'], 'Result has no `name` key'\n assert result['date'], 'Result has not `date` key'\n\n assert isinstance(result['name'], str), 'name is not a string'\n assert isinstance(result... | [
"0.66778857",
"0.61756045",
"0.5670221",
"0.56656975",
"0.5562138",
"0.5516637",
"0.5442413",
"0.5329534",
"0.5278533",
"0.5265692",
"0.5200957",
"0.5190491",
"0.5150237",
"0.5060852",
"0.502878",
"0.5007175",
"0.5005524",
"0.5000527",
"0.4918529",
"0.491221",
"0.4905834",
... | 0.75000304 | 0 |
get_next_competition() should return a python dict containing the following information, so we are going to check typing. { | def test_get_next_competition():
result = schedule.get_next_competition()
if result:
assert result['name'], 'Result has no `name` key'
assert result['date'], 'Result has not `date` key'
assert isinstance(result['name'], str), 'name is not a string'
assert isinstance(result['dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_next_match() -> Optional[MatchDict]:\n future_matches = Match.objects.filter(start_date_time__gt=timezone.now())\n\n if not any(future_matches):\n return None\n\n next_match = min(future_matches, key=lambda match: match.start_date_time)\n\n return {\n \"round_number\": next_matc... | [
"0.58795726",
"0.5813351",
"0.567814",
"0.55751944",
"0.55295223",
"0.53337306",
"0.53263855",
"0.5275608",
"0.5257976",
"0.5209702",
"0.5203406",
"0.5195369",
"0.5123675",
"0.5102984",
"0.50791115",
"0.5078988",
"0.507492",
"0.5061527",
"0.503499",
"0.5033235",
"0.5021887",
... | 0.76119816 | 0 |
use current scores of prediction to build curriculum mask | def build_curriculum(scores):
def do_one_row(row):
failed_once = False
for i, _ in enumerate(row):
if failed_once:
row[i] = 0
else:
if row[i] == 0:
row[i] = 1
failed_once = True
return row
tmp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prediction(self, v, imu_meas):\n # YOUR CODE HERE\n pass",
"def do_score_prediction(self):\n \n import iread.myio as mio\n from igui.score_canvas import ScoreCanvas\n exp_name = 'JPS_act_12_exp_4_accv_half_fc_j2'\n exp_name_base = 'ASM_act_12_exp_4'\n e... | [
"0.5994062",
"0.5990929",
"0.5910665",
"0.5848057",
"0.5788003",
"0.5786512",
"0.5734946",
"0.5715456",
"0.56456816",
"0.5630873",
"0.56003684",
"0.5597325",
"0.558995",
"0.557334",
"0.557334",
"0.557334",
"0.55621594",
"0.55452883",
"0.5543184",
"0.5534124",
"0.55177015",
... | 0.60258317 | 0 |
Store kwargs with whitelisted prefixes into this objects attributes. Raises an exception if one of the kwargs does not match a whiltelisted prefix. | def _store_kwargs(self, kwargs, allowed_prefixes):
def starts_with_legal_prefix(key):
for prefix in allowed_prefixes:
if key.startswith(prefix):
return True
return False
for key in kwargs.keys():
if not starts_with_legal_prefix(ke... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_prefix_kwargs(self, **kwargs):\n self._prefix_kwargs = kwargs",
"def set_prefix_arg(self, name, value):\n self._prefix_kwargs[name] = value",
"def update_from_kwargs(self, **kwargs):\n for (key, value) in kwargs.items():\n setattr(self, key, value)",
"def update(self, ... | [
"0.7138325",
"0.61355644",
"0.60685027",
"0.6023339",
"0.59003156",
"0.5698617",
"0.56504256",
"0.5593253",
"0.55829763",
"0.5553449",
"0.5549372",
"0.553346",
"0.54904735",
"0.54254025",
"0.5405928",
"0.5404934",
"0.53550386",
"0.53378785",
"0.53103906",
"0.52765805",
"0.526... | 0.7890116 | 0 |
Return all attributes of this class that start with a given prefix. The prefix is stripped in the result. This can be used to pass on some parameters to subclasses. | def _get_prefix_attributes(self, prefix):
return filter_dict_by_prefix(self.__dict__, prefix) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAttrPrefix(self, *args):\n return _libsbml.XMLToken_getAttrPrefix(self, *args)",
"def IncludePrefixAttrFlags(self):\r\n\t\treturn self._get_attribute('includePrefixAttrFlags')",
"def filter_dict_keystartswith(d, prefix):\n if d is None or isinstance(d, Undefined):\n return d\n\n if s... | [
"0.6526852",
"0.63475186",
"0.6125797",
"0.6076561",
"0.60585827",
"0.5996724",
"0.59167784",
"0.5860703",
"0.5788038",
"0.5702385",
"0.5688546",
"0.5686831",
"0.56714374",
"0.56254977",
"0.56164616",
"0.55917287",
"0.5570727",
"0.5553501",
"0.55194885",
"0.5506681",
"0.54737... | 0.78922427 | 0 |
Return extra parameters that should be passed to the module. You should take care to update the dictionary from the ``super`` implementation when overriding this function. You usually do not want to just discard the parameters that are specified by the super class. | def _get_extra_module_parameters(self):
return {"n_features": self.n_features_} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_request_extra_params(self, **kwargs):\n params = self.request_extra_params.copy()\n params.update(kwargs)\n return params",
"def getInitParams(self):\n paramDict = super().getInitParams()\n paramDict['p'] = self.p\n return paramDict",
"def get_params_for(self, prefix):\n ... | [
"0.72225326",
"0.6738379",
"0.6639496",
"0.663513",
"0.66014963",
"0.6593481",
"0.65483326",
"0.6542321",
"0.641646",
"0.63848907",
"0.6290378",
"0.62710214",
"0.6264966",
"0.6259236",
"0.6258083",
"0.62551636",
"0.62512887",
"0.6250752",
"0.6243539",
"0.6239338",
"0.62246126... | 0.7728107 | 0 |
Fit the estimator to data. This derives the number of object features from the data and then delegates to ``skorch.NeuralNet.fit``. See the documentation of that method for more details. | def fit(self, X, y=None, **fit_params):
dataset = self.get_dataset(X, y)
(_n_objects, self.n_features_) = dataset[0][0].shape
NeuralNet.fit(self, X=dataset, y=None, **fit_params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit(self, data):\n for v in self.features + self.targets:\n v._fit(data)",
"def fit(self, data):\n raise NotImplementedError(\"To be implemented in sub classes\")",
"def fit(self, X, y=None):\n # train on a training dataset\n self.logger.info(\n self.__name... | [
"0.7448496",
"0.73575133",
"0.7276809",
"0.72096294",
"0.71057993",
"0.70217955",
"0.7019076",
"0.69627523",
"0.69032884",
"0.6843155",
"0.68191653",
"0.681908",
"0.6817422",
"0.678813",
"0.67774725",
"0.67704254",
"0.6769305",
"0.67660964",
"0.67437035",
"0.6727992",
"0.6724... | 0.7426734 | 1 |
Filter columns in a tiny demo maf file | def test_filter_maf_file_cols(self):
maf_lines = [
['# comment 1'], # keep the comments
['# comment 2'],
['Hugo_Symbol', 'foo_value'], # foo_value column should be removed in output
['SUFU', '1'],
['GOT1', '2']
]
# run the script in a t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_filter_maf_file_cols_full(self):\n input_maf = os.path.join(DATA_SETS['Proj_08390_G']['MAF_DIR'], \"Sample1.Sample2.muts.maf\")\n\n with TemporaryDirectory() as tmpdir:\n input_json = {\n \"input_file\": {\n \"class\": \"File\",\n ... | [
"0.70876586",
"0.6242077",
"0.6210688",
"0.60806924",
"0.6003827",
"0.59954894",
"0.59101397",
"0.5891553",
"0.580093",
"0.57767576",
"0.57638955",
"0.5742314",
"0.5735339",
"0.5715693",
"0.57080173",
"0.5686506",
"0.56692064",
"0.564156",
"0.55887085",
"0.556586",
"0.5565069... | 0.7424854 | 0 |
Pickle data into file specified by filename. | def pickle(self,data,filename):
pickle.dump(data, open(filename, 'wb')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pickle_data(file_name, data):\n outfile = open(file_name, \"wb\")\n pickle.dump(data, outfile)\n outfile.close()",
"def pickle_data(filename, data):\n f = open(filename, \"wb\")\n pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)\n f.close()",
"def writePickle(self, filename):\n \n ... | [
"0.7725018",
"0.77053714",
"0.7507553",
"0.7489552",
"0.7476277",
"0.72783107",
"0.7160356",
"0.7134052",
"0.71158904",
"0.7089142",
"0.705694",
"0.703817",
"0.70282966",
"0.7015688",
"0.6977804",
"0.6972579",
"0.6957131",
"0.69528663",
"0.69492054",
"0.69443244",
"0.69185305... | 0.7732322 | 0 |
This method handles the initial setup of the agent to populate useful fields (such as what team we're on). A distanceCalculator instance caches the maze distances | def registerInitialState(self, gameState):
'''
Make sure you do not delete the following line. If you would like to
use Manhattan distances instead of maze distances in order to save
on initialization time, please take a look at
CaptureAgent.registerInitialState in captureAgents.py.
'''
self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def agent_init(self, agent_info):\n\n # First, we get the relevant information from agent_info \n # NOTE: we use np.random.RandomState(seed) to set the two different RNGs\n # for the planner and the rest of the code\n try:\n self.num_states = agent_info[\"num_states\"]\n ... | [
"0.677597",
"0.67422235",
"0.67121243",
"0.67107016",
"0.669828",
"0.6683791",
"0.6667049",
"0.6592061",
"0.6482256",
"0.6382768",
"0.62888527",
"0.62276787",
"0.6142589",
"0.6051486",
"0.6007251",
"0.5977527",
"0.596086",
"0.59469754",
"0.5945899",
"0.5943422",
"0.5932745",
... | 0.68589115 | 0 |
Replace 0's with 1 in positions of a bow dataframe to indicate that feature words are present in docs | def get_bow_dummies(self):
# Get an np matrix of zeros based on defined dim
zero_matrix = np.zeros(self.dim, np.int)
# Create a dataframe containing feature columns and 0's
zero_df = pd.DataFrame(zero_matrix, columns=self.features)
# Get a dictionary of index and features per ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lexicon_features(tokens, feats):\n# feats['neg_words'] = 0;\n# feats['pos_words'] = 0;\n# tokens = list([token.lower() for token in tokens])\n# feats['neg_words'] , feats['pos_words'] = np.count_nonzero(np.in1d(tokens, list(neg_words))), np.count_nonzero(np.in1d(tokens, list(pos_words)))\n n... | [
"0.6193716",
"0.6090465",
"0.59765124",
"0.59298915",
"0.59109485",
"0.58260477",
"0.58246064",
"0.5766537",
"0.5717991",
"0.5673746",
"0.56318784",
"0.55915904",
"0.5572817",
"0.555939",
"0.551199",
"0.5507517",
"0.5443707",
"0.5424428",
"0.54079854",
"0.53460324",
"0.534468... | 0.7016559 | 0 |
Remove agent from all environments and the model. | def delete(self):
self.model.remove_agents(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_agents(self, agents):\n for agent in list(make_list(agents)): # Soft copy as list is changed\n self._agents.remove(agent)\n agent.envs.remove(self)",
"def remove_agent(self):\n self.model.grid.remove_agent(self)\n self.model.schedule.remove(self)\n\n ... | [
"0.7754968",
"0.73393387",
"0.70831853",
"0.6764686",
"0.64536893",
"0.6403118",
"0.63056463",
"0.62893045",
"0.62893045",
"0.6246913",
"0.6222241",
"0.61733896",
"0.6144004",
"0.6129344",
"0.60065496",
"0.599283",
"0.5895316",
"0.58572364",
"0.58316344",
"0.58168846",
"0.578... | 0.75389045 | 1 |
Returns the agents' position from a spatial environment. | def position(self, env=None):
# TODO make position explicit 'position' for custom subclasses
env = self._find_env(env)
return env._agent_dict[self] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_agent_position(agent):\n pos = Vector2()\n pos.x = agent.pose.pose.position.x\n pos.y = agent.pose.pose.position.y\n return pos",
"def current_agent_position(self):\n return self.environment.current_agent_position",
"def get_position(self):\n ret = _pal.Vec3()\n _pal.li... | [
"0.7178856",
"0.6455099",
"0.584837",
"0.57384",
"0.57220656",
"0.5718657",
"0.5666183",
"0.5657211",
"0.56224465",
"0.56182814",
"0.5593324",
"0.55888134",
"0.5569933",
"0.5548484",
"0.55458045",
"0.5535166",
"0.5527065",
"0.5527065",
"0.5479049",
"0.5477238",
"0.5462611",
... | 0.65256304 | 1 |
Changes the agents' location in the selected environment. | def move_to(self, position, env=None):
env = self._find_env(env)
env.move_agent(self, position) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enter(self, env):\n env = self._find_env(env, new=True)\n env.add_agents(self)",
"def updateOmLocation(self):\n if self.om != None:\n self.om.current_loc = self.destinations[self.current_loc]",
"def set_defaults(self, agents):\n for a in agents:\n for k, v ... | [
"0.60086066",
"0.5679868",
"0.56625754",
"0.5617965",
"0.5574174",
"0.5542139",
"0.5526364",
"0.5511238",
"0.54692477",
"0.54643834",
"0.54403913",
"0.54335123",
"0.54307103",
"0.5408257",
"0.54040915",
"0.53924036",
"0.538678",
"0.5356103",
"0.534429",
"0.53241855",
"0.53065... | 0.5728405 | 1 |
Returns the agents' neighbors from its environments. | def neighbors(self, env=None, distance=1, **kwargs):
if env:
if isinstance(env, (list, tuple)):
envs = [self._find_env(en) for en in env]
else:
return self._find_env(env).neighbors(
self, distance=distance, **kwargs)
elif len(se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neighbors(self):\n return self._neighbors",
"def get_neighbors(self):\n return self.neighbors",
"def get_neighbors(self):\n return self.neighbors",
"def get_neighbors(self):\n return self.neighbors",
"def get_neighbors(self):\n return self.neighbors",
"def neighbors... | [
"0.7029478",
"0.69849086",
"0.69849086",
"0.69849086",
"0.69849086",
"0.6956161",
"0.6903547",
"0.6894783",
"0.67666906",
"0.6735697",
"0.6616413",
"0.6603485",
"0.65937454",
"0.6580956",
"0.65605927",
"0.6545098",
"0.6528773",
"0.6499415",
"0.6493673",
"0.6465558",
"0.634310... | 0.7019928 | 1 |
Adds agent to chosen environment. | def enter(self, env):
env = self._find_env(env, new=True)
env.add_agents(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_agent(self, environment_name, agent_name, agent_params):\n assert environment_name in self._environment_dict\n assert self._is_sweep is False or self._is_sweep is None\n self._is_sweep = False\n if agent_name in self._experiment_structure[environment_name]:\n raise At... | [
"0.73459333",
"0.69760495",
"0.6796307",
"0.6764443",
"0.67602885",
"0.6644225",
"0.66354024",
"0.64828455",
"0.6430813",
"0.6345899",
"0.6332545",
"0.6269571",
"0.6191697",
"0.5997349",
"0.59824824",
"0.5928395",
"0.58836985",
"0.58690846",
"0.5824172",
"0.5824085",
"0.57876... | 0.78915524 | 0 |
Removes agent from chosen environment. | def exit(self, env=None):
env = self._find_env(env)
env.remove_agents(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_agent(self, agent):\r\n return self.delete(self.agent_path % (agent))",
"def remove_agent(self):\n self.model.grid.remove_agent(self)\n self.model.schedule.remove(self)\n\n if self.agent_type == \"zombie\":\n self.model.infected -= 1\n elif self.agent_type... | [
"0.73224205",
"0.7211765",
"0.70782363",
"0.687923",
"0.6671557",
"0.63887864",
"0.62581664",
"0.61828506",
"0.61828506",
"0.61655545",
"0.61655545",
"0.612822",
"0.61228126",
"0.60835063",
"0.607442",
"0.60683966",
"0.60418147",
"0.6041678",
"0.593666",
"0.59155047",
"0.5895... | 0.77178913 | 0 |
Removes agents from the environment. | def remove_agents(self, agents):
for agent in list(make_list(agents)): # Soft copy as list is changed
self._agents.remove(agent)
agent.envs.remove(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self):\n self.model.remove_agents(self)",
"def exit(self, env=None):\n env = self._find_env(env)\n env.remove_agents(self)",
"def clear_agents(self):\n self.set(\"manager_agents\", {})\n self.set(\"transport_agents\", {})\n self.set(\"customer_agents\", {})\... | [
"0.7193147",
"0.7129347",
"0.6853051",
"0.66652393",
"0.66469735",
"0.65851957",
"0.656021",
"0.6533567",
"0.6510845",
"0.64831793",
"0.64831793",
"0.6430432",
"0.6383889",
"0.6353851",
"0.61463517",
"0.6134728",
"0.5980101",
"0.59225184",
"0.5900449",
"0.58824635",
"0.577424... | 0.8335762 | 0 |
Stops kernel and saves fundamental series to disk. | def kernelStopping(self):
# Always call parent method to be safe.
super().kernelStopping()
self.writeFundamental() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def TF_stopSweep(self):\n self.write(self.headStr('TF')+'TSTO')",
"def stop_step_sweep(self):\n self.write(\":SOUR:SWE:CONT:STAT OFF\")",
"def shutdown_kernel(self, now=False, restart=False):",
"def shutdown_kernel(self, now=False, restart=False):\n pass",
"def handle_stop(self):\n ... | [
"0.62382",
"0.61772066",
"0.6124827",
"0.5994076",
"0.58247674",
"0.58016104",
"0.57997113",
"0.5710244",
"0.56807035",
"0.5679342",
"0.565212",
"0.5513354",
"0.5454175",
"0.5417619",
"0.5408867",
"0.54048616",
"0.54048616",
"0.54048616",
"0.54048616",
"0.53805715",
"0.534413... | 0.70397437 | 0 |
Saves the fundamental value at self.currentTime to self.fundamental_series. | def measureFundamental(self):
obs_t = self.oracle.observePrice(self.symbol, self.currentTime, sigma_n=0)
self.fundamental_series.append({'FundamentalTime': self.currentTime, 'FundamentalValue': obs_t}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def writeFundamental(self):\n dfFund = pd.DataFrame(self.fundamental_series)\n dfFund.set_index('FundamentalTime', inplace=True)\n self.writeLog(dfFund, filename='fundamental_{symbol}_freq_{self.log_frequency}_ns'.format(self.symbol))\n\n print(\"Noise-free fundamental archival complete... | [
"0.72861224",
"0.49987587",
"0.4934618",
"0.4867984",
"0.48467526",
"0.47894397",
"0.47344294",
"0.47098976",
"0.47027668",
"0.46998316",
"0.4699296",
"0.46812695",
"0.46758923",
"0.46737683",
"0.46582603",
"0.46429592",
"0.46414623",
"0.4639165",
"0.46307817",
"0.46080744",
... | 0.6925588 | 1 |
Logs fundamental series to file. | def writeFundamental(self):
dfFund = pd.DataFrame(self.fundamental_series)
dfFund.set_index('FundamentalTime', inplace=True)
self.writeLog(dfFund, filename='fundamental_{symbol}_freq_{self.log_frequency}_ns'.format(self.symbol))
print("Noise-free fundamental archival complete.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logging_data(self):\n with open('sensor_data.log','w') as f:\n json.dump(self.read_continuous_data, f)",
"def data_log(self, file, spectra):\n if self.datalogflag:\n with open(file, 'a') as f:\n f.write('{0}, '.format(spectra))\n self.vprint(\... | [
"0.6402071",
"0.6369348",
"0.62639683",
"0.6185865",
"0.61254305",
"0.5977901",
"0.59585434",
"0.59228444",
"0.582202",
"0.57454675",
"0.56636196",
"0.5652068",
"0.5603465",
"0.5561641",
"0.5550956",
"0.55456173",
"0.5535323",
"0.55184317",
"0.5496816",
"0.5488238",
"0.548631... | 0.72034466 | 0 |
select(self, str) > str select(self, QUrl) > QUrl | def select(self, *__args): # real signature unknown; restored from __doc__ with multiple overloads
return "" or QUrl | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select(self, target):",
"def select(self, value) -> str:",
"def select(*args):",
"def select(*args):",
"def select(self):\r\n pass",
"def select(self):\n pass",
"def select(self):\n pass",
"def select(self,item):\r\n pass",
"def select(self):\n return",
"def... | [
"0.66250885",
"0.6428183",
"0.61227095",
"0.61227095",
"0.6083189",
"0.60714597",
"0.60714597",
"0.58745044",
"0.58118147",
"0.5801934",
"0.56114453",
"0.5566933",
"0.5518062",
"0.5432632",
"0.5428894",
"0.5407526",
"0.53446746",
"0.53292155",
"0.5282172",
"0.5264228",
"0.522... | 0.8112707 | 0 |
Checks if the game has been stuck (likely waiting to snap) for too long. If it has, press buttons to try to remedy this. | def checkStuck(stuckCount, pi):
if stuckCount > 2000:
# Execute button presses for high count
pi.send("Press A")
time.sleep(1)
pi.send("Press A")
time.sleep(2)
pi.send("Press A")
time.sleep(2)
# Reset the count to 0
return 0
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_retry_button(self, mouse_position):\n\t\tif self.gameover_images.retry_rect.collidepoint(mouse_position):\n\t\t\tself._reset_game()",
"def __timeout():\n global left_click_count, right_click_count\n\n if left_click_count >= right_click_count:\n if left_click_count == 1:\n ... | [
"0.65083414",
"0.6323192",
"0.63135475",
"0.60910714",
"0.6072648",
"0.600257",
"0.5975841",
"0.59192103",
"0.58566946",
"0.5850343",
"0.5836084",
"0.5827104",
"0.5818864",
"0.5801829",
"0.57996064",
"0.5792116",
"0.5782072",
"0.5773278",
"0.57663023",
"0.5761089",
"0.5759283... | 0.6345797 | 1 |
Creates a new knowledge entry. | def create(self, request):
if not hasattr(request, "data"):
request.data = request.POST
attrs = self.flatten_dict(request.data)
if not attrs.get('include_answer_page', None):
if 'answer_page_title' in attrs:
del attrs['answer_page_title']
if 'a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_entry(entry):\n Entry.create(**entry)\n return entry",
"def create_entry(cls, title, date, timeSpent, learned, resources):\n try:\n with DATABASE.transaction():\n cls.create(\n title=title,\n date=date,\n t... | [
"0.696124",
"0.67034054",
"0.66450465",
"0.63034475",
"0.62865496",
"0.6285667",
"0.62842464",
"0.62708634",
"0.6113546",
"0.6113546",
"0.6082992",
"0.6082992",
"0.6082992",
"0.60465604",
"0.6033027",
"0.60269064",
"0.6025811",
"0.6024235",
"0.6017848",
"0.59683245",
"0.59347... | 0.7331579 | 0 |
Partition of all values of `dimension` within `processes` | def partition(self, dimension, processes=None):
if processes:
q = (self._table.source.isin(processes) |
self._table.target.isin(processes))
values = self._table.loc[q, dimension].unique()
else:
values = self._table[dimension].unique()
return P... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nextDim(leaf, args):\n x = args['xsectionNum'] # number of subregions to partition for the leaf\n lb = leaf.lb # the lower bound of the leaf region\n ub = leaf.ub # the upper bound of the leaf region\n dimDiff = [] # store the diff value (e.g. max-min of dominantion count) for partition direction\n... | [
"0.6025621",
"0.5965202",
"0.5953877",
"0.5846123",
"0.58169276",
"0.58146",
"0.58093596",
"0.5777168",
"0.57228017",
"0.5683432",
"0.56505716",
"0.5645078",
"0.5593758",
"0.55668724",
"0.5530278",
"0.552402",
"0.5491814",
"0.54625183",
"0.5440648",
"0.5436604",
"0.5412756",
... | 0.70216995 | 0 |
Filter flows according to source_query, target_query, and flow_query. | def find_flows(flows,
source_query,
target_query,
flow_query=None,
ignore_edges=None):
if flow_query is not None:
flows = flows[eval_selection(flows, '', flow_query)]
if source_query is None and target_query is None:
raise ValueError('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute(self, flow_name, flow_arguments):\n for node_args in flow_arguments:\n if self.is_filter_query(node_args):\n for args in self.expand_filter_query(node_args):\n self.run_selinon_flow(flow_name, args)\n else:\n self.run_selinon... | [
"0.62893045",
"0.6024867",
"0.5824675",
"0.57540625",
"0.5578752",
"0.5558207",
"0.54998183",
"0.5492314",
"0.5435266",
"0.5421805",
"0.54080075",
"0.53399783",
"0.5299413",
"0.52574927",
"0.52539027",
"0.52310663",
"0.52191806",
"0.5180811",
"0.51780427",
"0.5109459",
"0.509... | 0.668801 | 0 |
Sets the values for each of the limb properties in the arguments list with a nonNone value. Returns this instance for method chaining | def assign(self, *args, **kwargs) -> 'Property':
for i in range(len(args)):
value = args[i]
if value is not None:
self.set(KEYS[i], value)
for short_key, long_key in LIMB_KEY_LOOKUP.items():
if short_key in kwargs and kwargs[short_key] is not None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, **attributes):\n self.set(**attributes)",
"def __init__(self, **kwargs):\n for key, value in kwargs.items():\n setattr(self, key, value)",
"def __init__(self, **kwargs):\n for key, val in kwargs.items():\n setattr(self, key, val)",
"def __init__(s... | [
"0.5855768",
"0.5669473",
"0.56427574",
"0.56427574",
"0.56427574",
"0.56169534",
"0.5615797",
"0.5609915",
"0.56035763",
"0.55986816",
"0.5595448",
"0.5577335",
"0.555102",
"0.55415136",
"0.5473085",
"0.5448137",
"0.5444671",
"0.54238045",
"0.541315",
"0.5404101",
"0.5393153... | 0.6664248 | 0 |
Values for each limb as a tuple containing the limbordered values of the Property | def values(self) -> tuple:
return (
self.left_pes,
self.right_pes,
self.left_manus,
self.right_manus
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _prop(self):\n return [\"%s = %s\" % (str(k), repr(v)) for k, v in self.prop.items()]",
"def items(self) -> tuple[tuple[Any, Any], ...]: # type: ignore\n return tuple(zip(self.keys(), self.values()))",
"def items(self):\n return [ (x, self[x]) for x in self ]",
"def items(self):\n\t\... | [
"0.62416136",
"0.61453134",
"0.61155087",
"0.6104317",
"0.60388017",
"0.60388017",
"0.6024878",
"0.59592485",
"0.59587896",
"0.5956599",
"0.5955489",
"0.59125787",
"0.58902466",
"0.5861265",
"0.5860886",
"0.582928",
"0.5828372",
"0.5807802",
"0.57654744",
"0.57640326",
"0.573... | 0.6429419 | 0 |
Returns a deep copy of the Property instance. The clone attempts to | def clone(self):
def deep_copy(value):
try:
if hasattr(value, 'clone'):
value.clone()
except Exception:
pass
try:
json.loads(json.dumps(value))
except Exception:
pass
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clone(self):\n clone = super(Property, self).clone()\n clone.fget = self.fget\n clone.fset = self.fset\n clone.cached = self.cached\n return clone",
"def copy(self):\n return properties.copy(self)",
"def clone(self):\n return _libsbml.ConversionProperties_cl... | [
"0.8501719",
"0.7826852",
"0.7311905",
"0.7284388",
"0.7240796",
"0.72003424",
"0.72003424",
"0.72003424",
"0.72003424",
"0.71516335",
"0.71035564",
"0.706953",
"0.7067994",
"0.7059914",
"0.6995763",
"0.6975141",
"0.6956973",
"0.6949359",
"0.6930484",
"0.68937236",
"0.688537"... | 0.8122834 | 1 |
Create the organized store with items arranged by aisle uses a single list and a dictionary Assuming N items in inventory and G items in grocery_list Students don't implement it this way, I was having fun seeing how concise I could be (at the expense of understandability and efficiency) | def organize(inventory, grocery_list, exists=set()):
lst = sorted(inventory, key=lambda x : x.aisle) #sort by aisle - O(N*logN)
aisles = [[] for y in lst if not exist_test(y.aisle, exists)] #create unique aisles only - O(N)
[aisles[y.aisle].append(y.grocery) for y in lst if y.grocery in grocery_list] #append groc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fancy_inventory_menu_items(life, show_equipped=True, show_containers=True, check_hands=False, matches=None):\n\t_inventory = []\n\t_inventory_items = 0\n\t_equipped_items = []\n\t_storage = {}\n\t\n\t#TODO: Time it would take to remove\n\tfor item_uid in life['inventory']:\n\t\tif show_equipped and item_is... | [
"0.6024047",
"0.5998682",
"0.5844901",
"0.5823991",
"0.56893134",
"0.5671859",
"0.55562484",
"0.5544263",
"0.5521425",
"0.5519689",
"0.5516972",
"0.5503798",
"0.54968417",
"0.54603326",
"0.5442683",
"0.5417788",
"0.5361586",
"0.5347583",
"0.53425723",
"0.5332526",
"0.5311254"... | 0.7104384 | 0 |
Returns a counter for all words in text. | def calculate_word_counts(text : Text)->Counter:
return Counter(tokenized_text(text)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_frequency(text):\n tokenizer = RegexpTokenizer(r'\\w+')\n tokens = tokenizer.tokenize(text)\n\n stop = set(stopwords.words('english'))\n tokens_without_stop = list(filter(lambda word: word.lower() not in stop, tokens))\n\n counts = Counter(tokens_without_stop)\n return counts",
"def wo... | [
"0.7879231",
"0.78658694",
"0.7828767",
"0.7735943",
"0.7562047",
"0.744783",
"0.74219364",
"0.7376352",
"0.735183",
"0.73507684",
"0.73184025",
"0.7299541",
"0.72456384",
"0.7221137",
"0.71881765",
"0.71629065",
"0.7149923",
"0.71411467",
"0.7109756",
"0.71067274",
"0.705446... | 0.84571725 | 0 |
Append a highscore to the list. | def appendScore(self, l):
score = Highscore(l[0], l[1])
self.scores.append(score) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_highscores(self):\n for i in range(len(self.highscores)):\n if self.score >= self.highscores[i]:\n self.highscores.insert(i, self.score)\n self.highscores.pop()\n break",
"def add_score(self, score):\n self._score += score",
"def ... | [
"0.74607056",
"0.7082559",
"0.67810464",
"0.67633176",
"0.66728705",
"0.64518374",
"0.62539417",
"0.62394863",
"0.6221508",
"0.6204827",
"0.6165038",
"0.6164946",
"0.6009481",
"0.59516245",
"0.59332067",
"0.5908806",
"0.59031516",
"0.5875213",
"0.5866701",
"0.58632696",
"0.58... | 0.83297217 | 0 |
Get the next highest highscore. Return it and delete it. | def getNextHighest(self):
maxScore = -1
idx = -1
for i, s in enumerate(self.scores):
if s.score > maxScore:
maxScore = s.score
idx = i
if idx != -1:
score = self.scores[idx]
del self.scores[idx]
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getHighScore(self):\n return max(self.scores)",
"def delete_max(self):\n max_val = self.peek_max()\n self.remove(max_val)\n return max_val",
"def get_high_score(self) -> float:\n return max(self._scores)",
"def get_highscore(self, score):\n scores = list(self.his... | [
"0.6998314",
"0.67851394",
"0.67692834",
"0.6668684",
"0.6623253",
"0.66182697",
"0.6566713",
"0.64252454",
"0.64252454",
"0.63730615",
"0.63553375",
"0.6247833",
"0.6235075",
"0.62325394",
"0.6220239",
"0.61793685",
"0.61691946",
"0.6156437",
"0.61210656",
"0.611256",
"0.609... | 0.81896377 | 0 |
Check if a score is high enough to be a highscore. | def isHighscore(self, score):
score = float(score)
if len(self.scores) < 10:
return True
lowest = float('inf')
for s in self.scores:
if s.score < lowest:
lowest = s.score
if score > lowest:
return True
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_high_score(self):\r\n if self.stats.score > self.stats.high_score:\r\n self.stats.high_score = self.stats.score\r\n self.prep_placar_score()",
"def check_high_score(stats, sb):\n if stats.score > stats.score:\n stats.high_score = stats.score\n sb.prep_high_... | [
"0.80717355",
"0.7789533",
"0.77738774",
"0.7773866",
"0.77672184",
"0.7757459",
"0.7635478",
"0.74855393",
"0.74152017",
"0.73769057",
"0.7176191",
"0.7096997",
"0.6666334",
"0.6586911",
"0.65854007",
"0.6573403",
"0.6522357",
"0.6514888",
"0.6482681",
"0.647976",
"0.6457664... | 0.8462402 | 0 |
Extract subjects urls from material pages. | def get_subjects_urls(self, subjects: Iterable[Subject]) -> List[str]:
self.logger.debug('Finding subjects urls.')
all_rows = self.browser.find_elements(*MaterialLocators.SUBJECT_ROW)
subjects = {(s.name.strip('. '), s.teacher.strip('. ')) for s in subjects}
subjects_urls = []
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_subjects_IOP_urls(url):\n # f = open(\"test.txt\", 'a+')\n body = getBody(url)\n\n html = soup(body,'html.parser')\n # print(html.original_encoding)\n div_content = html.find(id=\"content\")\n a_elems = div_content.find_all(\"a\", recursive=True, class_=\"entry-image-post-link\".encode('u... | [
"0.7316392",
"0.6313647",
"0.6124323",
"0.5874127",
"0.57900333",
"0.57490724",
"0.56303227",
"0.5598472",
"0.5589499",
"0.5502921",
"0.5496128",
"0.5460721",
"0.5385773",
"0.5371926",
"0.5350714",
"0.5315594",
"0.52851754",
"0.52603555",
"0.52437526",
"0.5241985",
"0.5223538... | 0.72147644 | 1 |
extract appname. if appLaunch field does not exist, skip that log but such a log is few like 0.0...01 %. | def _extract_appname(self, log):
appname = ""
if "appLaunch" in log:
appname = log["appLaunch"]["appName"]
else:
self.logger.info("no applaunch field")
self.logger.info(log["event"])
pass
return appname | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verbose_app_label(request):\n # import ipdb; ipdb.set_trace()\n \n # iterate through the app_list looking for a corresponding app with\n # a VERBOSE_APP_LABEL\n \n return {}",
"def _get_app_name(app):\n return app[APP_NAME_KEY]",
"def get_launch_name():\n\n if product_type == \"RHEL... | [
"0.5544456",
"0.54850507",
"0.5392244",
"0.532039",
"0.5250946",
"0.516634",
"0.5131515",
"0.51258844",
"0.5102148",
"0.50964046",
"0.50677574",
"0.50670105",
"0.5022448",
"0.501299",
"0.5001425",
"0.4900312",
"0.48944706",
"0.48849887",
"0.4863119",
"0.48554236",
"0.48482254... | 0.7711044 | 0 |
extract location info. if location field does not exist, (x,y,x) = (0,0,0) | def _extract_location_xyz(self, log):
if "location" in log:
x = log["location"]["latitude"]
y = log["location"]["longitude"]
z = log["location"]["altitude"]
else:
self.logger.debug("NaN case")
x = "NaN" # matlab Nan?
y = "NaN"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_location(self):\r\n return self.__x, self.__y",
"def extract_raw_simple_coordinates (raw_location):\n pattern = re.compile('(\\d+).(\\d+)?')\n x_result = pattern.match(str(raw_location[0]))\n y_result = pattern.match(str(raw_location[1]))\n return int(x_result[1]), int(y_result[1])",
... | [
"0.66463894",
"0.66299003",
"0.6430245",
"0.64059323",
"0.6361868",
"0.63144076",
"0.6281744",
"0.620699",
"0.6198024",
"0.6151657",
"0.611759",
"0.6094381",
"0.60920113",
"0.60854155",
"0.60774463",
"0.6064603",
"0.606397",
"0.60458744",
"0.6043754",
"0.6019512",
"0.6017592"... | 0.6918449 | 0 |
convert ${unix time}${millisecond} to periodic information on a weekly basis. return as string as format x,y | def _convert_timestamp_2_periodic_time(self, timestamp):
l = ""
# daily periodic
theta = self.two_pi_by_one_day_second * (int(timestamp[0:-3]) % self.one_day_second)
#x = 1 + np.cos(theta)
#y = 1 + np.sin(theta)
x = np.cos(theta)
y = np.sin(theta)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weekly():",
"def hourly(x):\n ann_salary = x * 40.0 * 52.0 #assumes 40 hours a week and 52 weeks in a year\n print(f\"The anual salary is ${ann_salary:,.2f}\")",
"def make_it_rw(time_stamp):\r\n seconds, milliseconds = divmod(int(time_stamp), 1000)\r\n minutes, seconds = divmod(seconds, 60)\r\n... | [
"0.61428905",
"0.58600867",
"0.57288903",
"0.56614155",
"0.5612752",
"0.54856414",
"0.5455284",
"0.54463637",
"0.54392874",
"0.5411659",
"0.5392435",
"0.53486353",
"0.53324914",
"0.53050107",
"0.53046787",
"0.5304025",
"0.52993816",
"0.5284498",
"0.5279005",
"0.52619976",
"0.... | 0.6399934 | 0 |
Some tablenames are forbidden because they're reserved words in the database, and can potentially cause issues. | def test_protected_table_names(self):
with self.assertRaises(ValueError):
class User(Table):
pass
with self.assertRaises(ValueError):
class MyUser(Table, tablename="user"):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTableByName(self, tablename):\n pass",
"def table_name() -> str:\n pass",
"def test_table_name(self):\n with self.assertRaises(IncompetentQiitaDeveloperError):\n MetadataTemplate._table_name(self.study)",
"def _table_name(self, name: AnyStr) -> bytes:\n name = en... | [
"0.6751934",
"0.66491693",
"0.65195495",
"0.6376159",
"0.63688517",
"0.6362305",
"0.63127697",
"0.63097805",
"0.6236647",
"0.62308514",
"0.6107026",
"0.61067206",
"0.60511607",
"0.5955739",
"0.5950967",
"0.5947142",
"0.5915182",
"0.5902847",
"0.5876245",
"0.5873746",
"0.58537... | 0.7084215 | 0 |
Make sure help_text can be set for the Table. | def test_help_text(self):
help_text = "The manager of a band."
class Manager(Table, help_text=help_text):
pass
self.assertEqual(Manager._meta.help_text, help_text) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def help_text(self, help_text):\n self._help_text = help_text",
"def test_form_help_text_is_correct(self):\n # https://stackoverflow.com/questions/24344981/how-to-change-help-\n # text-of-a-django-form-field\n\n # Above link helped figure out how to access help_text.\n self.ass... | [
"0.6772328",
"0.6298676",
"0.62130314",
"0.6118981",
"0.5977542",
"0.59753686",
"0.5949594",
"0.5936371",
"0.59007555",
"0.58799285",
"0.5830833",
"0.58306044",
"0.58306044",
"0.5786985",
"0.576787",
"0.5748433",
"0.5709595",
"0.5708106",
"0.56700426",
"0.56606495",
"0.564723... | 0.66085076 | 1 |
Creates a SQLAlchemy engine depending on the configuration passed. At this time it only supports mysql" | def __my_create_engine(self, config):
return {
'mysql': lambda c: create_engine(
"mysql://" + c["user"] + ":" + c["password"] +
"@" + c["host"] + "/" + c["database"],
encoding="utf-8",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_engine(username, password, ipaddress, database):\n #TODO(rnirmal):Based on permissions issues being resolved we may revert\n #url = URL(drivername='mysql', host='localhost',\n # query={'read_default_file': '/etc/mysql/my.cnf'})\n global ENGINE\n if ENGINE:\n return ENGINE\n ... | [
"0.73137504",
"0.70422524",
"0.6997168",
"0.6996811",
"0.6955308",
"0.69257414",
"0.69152117",
"0.69063073",
"0.6854277",
"0.68495774",
"0.67692935",
"0.6744367",
"0.67310536",
"0.6698378",
"0.6677413",
"0.6660402",
"0.6660402",
"0.6660402",
"0.6660402",
"0.66141945",
"0.6571... | 0.8131297 | 0 |
This is a method to make the color segmentation of the image called 'fachada1.png', the segmentation will be using six different trackbars two per channel (H,S,V). | def color_segmentation(self):
cv.namedWindow("Segmentation parameters")
self.create_trackbar("h-u", "Segmentation parameters")
self.create_trackbar("h-l","Segmentation parameters")
self.create_trackbar("s-u","Segmentation parameters")
self.create_trackbar("s-l","Segmentation para... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vis_seg(img, seg, palette, alpha=0.5):\n vis = np.array(img, dtype=np.float32)\n mask = seg > 0\n vis[mask] *= 1. - alpha\n vis[mask] += alpha * palette[seg[mask].flat]\n vis = vis.astype(np.uint8)\n\n # own code - Jasper\n total_pixels = totalNumPixels(seg, palette)\n # print(\"color_s... | [
"0.609005",
"0.6078117",
"0.6069302",
"0.6033831",
"0.5988165",
"0.58039105",
"0.57609457",
"0.5747587",
"0.57044333",
"0.56718445",
"0.5660993",
"0.5659466",
"0.5618801",
"0.5610856",
"0.5603964",
"0.5601937",
"0.55999964",
"0.5595812",
"0.5587714",
"0.55786747",
"0.5569767"... | 0.7120949 | 0 |
generate_session_key creates a new user if not found | def test_generate_session_key_creates_user(self, db_mock):
repo = Repository()
db_instance = db_mock.return_value
db_instance.get_user_info_by_google_id.return_value = None
db_instance.new_session.return_value = "1234"
self.assertEquals(repo.generate_session_key({"id": 123}), "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_generate_session_key(self, db_mock):\n repo = Repository()\n\n db_instance = db_mock.return_value\n\n db_instance.get_user_info_by_google_id.return_value = (1, {\"id\": 12345})\n db_instance.new_session.return_value = \"1234abcd\"\n \n self.assertEquals(repo.gener... | [
"0.71471393",
"0.6921913",
"0.6663228",
"0.6532278",
"0.63980514",
"0.6381294",
"0.6358152",
"0.6315179",
"0.6276196",
"0.62673694",
"0.62572086",
"0.6248092",
"0.6240196",
"0.61894184",
"0.61874044",
"0.6184263",
"0.61660343",
"0.6130686",
"0.6117421",
"0.6073234",
"0.607076... | 0.7592742 | 0 |
Bool, true if you can push to the branch. | def can_push(self) -> bool:
return pulumi.get(self, "can_push") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def developer_can_push(self) -> bool:\n return pulumi.get(self, \"developer_can_push\")",
"def is_push_enabled(self) -> bool:\n return pulumi.get(self, \"is_push_enabled\")",
"def push(self):\n return False",
"def push(self):\n if self.forward:\n git = self.repo.git\n ... | [
"0.74509853",
"0.63873035",
"0.62529266",
"0.6169094",
"0.6106241",
"0.60245824",
"0.6017629",
"0.6012996",
"0.5983292",
"0.594392",
"0.5929141",
"0.5861539",
"0.5784596",
"0.5744342",
"0.5743476",
"0.5739716",
"0.5731049",
"0.5721871",
"0.5690757",
"0.5676029",
"0.5674125",
... | 0.8083159 | 0 |
Bool, true if developer level access allows to merge branch. | def developer_can_merge(self) -> bool:
return pulumi.get(self, "developer_can_merge") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def developer_can_push(self) -> bool:\n return pulumi.get(self, \"developer_can_push\")",
"def should_deploy(request):\n\n data = json.loads(request.data.decode())\n\n if not data.get(\"pull_request\"):\n return False\n\n return data[\"action\"] == \"closed\" and data[\"pull_request\"][\"m... | [
"0.6195188",
"0.6061772",
"0.5880938",
"0.58001894",
"0.57091254",
"0.5704653",
"0.56948036",
"0.561762",
"0.5610504",
"0.5572607",
"0.55614686",
"0.5557953",
"0.5553806",
"0.546002",
"0.54458654",
"0.54457647",
"0.5428658",
"0.5332832",
"0.53166395",
"0.52947533",
"0.5289295... | 0.82510924 | 0 |
Bool, true if developer level access allows git push. | def developer_can_push(self) -> bool:
return pulumi.get(self, "developer_can_push") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_push(self) -> bool:\n return pulumi.get(self, \"can_push\")",
"def is_github_actions():\n return \"GITHUB_ACTIONS\" in os.environ and os.environ[\"GITHUB_ACTIONS\"] == \"true\"",
"def is_push_enabled(self) -> bool:\n return pulumi.get(self, \"is_push_enabled\")",
"def developer_can_m... | [
"0.7155684",
"0.662386",
"0.64810973",
"0.6472977",
"0.62037987",
"0.6097294",
"0.5968593",
"0.58751893",
"0.58304524",
"0.57572967",
"0.5674307",
"0.5588063",
"0.55823994",
"0.5579027",
"0.5555864",
"0.55459684",
"0.552257",
"0.54825073",
"0.54783696",
"0.54621714",
"0.54525... | 0.8265841 | 0 |
Bool, true if the branch has been merged into it's parent. | def merged(self) -> bool:
return pulumi.get(self, "merged") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_ancestor(ancestor, parent):\n try:\n subprocess.check_call([\"git\", \"merge-base\", \"--is-ancestor\", ancestor, parent],)\n return True\n except subprocess.CalledProcessError:\n return False",
"def has_parent(self):\n return self.parent != None",
"def is_merged(self):... | [
"0.7075676",
"0.6833406",
"0.67890143",
"0.6764371",
"0.6726826",
"0.66487074",
"0.6493714",
"0.6418102",
"0.6346954",
"0.6315968",
"0.6226936",
"0.61832917",
"0.616234",
"0.6160166",
"0.61332786",
"0.611147",
"0.6098897",
"0.60797226",
"0.6055989",
"0.60341156",
"0.6023276",... | 0.68772745 | 1 |
Import the SDMX MSD into JSON Schema. Overrides parent. | def load_schema(self):
schema = {
"type": "object",
"properties": {}
}
msd = self.parse_xml(self.schema_path)
for concept in msd.findall('.//Concept'):
concept_id = self.alter_key(concept.attrib['id'])
self.add_item_to_field_order(concept... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_dde_schemas(self, schema):\n url = DDE_SCHEMA_BASE_URL + schema\n if self.verbose:\n print(f'Loading registered DDE schema from \"{url}\"')\n return load_json_or_yaml(url)[\"source\"]",
"def load_dde_schemas(schema, verbose=False):\n url = DDE_SCHEMA_BASE_URL + schema\... | [
"0.54170114",
"0.5387725",
"0.5309976",
"0.52694154",
"0.52397996",
"0.5157364",
"0.51552695",
"0.51419425",
"0.5084924",
"0.5081027",
"0.5060391",
"0.50345147",
"0.5033894",
"0.49793848",
"0.49708065",
"0.49205256",
"0.48939368",
"0.4869892",
"0.48261774",
"0.48105964",
"0.4... | 0.5643728 | 0 |
Tests for method `createRegionDimensions`. | def test_createRegionDimensions(self):
classList = {}
classList[RegionType.REGION_TYPE_BOX] = RegionDimensions.RegionDimensionsBox
classList[RegionType.REGION_TYPE_CYLINDER] = RegionDimensions.RegionDimensionsCylinder
classList[RegionType.REGION_TYPE_SPHERE] = RegionDimensions.Regi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createSubdivRegion(*args, **kwargs)->bool:\n pass",
"def test_return_shape(self):\n print(\"Testing that get_region_data return values are the correct shape\")\n\n test = get_region_data(self.wmo_boxes, self.float_name, self.config,\n self.index, self.pres)\n\n ... | [
"0.65270966",
"0.6240372",
"0.60836077",
"0.5980812",
"0.5969983",
"0.57664895",
"0.575833",
"0.5737407",
"0.5722958",
"0.56984425",
"0.56962377",
"0.5632813",
"0.561277",
"0.5597011",
"0.54994",
"0.5488319",
"0.5483365",
"0.54427916",
"0.54357415",
"0.5430445",
"0.54247004",... | 0.72755873 | 0 |
Tests for class `RegionDimensionsCylinder`. | def test_RegionDimensionsCylinder_extractFromLinesWithKey(self):
regionDimensions = RegionDimensions.RegionDimensionsCylinder()
numberParameters = 8
self.assertEquals(numberParameters, len(regionDimensions._keys))
line = "RegionParameters=-500.000000 -500.000000 300.000000 0.00... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_createRegionDimensions(self):\r\n\r\n classList = {}\r\n classList[RegionType.REGION_TYPE_BOX] = RegionDimensions.RegionDimensionsBox\r\n classList[RegionType.REGION_TYPE_CYLINDER] = RegionDimensions.RegionDimensionsCylinder\r\n classList[RegionType.REGION_TYPE_SPHERE] = Region... | [
"0.6521858",
"0.6406924",
"0.6400371",
"0.5963709",
"0.59557366",
"0.58432007",
"0.5825487",
"0.5687325",
"0.5491019",
"0.5483367",
"0.5395308",
"0.5370438",
"0.5369076",
"0.53544396",
"0.5352458",
"0.5347984",
"0.5338374",
"0.533019",
"0.5293347",
"0.52909344",
"0.52883154",... | 0.68410605 | 0 |
Initialize with real y, predicted y, and probabilities y_proba should be a single column vector. | def __init__(self, clf, y_real, y_pred, y_proba):
self.clf = clf
self.y_real = y_real
self.y_pred = y_pred
self.y_proba = y_proba | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict_proba(self, X_test):\n if self._fitted is False:\n raise NotFittedError\n if X_test.shape[1] != self.theta.shape[0]:\n X_test = np.hstack((np.ones((X_test.shape[0], 1)), X_test))\n y_proba = self._sigmoid(X_test @ self.theta)\n return y_proba",
"def p... | [
"0.69407153",
"0.6790847",
"0.67209333",
"0.6692591",
"0.66359365",
"0.6487533",
"0.644551",
"0.6431803",
"0.6424399",
"0.63853794",
"0.63811916",
"0.6367134",
"0.63636446",
"0.6331281",
"0.63171285",
"0.62952566",
"0.62726724",
"0.62540257",
"0.62525856",
"0.61847705",
"0.61... | 0.6847743 | 1 |
Check if there is more data left on the pipe | def more_data(pipe_out):
r, _, _ = select.select([pipe_out], [], [], 0)
return bool(r) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eof(self):\n\t\tif not self._input: raise PlumberExceptions.PipeTypeException(self)\n\t\tresult = pservlet.pipe_eof(self._pipe_desc)\n\t\tif result > 0: return True\n\t\telif result == 0: return False\n\t\traise PlumberExceptions.PlumberNativeException(\"Cannot finish the API call to pipe_eof\")",
"def has_a... | [
"0.663518",
"0.66313183",
"0.6500803",
"0.6441102",
"0.6423749",
"0.6395081",
"0.63579106",
"0.6303101",
"0.6296602",
"0.6264113",
"0.6241928",
"0.6240164",
"0.6150191",
"0.6150191",
"0.6127",
"0.6116501",
"0.6086686",
"0.6072859",
"0.6072859",
"0.6046199",
"0.60122216",
"0... | 0.76144654 | 0 |
Read data on a pipe Used to capture stdout data produced by libiperf | def read_pipe(pipe_out):
out = b''
while more_data(pipe_out):
out += os.read(pipe_out, 1024)
return out.decode('utf-8') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_pipe(self, read_data):\n self.logger.info(read_data)",
"def output_to_pipe(pipe_in):\n os.dup2(pipe_in, 1) # stdout\n # os.dup2(pipe_in, 2) # stderr",
"def readFromPipe(self, pipe: Pipe, tag_name, **kwargs):\n\n # write the >>>\n if self.prompt_flag and not sys.stdin.readi... | [
"0.729745",
"0.6447887",
"0.6363505",
"0.6207005",
"0.6142507",
"0.6094141",
"0.60645294",
"0.60583884",
"0.59957916",
"0.5954015",
"0.5945904",
"0.59031606",
"0.58368886",
"0.5827655",
"0.5820704",
"0.5779274",
"0.5773242",
"0.57448304",
"0.57427263",
"0.5722564",
"0.5722061... | 0.76705056 | 0 |
Redirects stdout and stderr to a pipe | def output_to_pipe(pipe_in):
os.dup2(pipe_in, 1) # stdout
# os.dup2(pipe_in, 2) # stderr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pipe_redirected(to=os.devnull, pipe=sys.stdout):\n pipe_fd = _fileno(pipe)\n # copy pipe_fd before it is overwritten\n with os.fdopen(os.dup(pipe_fd), 'wb') as copied: \n pipe.flush() # flush library buffers that dup2 knows nothing about\n try:\n os.dup2(_fileno(to), pipe_fd... | [
"0.68599254",
"0.66581905",
"0.65979755",
"0.65901357",
"0.64683414",
"0.6315657",
"0.62606096",
"0.6250496",
"0.60683906",
"0.6024321",
"0.6015667",
"0.59631115",
"0.5947682",
"0.59428257",
"0.5923329",
"0.59175825",
"0.5914718",
"0.5891311",
"0.5879732",
"0.5879732",
"0.587... | 0.7783962 | 0 |
Initialise the iperf shared library | def __init__(self,
role,
verbose=True,
lib_name='libiperf.so.0'):
# TODO use find_library to find the best library
try:
self.lib = cdll.LoadLibrary(lib_name)
except OSError:
raise OSError('Could not find shared library {0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self._ll = LowLevelLibs()\n self._lib = self._ll.pythia",
"def init():\n global instance, swig\n global visionC, pythonC, ledsC, localizationC, opponentsC, behaviorC, planningC\n global BehaviorModuleLog\n global text_logger\n global sensor_values, joint_values,... | [
"0.6235048",
"0.6226763",
"0.6191392",
"0.6164226",
"0.61563796",
"0.607974",
"0.60637426",
"0.60478175",
"0.601776",
"0.5921122",
"0.5892373",
"0.5885541",
"0.5820454",
"0.5808728",
"0.58063316",
"0.5803603",
"0.5761715",
"0.57529664",
"0.5750184",
"0.5722902",
"0.57220775",... | 0.67787397 | 0 |
Initialise a new iperf test struct iperf_test iperf_new_test() | def _new(self):
return self.lib.iperf_new_test() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,\n role,\n verbose=True,\n lib_name='libiperf.so.0'):\n # TODO use find_library to find the best library\n try:\n self.lib = cdll.LoadLibrary(lib_name)\n except OSError:\n raise OSError('Could not find shar... | [
"0.68620664",
"0.6284989",
"0.62316006",
"0.5712635",
"0.5705042",
"0.5624765",
"0.5611089",
"0.5601138",
"0.55842394",
"0.5571116",
"0.55376065",
"0.5526115",
"0.55203676",
"0.5511073",
"0.54958457",
"0.54922533",
"0.5476346",
"0.5474224",
"0.5444997",
"0.54396325",
"0.54218... | 0.67591345 | 1 |
Set/reset iperf test defaults. | def defaults(self):
self.lib.iperf_defaults(self._test) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_defaults(self):\n self.plastic = False\n self.unset_output()\n self.reward = False\n self.patmod = config.impact_modulation_default",
"def test_Defaults(self):\n self._run(self._test_scenarios, \"Defaults\")",
"def initialize_options(self):\n self.all = False\n... | [
"0.6577314",
"0.6432702",
"0.6010667",
"0.6009887",
"0.5885464",
"0.5843579",
"0.57990265",
"0.5738272",
"0.5722675",
"0.55779403",
"0.55742717",
"0.553187",
"0.5531",
"0.5462259",
"0.544786",
"0.5443715",
"0.54303724",
"0.5425893",
"0.54173815",
"0.5408416",
"0.54074025",
... | 0.6945136 | 0 |
Toggles json output of libiperf Turning this off will output the iperf3 instance results to stdout/stderr | def json_output(self):
enabled = self.lib.iperf_get_test_json_output(self._test)
if enabled:
self._json_output = True
else:
self._json_output = False
return self._json_output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_output(f):\n\n @click.option('--json', default=False, is_flag=True, help='Uses JSON output.')\n @click.pass_context\n def _json_output(ctx, json, *args, **kwargs):\n \"\"\" This wrapper disables logging when json is set and restores it after print json value\n\n In order for thi... | [
"0.5572117",
"0.54888135",
"0.54796225",
"0.5420121",
"0.539488",
"0.5392044",
"0.5352148",
"0.5272823",
"0.5266823",
"0.5266469",
"0.5244523",
"0.52419454",
"0.5212728",
"0.5160544",
"0.5154456",
"0.5146573",
"0.51388377",
"0.50940406",
"0.5090786",
"0.5088625",
"0.5080342",... | 0.61665297 | 0 |
The test duration in seconds. | def duration(self):
self._duration = self.lib.iperf_get_test_duration(self._test)
return self._duration | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duration(self) -> int:\n return 0",
"def duration(self):\n pass",
"def duration(self):\n pass",
"def get_duration(self):\n try:\n if self.is_skipped:\n return \"00:00\"\n assert self.start_time\n assert self.stop_time\n ... | [
"0.7883373",
"0.7750263",
"0.7750263",
"0.7678744",
"0.7383673",
"0.7330992",
"0.7328771",
"0.7282695",
"0.7278623",
"0.72580075",
"0.7154214",
"0.7146179",
"0.7112877",
"0.71073246",
"0.708255",
"0.707991",
"0.7078312",
"0.7054944",
"0.7027199",
"0.69971526",
"0.6994351",
... | 0.8444397 | 0 |
The number of streams to use. | def num_streams(self):
self._num_streams = self.lib.iperf_get_test_num_streams(self._test)
return self._num_streams | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_total_session_count(self) -> int:\n return self.streams_count",
"def fileCount(self):\n pass",
"def __len__(self):\n if not hasattr(self.limitedstream, \"limit\"):\n return 0\n return self.limitedstream.limit",
"def get_size(self):\n cum_size = 0\n ... | [
"0.6905331",
"0.6791878",
"0.65280783",
"0.6519969",
"0.64944726",
"0.64938784",
"0.63854825",
"0.63361406",
"0.63323224",
"0.6324139",
"0.63137907",
"0.62905824",
"0.62894714",
"0.62867564",
"0.62855965",
"0.62815756",
"0.627993",
"0.62626624",
"0.62379867",
"0.62328315",
"0... | 0.7793534 | 0 |
Toggle zerocopy. Use the sendfile() system call for "Zero Copy" mode. This uses much less CPU. This is not supported on all systems. Note there isn't a hook in the libiperf library for getting the current configured value. Relying on zerocopy.setter function | def zerocopy(self):
return self._zerocopy | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setAllowCopy(self,value):\n self.PDFreactorConfiguration.in1[\"allowCopy\"] = value",
"def setPhaseZero(self):\n self.write('PCLR')",
"def cancel_copy(self):\n self.copyWorker.must_run = False\n self.copyButton.setEnabled(True)",
"def simple_copy():\n src, des = rem('grab')... | [
"0.59855205",
"0.5321563",
"0.51962066",
"0.5180342",
"0.50980914",
"0.50939006",
"0.5067787",
"0.5026038",
"0.4956752",
"0.49567023",
"0.49564937",
"0.49475056",
"0.4944015",
"0.49425653",
"0.49275255",
"0.49061468",
"0.49055517",
"0.49017212",
"0.48807",
"0.48788923",
"0.48... | 0.59269214 | 1 |
Run the iperf3 server instance. | def run(self):
def _run_in_thread(self, data_queue):
"""Runs the iperf_run_server
:param data_queue: thread-safe queue
"""
output_to_pipe(self._pipe_in)
self.lib.iperf_run_server(self._test)
# TODO json_output_string not available on ea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def launchIperf(self, job):\n\n sleep(job['time'])\n jobID = job['id']\n client = self.net.getNodeByName(job['src'])\n server = self.net.getNodeByName(job['dst'])\n size = job['size']\n # Since there could be multiple flows destined to the same server at the same time, we ... | [
"0.66892844",
"0.63128114",
"0.62923425",
"0.62206167",
"0.61698973",
"0.6126845",
"0.60241485",
"0.59881836",
"0.5968893",
"0.5913123",
"0.58941346",
"0.58923304",
"0.5888771",
"0.58805776",
"0.58556646",
"0.5844294",
"0.5816747",
"0.57955",
"0.57508725",
"0.5745107",
"0.572... | 0.633513 | 1 |
calculate the mean of the input numbers | def mean(mean_numbers):
return sum(mean_numbers) / float(len(mean_numbers)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean(numbers):\n return float(sum(numbers)) / float(len(numbers))",
"def mean(numbers):\n return int(sum(numbers)) / max(len(numbers), 1)",
"def mean(num_list):\n i = 0\n num_sum = 0.0\n for item in num_list:\n num_sum += item\n i += 1\n retur... | [
"0.85952383",
"0.82022816",
"0.79154694",
"0.79141283",
"0.7871546",
"0.784325",
"0.77834255",
"0.7775976",
"0.7725171",
"0.7695684",
"0.76810277",
"0.7678286",
"0.76708907",
"0.7607487",
"0.7587782",
"0.7557909",
"0.75387573",
"0.7516973",
"0.75087416",
"0.7506217",
"0.75024... | 0.8353405 | 1 |
calculate the median of the input numbers | def median(median_numbers):
sorted_numbers = sorted(median_numbers)
length = len(sorted_numbers)
if len(median_numbers) % 2: # uneven numbers of integers
return sorted_numbers[length / 2]
return (sorted_numbers[length / 2] + sorted_numbers[length / 2 - 1]) / 2.0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_median(numbers):\n middle_index = len(numbers) // 2\n return sorted(numbers[middle_index]) # sorted returns the numbers sorted without changing",
"def median(self, nums):\n n = len(nums)\n return self.find_kth(nums, 0, n, (n-1)/2)",
"def median(nums):\n\n sorted_nums = sorte... | [
"0.8407379",
"0.8232327",
"0.813549",
"0.80645484",
"0.80612564",
"0.8058928",
"0.7946964",
"0.7828123",
"0.77973455",
"0.77795374",
"0.77187425",
"0.7701456",
"0.76882464",
"0.7678064",
"0.76521647",
"0.76495224",
"0.7649203",
"0.7648357",
"0.76459056",
"0.7627203",
"0.75797... | 0.84065765 | 1 |
calculate the standard deviation of the input numbers | def stddev(std_numbers):
mean = sum(std_numbers) / float(len(std_numbers))
sum_std = 0.0
for x in std_numbers:
sum_std += (mean - x) * (mean - x)
variance = sum_std / float(len(std_numbers))
stddev = math.sqrt(variance)
return stddev | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_standard_deviation(data: list) -> float:\n mean = calc_mean(data)\n acc = 0.0\n for n in data:\n acc += (n - mean) ** 2\n acc /= len(data) - 1\n return math.sqrt(acc)",
"def StandardDeviation(numlist):\n\tv = Variance(numlist)\n\t#print v\n\treturn math.sqrt(v)",
"def stdDev(data... | [
"0.81877357",
"0.80649596",
"0.80532163",
"0.79993296",
"0.79993296",
"0.7950708",
"0.7899896",
"0.785602",
"0.7838927",
"0.7835389",
"0.7822817",
"0.7810945",
"0.77946717",
"0.7768366",
"0.7749407",
"0.7743119",
"0.77374595",
"0.7726279",
"0.7724785",
"0.7721752",
"0.7708825... | 0.8143395 | 1 |
GetSelection() > int Returns the index of the selected item or wxNOT_FOUND if no item is selected. | def 取选中项索引(self): # real signature unknown; restored from __doc__
return self.GetSelection() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_selected_index(self) -> int:\n return self._selected_index",
"def get_selected_ix( self ):\n selected_ix = self.listbox.curselection()\n\n if selected_ix == tuple( ):\n selected_ix = -1\n else:\n selected_ix = selected_ix[0] # since we allow only ... | [
"0.7958021",
"0.77429086",
"0.7624132",
"0.7431646",
"0.7400651",
"0.73952955",
"0.72859895",
"0.7270833",
"0.7139183",
"0.7138472",
"0.7051662",
"0.69491136",
"0.6752822",
"0.66836435",
"0.6617146",
"0.660846",
"0.65961975",
"0.6591815",
"0.6574607",
"0.6501574",
"0.64512783... | 0.833965 | 0 |
GetStringSelection() > String Returns the label of the selected item or an empty string if no item is selected. | def 取现行选中项文本(self): # real signature unknown; restored from __doc__
return self.GetStringSelection() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetStringSelection(self):\n \n return self.choices[self.selected].GetLabel()",
"def get_selected_text(self):\r\n return self.selectedText()",
"def GetStringSelection(self):\n\n return self._string",
"def selection(self) -> str:\n return self._selection",
"def GetStrin... | [
"0.87059027",
"0.7748784",
"0.7506609",
"0.6846715",
"0.6801598",
"0.6744945",
"0.6727683",
"0.6671624",
"0.66041636",
"0.6408322",
"0.6373582",
"0.6314192",
"0.6293499",
"0.6282168",
"0.62769645",
"0.62610203",
"0.61652285",
"0.6132265",
"0.6092285",
"0.6075726",
"0.6046417"... | 0.7833737 | 1 |
Select(n) This is the same as SetSelection() and exists only because it is slightly more natural for controls which support multiple selection. | def 选择项目(self, n): # real signature unknown; restored from __doc__
return self.Select(n) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def 置现行选中项(self, n): # real signature unknown; restored from __doc__\n return self.SetSelection(n)",
"def _select(start, n, label) -> int:\n n_selected = 0\n for i in range(start, int(start + n)):\n x = self._x_positions[i]\n n_selected += self._cols[x]... | [
"0.7000919",
"0.63412076",
"0.6185251",
"0.61827874",
"0.6166296",
"0.61599064",
"0.6082377",
"0.6063224",
"0.6040906",
"0.6017828",
"0.5841552",
"0.5835006",
"0.574449",
"0.57079726",
"0.5705544",
"0.56915593",
"0.56839377",
"0.5664473",
"0.56306994",
"0.56306994",
"0.559819... | 0.63493353 | 1 |
SetSelection(n) Sets the selection to the given item n or removes the selection entirely if n == wxNOT_FOUND. | def 置现行选中项(self, n): # real signature unknown; restored from __doc__
return self.SetSelection(n) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_selection(self, selection):\n self._selection = selection",
"def SetSelection(self, s):\r\n\r\n self.selection = s\r\n self._commandInt = s",
"def _set_selection(self, new_sel_index):\r\n if new_sel_index >= 0 and new_sel_index <= len(self.points) -1:\r\n iid = se... | [
"0.66015226",
"0.64478713",
"0.6368983",
"0.62490034",
"0.61992234",
"0.6193018",
"0.6084691",
"0.6080904",
"0.607264",
"0.5921971",
"0.5866189",
"0.58543897",
"0.5850437",
"0.5781122",
"0.56755286",
"0.56520116",
"0.564246",
"0.5586318",
"0.55298316",
"0.5428035",
"0.5418861... | 0.79642093 | 0 |
SetStringSelection(string) > bool Selects the item with the specified string in the control. | def 置现行选中项文本(self, string): # real signature unknown; restored from __doc__
return self.SetStringSelection(string) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetStringSelection(self, val):\n \n for c in self.choices:\n if val == c.GetLabel():\n c.SetValue(True)\n break",
"def set_selection(self, selection):\n for num in self.cryptomattes:\n if self.cryptomattes[num][\"name\"] == selection:\n... | [
"0.7313896",
"0.6929537",
"0.6751543",
"0.6390979",
"0.62226284",
"0.6197027",
"0.6195849",
"0.6180891",
"0.6180891",
"0.61724377",
"0.6051186",
"0.6006025",
"0.59900767",
"0.5982021",
"0.5977813",
"0.5894183",
"0.5887898",
"0.58847815",
"0.58803654",
"0.58504415",
"0.5825539... | 0.76349425 | 0 |
Create scatter output table. This function is used by the FL scatter gather node to reduce a dynamic number of silo outputs into a single input for the usersupplied aggregation step. | def create_scatter_output_table(aggregated_output: Output(type="mltable"), **kwargs):
# kwargs keys are inputs names (ex: silo_output_silo_1)
# values are uri_folder paths
save_mltable_yaml(aggregated_output, kwargs.values()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def table(self):\n\n param=self.x_param\n\n device=self.device\n\n base_params=device.get_params()\n\n data_tot=DataFrame()\n\n for i in range(len(param)):\n\n print_index=1\n\n for name in param.names:\n\n device._set_params(param(i))\n\n ... | [
"0.57813793",
"0.5676904",
"0.556825",
"0.5551498",
"0.5481106",
"0.54687935",
"0.54653734",
"0.5410685",
"0.5348763",
"0.5348204",
"0.52968776",
"0.528589",
"0.52699184",
"0.5238687",
"0.5185307",
"0.51821464",
"0.516922",
"0.5164525",
"0.51644397",
"0.5152699",
"0.5133322",... | 0.74938846 | 0 |
Poll current weather condition and log it to file | def main(logfile, location_id, units, api_key, interval, mode):
logging.basicConfig(
filename=logfile,
filemode="a",
format="%(created)f %(message)s",
level=logging.INFO,
)
url = build_url(location_id, api_key, units)
while True:
result = get_data(url)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Kweather():\n while True:\n hr = int(datetime.datetime.now().strftime(\"%H\"))\n if hr == 23:\n from weather import Weather, Unit\n weather = Weather(unit=Unit.CELSIUS)\n lookup = weather.lookup_by_location('Taipei')\n condition = lookup.print_obj\n ... | [
"0.6561798",
"0.6261902",
"0.60890746",
"0.59888285",
"0.59848696",
"0.59355026",
"0.57569325",
"0.5750641",
"0.5710099",
"0.5705046",
"0.5687179",
"0.56388235",
"0.5556656",
"0.55501246",
"0.55079794",
"0.5483929",
"0.54749393",
"0.5473268",
"0.54699713",
"0.54696065",
"0.54... | 0.64399636 | 1 |
Adds standard commandline arguments for interacting with hither/slurm calling conventions. Included arguments are verbose (v|vv|vvv...), test (t), outfile (o), workercount (w), jobcache, nojobcache, usecontainer, nocontainer, useslurm, slurmpartition, slurmacceptsharednodes, slurmjobsperallocation, slurmmaxsimultaneous... | def add_standard_args(parser: ArgumentParser) -> ArgumentParser:
parser.add_argument('--verbose', '-v', action='count', default=0,
help="Set verbosity level. Add vs for more verbosity.")
# Note: Whatever 'number of iterations' means for your application should be locally defined.
parser.add_argument... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_commandline_args(parser=None):\n if not parser:\n parser = ArgumentParser()\n\n parser = _add_uploader_config_argparser(parser=parser)\n\n parser.add_argument(\"--quiet\",\n action=\"store_false\",\n dest=\"verbose\",\n ... | [
"0.66621363",
"0.6642149",
"0.6608248",
"0.6395445",
"0.63052016",
"0.625772",
"0.6251635",
"0.6241317",
"0.6220123",
"0.6218774",
"0.6206903",
"0.6198087",
"0.61913085",
"0.6173481",
"0.616811",
"0.6155044",
"0.61514795",
"0.6150171",
"0.61460763",
"0.61460745",
"0.61341894"... | 0.7506267 | 0 |
Swaps portions of the mother and father's lists to create a child and returns a new genome with the swapped characteristics. | def crossover(mother: Layout, father: Layout):
# make a copy of the mother
child = Layout.deepcopy(mother)
# get the count of 'chromosomes' to swap
chromosomes_to_swap = len(child.get_guests()) // 2
# for each of the chromosomes we need to swap, select a random
# numb... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross_over(self, father: Tour, mother: Tour) -> Tour:\n startGene = int(random.random() * father.size())\n endGene = int(random.random() * father.size())\n\n # Swap 2 position if start > end\n if startGene > endGene:\n startGene, endGene = endGene, startGene\n\n # ... | [
"0.68247426",
"0.6088587",
"0.5802354",
"0.5786365",
"0.5724876",
"0.5564896",
"0.55464953",
"0.55440074",
"0.54406685",
"0.5438963",
"0.5411323",
"0.54108125",
"0.5314691",
"0.5311053",
"0.5278557",
"0.52211183",
"0.5208339",
"0.51947296",
"0.5190898",
"0.5184963",
"0.517858... | 0.7209222 | 0 |
Perform a single integrator step from a supplied state. | def step(self, state): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step(self, state: Dict, stop_on_first_trigger: bool = True):\n # always re-initialise the state\n return self.run_all(\n state=state,\n stop_on_first_trigger=stop_on_first_trigger\n )",
"def step(self):\n self.solver.integrate(self.t)\n self.state = se... | [
"0.6519691",
"0.64235574",
"0.6203998",
"0.6085753",
"0.6071868",
"0.5971172",
"0.5931604",
"0.5924983",
"0.5921909",
"0.59202254",
"0.5917165",
"0.58530015",
"0.58262825",
"0.58052707",
"0.57408744",
"0.5717384",
"0.57027835",
"0.56891024",
"0.5683059",
"0.5679051",
"0.56769... | 0.67703766 | 0 |
Activate organizations created before activation moderation/activation was possible. | def activate_existing_organization(apps, schema_editor):
Organization = apps.get_model("organization", "Organization")
Organization.objects.all().update(is_active=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activate(self):\r\n self.update_enrollment(is_active=True)",
"def set_is_org_active(self, is_org_active):\n self.is_org_active = is_org_active",
"def activate(self):\r\n if self.activation_code == '':\r\n raise ValidationError('The member is already activated')\r\n si... | [
"0.6266788",
"0.57591414",
"0.5720214",
"0.57003564",
"0.567637",
"0.5614927",
"0.5603232",
"0.5549756",
"0.5548593",
"0.5532794",
"0.5504182",
"0.5483229",
"0.546581",
"0.5443003",
"0.54100585",
"0.540253",
"0.540253",
"0.54005444",
"0.5392211",
"0.5383875",
"0.5380019",
"... | 0.7074332 | 0 |
Test Product Template import | def test_0010_product_template_import(self):
with Transaction().start(DB_NAME, USER, context=CONTEXT) as txn:
# Call method to setup defaults
self.setup_defaults()
with txn.set_context(
current_channel=self.channel.id, ps_test=True,
):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_template_subsciption(self):\n pass",
"def test_register_template(self):\n pass",
"def test_get_tosca_template(self):\n pass",
"def import_template():\n posted_json = request.get_json(force=True)\n try:\n name = posted_json['name']\n encoded_template = ... | [
"0.66047585",
"0.65659595",
"0.6447607",
"0.6366833",
"0.6255727",
"0.6217309",
"0.620413",
"0.61352795",
"0.6123963",
"0.6044459",
"0.6028533",
"0.60223097",
"0.60210025",
"0.60134065",
"0.60009706",
"0.59955597",
"0.5995271",
"0.59479016",
"0.5922596",
"0.5922596",
"0.58856... | 0.74172705 | 0 |
Authentication using SSH agent Attempt to authenticate to the given transport using any of the private keys available from an SSH agent. | def agent_auth(transport, username):
agent = paramiko.Agent()
agent_keys = agent.get_keys()
if len(agent_keys) == 0:
return
for key in agent_keys:
print('Trying ssh-agent key %s' % hexlify(key.get_fingerprint()))
try:
transport.auth_publickey(username, key)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def agent_auth(cls, transport, username):\n\n agent = paramiko.Agent()\n agent_keys = agent.get_keys()\n if len(agent_keys) == 0:\n #print \"Warning: No keys found loaded in ssh-agent. Forgot to use ssh-add ?\"\n return\n\n for key in agent_keys:\n #prin... | [
"0.81977487",
"0.7960795",
"0.7936862",
"0.7672226",
"0.65417856",
"0.60478085",
"0.6015765",
"0.59195924",
"0.58819425",
"0.5816048",
"0.5652883",
"0.5537892",
"0.5495845",
"0.54872817",
"0.5474536",
"0.54670036",
"0.54341215",
"0.5428233",
"0.541733",
"0.5394163",
"0.537209... | 0.80086344 | 1 |
run kkr calculation from output of previous calculation but with increased lmax (done with auxiliary voronoi calculation which is imported here). | def test_kkr_increased_lmax(self, clear_database_before_test, kkrhost_local_code, run_with_cache):
from aiida.orm import load_node, CalcJobNode, Dict
from aiida_kkr.calculations import KkrCalculation, VoronoiCalculation
from aiida_kkr.tools import kkrparams
# import previous voronoi cal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_kkr_from_voronoi(self, kkrhost_local_code):\n from aiida.orm import load_node, Dict\n from masci_tools.io.kkr_params import kkrparams\n from aiida_kkr.calculations.kkr import KkrCalculation\n\n # load necessary files from db_dump files\n import_with_migration('files/db_d... | [
"0.6277666",
"0.59252477",
"0.5855886",
"0.5816016",
"0.57803315",
"0.576379",
"0.5713312",
"0.5685985",
"0.5630714",
"0.5571376",
"0.55380166",
"0.55263484",
"0.55182064",
"0.5515467",
"0.5509155",
"0.5501064",
"0.54957944",
"0.54683554",
"0.5454817",
"0.54466635",
"0.543415... | 0.6425502 | 0 |
Assigns card names according to rank | def _assign_names(rank):
if isinstance(rank, int):
if rank == 1:
return "Ace", (Card.ACE_LOW,Card.ACE_HIGH)
elif rank == 11:
return "Jack", (Card.FACE,Card.FACE)
elif rank == 12:
return "Queen", (Card.FACE,Card.FACE)
elif rank == 13:
return "King", (Card.F... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assignRanks(self):\r\n\t\trank = 0\r\n\t\tscores = list(self._playerScores)\r\n\t\tscores.reverse()\r\n\t\tfor playerScore in scores:\r\n\t\t\tif not playerScore.has(NOT_MET) or not playerScore.value(NOT_MET):\r\n\t\t\t\trank += 1\r\n\t\t\t\tplayerScore.set(RANK, smallText(BugUtil.colorText(u\"%d\" % rank, Sco... | [
"0.69135374",
"0.68602526",
"0.66031533",
"0.6506584",
"0.65063035",
"0.65042865",
"0.6310269",
"0.6241424",
"0.6187",
"0.61537945",
"0.61508846",
"0.61477995",
"0.61477995",
"0.6077921",
"0.6052699",
"0.60426915",
"0.6025718",
"0.5999583",
"0.5924033",
"0.59186965",
"0.59184... | 0.7878142 | 0 |
Function to generate shingles | def generate_shingles(input_path, output_path, w=3):
j = 0
shingles_dict = defaultdict(set)
shingles_identifier = dict()
with open(input_path, 'r') as read_obj:
csv_reader = csv.reader(read_obj)
header = next(csv_reader)
# Check file as empty
if header is not None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def computeShingles(q, document):\n shingles = []\n for i in range(len(document) - q + 1):\n shingle = \"\"\n for j in range(i,i+q):\n shingle += document[j]\n shingles.append(shingle)\n return shingles",
"def create_shingles(data, k):\n shingle_dict = dict()\n new_... | [
"0.65647423",
"0.646649",
"0.6418758",
"0.6358705",
"0.6336535",
"0.5930762",
"0.5701412",
"0.5688758",
"0.5633621",
"0.5612346",
"0.5558592",
"0.5452589",
"0.5443209",
"0.5427365",
"0.53837925",
"0.538002",
"0.5313134",
"0.5302711",
"0.5283405",
"0.5276694",
"0.52745795",
... | 0.6740815 | 0 |
Detect env queue recursively. | def detect_install_queue(env, install_queue=[]):
_env = env()
if _env.done():
print "[info]", env.__name__, "is already done."
return install_queue
else:
if env not in install_queue:
install_queue.insert(0, env)
requires = _env.requires()
if not isinstance(requi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_prerequisites(self, env):\n super(PassiveTracersDepth, self).check_prerequisites(env)\n print(' Checking prerequisites for : {0}'.format(self.__class__.__name__))",
"def contains_venv(_dir, **kargs):\n kargs.update(max_venvs=1)\n venvs = find_venvs(_dir, **kargs)\n return venvs ... | [
"0.560535",
"0.5001595",
"0.49856818",
"0.49259284",
"0.4894782",
"0.48739728",
"0.48473755",
"0.4797054",
"0.47788292",
"0.4734916",
"0.4718234",
"0.47052276",
"0.46757907",
"0.46513224",
"0.46418062",
"0.46293324",
"0.46264154",
"0.4610384",
"0.4603777",
"0.45974433",
"0.45... | 0.70503646 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.