From 5160619783573cdcfbccbe8b9e7b9c4c255bfba4 Mon Sep 17 00:00:00 2001 From: David Chang Date: Fri, 12 Jan 2024 12:19:23 +0800 Subject: [PATCH] ver Jan12th quickly fixed two thunderbird examples --- desktop_env/evaluators/metrics/thunderbird.py | 2 +- .../2ad9387a-65d8-4e33-ad5b-7580065a27ca.json | 72 +++++++++++++++++ .../35253b65-1c19-4304-8aa4-6884b8218fc0.json | 77 +++++++++++++++++++ 3 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 evaluation_examples/examples/thunderbird/2ad9387a-65d8-4e33-ad5b-7580065a27ca.json create mode 100644 evaluation_examples/examples/thunderbird/35253b65-1c19-4304-8aa4-6884b8218fc0.json diff --git a/desktop_env/evaluators/metrics/thunderbird.py b/desktop_env/evaluators/metrics/thunderbird.py index b202d94..ce7d00d 100644 --- a/desktop_env/evaluators/metrics/thunderbird.py +++ b/desktop_env/evaluators/metrics/thunderbird.py @@ -85,7 +85,7 @@ def check_thunderbird_prefs(result: str, rule: Dict[str, Dict[str, Dict[str, Any _value_processor: Callable[[str], str] = lambda val: val.replace("\\\"", "\"").replace("\\\\", "\\") #_condition_pattern: Pattern[str] = re.compile(r'(?PAND|OR) \((?P[\w ]+),(?P[\w ' + '\'' + r']+),(?:"(?P(?:[^"]|\")+)"|(?P[^)]+))\)') -_condition_pattern: Pattern[str] = re.compile(r'(?:AND|OR) \((?:[\w ]+),(?:[\w ' + '\'' + r']+),(?:"(?:(?:[^"]|\")+)"|(?:[^)]+))\)') +_condition_pattern: Pattern[str] = re.compile(r'\b(?:AND|OR) \((?:[\w ]+),(?:[\w ' + '\'' + r']+),(?:"(?:(?:[^"]|\")+)"|(?:[^)]+))\)|\bALL\b') def check_thunderbird_filter(result: str, rules: Dict[str, List[Dict[str, str]]]) -> float: """ Args: diff --git a/evaluation_examples/examples/thunderbird/2ad9387a-65d8-4e33-ad5b-7580065a27ca.json b/evaluation_examples/examples/thunderbird/2ad9387a-65d8-4e33-ad5b-7580065a27ca.json new file mode 100644 index 0000000..6b89f31 --- /dev/null +++ b/evaluation_examples/examples/thunderbird/2ad9387a-65d8-4e33-ad5b-7580065a27ca.json @@ -0,0 +1,72 @@ +{ + "id": "2ad9387a-65d8-4e33-ad5b-7580065a27ca", + "snapshot": "thunderbird", + "instruction": "Create two local folders for me: COMPANY and UNIVERSITY.", + "source": "https://support.mozilla.org/bm/questions/1027435", + "config": [ + { + "type": "download", + "parameters": { + "files": [ + { + "url": "https://drive.usercontent.google.com/download?id=1EHLRWzBCOsyERkSMUnTF2pnsR0n6ZvtR&export=download&authuser=0&confirm=t&uuid=de09bd5e-bef8-499a-b599-c642af190e10&at=APZUnTXqOsQkxl0zMSX6R1Sgp_v3:1704362491712", + "path": "/home/user/thunderbird-profile.tar.gz" + } + ] + } + }, + { + "type": "execute", + "parameters": { + "command": [ + "tar", + "-xzv", + "--recursive-unlink", + "-f", + "/home/user/thunderbird-profile.tar.gz", + "-C", + "/home/user/" + ] + } + }, + { + "type": "launch", + "parameters": { + "command": [ + "/usr/bin/thunderbird" + ] + } + } + ], + "trajectory": "trajectories/2ad9387a-65d8-4e33-ad5b-7580065a27ca", + "related_apps": [ + "thunderbird" + ], + "evaluator": { + "postconfig": [ + { + "type": "execute", + "parameters": { + "command": ["ls", "-R", "/home/user/.thunderbird/t5q2a5hp.default-release/Mail/Local Folders"], + "stdout": "thunder-local-folder.ls" + } + } + ], + "func": "check_list", + "result": { + "type": "cache_file", + "path": "thunder-local-folder.ls" + }, + "expected": { + "type": "rule", + "rules": { + "expect": [ + "\\bCOMPANY\\.msf\\b", + "\\bCOMPANY/?(?!\\.msf)", + "\\bUNIVERSITY\\.msf\\b", + "\\bUNIVERSITY/?(?!\\.msf)" + ] + } + } + } +} diff --git a/evaluation_examples/examples/thunderbird/35253b65-1c19-4304-8aa4-6884b8218fc0.json b/evaluation_examples/examples/thunderbird/35253b65-1c19-4304-8aa4-6884b8218fc0.json new file mode 100644 index 0000000..a1c3154 --- /dev/null +++ b/evaluation_examples/examples/thunderbird/35253b65-1c19-4304-8aa4-6884b8218fc0.json @@ -0,0 +1,77 @@ +{ + "id": "35253b65-1c19-4304-8aa4-6884b8218fc0", + "snapshot": "thunderbird", + "instruction": "Set up to forward every email received by anonym-x2024@outlook.com in the future to anonym-x2024@gmail.com. Please don't touch the online account. Just locally in the Thunderbird!", + "source": "https://support.mozilla.org/en-US/questions/1259354", + "config": [ + { + "type": "download", + "parameters": { + "files": [ + { + "url": "https://drive.usercontent.google.com/download?id=1EHLRWzBCOsyERkSMUnTF2pnsR0n6ZvtR&export=download&authuser=0&confirm=t&uuid=de09bd5e-bef8-499a-b599-c642af190e10&at=APZUnTXqOsQkxl0zMSX6R1Sgp_v3:1704362491712", + "path": "/home/user/thunderbird-profile.tar.gz" + } + ] + } + }, + { + "type": "execute", + "parameters": { + "command": [ + "tar", + "-xzv", + "--recursive-unlink", + "-f", + "/home/user/thunderbird-profile.tar.gz", + "-C", + "/home/user/" + ] + } + }, + { + "type": "launch", + "parameters": { + "command": [ + "/usr/bin/thunderbird" + ] + } + } + ], + "trajectory": "trajectories/35253b65-1c19-4304-8aa4-6884b8218fc0", + "related_apps": [ + "thunderbird" + ], + "evaluator": { + "postconfig": [ + { + "type": "command", + "parameters": { + "command": ["wmctrl", "-Fc", "Message Filters"], + "until": { + "returncode": 1 + } + } + } + ], + "func": "check_thunderbird_filter", + "result": { + "type": "vm_file", + "path": "/home/user/.thunderbird/t5q2a5hp.default-release/ImapMail/outlook.office365.com/msgFilterRules.dat", + "dest": "msgFilterRules.dat" + }, + "expected": { + "type": "rule", + "rules": { + "expect": [ + { + "enabled": "yes", + "action": "Forward", + "actionValue": "anonym-x2024@gmail.com", + "condition": ["ALL"] + } + ] + } + } + } +}