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 |
|---|---|---|---|---|---|---|
Add a key to each payload_info_dict with the path under which the file will be stored in the ZIP file and which will be used for the file when the ZIP is uncompressed. Since there is no unique restriction on the `fileName` element in SysMeta, this method checks for duplicated files and adds a count to filenames as need... | def _add_path(dir_name, payload_info_list):
path_count_dict = {}
for payload_info_dict in payload_info_list:
file_name = payload_info_dict["filename"] or payload_info_dict["pid"]
path = d1_common.utils.filesystem.gen_safe_path(dir_name, "data", file_name)
path_count_dict.setdefault(path,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_payload_files(zip_file, payload_info_list):\n payload_byte_count = 0\n payload_file_count = 0\n for payload_info_dict in payload_info_list:\n zip_file.write_iter(payload_info_dict[\"path\"], payload_info_dict[\"iter\"])\n payload_byte_count += payload_info_dict[\"iter\"].size\n ... | [
"0.6585671",
"0.6330474",
"0.61164355",
"0.5857296",
"0.5550734",
"0.54473835",
"0.5447037",
"0.54349947",
"0.5430097",
"0.54053926",
"0.5364372",
"0.5325162",
"0.53177786",
"0.53022224",
"0.529222",
"0.528866",
"0.5286867",
"0.52864254",
"0.52839154",
"0.5261739",
"0.5226235... | 0.658604 | 0 |
Add the payload files to the zip. | def _add_payload_files(zip_file, payload_info_list):
payload_byte_count = 0
payload_file_count = 0
for payload_info_dict in payload_info_list:
zip_file.write_iter(payload_info_dict["path"], payload_info_dict["iter"])
payload_byte_count += payload_info_dict["iter"].size
payload_file_c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_manifest_files(zip_file, dir_name, payload_info_list, tag_info_list):\n for checksum_algorithm in _get_checksum_algorithm_set(payload_info_list):\n _add_tag_file(\n zip_file,\n dir_name,\n tag_info_list,\n _gen_manifest_file_tup(payload_info_list, chec... | [
"0.73674893",
"0.7222131",
"0.711248",
"0.6768084",
"0.6704616",
"0.66246665",
"0.6362755",
"0.6321282",
"0.62013245",
"0.6189686",
"0.6161364",
"0.614104",
"0.6137726",
"0.61335224",
"0.6125119",
"0.610764",
"0.60853654",
"0.6064547",
"0.6051613",
"0.60146946",
"0.60138756",... | 0.7595122 | 0 |
Generate the tag files and add them to the zip. | def _add_tag_files(
zip_file, dir_name, payload_info_list, payload_byte_count, payload_file_count
):
tag_info_list = []
_add_tag_file(zip_file, dir_name, tag_info_list, _gen_bagit_text_file_tup())
_add_tag_file(
zip_file,
dir_name,
tag_info_list,
_gen_bag_info_file_tup(pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _zip_files(self):\n\n zip_file = Path(self.build_directory.parent).joinpath(\n self.package_name + '.zip'\n )\n logger.info('Creating zip file: %s', zip_file)\n\n shutil.make_archive(zip_file.with_suffix(''), 'zip', self.build_directory)\n shutil.move(str(zip_file)... | [
"0.7341464",
"0.71965224",
"0.67646176",
"0.6753322",
"0.66909355",
"0.66733277",
"0.6497623",
"0.63924235",
"0.62736905",
"0.6224912",
"0.62128276",
"0.61862534",
"0.6123816",
"0.60985434",
"0.6071093",
"0.60371196",
"0.6033552",
"0.6028935",
"0.6010823",
"0.5939168",
"0.593... | 0.7430133 | 0 |
Generate the manifest files and add them to the zip. | def _add_manifest_files(zip_file, dir_name, payload_info_list, tag_info_list):
for checksum_algorithm in _get_checksum_algorithm_set(payload_info_list):
_add_tag_file(
zip_file,
dir_name,
tag_info_list,
_gen_manifest_file_tup(payload_info_list, checksum_algori... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _zip_files(self):\n\n zip_file = Path(self.build_directory.parent).joinpath(\n self.package_name + '.zip'\n )\n logger.info('Creating zip file: %s', zip_file)\n\n shutil.make_archive(zip_file.with_suffix(''), 'zip', self.build_directory)\n shutil.move(str(zip_file)... | [
"0.7340745",
"0.67268693",
"0.66946185",
"0.6680291",
"0.64781016",
"0.64311486",
"0.64154756",
"0.62917674",
"0.62904966",
"0.626548",
"0.6254546",
"0.6248287",
"0.6234406",
"0.62308794",
"0.62123543",
"0.6197038",
"0.6114052",
"0.60938174",
"0.6092358",
"0.60488105",
"0.604... | 0.762062 | 0 |
Generate the tag manifest file and add it to the zip. | def _add_tag_manifest_file(zip_file, dir_name, tag_info_list):
_add_tag_file(
zip_file, dir_name, tag_info_list, _gen_tag_manifest_file_tup(tag_info_list)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_manifest_files(zip_file, dir_name, payload_info_list, tag_info_list):\n for checksum_algorithm in _get_checksum_algorithm_set(payload_info_list):\n _add_tag_file(\n zip_file,\n dir_name,\n tag_info_list,\n _gen_manifest_file_tup(payload_info_list, chec... | [
"0.7281861",
"0.6460843",
"0.6363633",
"0.63002366",
"0.6287879",
"0.62703556",
"0.6198806",
"0.6169785",
"0.6072644",
"0.60657287",
"0.6056066",
"0.60218394",
"0.5955132",
"0.59292465",
"0.58778006",
"0.5859487",
"0.58458424",
"0.5830344",
"0.5762108",
"0.5739561",
"0.571481... | 0.7713092 | 0 |
Add a tag file to zip_file and record info for the tag manifest file. | def _add_tag_file(zip_file, dir_name, tag_info_list, tag_tup):
tag_name, tag_str = tag_tup
tag_path = d1_common.utils.filesystem.gen_safe_path(dir_name, tag_name)
tag_iter = _create_and_add_tag_iter(zip_file, tag_path, tag_str)
tag_info_list.append(
{
"path": tag_path,
"c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_tag_manifest_file(zip_file, dir_name, tag_info_list):\n _add_tag_file(\n zip_file, dir_name, tag_info_list, _gen_tag_manifest_file_tup(tag_info_list)\n )",
"def _add_tag_files(\n zip_file, dir_name, payload_info_list, payload_byte_count, payload_file_count\n):\n tag_info_list = []\n ... | [
"0.8294056",
"0.7131481",
"0.70081836",
"0.65047705",
"0.63573885",
"0.62825936",
"0.61044526",
"0.59843755",
"0.5793532",
"0.5747666",
"0.57412016",
"0.5733688",
"0.570958",
"0.56585723",
"0.56032634",
"0.55815566",
"0.5539693",
"0.55343246",
"0.55220366",
"0.55152017",
"0.5... | 0.82864404 | 1 |
Get set of checksum algorithms in use. | def _get_checksum_algorithm_set(payload_info_list):
return {d["checksum_algorithm"] for d in payload_info_list} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _available_algorithms(**_: str) -> Set[str]:\n avail = set()\n pass2 = set()\n for algo in hashlib.algorithms_available:\n lalgo = algo.lower()\n if \"with\" in lalgo:\n continue # skip apparently redundant ones\n if lalgo != algo:\n pass2.add(algo)\n ... | [
"0.7008935",
"0.61175835",
"0.60697055",
"0.58571124",
"0.5647619",
"0.56306684",
"0.5619436",
"0.544763",
"0.54312253",
"0.5408312",
"0.5348536",
"0.5271971",
"0.52447987",
"0.52371943",
"0.5181457",
"0.5181457",
"0.51659715",
"0.51659256",
"0.515521",
"0.515521",
"0.5150863... | 0.72032493 | 0 |
Decode a dictionary made with encode() into a Game object. | def decode_game(obj):
try:
players = obj['players']
jacks = obj['jacks']
library = obj['library']
pool = obj['pool']
stack = obj['stack']
_current_frame = obj['_current_frame']
except KeyError as e:
raise GTREncodingError(e.message)
game_dict = copy.d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_player(obj):\n player_dict = copy.deepcopy(obj)\n\n zones = ('hand', 'stockpile', 'clientele', 'vault', 'camp',\n 'revealed', 'prev_revealed', 'clients_given')\n\n for k in zones:\n try:\n zone_list = player_dict[k]\n except KeyError as e:\n # With... | [
"0.6415413",
"0.6319182",
"0.6218529",
"0.5617776",
"0.5549174",
"0.5508921",
"0.55043656",
"0.5463203",
"0.5459009",
"0.54051703",
"0.5317273",
"0.5297406",
"0.52961904",
"0.5280745",
"0.52756923",
"0.52468866",
"0.5208038",
"0.51901245",
"0.5184368",
"0.5180316",
"0.5170047... | 0.7575048 | 0 |
Decode a dictionary made with encode() into a Player object. | def decode_player(obj):
player_dict = copy.deepcopy(obj)
zones = ('hand', 'stockpile', 'clientele', 'vault', 'camp',
'revealed', 'prev_revealed', 'clients_given')
for k in zones:
try:
zone_list = player_dict[k]
except KeyError as e:
# Without a marker fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player_from_raw(data: Dict[str, Any]) -> andesite.Player:\n return build_from_raw(andesite.Player, data)",
"def player_to_raw(player: andesite.Player) -> Dict[str, Any]:\n return convert_to_raw(player)",
"def decode_game(obj):\n try:\n players = obj['players']\n jacks = obj['jacks']\... | [
"0.68906856",
"0.63027155",
"0.595839",
"0.5783335",
"0.56507695",
"0.5614548",
"0.5443457",
"0.53009176",
"0.5233862",
"0.52042294",
"0.51937217",
"0.51900107",
"0.51782286",
"0.51741654",
"0.51265824",
"0.5118537",
"0.51110995",
"0.5083439",
"0.5032245",
"0.49747798",
"0.49... | 0.7461034 | 0 |
Transform a Game object into JSON. | def game_to_json(game):
return json.dumps(encode(game), sort_keys=True, indent=None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_json(self):\r\n\r\n object_json = dict()\r\n object_json[\"Type\"] = self.__class__.__name__\r\n game_json = dict()\r\n game_json[\"x_dist\"] = self.x_dist\r\n game_json[\"y_dist\"] = self.y_dist\r\n game_json[\"turn_number\"] = self.turn_number\r\n game_json[\"max_turns\"] = self.max_t... | [
"0.8218906",
"0.689022",
"0.67576677",
"0.66327727",
"0.659543",
"0.651706",
"0.651706",
"0.63629264",
"0.6226575",
"0.62217385",
"0.61337006",
"0.6129566",
"0.6126686",
"0.61172396",
"0.61062807",
"0.6105073",
"0.60903734",
"0.60819376",
"0.60679865",
"0.6067136",
"0.6053544... | 0.81920624 | 1 |
Transform JSON into game object. | def json_to_game(game_json):
try:
game_dict = json.loads(game_json)
except ValueError as e:
raise GTREncodingError(e.message)
return decode_game(game_dict) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(cls, json_str):\n \n game_state = json.loads(json_str)\n return cls(game_state)",
"def deserialize(cls, json_):\n schema = movers_schema.CatsMover()\n if 'tide' in json_:\n schema.add(Tide())\n _to_dict = schema.deserialize(json_)\n\n return _t... | [
"0.6219264",
"0.6184896",
"0.61346227",
"0.6123026",
"0.60975194",
"0.598766",
"0.5962306",
"0.59619",
"0.5826152",
"0.5800307",
"0.5779192",
"0.57340384",
"0.5732537",
"0.5730262",
"0.5729551",
"0.57233346",
"0.5716984",
"0.5715081",
"0.57098496",
"0.5694461",
"0.5693428",
... | 0.74482936 | 0 |
Tests the getEditor method. It checks if every property type has a corresponding editor. | def testGetEditorForPropTypes(self):
propTypes = PROPERTY_TYPE_NAMES[:]
propTypes.remove(u'Any')
for propType in propTypes:
self._editorFactory.createEditor(None, propType) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testGetCorrectEditor(self):\r\n \r\n self.assertTrue(type(self._editorFactory.createEditor(None, 'Number')) == QtGui.QDoubleSpinBox)\r\n self.assertTrue(type(self._editorFactory.createEditor(None, 'Boolean')) == QtGui.QCheckBox)\r\n self.assertTrue(type(self._editorFactory.createEdi... | [
"0.69960827",
"0.6227144",
"0.61762774",
"0.5788499",
"0.5787922",
"0.5742062",
"0.5738227",
"0.5693842",
"0.5583199",
"0.55080473",
"0.54564714",
"0.54548",
"0.5422763",
"0.53486246",
"0.5312354",
"0.53043926",
"0.5302288",
"0.5210343",
"0.51824975",
"0.517645",
"0.5159225",... | 0.7330423 | 0 |
Checks that the correct editor type is returned corresponding to the input type. | def testGetCorrectEditor(self):
self.assertTrue(type(self._editorFactory.createEditor(None, 'Number')) == QtGui.QDoubleSpinBox)
self.assertTrue(type(self._editorFactory.createEditor(None, 'Boolean')) == QtGui.QCheckBox)
self.assertTrue(type(self._editorFactory.createEditor(None, 'Da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def editorForTyp(typ):\n\n if typ == \"quint32\":\n return (\"QSpinBox\", \"setValue\", \"value\")\n elif typ == \"QString\":\n return (\"QLineEdit\", \"setText\", \"text\")\n elif typ == \"bool\":\n return (\"QCheckBox\", \"setChecked\", \"isChecked\")\n return (None, None, None)"... | [
"0.633208",
"0.6181055",
"0.61696106",
"0.60853004",
"0.602449",
"0.5877308",
"0.5861125",
"0.5839989",
"0.5791773",
"0.57858986",
"0.5739676",
"0.5671304",
"0.56486547",
"0.5628105",
"0.5628105",
"0.5628105",
"0.5628105",
"0.5628105",
"0.5628105",
"0.5607358",
"0.557421",
... | 0.6798127 | 0 |
Tests restrictions for integer and string editors | def testEditorRestrictionsStringInt(self):
restrictions = {constants.MAXIMUM_LENGTH: 12,
constants.MAXIMUM_VALUE: 500,
constants.MINIMUM_VALUE: 10,
constants.MAXIMUM_NUMBER_OF_DECIMAL_PLACES: 5,
consta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_for_int(check):",
"def test_non_numberic_validation(self):",
"def test_non_numberic_validation(self):",
"def isInteger(self):",
"def isInteger(self):",
"def test_int_field():",
"def _validate_input_integer(display_name, value):\n\n if isinstance(value, int) is False:\n raise... | [
"0.6691826",
"0.6463864",
"0.6463864",
"0.63469595",
"0.63469595",
"0.6161424",
"0.6137666",
"0.6132693",
"0.603034",
"0.5942053",
"0.58878326",
"0.58795506",
"0.5863159",
"0.5862947",
"0.585413",
"0.58304596",
"0.58263016",
"0.58039445",
"0.5799234",
"0.5799234",
"0.5795546"... | 0.75351286 | 0 |
Tests restrictions for the date time editor | def testEditorRestrictionsDateTime(self):
restrictions = {
constants.MINIMUM_VALUE: datetime.datetime(1950, 1, 1, 0, 15),
constants.MAXIMUM_VALUE: datetime.datetime(2010, 1, 1, 0, 15),
}
dateTimeEdit = self._e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_date_or_time(css, date_or_time):\r\n # We need to wait for JavaScript to fill in the field, so we use\r\n # css_has_value(), which first checks that the field is not blank\r\n assert_true(world.css_has_value(css, date_or_time))",
"def date_temporal_paradox_free(self):\n valid_date = Tr... | [
"0.68290424",
"0.67668205",
"0.6597302",
"0.6583743",
"0.6518259",
"0.65147626",
"0.65147066",
"0.6456792",
"0.6448193",
"0.6399789",
"0.6349306",
"0.6319812",
"0.6310786",
"0.63087565",
"0.6229291",
"0.62238276",
"0.61363155",
"0.6135235",
"0.6109809",
"0.6098492",
"0.609434... | 0.776444 | 0 |
Tests the setEditorValue method | def testSetEditorValue(self):
lineEdit = QtGui.QLineEdit()
self._editorFactory.setEditorValue(lineEdit, u"Test")
self.assertTrue(lineEdit.text() == u"Test" )
spinBox = QtGui.QDoubleSpinBox()
self._editorFactory.setEditorValue(spinBox, 2.05)
self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testGetValueFromEditor(self):\r\n \r\n lineEdit = QtGui.QLineEdit()\r\n lineEdit.setText(QtCore.QString(u\"TestValue\"))\r\n self.assertEquals(self._editorFactory.getValueFromEditor(lineEdit), u\"TestValue\")\r\n \r\n lineEdit = QtGui.QLineEdit()\r\n lineEdit.se... | [
"0.75850475",
"0.69617355",
"0.681993",
"0.66658187",
"0.66211206",
"0.65987045",
"0.6571044",
"0.6496191",
"0.6449459",
"0.6372082",
"0.627165",
"0.6246487",
"0.62422246",
"0.62090874",
"0.6189002",
"0.6134371",
"0.6124313",
"0.61129946",
"0.60911644",
"0.60907924",
"0.60879... | 0.8129166 | 0 |
Parse the /gauges Slack command and invoke the corresponding function. | def gauges_app(params):
user = params['user_name'][0]
command = params['command'][0]
channel = params['channel_name'][0]
command_text = params['text'][0] if 'text' in params else ''
commands = {
r'\s*check\s+(.+)': check_gauge,
r'\s*add\s+(\d+)\s+(.+)': add_favorite_gauge,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n from argparse import ArgumentParser\n\n parser = ArgumentParser(usage=main.__doc__)\n parser.add_argument('-st', '--slack-token', required=True, dest='slack_token',\n help='Slack token to use for auth into the Slack WebAPI')\n parser.add_argument('-su', '--slack-use... | [
"0.547369",
"0.5310262",
"0.5220047",
"0.51400256",
"0.51285195",
"0.5113715",
"0.5092041",
"0.5075265",
"0.5070688",
"0.49853694",
"0.49404556",
"0.49369788",
"0.493058",
"0.48483506",
"0.48424324",
"0.48346627",
"0.48330617",
"0.48283508",
"0.48094562",
"0.47862118",
"0.477... | 0.76390374 | 0 |
Display usage information for the /gauges Slack command. | def display_help_message():
return lambda_response(None, {
"text": """
/gauges list - list favorite gauges
/gauges add USGS_SITE_NUMBER RIVER_DESCRIPTION - add gauge to list of favorite gauges
/gauges check USGS_SITE_NUMBER - display current flow readings for gauge
""".strip(),
}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gauges_app(params):\n user = params['user_name'][0]\n command = params['command'][0]\n channel = params['channel_name'][0]\n command_text = params['text'][0] if 'text' in params else ''\n\n commands = {\n r'\\s*check\\s+(.+)': check_gauge,\n r'\\s*add\\s+(\\d+)\\s+(.+)': add_favor... | [
"0.6884933",
"0.6428911",
"0.6290922",
"0.62412703",
"0.62412703",
"0.6190606",
"0.61636436",
"0.6121168",
"0.6121168",
"0.6049153",
"0.595806",
"0.5918434",
"0.59167045",
"0.58756137",
"0.5801118",
"0.57649565",
"0.5740664",
"0.5724877",
"0.57188916",
"0.5716132",
"0.5698429... | 0.699159 | 0 |
Ensure the Slack token given in request matches token provided by Slack. | def verify_slack_token(request_token):
encrypted_token = os.environ['kmsEncryptedToken']
if encrypted_token == 'local':
return True
kms = boto3.client('kms')
expected_token = kms.decrypt(CiphertextBlob=b64decode(encrypted_token))['Plaintext']
return request_token == expected_token | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def validate_token(self, token):",
"def is_request_valid(request: request) -> bool:\n \n key = os.environ.get(\"SLACK_SIGNING_SECRET\")\n basestring = 'v0:' + request.headers['X-Slack-Request-Timestamp'] + ':' + str(request.get_data(), 'utf-8')\n\n # Hash the basestring using the signing secret as the ... | [
"0.673191",
"0.65924937",
"0.6549066",
"0.6414952",
"0.64047205",
"0.6387332",
"0.6221181",
"0.6215041",
"0.6141358",
"0.6137149",
"0.61179763",
"0.6112969",
"0.6043269",
"0.60235155",
"0.5993183",
"0.59824115",
"0.59796953",
"0.59645915",
"0.58996564",
"0.5895253",
"0.585439... | 0.7522207 | 0 |
Tests for successful fetch of user details | def test_fetch_user(self):
self.register_user()
self.assertEqual(self.fetch_user_details().status_code, 200)
self.assertTrue(self.fetch_user_details(
).json["data"][0]["username"] == 'Bjorn') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_retrive_user(self):\n res = self.client.get(ME_URL)\n\n self.assertEqual(res.status_code, status.HTTP_200_OK)\n self.assertEqual(res.data['email'], self.user.email)\n self.assertEqual(res.data['name'], self.user.name)\n self.assertNotIn('password', res.data)",
"def tes... | [
"0.7265743",
"0.7263957",
"0.7238713",
"0.72018176",
"0.7172804",
"0.7141861",
"0.7141622",
"0.71234095",
"0.70722234",
"0.6969097",
"0.6912244",
"0.689363",
"0.6856903",
"0.68492436",
"0.68488216",
"0.67698485",
"0.6769589",
"0.67637604",
"0.6760221",
"0.6758316",
"0.6752664... | 0.82008743 | 0 |
Test pure strategy deviation gains | def test_pure_strategy_deviation_gains():
profiles = [
[2, 0, 2, 0],
[2, 0, 1, 1],
[2, 0, 0, 2],
[1, 1, 2, 0],
[1, 1, 1, 1],
[1, 1, 0, 2],
[0, 2, 2, 0],
[0, 2, 1, 1],
[0, 2, 0, 2],
]
payoffs = [
[1, 0, 2, 0],
[3, 0, 4, 5... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_pooled_sd(self):\r\n exp = pooled_standard_deviation(self.pooled_sd_input_1)\r\n self.assertEqual(self.pooled_sd_result, exp)",
"def test_stddev(self):\n self.assertEqual(stddev(list1, sample=False), np.std(list1))\n self.assertEqual(stddev(list1), np.std(list1, ddof=1))",
... | [
"0.719028",
"0.6858666",
"0.68027776",
"0.65296084",
"0.6486555",
"0.635483",
"0.62375724",
"0.6182963",
"0.6129973",
"0.61291724",
"0.6124701",
"0.6107477",
"0.6103591",
"0.60841995",
"0.60734254",
"0.60684186",
"0.60591066",
"0.60487235",
"0.60455656",
"0.60227054",
"0.5993... | 0.72749144 | 0 |
Test empty pure strategy deviation gains | def test_empty_pure_strategy_deviation_gains():
game = rsgame.empty(2, [2, 2])
gains = regret.pure_strategy_deviation_gains(game, [2, 0, 2, 0])
expected = [np.nan, np.nan, 0, 0, np.nan, np.nan, 0, 0]
assert np.allclose(gains, expected, equal_nan=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_pure_strategy_deviation_gains():\n profiles = [\n [2, 0, 2, 0],\n [2, 0, 1, 1],\n [2, 0, 0, 2],\n [1, 1, 2, 0],\n [1, 1, 1, 1],\n [1, 1, 0, 2],\n [0, 2, 2, 0],\n [0, 2, 1, 1],\n [0, 2, 0, 2],\n ]\n payoffs = [\n [1, 0, 2, 0],\n... | [
"0.6807216",
"0.66973627",
"0.6601877",
"0.65545076",
"0.6377348",
"0.63439",
"0.6266455",
"0.6247438",
"0.61981374",
"0.6193134",
"0.6173661",
"0.61724055",
"0.6157527",
"0.6086358",
"0.6079541",
"0.6078199",
"0.5965986",
"0.596592",
"0.59586865",
"0.59433013",
"0.5929411",
... | 0.7720673 | 0 |
Test mixed prisoners dilemma | def test_mixed_prisoners_dilemma(_):
game = gamegen.sym_2p2s_game(2, 0, 3, 1) # prisoners dilemma
eqm = [0, 1]
assert (
regret.mixture_regret(game, eqm) == 0
), "Known symmetric mixed was not zero regret" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_mixed():\n # assert the distribution of the samples is close to the distribution of the data\n # using a kstest for continuous + a cstest for categorical.",
"def test_mixed_detections(self):\n expected_accuracy = dict(num_recall=5, uniq_recall=5, num_precision=5, uniq_precision=5)\n ... | [
"0.65623516",
"0.6245512",
"0.6154409",
"0.6082697",
"0.59172255",
"0.5830582",
"0.57946837",
"0.57719916",
"0.5732568",
"0.5726638",
"0.56996834",
"0.56880736",
"0.5664511",
"0.5660921",
"0.5639972",
"0.5627481",
"0.5621667",
"0.5621211",
"0.56166404",
"0.5614224",
"0.561177... | 0.70147854 | 0 |
Test pure regret with incomplete data | def test_pure_incomplete_data():
profiles = [[2, 0]]
payoffs = [[1.0, 0.0]]
game = paygame.game(2, 2, profiles, payoffs)
reg = regret.pure_strategy_regret(game, [2, 0])
assert np.isnan(reg), "regret of missing profile not nan" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_regref(self, parse_input_mocked_metadata):\n with pytest.raises(BlackbirdSyntaxError, match=\"reserved for register references\"):\n parse_input_mocked_metadata(\"float q0 = 5\")\n\n with pytest.raises(BlackbirdSyntaxError, match=\"reserved for register references\"):\n ... | [
"0.6081043",
"0.6043012",
"0.6031904",
"0.59613633",
"0.592191",
"0.5688931",
"0.56843865",
"0.5655039",
"0.55757535",
"0.55755067",
"0.55748713",
"0.55063003",
"0.54772604",
"0.54687196",
"0.54585534",
"0.54542834",
"0.5448106",
"0.54242694",
"0.54238486",
"0.54132485",
"0.5... | 0.646208 | 0 |
Test pure welfare in zero sum games | def test_two_player_zero_sum_pure_wellfare(strategies):
game = gamegen.two_player_zero_sum_game(strategies)
for prof in game.profiles():
assert np.isclose(
regret.pure_social_welfare(game, prof), 0
), "zero sum profile wasn't zero sum" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_non_zero_sum_profile_welfare():\n game = matgame.matgame([[[3.5, 2.5]]])\n assert np.isclose(\n regret.pure_social_welfare(game, [1, 1]), 6\n ), \"didn't properly sum welfare\"",
"def test_non_zero_sum_mixture_welfare():\n game = matgame.matgame([[[3.5, 2.5]]])\n assert np.isclose(... | [
"0.76916975",
"0.7210226",
"0.7141413",
"0.684246",
"0.6546029",
"0.64272505",
"0.63730365",
"0.63717544",
"0.63704246",
"0.63644445",
"0.6319052",
"0.62989366",
"0.62974435",
"0.61459094",
"0.6137057",
"0.6119639",
"0.6090532",
"0.6086124",
"0.6081551",
"0.60814744",
"0.6081... | 0.74965405 | 1 |
Test nonzero profile welfare | def test_non_zero_sum_profile_welfare():
game = matgame.matgame([[[3.5, 2.5]]])
assert np.isclose(
regret.pure_social_welfare(game, [1, 1]), 6
), "didn't properly sum welfare" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_zero_profile(in_file):\n profile = restore_profile_from_csv(in_file)\n for i in range(0, profile.shape[0]):\n for j in range(0, profile.shape[1]):\n if profile[i, j] != 0:\n return False\n return True",
"def test_positive_electrode_potential_profile(self):\n\n ... | [
"0.6667073",
"0.6578624",
"0.65420437",
"0.6202654",
"0.60797954",
"0.60783195",
"0.6010807",
"0.5971078",
"0.5968356",
"0.5959089",
"0.58125484",
"0.5811336",
"0.5766108",
"0.57221985",
"0.56860477",
"0.56216055",
"0.5620033",
"0.5616786",
"0.5614003",
"0.5604861",
"0.560298... | 0.6625437 | 1 |
Test nonzero mixed welfare | def test_non_zero_sum_mixture_welfare():
game = matgame.matgame([[[3.5, 2.5]]])
assert np.isclose(
regret.mixed_social_welfare(game, [1, 1]), 6
), "Didn't properly sum welfare" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_none_zero_values(self):\n hits = -1\n if (len(self.data.shape) == 3):\n hits = 0\n frames = self.data.shape[0]\n pixels = self.data.shape[1]\n bins = self.data.shape[2]\n for i in range(frames):\n for j in range(pixels):\... | [
"0.6825846",
"0.6737633",
"0.6604445",
"0.6584222",
"0.6580977",
"0.65670985",
"0.6548527",
"0.65309095",
"0.6498254",
"0.64602643",
"0.63998973",
"0.6371484",
"0.6345554",
"0.634395",
"0.63356173",
"0.63250744",
"0.63208586",
"0.62827486",
"0.62546605",
"0.62483233",
"0.6247... | 0.7034014 | 0 |
function to write data frame to output path in csv format | def write_df_to_csv(output_df,file_path):
output_df\
.coalesce(1)\
.write\
.format("csv")\
.option("header","true")\
.mode("overwrite")\
.save(file_path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_csv(self, outpath):\n\n\t\tself.df.to_csv(outpath)",
"def write_tocsv(file_name, dataframe) :\n print(\"\\nSaved result to {}\\n\".format(file_name))\n dataframe.to_csv(file_name, mode='a', header=False,index=False)",
"def write_csv(df: pd.DataFrame, outpath) -> None:\n logging.info('Writin... | [
"0.7855553",
"0.78537613",
"0.7837353",
"0.7741046",
"0.75917834",
"0.75553155",
"0.7541798",
"0.74970007",
"0.74893373",
"0.7447898",
"0.74433726",
"0.74422675",
"0.7428777",
"0.73904103",
"0.7386684",
"0.7379027",
"0.73772454",
"0.73599726",
"0.7357234",
"0.7354454",
"0.732... | 0.8036679 | 0 |
Set the xmin for the mapping. | def set_xmin(self, xmin):
self.__xmin = xmin | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xmin(self, xmin):\n\n self._xmin = xmin",
"def xmin(self, destination):\n self.move(destination=(destination, 0), origin=self.bbox[0], axis=\"x\")",
"def xmin(self):\n return self.bbox[0][0]",
"def get_xmin(self):\n return self.__xmin",
"def set_min(self, min):\n self... | [
"0.8546644",
"0.7350368",
"0.68326217",
"0.6685566",
"0.66629",
"0.65917593",
"0.64036345",
"0.6326491",
"0.63188314",
"0.6296113",
"0.6296113",
"0.60920125",
"0.60920125",
"0.60776895",
"0.60623056",
"0.5921677",
"0.58865154",
"0.58865154",
"0.58865154",
"0.5882641",
"0.5879... | 0.86203754 | 0 |
Set the xmax for the mapping. | def set_xmax(self, xmax):
self.__xmax = xmax | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xmax(self, xmax):\n\n self._xmax = xmax",
"def xmax(self):\n return self.bbox[1][0]",
"def xmax(self, destination):\n self.move(destination=(destination, 0), origin=self.bbox[1], axis=\"x\")",
"def xmax(self):\n return asarray([b[1] for b in self.bounds])",
"def _setBound(se... | [
"0.84297174",
"0.7287082",
"0.7274528",
"0.68572927",
"0.6426226",
"0.62207067",
"0.62118715",
"0.61695695",
"0.61545426",
"0.6103323",
"0.60710305",
"0.60276586",
"0.59652644",
"0.5898234",
"0.58467394",
"0.5786875",
"0.576071",
"0.5755433",
"0.57478565",
"0.5699613",
"0.566... | 0.8266433 | 1 |
Set the ymin for the mapping. | def set_ymin(self, ymin):
self.__ymin = ymin | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ymin(self, ymin):\n\n self._ymin = ymin",
"def ymin(self, destination):\n self.move(destination=(0, destination), origin=self.bbox[0], axis=\"y\")",
"def ymin(self):\n return self.bbox[0][1]",
"def get_ymin(self):\n return self.__ymin",
"def set_ymax(self, ymax):\n se... | [
"0.8518179",
"0.73270565",
"0.7244329",
"0.6646633",
"0.6147055",
"0.60741645",
"0.57971996",
"0.56157273",
"0.5505832",
"0.54995227",
"0.54981184",
"0.5381225",
"0.53610086",
"0.5355128",
"0.5323465",
"0.53104085",
"0.5291042",
"0.52726233",
"0.5203422",
"0.51997155",
"0.519... | 0.8445956 | 1 |
Set the ymax for the mapping. | def set_ymax(self, ymax):
self.__ymax = ymax | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ymax(self, ymax):\n\n self._ymax = ymax",
"def ymax(self, destination):\n self.move(destination=(0, destination), origin=self.bbox[1], axis=\"y\")",
"def ymax(self):\n return self.bbox[1][1]",
"def set_ymin(self, ymin):\n self.__ymin = ymin",
"def get_ymax(self):\n re... | [
"0.8489985",
"0.7041553",
"0.6871194",
"0.6711301",
"0.6381728",
"0.63408226",
"0.6269262",
"0.6192177",
"0.614379",
"0.6101817",
"0.6024359",
"0.59569526",
"0.58705556",
"0.5842018",
"0.5806912",
"0.56911963",
"0.5687205",
"0.5669724",
"0.5645723",
"0.5644793",
"0.56286293",... | 0.8542827 | 0 |
Set the height for the mapping. | def __set_height(self, height):
self._height = height | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def height(self, value: int):\n self._height = value",
"def set_height(height):\n resize.transforms[1].size = height",
"def SetHeight(self, h):\r\n\r\n self._height = h",
"def height(self, height):\n\n self._height = height",
"def height(self, height):\n\n self._height = heig... | [
"0.75247383",
"0.74844486",
"0.7423809",
"0.7423585",
"0.7423585",
"0.7423585",
"0.7423585",
"0.7423585",
"0.737109",
"0.7257267",
"0.7257267",
"0.7257267",
"0.7257267",
"0.7257267",
"0.7257267",
"0.7257267",
"0.7257267",
"0.7257267",
"0.7257267",
"0.7257267",
"0.7226241",
... | 0.78607804 | 0 |
Get the xmin of the mapping. | def get_xmin(self):
return self.__xmin | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xmin(self):\n return self.bbox[0][0]",
"def xmin(self):\n return asarray([b[0] for b in self.bounds])",
"def minX(self):\n self._updateExtents()\n return self._mMinX",
"def minX(self):\n return min(self.getx())",
"def min(self):\n return self._min_coords",
"d... | [
"0.83678037",
"0.7899679",
"0.7388378",
"0.73382795",
"0.73255056",
"0.7257165",
"0.71720254",
"0.7110704",
"0.708758",
"0.6859429",
"0.67958695",
"0.6657579",
"0.6656625",
"0.66109127",
"0.65634185",
"0.64638853",
"0.643652",
"0.64289904",
"0.6412782",
"0.63891435",
"0.63891... | 0.8122791 | 1 |
Get the ymin of the mapping. | def get_ymin(self):
return self.__ymin | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ymin(self):\n return self.bbox[0][1]",
"def ymax(self):\n return self.bbox[1][1]",
"def xmax(self):\n return self.bbox[1][0]",
"def ymin(self, ymin):\n\n self._ymin = ymin",
"def ymin(self, destination):\n self.move(destination=(0, destination), origin=self.bbox[0], a... | [
"0.8741283",
"0.71017414",
"0.6655721",
"0.66541207",
"0.66170704",
"0.65841466",
"0.62649477",
"0.62310493",
"0.6072929",
"0.6013632",
"0.60135776",
"0.59821725",
"0.59467",
"0.59035945",
"0.58949155",
"0.58858633",
"0.5879028",
"0.58733577",
"0.5852738",
"0.58307093",
"0.58... | 0.8153747 | 1 |
Get the ymax of the mapping. | def get_ymax(self):
return self.__ymax | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ymax(self):\n return self.bbox[1][1]",
"def ymax(self, ymax):\n\n self._ymax = ymax",
"def get_ymin(self):\n return self.__ymin",
"def maxY(self):\n return max(self.gety())",
"def get_y_max(self):\n if len(self._statDict) == 0:\n return -1E10\n\n lin... | [
"0.86830366",
"0.69359404",
"0.68736345",
"0.68600047",
"0.6859924",
"0.6851752",
"0.6827102",
"0.6717167",
"0.66788393",
"0.65750885",
"0.65327144",
"0.64925885",
"0.6480698",
"0.6446625",
"0.64244026",
"0.64226824",
"0.6334915",
"0.6293351",
"0.62724763",
"0.6239155",
"0.61... | 0.81109774 | 1 |
Map a tkinter i coordinate to an x coordinate in math scale. | def get_x(self, i):
scale = (self.__xmax - self.__xmin) / (self.__width - 1)
return scale * i + self.__xmin | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _scale_coordinate(self, x, y, scale_factor):\n\n return (x * scale_factor, y * scale_factor)",
"def xscale(value):\n impl.xscale(**locals())",
"def get_i(self, x):\n return (x - self.__xmin) * (self.__width - 1) // (self.__xmax - self.__xmin)",
"def pt_to_px(dpi,coord,i=0):\n\n if i =... | [
"0.6358537",
"0.63275945",
"0.6078526",
"0.6054983",
"0.5917263",
"0.590981",
"0.586147",
"0.58428895",
"0.5812084",
"0.5812084",
"0.57988787",
"0.57113504",
"0.56550455",
"0.5634713",
"0.5608298",
"0.5592725",
"0.5587291",
"0.5571795",
"0.55699193",
"0.5550726",
"0.55462784"... | 0.71739125 | 0 |
Map a tkinter j coordinate to a y coordinate in math scale. | def get_y(self, j):
scale = (self.__ymin - self.__ymax) / (self.__height - 1)
return scale * j + self.__ymax | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toTk(self,y):\r\n if y == maxValue: return 0\r\n tk_y = Size\r\n if y != minValue:\r\n tk_y -= y\r\n return tk_y",
"def _scale_coordinate(self, x, y, scale_factor):\n\n return (x * scale_factor, y * scale_factor)",
"def yscale(value):\n impl.yscale(**locals(... | [
"0.6494457",
"0.61208355",
"0.6013286",
"0.5936811",
"0.5932429",
"0.5888345",
"0.57732797",
"0.577191",
"0.5771299",
"0.57565564",
"0.5745768",
"0.57041335",
"0.5702418",
"0.5664975",
"0.56192434",
"0.5598867",
"0.55813575",
"0.556827",
"0.55515087",
"0.55374634",
"0.5533767... | 0.6374429 | 1 |
Concatenate features tables from many results.db files. | def combine_features_tables(*paths_to_dbs):
con = None
con = sql.connect('combined_results.db')
cur = con.cursor()
# Create a table matching the schema of the 'features' tables
cur.execute("CREATE TABLE combined_features(id INT PRIMARY KEY, \
resname TEXT, short_name TEXT, cc REAL, d_ref REAL, d_mid REAL... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def results2sqlite(features, results_files, options):\n\n # open log\n log = open(options.log,\"a\",0)\n\n dbfile = \"%s/%s\" % (os.path.dirname(results_files[0]), \n re.sub(\"_rout\",\"\",os.path.basename(results_files[0])))\n\n if os.path.exists(dbfile):\n log.write(... | [
"0.7104086",
"0.62097013",
"0.6068326",
"0.60657793",
"0.59878415",
"0.59683645",
"0.582525",
"0.5821348",
"0.5807332",
"0.5784937",
"0.5756549",
"0.5733246",
"0.5726869",
"0.5663718",
"0.5657538",
"0.56495064",
"0.5642732",
"0.5623717",
"0.5599618",
"0.5579816",
"0.5521819",... | 0.7974553 | 0 |
Used to ensure a conditional operation is supported by this type. By default, uses a hardcoded table of operations that maps to each backing DynamoDB type. You can override this method to implement your own conditional operators, or to dynamically adjust which operations your type supports. | def supports_operation(self, operation: str) -> bool:
return operation in OPERATION_SUPPORT_BY_TYPE[self.backing_type] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supports_operation(self, operation: str) -> bool:\n return True",
"def test_unsupported_op(self):\n\n NIE = NotImplementedError\n self.assertRaises(NIE, self.table.where, 'c_complex128 > 0j')\n self.assertRaises(NIE, self.table.where, 'c_string + b\"a\" > b\"abc\"')",
"def query... | [
"0.5756933",
"0.5544241",
"0.5353713",
"0.5221998",
"0.5214765",
"0.51125634",
"0.5091606",
"0.50755566",
"0.504344",
"0.50336653",
"0.5032038",
"0.5025396",
"0.5019139",
"0.5012174",
"0.49985704",
"0.49951243",
"0.49788997",
"0.49714226",
"0.49690187",
"0.49671888",
"0.49544... | 0.5650001 | 1 |
Returns the DynamoDB backing type from a given wire dict | def extract_backing_type(value: dict) -> str:
return next(iter(value.keys())) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wire_type(self):\n if hasattr(self, '_m_wire_type'):\n return self._m_wire_type if hasattr(self, '_m_wire_type') else None\n\n self._m_wire_type = self._root.Pair.WireTypes((self.key.value & 7))\n return self._m_wire_type if hasattr(self, '_m_wire_type') else Non... | [
"0.56782347",
"0.5649958",
"0.54733914",
"0.5367086",
"0.535196",
"0.5344845",
"0.5209075",
"0.5205346",
"0.5180094",
"0.51395494",
"0.5101474",
"0.50907433",
"0.50560325",
"0.5052811",
"0.5048965",
"0.50400937",
"0.50352675",
"0.5021212",
"0.5015264",
"0.500321",
"0.49859893... | 0.56898856 | 0 |
Returns the DynamoDB backing type for a given python value's type | def backing_type_for(value):
if isinstance(value, str):
vtype = "S"
elif isinstance(value, bytes):
vtype = "B"
# NOTE: numbers.Number check must come **AFTER** bool check since isinstance(True, numbers.Number)
elif isinstance(value, bool):
vtype = "BOO... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_type(value):\n return type(value)",
"def extract_backing_type(value: dict) -> str:\n return next(iter(value.keys()))",
"def gettype(value):\n\n # Return the type\n return type(value)",
"def value_type(self) -> global___Type:",
"def _get_value_type(cls, value):\n #TODO: Fix Args: ... | [
"0.6814509",
"0.67314994",
"0.6731047",
"0.66861975",
"0.66235596",
"0.6606717",
"0.6563416",
"0.65233344",
"0.65001804",
"0.640095",
"0.63078845",
"0.628035",
"0.61927396",
"0.61868817",
"0.6145348",
"0.61447763",
"0.6131414",
"0.6111457",
"0.61069417",
"0.60865813",
"0.6081... | 0.67685336 | 1 |
This function inserts particles, and assigns particle velocities if requested by the user. If species is 'all', all components specified in SS are inserted. Otherwise, species must be the id of the component to be inserted. | def insert(self, species, value, **args):
if not self.pddName:
print('Probability distribution not set for particle insertion. Exiting ...')
sys.exit()
if 'region' in args:
region = args['region']
else:
# Default region is sim box
if 'cylinder' in self.pargs:
region = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_loc(self, id, value, vel, vel_type, region, mech, **ss):\n\n if not self.rank:\n logging.info('Inserting particles for species {}'.format(id+1))\n\n seed = 32452843\n name = np.random.randint(0,1e8)\n\n randName = 'insert' + '{}'.format(np.random.randint(0,10**6))\n self.... | [
"0.6746342",
"0.6594203",
"0.6537573",
"0.59755516",
"0.55078655",
"0.54103255",
"0.534477",
"0.5317178",
"0.5149414",
"0.507633",
"0.50294185",
"0.499245",
"0.49844128",
"0.496207",
"0.49476174",
"0.49295354",
"0.48623806",
"0.48584262",
"0.4830943",
"0.4827854",
"0.4824184"... | 0.6971915 | 0 |
Control how a mesh (specified by name) moves in time | def moveMesh(self, name, **args):
randName = 'moveMesh' + str(np.random.randint(10**5,10**8))
args = dictToTuple(**args)
self.lmp.command('fix {} all move/mesh mesh {} '.format(randName, name) + ('{} ' * len(args)).format(*args))
return randName | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_mesh(self, dt):\r\n # get the displacement vector from dt*u\r\n move = project(Constant(dt)*self.u, self.V)\r\n\r\n # use ALE to move the mesh.\r\n # this updates all functions defined on the mesh\r\n ALE.move(self.mesh, move)",
"def add_to_mesh_change(self, name):\n ... | [
"0.63525367",
"0.60311604",
"0.60311604",
"0.60311604",
"0.60311604",
"0.5925341",
"0.5627964",
"0.5594248",
"0.5550356",
"0.55171347",
"0.546519",
"0.54598683",
"0.5451154",
"0.54161954",
"0.54103166",
"0.5406515",
"0.5406515",
"0.5337231",
"0.52510047",
"0.5240432",
"0.5229... | 0.71671987 | 0 |
Imports all meshes and sets them up as walls. Can import only one mesh specified by the 'name' keyword. | def importMeshes(self, name=None):
wall = False
if 'mesh' in self.pargs:
for mesh in self.pargs['mesh'].keys():
if 'file' in self.pargs['mesh'][mesh]:
if name:
if mesh == name:
self.pargs['mesh'][mesh]['import'] = True
self.importMesh(mes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def importMesh(self, name, file, mtype, material, **args):\n args = dictToTuple(**args)\n\n if not self.rank:\n logging.info('Importing mesh from {}'.format(file))\n\n self.lmp.command('fix {} all {} file {} type {} '.format(name, mtype, file, material) + ('{} ' * len(args)).format(*args))",
"def l... | [
"0.6945744",
"0.6573277",
"0.61359596",
"0.60860705",
"0.60441947",
"0.60246503",
"0.5938384",
"0.5814568",
"0.5810275",
"0.5705016",
"0.56539613",
"0.5643031",
"0.5590081",
"0.5547731",
"0.5471243",
"0.5470875",
"0.54425204",
"0.5442343",
"0.5380809",
"0.53356165",
"0.526336... | 0.8273944 | 0 |
Imports a specific surface mesh requested by the user | def importMesh(self, name, file, mtype, material, **args):
args = dictToTuple(**args)
if not self.rank:
logging.info('Importing mesh from {}'.format(file))
self.lmp.command('fix {} all {} file {} type {} '.format(name, mtype, file, material) + ('{} ' * len(args)).format(*args)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_mesh(self, scenegroup):\n logger.debug((\"mesh\", scenegroup[\"asset\"]))\n if scenegroup[\"asset\"] in self._imported_assets:\n return self._imported_assets[scenegroup[\"asset\"]]\n asset = self.gridinfo.getAsset(scenegroup[\"asset\"])\n if not asset[\"type\"] == ... | [
"0.69858706",
"0.6630239",
"0.62958664",
"0.6269835",
"0.61887455",
"0.59663564",
"0.59480304",
"0.5947817",
"0.5945489",
"0.59407437",
"0.5907435",
"0.5760054",
"0.57484245",
"0.57418364",
"0.57133335",
"0.57010317",
"0.5665503",
"0.56468004",
"0.56454825",
"0.56454825",
"0.... | 0.69797635 | 1 |
Deletes a specified fix. If the fix is for a mesh, we must unfix it and reimport all meshes again and setup them up as walls. Very tedious! | def remove(self, name):
# Remove any DUMP-IDS 1st in case the user wants to move a mesh
if 'mesh' in self.pargs:
if name in self.pargs['mesh']:
# must delete all meshes / dumps in order to re-import remaining meshes
for dump in self.pargs['traj']['dump_mname']:
self.lmp.command('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _removeFX(self):\r\n\t\tnodesToClean = [CONST.FOAM_FLUID_SHAPENODE, CONST.WAKE_FLUID_SHAPENODE, 'fluids_hrc']\r\n\t\tfor eachNode in nodesToClean:\r\n\t\t\ttry:\r\n\t\t\t\tcmds.delete(each)\r\n\t\t\texcept:\r\n\t\t\t\tpass\r\n\r\n\t\tfor eachCache in cmds.ls(type = 'cacheFile'):\r\n\t\t\tcmds.delete(eachCache)... | [
"0.5865778",
"0.56835383",
"0.5389302",
"0.53211343",
"0.531655",
"0.52936274",
"0.51581055",
"0.511852",
"0.5106332",
"0.504785",
"0.50136316",
"0.49483892",
"0.48978946",
"0.48941877",
"0.4893984",
"0.4875528",
"0.48603132",
"0.48492587",
"0.48492292",
"0.4833869",
"0.48258... | 0.6244937 | 0 |
Create groups of atoms. If group is empty, groups{i} are created for every i species. | def createGroup(self, *group):
if not self.rank:
logging.info('Creating atom group {}'.format(group))
if not len(group):
for idSS in self.pargs['idSS']:
self.lmp.command('group group{} type {}'.format(idSS, idSS))
else:
self.lmp.command('group ' + ('{} ' * len(group)).format(*grou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_groups(self):\n for g in self.groups:\n self.add_group(groupname=g['groupname'],\n grouptitle=g['grouptitle'],\n path_to_group=g['path'])",
"def __make_group_by_atom(self, group_name, name_list):\r\n pass",
"def make_grp(self... | [
"0.71495205",
"0.69463223",
"0.6469187",
"0.64420646",
"0.6370277",
"0.61504716",
"0.6145693",
"0.61286277",
"0.6062877",
"0.6041889",
"0.6011992",
"0.5992965",
"0.5974285",
"0.5900575",
"0.5900106",
"0.5836723",
"0.58321244",
"0.582717",
"0.58037156",
"0.57611716",
"0.574774... | 0.7061944 | 1 |
Creates particles of type 'type' (1,2, ...) using style 'style' (box or region or single or random) | def createParticles(self, type, style, *args):
if not self.rank:
logging.info('Creating particles {} with args'.format(type) + (' {}' * len(args)).format(*args))
self.lmp.command('create_atoms {} {}'.format(type, style) + (' {}' * len(args)).format(*args)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addParticles( screen, number, color ):\n\t\n\tparticles = []\n\t\n\tfor i in range( number ):\n\t\n\t\tradius = 5\n\t\tmass = 1\n\t\t\n\t\t#random position and velocity\n\t\tx, y = randint(-WINDOW_X + radius, 1), randint(-WINDOW_Y + radius, WINDOW_Y - radius)\n\t\tvx, vy = randrange(-1, 2, 2) * 100, randrange(... | [
"0.6079593",
"0.56353205",
"0.56245106",
"0.54297006",
"0.5420395",
"0.53964645",
"0.53846157",
"0.5324577",
"0.5313518",
"0.5307059",
"0.5296735",
"0.52721125",
"0.52652985",
"0.5231309",
"0.5216166",
"0.5180959",
"0.5177343",
"0.5174028",
"0.51480824",
"0.5126019",
"0.50871... | 0.77557886 | 0 |
This creates dumps for particles and meshes in the system. In LIGGGHTS, all meshes must be declared once, so if a mesh is removed during the simulation, this function has to be called again, usually with only_mesh=True to keep the particle dump intact. | def writeSetup(self, only_mesh=False, name=None):
if not self.rank:
logging.info('Setting up trajectory i/o')
# Make sure the user did not request no particles be saved to a traj file, or we're not just re-initializing the meshes
if not only_mesh and self.pargs['traj']['pfile']:
if hasattr(sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_file_empty_particles( self, fullpath, iteration,\n time, dt, select_nglobal_dict=None ):\n # Create the file (can be done by one proc or in parallel)\n f = self.open_file( fullpath,\n parallel_open=self.write_metadata_parallel )\n\n # Set... | [
"0.6348499",
"0.6017643",
"0.59433347",
"0.5918724",
"0.58867896",
"0.58040327",
"0.5587725",
"0.5572685",
"0.5547502",
"0.5473173",
"0.54305583",
"0.53962207",
"0.53418237",
"0.5297949",
"0.5287817",
"0.52804905",
"0.5266058",
"0.5265977",
"0.5259798",
"0.5246343",
"0.524503... | 0.6408265 | 0 |
Extracts atomic positions from a certian frame and adds it to coords | def extractCoords(self):
if not self.rank:
logging.info('Extracting atomic poitions')
# Extract coordinates from liggghts
self.lmp.command('variable x atom x')
x = Rxn.lmp.extract_variable("x", "group1", 1)
self.lmp.command('variable y atom y')
y = Rxn.lmp.extract_variable("y", "group1",... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pos(self, frame):\n frame = self.perspective_shift(frame)\n \n puck_mask = self.color_mask(frame, self.color_green, thresh=15)\n striker_mask = self.color_mask(frame, self.color_orange, thresh=25, blur=5)\n \n puck_loc, _ = self.find_centroids(puck_mask)\n s... | [
"0.6418823",
"0.58318746",
"0.5818105",
"0.5788571",
"0.57316256",
"0.5709246",
"0.5681508",
"0.56652397",
"0.5647281",
"0.55638516",
"0.5563346",
"0.55037403",
"0.5490451",
"0.54636997",
"0.5463126",
"0.5431869",
"0.5429323",
"0.5427259",
"0.5409296",
"0.5408596",
"0.5398529... | 0.68274844 | 0 |
Passes a specific command to LIGGGHTS | def command(self, cmd):
self.lmp.command(cmd) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command():\n pass",
"def _command(self, *cmd, handler=None):",
"def command(self,cmd):\n self.lib.lammps_command(self.lmp,cmd.encode('utf-8'))",
"def cmd(self):",
"def on_command(server, user, command, args):",
"def commands():",
"def command(self):\n raise NotImplementedError",
... | [
"0.6999622",
"0.6866277",
"0.6741059",
"0.6593362",
"0.64950615",
"0.6341376",
"0.6274385",
"0.6233461",
"0.6208959",
"0.6190069",
"0.61529213",
"0.6144111",
"0.6131297",
"0.6122536",
"0.6122536",
"0.6122536",
"0.6122536",
"0.6120965",
"0.60502476",
"0.60389584",
"0.6030587",... | 0.76537764 | 0 |
Fill Matrix with numbers in ascending order. On clock direction. | def on_clock_spirral_matrix(Matrix, size):
x, y = 0, 0
dx, dy = 1, 0
nx, ny = 0, 0
for i in range(1, size ** 2 + 1):
Matrix[x][y] = i
nx, ny = x + dx, y + dy
if (0 <= nx < size and 0 <= ny < size and not Matrix[nx][ny]):
x, y = nx, ny
else:
dx, dy = -dy, dx
x, y = x + dx, y + dy | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fillMatrix(self, data):\r\n i = 0\r\n length = len(data)\r\n for r in range(self.rows):\r\n for c in range(self.columns):\r\n if i >= length:\r\n num = 0\r\n else:\r\n num = data[i]\r\n self.mat[r... | [
"0.67694896",
"0.6287781",
"0.6243157",
"0.61745304",
"0.61402696",
"0.60935116",
"0.6017933",
"0.5998255",
"0.5992001",
"0.5984787",
"0.598449",
"0.5972426",
"0.5968762",
"0.59303033",
"0.5921056",
"0.59167343",
"0.58961636",
"0.58904725",
"0.58780414",
"0.58708453",
"0.5862... | 0.64188 | 1 |
Testing snail func that returns a snail list from matrix. (nonclock direction) | def test_snail():
print(test_snail.__doc__)
size = 3
matrix = init_matrix(size)
non_clock_spirral_matrix(matrix, size)
print_matrix(matrix)
print("Result:", *new_way_snail(matrix)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_game(n):\n matrix = []\n\n for i in range(n):\n matrix.append([0] * n)\n return matrix",
"def non_clock_spirral_matrix(Matrix, size):\n\tx, y = 0, 0\n\tdx, dy = 1, 0\n\tnx, ny = 0, 0\n\n\tfor i in range(1, size ** 2 + 1):\n\t\tMatrix[y][x] = i\n\n\t\tnx, ny = x + dx, y + d... | [
"0.6032252",
"0.59371877",
"0.5891421",
"0.58768857",
"0.58269703",
"0.5766986",
"0.5766963",
"0.56685406",
"0.56066597",
"0.5586566",
"0.55854857",
"0.5582861",
"0.5554448",
"0.55358297",
"0.5524303",
"0.5515351",
"0.55099577",
"0.55098355",
"0.54912657",
"0.5476773",
"0.546... | 0.7491709 | 0 |
List other available variants for given config/datataset >>> pidgen = PidGen ( ... ) >>> variants = pidgen.variants () | def variants ( self ) :
vars = []
items = [ 'distrib' , 'default' ]
items += [ 'stat_%s' % d for d in range ( 10 ) ]
items += [ 'syst_%s' % d for d in range ( 10 ) ]
from ostap.core.core import rootError
from ostap.logger.logger import logFatal
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_variants(context, variant_id):\n adapter = context.obj['adapter']\n\n results = []\n if variant_id is not None:\n results = adapter.find_variant({'display_name': variant_id})\n\n else:\n results = adapter.find_variants({})\n\n click.echo(pprint(results))",
"def variants(self... | [
"0.7305709",
"0.6922923",
"0.6757159",
"0.65926665",
"0.624297",
"0.6191393",
"0.60683614",
"0.602377",
"0.60061955",
"0.5994383",
"0.5958372",
"0.5929455",
"0.587311",
"0.58460873",
"0.58350617",
"0.5800091",
"0.5700619",
"0.5698907",
"0.56448954",
"0.55987716",
"0.55907583"... | 0.72740257 | 1 |
The function to add resampled variable into TTree/TChain `tree` input `ROOT.TTree/TChain` to be updated `pidgen` configured `PidGen` object `newpid` the name of new resampled PID variable `seed` the seed for `ROOT.gRandom` `silent` silent processing? >>> pidgen = PidGen ( ... ) configure PidGenObject >>> tree = .... >>... | def runPidGen ( tree , ## initial tree/chain to be updated
pidgen , ## PidGen object
newpid , ## name of new PID variable
seed = None , ## random seed
silent = False , ## silent ?
variants... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def propose_tree(self, grammar, t, resampleProbability=lambdaOne):\n new_t = copy(t)\n \n try: # to sample a subnode\n n, lp = new_t.sample_subnode(resampleProbability=resampleProbability)\n except NodeSamplingException: # when no nodes can be sampled\n raise ProposalF... | [
"0.5460168",
"0.515881",
"0.5158306",
"0.4802454",
"0.4769962",
"0.47576377",
"0.47512767",
"0.47205713",
"0.47106993",
"0.46914384",
"0.46690536",
"0.46572798",
"0.46415716",
"0.46258706",
"0.46246016",
"0.46200678",
"0.46048224",
"0.45871305",
"0.4586186",
"0.4586186",
"0.4... | 0.6324577 | 0 |
" Method which adds a squad to the army via the GUI | def AddSquad(self):
if self.squad.squad_type == "Troop":
self.parent._army.AddTroop(self.squad)
if self.squad.squad_type == "HQ":
self.parent._army.AddHq(self.squad)
if self.squad.squad_type == "Elite":
self.parent._army.AddElite(self.squad)
if self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def FillSquad(self):\n unitName = \"\"\n if isinstance(self.squad, squad.Squad):\n unitName = list(self.squad.additional_units.keys())[0]\n while self.squad.current_size < self.squad.max_size:\n self.squad.addUnit(unitName)\n self.addButton\n self.exportButt... | [
"0.7039126",
"0.675486",
"0.65136003",
"0.57337856",
"0.57215184",
"0.5513476",
"0.5379643",
"0.5367716",
"0.5356816",
"0.53470695",
"0.53430533",
"0.5317361",
"0.5301197",
"0.5258149",
"0.52295804",
"0.5219136",
"0.52143854",
"0.51988274",
"0.5195523",
"0.51935565",
"0.51610... | 0.81639963 | 0 |
" Method where the squad is filled with units that are possible to add to the squad | def FillSquad(self):
unitName = ""
if isinstance(self.squad, squad.Squad):
unitName = list(self.squad.additional_units.keys())[0]
while self.squad.current_size < self.squad.max_size:
self.squad.addUnit(unitName)
self.addButton
self.exportButton
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def AddUnit(self):\n unitName = \"\"\n if isinstance(self.squad, squad.Squad):\n unitName = list(self.squad.additional_units.keys())[0]\n self.squad.addUnit(unitName)\n self.addButton\n self.exportButton\n self.pointLabel['text'] = self.squad.point_cost\n ... | [
"0.6318594",
"0.58827853",
"0.57576257",
"0.55876845",
"0.5514329",
"0.54756093",
"0.5407312",
"0.5405466",
"0.5399058",
"0.5363443",
"0.5333698",
"0.53286374",
"0.5242067",
"0.5224506",
"0.5214227",
"0.52113014",
"0.5201802",
"0.5199368",
"0.5171452",
"0.5141711",
"0.5123312... | 0.7201948 | 0 |
" Method which adds unit to the squad via GUI | def AddUnit(self):
unitName = ""
if isinstance(self.squad, squad.Squad):
unitName = list(self.squad.additional_units.keys())[0]
self.squad.addUnit(unitName)
self.addButton
self.exportButton
self.pointLabel['text'] = self.squad.point_cost
self.sizeLabel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def FillSquad(self):\n unitName = \"\"\n if isinstance(self.squad, squad.Squad):\n unitName = list(self.squad.additional_units.keys())[0]\n while self.squad.current_size < self.squad.max_size:\n self.squad.addUnit(unitName)\n self.addButton\n self.exportButt... | [
"0.74241513",
"0.7366921",
"0.6602817",
"0.65173954",
"0.6318469",
"0.6278951",
"0.61514944",
"0.5895767",
"0.5871472",
"0.5859954",
"0.5858473",
"0.5858082",
"0.58192956",
"0.57063824",
"0.570543",
"0.56862175",
"0.568427",
"0.56647366",
"0.5661415",
"0.56187904",
"0.5581613... | 0.8354949 | 0 |
" Method to upgrade the ranged weapons of a squad | def UpgradeWeapon(self):
label = self.wepSpin.get()
for index in range(min(self.squad.current_size, self.unitToWeap[label][1])):
upgradedUnit = next(x for x in self.squad.units if x.name == self.unitToWeap[label][3])
upgradedUnit.armRangedWeapon(weapon.ranged_weapons[self.unitToW... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateWeapons(self):\n self.readyWeapons = []\n self.setWeaponStatus()\n\n for myWeapon in self.activeWeapons:\n if myWeapon.preFireCheck() == 1:\n self.readyWeapons.append(myWeapon)\n self.alternateTargets = []\n\n if self.amsTargets != []:\n ... | [
"0.6541726",
"0.6521238",
"0.6098683",
"0.6015632",
"0.5897755",
"0.5890416",
"0.58825946",
"0.5880486",
"0.58393854",
"0.5827482",
"0.5787463",
"0.57143486",
"0.5684553",
"0.56694335",
"0.56388384",
"0.56300396",
"0.5598631",
"0.5584784",
"0.5554347",
"0.55406827",
"0.552452... | 0.7872686 | 0 |
Test that Client object fails properly | def test_vogeler_client_failure(self):
with self.assertRaises(Exception):
VogelerClient(callback_function=self.echo, role='client', dsn=self.bad_amqp_dsn) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_client_exception_for_invalid_request(self):\n self.assertRaises(RapicException, self.httpbin_3.get_request_data, 'request_not_in_client_json_file')",
"def test_call_httperror(self):\n\n with Client('username', 'password') as client:\n self.setSessionResponse(500)\n wi... | [
"0.7315777",
"0.72837347",
"0.71613777",
"0.7133152",
"0.6974426",
"0.69093716",
"0.68914354",
"0.6881749",
"0.6847558",
"0.682938",
"0.68140477",
"0.6799873",
"0.6765406",
"0.6748",
"0.6735373",
"0.6730854",
"0.6729832",
"0.67259014",
"0.6716003",
"0.66876423",
"0.6682814",
... | 0.7676785 | 0 |
Test that client can send durable messages | def test_client_message_durable(self):
test_message = 'this is a test'
c = VogelerClient(callback_function=self.echo, role='client', dsn=self.good_amqp_dsn)
self.assertIsNone(c.message(test_message))
c.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_client_message_nondurable(self):\n test_message = 'this is a test'\n c = VogelerClient(callback_function=self.echo, role='client', dsn=self.good_amqp_dsn)\n self.assertIsNone(c.message(test_message, durable=False))\n c.close()",
"def test_basic():\n client = CloudAMQPClien... | [
"0.7605211",
"0.71388835",
"0.7056882",
"0.67675745",
"0.670912",
"0.66242766",
"0.65502363",
"0.6498487",
"0.64008045",
"0.63720566",
"0.6324263",
"0.6322668",
"0.6289845",
"0.62881804",
"0.6288028",
"0.6273654",
"0.61799335",
"0.61789775",
"0.61651593",
"0.61599165",
"0.615... | 0.7842933 | 0 |
Test that client can send nondurable messages | def test_client_message_nondurable(self):
test_message = 'this is a test'
c = VogelerClient(callback_function=self.echo, role='client', dsn=self.good_amqp_dsn)
self.assertIsNone(c.message(test_message, durable=False))
c.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_client_message_durable(self):\n test_message = 'this is a test'\n c = VogelerClient(callback_function=self.echo, role='client', dsn=self.good_amqp_dsn)\n self.assertIsNone(c.message(test_message))\n c.close()",
"def test_must_be_subbed_to_send(self) -> None:\n user = s... | [
"0.7473128",
"0.6981395",
"0.69051445",
"0.6855454",
"0.6792945",
"0.67007333",
"0.66775346",
"0.6673682",
"0.6646512",
"0.6644426",
"0.6599354",
"0.6598506",
"0.65415764",
"0.6526683",
"0.64987653",
"0.6463907",
"0.641811",
"0.6413145",
"0.63612807",
"0.6351507",
"0.6328258"... | 0.77447563 | 0 |
Test that client callbacks work | def test_client_callback(self):
sample_text = 'this is a test'
message_body = json.dumps(sample_text)
test_message = message.SampleMessage(message_body)
c = VogelerClient(callback_function=None,
role='client',
host='localhost',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_for_client():",
"def test_callbacks_are_invoked_with_connections(self):\n client_calls = []\n server_calls = []\n\n def client_callback(conn, *args, **kwargs):\n client_calls.append(conn)\n return True\n\n def server_callback(conn, *args, **kwargs):\n ... | [
"0.7667442",
"0.7194082",
"0.7102082",
"0.6915728",
"0.6862485",
"0.67693526",
"0.6735676",
"0.6700892",
"0.66792536",
"0.65348333",
"0.6534562",
"0.6528283",
"0.6527646",
"0.65179193",
"0.65014017",
"0.64742434",
"0.6473794",
"0.64695454",
"0.6419276",
"0.63924927",
"0.63904... | 0.76622844 | 1 |
Test set of protocol ids updated. | def test_protocols_updated(self):
assert self.agent_config.protocols == {self.new_protocol_id} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_protocols_updated(self):\n assert self.skill_config.protocols == {self.new_protocol_id}",
"def test_protocols_updated(self):\n assert self.connection_config.protocols == {self.new_protocol_id}",
"def test_restricted_to_protocols_updated(self):\n assert self.connection_config.restr... | [
"0.7437529",
"0.7357184",
"0.68993795",
"0.67584455",
"0.61692876",
"0.59563965",
"0.5929382",
"0.5882808",
"0.5868374",
"0.5865916",
"0.5815501",
"0.58100575",
"0.577241",
"0.5757336",
"0.5750769",
"0.5720688",
"0.5719784",
"0.5719736",
"0.5719736",
"0.5719736",
"0.5685316",... | 0.74834657 | 0 |
Test set of contract ids updated. | def test_contracts_updated(self):
assert self.agent_config.contracts == {self.new_contract_id} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_contracts_updated(self):\n assert self.skill_config.contracts == {self.new_contract_id}",
"def test_contracts(self):\n correct_contracts = [factories.ProjectContract(projects=self.projects,\n status=ProjectContract.STATUS_CURRENT) for i in range(3)]\n res... | [
"0.77372605",
"0.6632399",
"0.6293191",
"0.59031224",
"0.5869236",
"0.58332425",
"0.5806536",
"0.5756309",
"0.5726403",
"0.5703236",
"0.5690074",
"0.5660192",
"0.56283087",
"0.5626664",
"0.56259495",
"0.5623313",
"0.56025594",
"0.558459",
"0.5583168",
"0.55798614",
"0.5564105... | 0.7739634 | 0 |
Test set of connection ids updated. | def test_connections_updated(self):
assert self.agent_config.connections == {self.new_connection_id} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_connections_updated(self):\n assert self.connection_config.connections == {self.new_connection_id}",
"def test_connections_updated(self):\n assert self.skill_config.connections == {self.new_connection_id}",
"def update_connections():\n try:\n connection_cache.update_connection_... | [
"0.81103927",
"0.7891609",
"0.6969484",
"0.65857124",
"0.6541592",
"0.6409961",
"0.6259836",
"0.6247465",
"0.6197166",
"0.61824673",
"0.61189234",
"0.61020297",
"0.6087449",
"0.60827804",
"0.60628784",
"0.6046517",
"0.60209197",
"0.6001883",
"0.5992094",
"0.5900211",
"0.58734... | 0.79714346 | 1 |
Test set of skill ids updated. | def test_skills_updated(self):
assert self.agent_config.skills == {self.new_skill_id} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_skills_updated(self):\n assert self.skill_config.skills == {self.new_skill_id}",
"def test_update_skills_to_completed(self):\n self._build_sample_graph()\n self._create_lessons() # 3 lessons in unit 1\n self._add_student_and_progress() # sa completed, sb in progress\n ... | [
"0.83605313",
"0.6229875",
"0.60261554",
"0.5851457",
"0.5804405",
"0.571166",
"0.56754595",
"0.5666196",
"0.56077766",
"0.5587807",
"0.5581246",
"0.5541418",
"0.55349255",
"0.54972684",
"0.5493252",
"0.54751647",
"0.5472471",
"0.5440563",
"0.54370815",
"0.5427395",
"0.542275... | 0.8231693 | 1 |
Test default connection updated. | def test_default_connection_updated(self):
assert self.agent_config.default_connection == self.new_connection_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_default_connection_updated_correctly(self):\n result = self.run_cli_command(\n \"--skip-consistency-check\",\n \"config\",\n \"get\",\n \"agent.default_connection\",\n cwd=self._get_cwd(),\n )\n assert result.stdout == \"fetchai/s... | [
"0.77050036",
"0.74974513",
"0.73781043",
"0.73388135",
"0.7110749",
"0.6943401",
"0.67577845",
"0.6724499",
"0.65678674",
"0.6565603",
"0.65255296",
"0.65073645",
"0.64634645",
"0.64422137",
"0.6425109",
"0.64169496",
"0.6412378",
"0.63855004",
"0.6353204",
"0.6346641",
"0.6... | 0.8527976 | 0 |
Test default routing updated. | def test_default_routing_updated(self):
assert self.agent_config.default_routing == {
self.new_protocol_id: self.new_connection_id
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_default_routing_updated_correctly(self):\n result = self.run_cli_command(\n \"--skip-consistency-check\",\n \"config\",\n \"get\",\n \"agent.default_routing\",\n cwd=self._get_cwd(),\n )\n assert (\n result.stdout\n ... | [
"0.74396104",
"0.7185289",
"0.7095077",
"0.70630145",
"0.6892813",
"0.68763053",
"0.6704222",
"0.66979414",
"0.65297955",
"0.6512689",
"0.64154744",
"0.619981",
"0.6185665",
"0.61728835",
"0.6143343",
"0.61333907",
"0.6123227",
"0.6076429",
"0.60449207",
"0.60284096",
"0.6026... | 0.7994095 | 0 |
Test set of connection ids updated. | def test_connections_updated(self):
assert self.connection_config.connections == {self.new_connection_id} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_connections_updated(self):\n assert self.agent_config.connections == {self.new_connection_id}",
"def test_connections_updated(self):\n assert self.skill_config.connections == {self.new_connection_id}",
"def update_connections():\n try:\n connection_cache.update_connection_ddb_i... | [
"0.79714346",
"0.7891609",
"0.6969484",
"0.65857124",
"0.6541592",
"0.6409961",
"0.6259836",
"0.6247465",
"0.6197166",
"0.61824673",
"0.61189234",
"0.61020297",
"0.6087449",
"0.60827804",
"0.60628784",
"0.6046517",
"0.60209197",
"0.6001883",
"0.5992094",
"0.5900211",
"0.58734... | 0.81103927 | 0 |
Test restricted to protocols updated. | def test_restricted_to_protocols_updated(self):
assert self.connection_config.restricted_to_protocols == {self.new_protocol_id} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_protocols_updated(self):\n assert self.agent_config.protocols == {self.new_protocol_id}",
"def test_protocols_updated(self):\n assert self.connection_config.protocols == {self.new_protocol_id}",
"def test_protocols_updated(self):\n assert self.skill_config.protocols == {self.new_p... | [
"0.75679874",
"0.7528051",
"0.7427925",
"0.7278169",
"0.6160645",
"0.6157591",
"0.6125485",
"0.61138844",
"0.604189",
"0.5972104",
"0.59465045",
"0.5927124",
"0.59183246",
"0.58987784",
"0.5826463",
"0.5806167",
"0.57840437",
"0.57480145",
"0.57464993",
"0.57422096",
"0.57277... | 0.8235798 | 0 |
Test excluded protocols updated. | def test_excluded_protocols_updated(self):
assert self.connection_config.excluded_protocols == {self.new_protocol_id} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_restricted_to_protocols_updated(self):\n assert self.connection_config.restricted_to_protocols == {self.new_protocol_id}",
"def test_protocols_updated(self):\n assert self.agent_config.protocols == {self.new_protocol_id}",
"def test_protocols_updated(self):\n assert self.connectio... | [
"0.7378383",
"0.7221924",
"0.7154313",
"0.6971142",
"0.5983788",
"0.59001005",
"0.5846674",
"0.5790287",
"0.57787937",
"0.57363385",
"0.5622191",
"0.5558229",
"0.55444884",
"0.5543816",
"0.54887116",
"0.5455366",
"0.5444625",
"0.54177165",
"0.5409472",
"0.54023206",
"0.539025... | 0.8350618 | 0 |
Test set of protocol ids updated. | def test_protocols_updated(self):
assert self.skill_config.protocols == {self.new_protocol_id} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_protocols_updated(self):\n assert self.agent_config.protocols == {self.new_protocol_id}",
"def test_protocols_updated(self):\n assert self.connection_config.protocols == {self.new_protocol_id}",
"def test_restricted_to_protocols_updated(self):\n assert self.connection_config.restr... | [
"0.74834657",
"0.7357184",
"0.68993795",
"0.67584455",
"0.61692876",
"0.59563965",
"0.5929382",
"0.5882808",
"0.5868374",
"0.5865916",
"0.5815501",
"0.58100575",
"0.577241",
"0.5757336",
"0.5750769",
"0.5720688",
"0.5719784",
"0.5719736",
"0.5719736",
"0.5719736",
"0.5685316"... | 0.7437529 | 1 |
Test set of contract ids updated. | def test_contracts_updated(self):
assert self.skill_config.contracts == {self.new_contract_id} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_contracts_updated(self):\n assert self.agent_config.contracts == {self.new_contract_id}",
"def test_contracts(self):\n correct_contracts = [factories.ProjectContract(projects=self.projects,\n status=ProjectContract.STATUS_CURRENT) for i in range(3)]\n res... | [
"0.7739634",
"0.6632399",
"0.6293191",
"0.59031224",
"0.5869236",
"0.58332425",
"0.5806536",
"0.5756309",
"0.5726403",
"0.5703236",
"0.5690074",
"0.5660192",
"0.56283087",
"0.5626664",
"0.56259495",
"0.5623313",
"0.56025594",
"0.558459",
"0.5583168",
"0.55798614",
"0.55641055... | 0.77372605 | 1 |
Test set of skill ids updated. | def test_skills_updated(self):
assert self.skill_config.skills == {self.new_skill_id} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_skills_updated(self):\n assert self.agent_config.skills == {self.new_skill_id}",
"def test_update_skills_to_completed(self):\n self._build_sample_graph()\n self._create_lessons() # 3 lessons in unit 1\n self._add_student_and_progress() # sa completed, sb in progress\n ... | [
"0.8231693",
"0.6229875",
"0.60261554",
"0.5851457",
"0.5804405",
"0.571166",
"0.56754595",
"0.5666196",
"0.56077766",
"0.5587807",
"0.5581246",
"0.5541418",
"0.55349255",
"0.54972684",
"0.5493252",
"0.54751647",
"0.5472471",
"0.5440563",
"0.54370815",
"0.5427395",
"0.5422755... | 0.83605313 | 0 |
Project CRUD check for signed in account. Check if a signed in account has a specified action for a given project. action, valid values ["list", "administer", "create", "read", "update", "delete"] project (optional) bool Call as app.access('project', action='update', project=PROJECT) | def permission_project(action=None, project=None, account=None):
from models.project import Project
from helpers.project import ProjectHelper
if not action:
raise Exception('Project CRUD permission: action missing')
if not account or not account.id:
account=g.account
if not project and not ac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_returns_all_projects_that_user_is_permitted_if_action_set_to_any(self):\n # Arrange\n self.test_project_2.private = False\n # Since test_author is BEGINNER, they can only map projects with mapping permission ANY.\n self.test_project_1.mapping_permission = MappingPermission.ANY.... | [
"0.61615855",
"0.5995651",
"0.5962695",
"0.5755086",
"0.57181513",
"0.5678517",
"0.5642671",
"0.5536842",
"0.5513272",
"0.54979163",
"0.54801095",
"0.54586595",
"0.5458606",
"0.54059535",
"0.53652745",
"0.5352691",
"0.5349785",
"0.53437066",
"0.5334904",
"0.5308164",
"0.53077... | 0.7642117 | 0 |
Accounts' membership check for signed in account. Check if a signed in account is permitted to see the given account's membership projects. account bool Call as app.access('membership', account=ACCOUNT) | def permission_membership(account=None):
if not account:
raise Exception('Membership permission: account missing')
if account.id == g.account.id:
return app.access('profile', action='read', account=account)
else:
return app.access('profile', action='read', account=account) and app.access('project',... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_member(self, account):\n return self.find_entry_for(account, key_only=True) is not None",
"def UserIsInProject(project, effective_ids):\n return (UserOwnsProject(project, effective_ids) or\n not effective_ids.isdisjoint(project.committer_ids or set()) or\n not effective_ids.isdis... | [
"0.6505063",
"0.6154576",
"0.61419475",
"0.6131608",
"0.6120828",
"0.60575557",
"0.6041669",
"0.5957435",
"0.59478444",
"0.5927454",
"0.5911274",
"0.58389574",
"0.58296996",
"0.5810735",
"0.5809459",
"0.57984835",
"0.5776257",
"0.57572246",
"0.57406795",
"0.57084596",
"0.5708... | 0.79882616 | 0 |
Update the internal module list to reflect the state of files on disk | def refresh(self):
self.modules.clear()
module_files = []
module_paths = os.environ['MAYA_MODULE_PATH'].split(os.pathsep)
for p in module_paths:
try:
module_files += [os.path.join(p, x).replace(os.sep, os.altsep or os.sep) for x in os.listdir(p) if
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self):\n if os.path.isdir(self.full_path):\n self.file_list = os.listdir(self.full_path)\n else:\n self.file_list = []",
"def update_modules(self) -> None:\n\n matches = apache_util.parse_modules(self.configurator.options.get_modules_cmd)\n for mod in ... | [
"0.700089",
"0.6846463",
"0.6714777",
"0.66056633",
"0.64734066",
"0.64055634",
"0.6323316",
"0.6281828",
"0.61859167",
"0.6173358",
"0.61717224",
"0.6084057",
"0.6034003",
"0.6016183",
"0.5997605",
"0.58926195",
"0.5865267",
"0.5817939",
"0.5814585",
"0.5804573",
"0.5798749"... | 0.70483965 | 0 |
Yields a modtuple describing the supplied .mod file | def parse_mod(self, modfile):
with open(modfile, 'rt') as filehandle:
for line in filehandle:
if line.startswith(("+", "-")):
enable, name, version, path = self.parse_mod_entry(line)
yield ModTuple(enable == "+", name, version, path, modfile) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def module_file(module):\n ...",
"def getAttributesOf(module: str) -> tuple:\n return data.getFileNameListOf(\"etc\", module, \"txt\")",
"def PopulateModuleMetadata(self, mod, mojom_file):\n mod.name = os.path.basename(mojom_file.file_name)\n mod.path = mojom_file.file_name\n mod.namespace = moj... | [
"0.6117822",
"0.60648334",
"0.59750557",
"0.59016097",
"0.5743923",
"0.57110524",
"0.5694326",
"0.563331",
"0.5625122",
"0.5611489",
"0.55594957",
"0.555297",
"0.5548419",
"0.5531724",
"0.5504892",
"0.5474891",
"0.5444778",
"0.54338825",
"0.5425005",
"0.5402909",
"0.5380408",... | 0.8003594 | 0 |
parses a line from a mod file describing a given mod | def parse_mod_entry(self, line):
split_line = line.split(' ')
enable = split_line.pop(0)
path = split_line.pop()
version = split_line.pop()
name = split_line.pop()
return enable, name, version, path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_mod(self, modfile):\n with open(modfile, 'rt') as filehandle:\n for line in filehandle:\n if line.startswith((\"+\", \"-\")):\n enable, name, version, path = self.parse_mod_entry(line)\n yield ModTuple(enable == \"+\", name, version, ... | [
"0.6852358",
"0.60479766",
"0.5966901",
"0.5856522",
"0.58414024",
"0.58395195",
"0.5759204",
"0.5750431",
"0.5700789",
"0.56939554",
"0.56689703",
"0.56604743",
"0.56312585",
"0.5620471",
"0.56203747",
"0.5590507",
"0.5590507",
"0.5590507",
"0.5590507",
"0.5563013",
"0.55418... | 0.7333696 | 0 |
Create a CartOriginator object and instantiate the class data fields. | def __init__(self):
self._state: CartState = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, origin):\n self.origin = origin",
"def __init__(self, request):\n # storage of current session making it accessible to other method of cart class\n self.session = request.session\n\n # getting cart from current session using self\n cart = self.session.get(set... | [
"0.5826915",
"0.5801028",
"0.56556803",
"0.5631175",
"0.55185956",
"0.5517896",
"0.54799616",
"0.546187",
"0.5435754",
"0.5423805",
"0.54229254",
"0.5364012",
"0.5356724",
"0.53173894",
"0.5300335",
"0.5269088",
"0.52543956",
"0.5244794",
"0.5238936",
"0.5238279",
"0.5227214"... | 0.6032625 | 0 |
Create a CartMemento object using the current state. | def create_memento(self) -> CartMemento:
memento = CartMemento()
memento.set_state(self._state)
return memento | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_context_data(self, *args, object_list=None, **kwargs):\n context = super(ProductListView, self).get_context_data(*args, **kwargs)\n cart_obj, new_obj = Cart.objects.new_or_get(self.request)\n context[\"cart\"] = cart_obj\n return context",
"def __init__(self):\n self._s... | [
"0.5900827",
"0.5886835",
"0.56037086",
"0.5485692",
"0.53790444",
"0.5269865",
"0.5222798",
"0.5213667",
"0.5164035",
"0.5081437",
"0.5014715",
"0.4979188",
"0.4928445",
"0.48922238",
"0.48761758",
"0.4876089",
"0.48291668",
"0.47909814",
"0.47888178",
"0.47818184",
"0.47557... | 0.82744515 | 0 |
Write BGF ATOM/HETATM line and CONECT info. Returns | def writeline(self):
if self.record == 'ATOM' and not self.atom.startswith('H') and len(self.atom) < 4:
atom = ' {0}'.format(self.atom)
else:
atom = self.atom
aline = (
"{0:6s} {1:5d} {2:5s} {3} {4}{5:5d} {6:10.5f}{7:10.5f}"
"{8:10.5f} {9:5s}{10:3d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_bgf(self, filename):\n body = [\"BIOGRF{0:>5s}\\n\".format(self.biogrf)]\n if self.descrp:\n body.append(\"DESCRP {0}\\n\".format(self.descrp))\n else:\n body.append(\"DESCRP {0}\\n\".format(filename))\n body.append(\"FORCEFIELD {0}\\n\".format(self.ff))\... | [
"0.6745261",
"0.57624286",
"0.57033324",
"0.5645388",
"0.5579009",
"0.54127544",
"0.53122085",
"0.5283175",
"0.52658045",
"0.5237313",
"0.52296203",
"0.5224289",
"0.52214557",
"0.52070725",
"0.51987725",
"0.51454854",
"0.51406944",
"0.5138567",
"0.51315075",
"0.51079136",
"0.... | 0.6542541 | 1 |
Create a new BGFFile object from a file. Parses BGF file header and RECORD lines. Parameter | def from_file(cls, filename):
biogrf = ''
ff = ''
descrp = ''
atoms = {}
with open(filename) as f:
for line in f:
if line.startswith('BIOGRF'):
biogrf = line.strip().split()[1]
elif line.startswith('DESCRP'):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(cls, file: str):\n\n bfh = cls()\n\n with open(file, 'br') as sgy:\n # get the endian\n endian = gfunc.grab_endiannes(sgy)\n\n # skip the TFH, read the BFH bytes\n sgy.seek(3200)\n raw = sgy.read(400)\n\n # unpack and store the va... | [
"0.6263611",
"0.61658895",
"0.60583544",
"0.59516656",
"0.585256",
"0.585256",
"0.5852387",
"0.5793265",
"0.5739983",
"0.57279915",
"0.5726969",
"0.5682482",
"0.56549424",
"0.5634668",
"0.5634576",
"0.5609862",
"0.5599395",
"0.55844796",
"0.55730563",
"0.55582756",
"0.5532192... | 0.6296823 | 0 |
Create PDBFile object. Returns | def to_pdb(self):
pdb_atoms = []
for _atom in self.atoms:
record = _atom.record
natom = _atom.natom
atom = _atom.atom
altloc = ''
res = _atom.res
chain = _atom.chain
nres = _atom.nres
icode = ''
x... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_pdb(self, **kwargs):\n return self.__from_file(kwargs, _pdb)",
"def to_pdb_file(self, pdb_path: str) -> None:\n with open(pdb_path, \"w\", encoding=\"utf-8\") as pdb_file:\n pdb_file.write(self.to_pdb_block())",
"def save_pdb(self, fname):\n return",
"def to_pdb(self,... | [
"0.6464691",
"0.6441167",
"0.6345607",
"0.62949514",
"0.6069252",
"0.6047589",
"0.6034405",
"0.5995902",
"0.59734076",
"0.59593236",
"0.5942731",
"0.59304285",
"0.5888666",
"0.5873054",
"0.58659935",
"0.5821737",
"0.58119076",
"0.5773948",
"0.57447153",
"0.5714402",
"0.569841... | 0.6539757 | 0 |
Write object contents as a PDB file. | def write_pdb(self, filename):
pdb = self.to_pdb()
pdb.write_pdb(filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_pdb_file(self, pdb_path: str) -> None:\n with open(pdb_path, \"w\", encoding=\"utf-8\") as pdb_file:\n pdb_file.write(self.to_pdb_block())",
"def writepdb(self,fname):\n pdbfile = open(fname + \".pdb\", \"w\")\n for a in self.atoms:\n pdbfile.write(... | [
"0.7499996",
"0.7313111",
"0.72127074",
"0.7209375",
"0.71993107",
"0.6889182",
"0.6737158",
"0.66468364",
"0.6579549",
"0.65451986",
"0.6514591",
"0.64630693",
"0.6398927",
"0.63631594",
"0.6348748",
"0.6254642",
"0.6230055",
"0.62169695",
"0.6104129",
"0.6028324",
"0.593389... | 0.7498248 | 1 |
Instanties the appropriate GNN message passing model from the provided configuration. | def gnn_model_construct(cfg, model_name='gnn_model', **kwargs):
models = gnn_model_dict()
model_cfg = cfg[model_name]
name = model_cfg.get('name', 'meta')
if not name in models:
raise Exception("Unknown GNN message passing model name provided:", name)
return models[name](model_cfg, **kwargs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_config(cls,config):\n ## find labels in list\n label_list = load_label_list(config.label_list)\n use_cuda = True if torch.cuda.is_available() else False\n\n global_args = {\n \"fp16\" : False,\n \"classification_report\" : True,\n \"tensorboard_... | [
"0.67296934",
"0.6261608",
"0.62435234",
"0.60592365",
"0.60236555",
"0.59820974",
"0.5933083",
"0.5919707",
"0.59194344",
"0.58706003",
"0.5859018",
"0.5856421",
"0.5841997",
"0.58010566",
"0.5800078",
"0.5797704",
"0.57974833",
"0.5797201",
"0.576441",
"0.5757969",
"0.57513... | 0.745079 | 0 |
Instanties the appropriate node encoder from the provided configuration. | def node_encoder_construct(cfg, model_name='node_encoder', **kwargs):
encoders = node_encoder_dict()
encoder_cfg = cfg[model_name]
name = encoder_cfg.get('name', 'geo')
if not name in encoders:
raise Exception("Unknown node encoder name provided:", name)
return encoders[name](encoder_cfg, *... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_node_encoder(key, module):\n register(key, module, node_encoder_dict)",
"def registerEncoder (encoder):\n assert False, \"TODO:\"",
"def register_edge_encoder(key, module):\n register(key, module, edge_encoder_dict)",
"def node_encoder_dict():\n\n from .encoders import geometric, mix... | [
"0.6464376",
"0.5879688",
"0.5607723",
"0.55974233",
"0.5569245",
"0.5477778",
"0.5472452",
"0.53909737",
"0.53809834",
"0.52404594",
"0.52369714",
"0.5182294",
"0.5161166",
"0.512532",
"0.5101028",
"0.50982064",
"0.5080763",
"0.5073675",
"0.50220376",
"0.5020984",
"0.5017529... | 0.7300629 | 0 |
Instanties the appropriate edge encoder from the provided configuration. | def edge_encoder_construct(cfg, model_name='edge_encoder', **kwargs):
encoders = edge_encoder_dict()
encoder_cfg = cfg[model_name]
name = encoder_cfg.get('name', 'geo')
if not name in encoders:
raise Exception("Unknown edge encoder name provided:", name)
return encoders[name](encoder_cfg, *... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edge_encoder_dict():\n\n from .encoders import geometric, mixed\n from mlreco.models.layers.gnn.encoders.cnn import ClustCNNMinkEdgeEncoder\n # from mlreco.models.scn.gnn.encoders.cnn import ClustCNNEdgeEncoder\n\n encoders = {\n \"geo\" : geometric.ClustGeoEdgeEncoder,\n \"mix_... | [
"0.60603964",
"0.6059706",
"0.59817266",
"0.57332045",
"0.55294275",
"0.55144197",
"0.5459491",
"0.535701",
"0.5339765",
"0.52790105",
"0.52527785",
"0.52122617",
"0.5137201",
"0.5117694",
"0.5109435",
"0.5098084",
"0.509051",
"0.50788057",
"0.50707597",
"0.506434",
"0.506246... | 0.7528507 | 0 |
Instanties the appropriate node loss from the provided configuration. | def node_loss_construct(cfg, model_name='node_loss', **kwargs):
losses = node_loss_dict()
loss_cfg = cfg[model_name]
name = loss_cfg.get('name', 'type')
if not name in losses:
raise Exception("Unknown node loss name provided:", name)
return losses[name](loss_cfg, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_config(cls, loss_config: AttrDict):\n return cls(loss_config)",
"def from_config(cls, loss_config: AttrDict):\n return cls(loss_config)",
"def loss_creator(config):\n return torch.nn.BCELoss()",
"def init_loss(config):\n if config.loss == 'cross_entropy':\n criterion = nn.... | [
"0.6468619",
"0.6468619",
"0.6294675",
"0.60733837",
"0.6073159",
"0.6028237",
"0.5814656",
"0.5808128",
"0.58029133",
"0.579105",
"0.57791686",
"0.57367456",
"0.5682486",
"0.56724095",
"0.56680655",
"0.5643065",
"0.5639453",
"0.5635923",
"0.56345826",
"0.5605697",
"0.5581671... | 0.7214732 | 0 |
Instanties the appropriate edge loss from the provided configuration. | def edge_loss_construct(cfg, model_name='edge_loss', **kwargs):
losses = edge_loss_dict()
loss_cfg = cfg[model_name]
name = loss_cfg.get('name', 'channel')
if not name in losses:
raise Exception("Unknown edge loss name provided:", name)
return losses[name](loss_cfg, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_config(cls, loss_config: AttrDict):\n return cls(loss_config)",
"def from_config(cls, loss_config: AttrDict):\n return cls(loss_config)",
"def node_loss_construct(cfg, model_name='node_loss', **kwargs):\n losses = node_loss_dict()\n loss_cfg = cfg[model_name]\n name = loss_cfg.g... | [
"0.6597849",
"0.6597849",
"0.6409729",
"0.6368153",
"0.59012073",
"0.5860468",
"0.5802963",
"0.5630297",
"0.5610324",
"0.5596637",
"0.5476308",
"0.5418165",
"0.5410972",
"0.54078156",
"0.54002845",
"0.53679717",
"0.5361046",
"0.5358173",
"0.5353789",
"0.5331932",
"0.53162646"... | 0.7398398 | 0 |
Imports and returns dictionary of valid GNN message passing models. | def gnn_model_dict():
from .message_passing import agnnconv, econv, gatconv, meta, nnconv, nnconv_elu, nnconv_old
models = {
"agnnconv" : agnnconv.AGNNConvModel,
"econv" : econv.EConvModel,
"gatconv" : gatconv.GATConvModel,
"nnconv" : nnconv.NNConvMode... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gnn_model_construct(cfg, model_name='gnn_model', **kwargs):\n models = gnn_model_dict()\n model_cfg = cfg[model_name]\n name = model_cfg.get('name', 'meta')\n if not name in models:\n raise Exception(\"Unknown GNN message passing model name provided:\", name)\n\n return models[name](model... | [
"0.6047568",
"0.5995859",
"0.5928627",
"0.57301456",
"0.5555398",
"0.5525421",
"0.5503315",
"0.5498625",
"0.54781795",
"0.5477776",
"0.5477387",
"0.54035145",
"0.5397269",
"0.53889364",
"0.53483593",
"0.5345979",
"0.5344768",
"0.5332039",
"0.53186995",
"0.5317741",
"0.5310642... | 0.72087896 | 0 |
Imports and returns dictionary of valid node encoders. | def node_encoder_dict():
from .encoders import geometric, mixed
from mlreco.models.layers.gnn.encoders.cnn import ClustCNNMinkNodeEncoder
# from mlreco.models.scn.gnn.encoders.cnn import ClustCNNNodeEncoder
encoders = {
"geo" : geometric.ClustGeoNodeEncoder,
"mix_debug" : mixed.C... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_encoders():\n\n encoders = {}\n\n # Pclass\n pclass_encoder = LabelBinarizer()\n\n with open(os.path.join('encoders', 'pclass_encoder.json'),\n 'r', encoding='utf8', errors='ignore') as infile:\n pclass_encoder.classes_ = json.load(infile)\n encoders['pclass_encoder'] = ... | [
"0.64045787",
"0.6063029",
"0.5850671",
"0.57165545",
"0.562102",
"0.55880463",
"0.5434193",
"0.53902626",
"0.51345485",
"0.51192814",
"0.50883454",
"0.5066851",
"0.506602",
"0.4968335",
"0.49369892",
"0.49278858",
"0.4912044",
"0.4911321",
"0.49036723",
"0.4885584",
"0.48643... | 0.6788225 | 0 |
Imports and returns dictionary of valid edge encoders. | def edge_encoder_dict():
from .encoders import geometric, mixed
from mlreco.models.layers.gnn.encoders.cnn import ClustCNNMinkEdgeEncoder
# from mlreco.models.scn.gnn.encoders.cnn import ClustCNNEdgeEncoder
encoders = {
"geo" : geometric.ClustGeoEdgeEncoder,
"mix_debug" : mixed.C... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_encoders():\n\n encoders = {}\n\n # Pclass\n pclass_encoder = LabelBinarizer()\n\n with open(os.path.join('encoders', 'pclass_encoder.json'),\n 'r', encoding='utf8', errors='ignore') as infile:\n pclass_encoder.classes_ = json.load(infile)\n encoders['pclass_encoder'] = ... | [
"0.6135715",
"0.607272",
"0.5888495",
"0.5838338",
"0.5749316",
"0.55672175",
"0.5528523",
"0.54451543",
"0.5349375",
"0.53440875",
"0.52776974",
"0.5193808",
"0.5190415",
"0.5131525",
"0.5125697",
"0.51008815",
"0.507108",
"0.5066791",
"0.50292677",
"0.5026871",
"0.50016445"... | 0.72158724 | 0 |
Imports and returns dictionary of valid node losses. | def node_loss_dict():
from .losses import node_kinematics, node_primary, node_type
losses = {
"kinematics" : node_kinematics.NodeKinematicsLoss,
"kinematics_edl" : node_kinematics.NodeEvidentialKinematicsLoss,
"kinematics_attn": node_kinematics.NodeTransformerLoss,
"primary... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_losses(self):\n # Fast-path already loaded\n if self.__losses is not None:\n return self.__losses\n # Initialize the dictionary\n self.__losses = dict()\n # Simply populate this dictionary\n for name in dir(torch.nn.modules.loss):\n if len(name) < 5 or name[0] == \"_\" or name[... | [
"0.6405789",
"0.6144503",
"0.6131553",
"0.5683623",
"0.54286945",
"0.539906",
"0.53653234",
"0.53653234",
"0.53214693",
"0.5227459",
"0.5206962",
"0.518636",
"0.5170307",
"0.51663935",
"0.5074943",
"0.5051031",
"0.5050073",
"0.5032057",
"0.5029979",
"0.5016129",
"0.5012334",
... | 0.7180829 | 0 |
Imports and returns dictionary of valid edge losses. | def edge_loss_dict():
from .losses import edge_channel
losses = {
"channel" : edge_channel.EdgeChannelLoss
}
return losses | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_loss_dict():\n\n from .losses import node_kinematics, node_primary, node_type\n\n losses = {\n \"kinematics\" : node_kinematics.NodeKinematicsLoss,\n \"kinematics_edl\" : node_kinematics.NodeEvidentialKinematicsLoss,\n \"kinematics_attn\": node_kinematics.NodeTransformerLoss... | [
"0.6524908",
"0.6374087",
"0.5645223",
"0.5556413",
"0.54753983",
"0.5254519",
"0.52236855",
"0.52026457",
"0.51949316",
"0.5176586",
"0.5176586",
"0.51469845",
"0.51331854",
"0.5119489",
"0.50777334",
"0.50702155",
"0.5061726",
"0.5005074",
"0.49950355",
"0.49868387",
"0.498... | 0.7556496 | 0 |
Tests if the default login works. | def default_login_works(self):
return True if self.default_login_auth_header else False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_can_login(self):\n user = authenticate(username='jack', password='secret')\n self.assertTrue(user is not None)\n self.assertTrue(user.is_authenticated)",
"def is_correct_user(self, login, password):\n pass",
"def test_user_login_attempt_when_user_already_logged_in(self):\n\... | [
"0.7507055",
"0.74272954",
"0.7419818",
"0.7403673",
"0.7382607",
"0.73820144",
"0.73796177",
"0.73725265",
"0.73607916",
"0.73205966",
"0.73205966",
"0.7300815",
"0.7260027",
"0.7255122",
"0.72520965",
"0.72056437",
"0.71639794",
"0.7127481",
"0.7112721",
"0.7098007",
"0.706... | 0.8108004 | 0 |
Test if the configured admin account can authenticate. If not create it. Also test if the default bootstrap user exists and if so delete it. | def check_login(self):
admin_exists = self.set_auth_header()
if self.default_login_works:
self.log.info("default login worked, removing it")
if admin_exists:
self.log.info("admin user exists, only deleting default user")
else:
# Since ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ensure_initial_admin(config):\n if get_api_version() > 2:\n manager = get_manager()\n default_domain_id = create_or_show_domain(DEFAULT_DOMAIN)\n leader_set({'default_domain_id': default_domain_id})\n admin_domain_id = create_or_show_domain(ADMIN_DOMAIN)\n ... | [
"0.69742066",
"0.667708",
"0.66169393",
"0.6586218",
"0.6528444",
"0.6478201",
"0.6326831",
"0.63000816",
"0.6247882",
"0.619613",
"0.6177981",
"0.6177326",
"0.6122847",
"0.6044396",
"0.6029417",
"0.6013946",
"0.5995666",
"0.5987236",
"0.5979493",
"0.59370977",
"0.5904876",
... | 0.70616585 | 0 |
return all next states | def get_next_states(self):
return self.__next_state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_states(self):\n return self.get_next_states()",
"def next_states(self):\n return self._states[1:]",
"def next(self):\n self.current_state = self.next_state\n self.next_state = self.clear_screen() # set values to 0\n for x in range(1, 101):\n for y in rang... | [
"0.84354216",
"0.8185105",
"0.7364463",
"0.7181687",
"0.71218216",
"0.7045079",
"0.7022859",
"0.69755375",
"0.69216543",
"0.6912857",
"0.6894752",
"0.6855079",
"0.68516403",
"0.6734609",
"0.67293054",
"0.6702217",
"0.6677168",
"0.6655622",
"0.65613484",
"0.6501442",
"0.647650... | 0.82421875 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.