0

次のことをどのように行うことができるかについて、いくつかの入力が必要です

以下の入力があります。最新の「Depends-on」タグを取得してから、その値、サンプルの入力と出力を以下に出力する必要があります...

入力:-

[{u'timestamp': 1361325046, u'message': u"Patch Set 1: I would prefer that you didn't submit this\n\n1) Now that this project is mapped to noship, should x-ship be set to none?\n\n2) Make sure that noship_common_HY11/22 are updated to not ship this folder. I see release/crm/noship_common_HY22:LINUX\\android\\vendor\\company\\proprietary\\wlan. This needs to be removed and wlan-noship has to be included in both HY11/22 files. \n\n3) Make a customer variant build and post results. \n\n4) Follow these guidelines for commit text. http://qwiki.company.com/quic/Git#Formatting_Commit_Messages", u'reviewer': {u'username': u'nname', u'name': u'Nagender name', u'email': u'nname@company.com'}}, {u'timestamp': 1361341193, u'message': u'Patch Set 1:\n\nThis change is being verified in lookahead for the following manifests along with other changes as detailed below:\n\n\n\n=====================================================================================\n\ngit-android.company.com/platform/manifest:jb_mr1:default.xml\n\n=====================================================================================\n\nhttps://commander.company.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId=723644\n\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n  o https://review-android.company.com/#change,252804\n\n\n\nPlease note that verification of all changes in this batch need to be successful before this change can be merged.\n\nPLEASE DO NOT UPLOAD A NEW PATCH SET, OR REMOVE APPROVALS UNTIL THE VERIFICATION IS COMPLETE.\n', u'reviewer': {u'username': u'lnxbuild', u'name': u'Linux Build Service Account', u'email': u'lnxbuild@localhost'}}, {u'timestamp': 1361344352, u'message': u'Patch Set 1: Fails\n\nFailed lookahead verification. You may find the results of the verification by following the link(s) below:                 If you feel this is an automation error and want it to be re-verified\nplease use https://commander.company.com/commander/runProcedure.php?procedureName=reset_failed_bit&projectName=Android_Main to reset the failed verify bit.\n\nYou may find the results of the verification by following the link(s) below:\n\nhttps://commander.company.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId=723644\n\n', u'reviewer': {u'username': u'lnxbuild', u'name': u'Linux Build Service Account', u'email': u'lnxbuild@localhost'}}, {u'timestamp': 1361477871, u'message': u'Uploaded patch set 2.', u'reviewer': {u'username': u'name', u'name': u'name', u'email': u'name@qca.company.com'}}, {u'timestamp': 1361477872, u'message': u'Patch Set 2:\n\nNew patchset patch-id matches previous patchset, but commit message has changed.', u'reviewer': {u'username': u'gituser', u'name': u'Git User Service Account', u'email': u'gituser@localhost'}}, {u'timestamp': 1361477891, u'message': u'Patch Set 2: Looks good to me, but someone else must approve\n\nYour change has passed all of the checks enforced by the android patch\nchecker.', u'reviewer': {u'username': u'checkpatch', u'name': u'Checkpatch Service Account', u'email': u'checkpatch@localhost'}}, {u'timestamp': 1361491295, u'message': u'Patch Set 2:\n\nDepends-on:254994', u'reviewer': {u'username': u'nname', u'name': u'Nagender name', u'email': u'nname@company.com'}}, {u'timestamp': 1361494370, u'message': u'Uploaded patch set 3.', u'reviewer': {u'username': u'name', u'name': u'name', u'email': u'name@qca.company.com'}}, {u'timestamp': 1361494386, u'message': u'Patch Set 3: Looks good to me, but someone else must approve\n\nYour change has passed all of the checks enforced by the android patch\nchecker.', u'reviewer': {u'username': u'checkpatch', u'name': u'Checkpatch Service Account', u'email': u'checkpatch@localhost'}}, {u'timestamp': 1361535719, u'message': u'Patch Set 3:\n\nThis change is being verified in lookahead for the following manifests along with other changes as detailed below:\n\n\n\n=====================================================================================\n\ngit-android.company.com/platform/manifest:jb_mr1:default.xml\n\n=====================================================================================\n\nhttps://commander.company.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId=733150\n\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n  o https://review-android.company.com/#change,252804\n\n  o https://review-android.company.com/#change,254994\n\n\n\nPlease note that verification of all changes in this batch need to be successful before this change can be merged.\n\nPLEASE DO NOT UPLOAD A NEW PATCH SET, OR REMOVE APPROVALS UNTIL THE VERIFICATION IS COMPLETE.\n', u'reviewer': {u'username': u'lnxbuild', u'name': u'Linux Build Service Account', u'email': u'lnxbuild@localhost'}}, {u'timestamp': 1361536209, u'message': u'Patch Set 3: Fails\n\nFailed lookahead verification. You may find the results of the verification by following the link(s) below:                 If you feel this is an automation error and want it to be re-verified\nplease use https://commander.company.com/commander/runProcedure.php?procedureName=reset_failed_bit&projectName=Android_Main to reset the failed verify bit.\n\nYou may find the results of the verification by following the link(s) below:\n\nhttps://commander.company.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId=733150\n\n', u'reviewer': {u'username': u'lnxbuild', u'name': u'Linux Build Service Account', u'email': u'lnxbuild@localhost'}}, {u'timestamp': 1361544517, u'message': u"Patch Set 3: I would prefer that you didn't submit this\n\n(1 inline comment)\n\n", u'reviewer': {u'username': u'name', u'name': u'Satya Durga Srinivasu Prabhala', u'email': u'a_name@company.com'}}, {u'timestamp': 1361560535, u'message': u'Uploaded patch set 4.', u'reviewer': {u'username': u'name', u'name': u'name', u'email': u'name@qca.company.com'}}, {u'timestamp': 1361560553, u'message': u'Patch Set 4: Looks good to me, but someone else must approve\n\nYour change has passed all of the checks enforced by the android patch\nchecker.', u'reviewer': {u'username': u'checkpatch', u'name': u'Checkpatch Service Account', u'email': u'checkpatch@localhost'}}, {u'timestamp': 1361565513, u'message': u'Patch Set 4: Looks good to me, but someone else must approve; Developer Build and Test Successful\n\nFixed all the comments and made a customer-variant build @\n\\\\wbit-linux1\\workspace\\name\\wbit\\LA_builds\\AU_LINUX_ANDROID_JB_MR1.04.02.00.49.041 ,please let me know if anything else is needed', u'reviewer': {u'username': u'name', u'name': u'name', u'email': u'name@qca.company.com'}}, {u'timestamp': 1361594838, u'message': u'Patch Set 4: Looks good to me, approved\n\n', u'reviewer': {u'username': u'nname', u'name': u'Nagender name', u'email': u'nname@company.com'}}, {u'timestamp': 1361833588, u'message': u'Patch Set 4:\n\nDepends-on:254994 258334', u'reviewer': {u'username': u'name', u'name': u'name', u'email': u'name@qca.company.com'}}, {u'timestamp': 1361846437, u'message': u'Patch Set 4: No code review score\n\n', u'reviewer': {u'username': u'name', u'name': u'Satya Durga Srinivasu Prabhala', u'email': u'a_name@company.com'}}, {u'timestamp': 1361922741, u'message': u'Patch Set 4:\n\nThis change is being verified in lookahead for the following manifests along with other changes as detailed below:\n\n\n\n=====================================================================================\n\ngit-android.company.com/platform/manifest:jb_2.5:default.xml\n\n=====================================================================================\n\nhttps://commander.company.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId=746359\n\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n  o https://review-android.company.com/#change,258334\n\n\n\n=====================================================================================\n\ngit-android.company.com/platform/manifest:jb_mr1:default.xml\n\n=====================================================================================\n\nhttps://commander.company.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId=746360\n\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n  o https://review-android.company.com/#change,258334\n\n  o https://review-android.company.com/#change,252804\n\n  o https://review-android.company.com/#change,254994\n\n\n\nPlease note that verification of all changes in this batch need to be successful before this change can be merged.\n\nPLEASE DO NOT UPLOAD A NEW PATCH SET, OR REMOVE APPROVALS UNTIL THE VERIFICATION IS COMPLETE.\n', u'reviewer': {u'username': u'lnxbuild', u'name': u'Linux Build Service Account', u'email': u'lnxbuild@localhost'}}, {u'timestamp': 1361923330, u'message': u'Patch Set 4: Fails\n\nFailed lookahead verification. You may find the results of the verification by following the link(s) below:                 If you feel this is an automation error and want it to be re-verified\nplease use https://commander.company.com/commander/runProcedure.php?procedureName=reset_failed_bit&projectName=Android_Main to reset the failed verify bit.\n\nYou may find the results of the verification by following the link(s) below:\n\nhttps://commander.company.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId=746360\n\n', u'reviewer': {u'username': u'lnxbuild', u'name': u'Linux Build Service Account', u'email': u'lnxbuild@localhost'}}]

出力:-

[254994 258334]

4

2 に答える 2

3

あなたはその入力を持つべきではありません。誰かがPythonを印刷しているだけreprで、それはノーノーです。代わりに、組み込みjsonモジュールを使用してプロセス間で通信することを検討してください。

それまでのast.literal_eval間、それをPython構造に戻す唯一の安全な方法です。

于 2013-02-28T01:58:30.587 に答える
0

タグが常にメッセージの最後にある場合は、それstr.rpartition()を抽出できます。

tag = "Depends-on:"
latest = max((d for d in data if tag in d["message"]),
             key=lambda d: d["timestamp"])
print(latest["message"].rpartition(tag)[2])

出力

254994 258334
于 2013-02-28T03:35:54.110 に答える