Merge remote-tracking branch 'origin/main'
# Conflicts: # desktop_env/evaluators/getters/__init__.py # desktop_env/evaluators/metrics/__init__.py # requirements.txt
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from .file import get_cloud_file, get_vm_file, get_cache_file
|
||||
from .misc import get_rule
|
||||
from .info import get_vm_screen_size, get_vm_window_size, get_vm_wallpaper
|
||||
from .misc import get_rule, get_accessibility_tree
|
||||
from .vlc import get_vlc_playing_info, get_vlc_config
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
from typing import Dict
|
||||
from typing import Optional
|
||||
|
||||
import requests
|
||||
|
||||
@@ -27,7 +28,7 @@ def get_cloud_file(env, config: Dict[str, str]) -> str:
|
||||
return _path
|
||||
|
||||
|
||||
def get_vm_file(env, config: Dict[str, str]) -> str:
|
||||
def get_vm_file(env, config: Dict[str, str]) -> Optional[str]:
|
||||
"""
|
||||
Config:
|
||||
path (str): absolute path on the VM to fetch
|
||||
@@ -37,10 +38,9 @@ def get_vm_file(env, config: Dict[str, str]) -> str:
|
||||
_path = os.path.join(env.cache_dir, config["dest"])
|
||||
|
||||
file = env.controller.get_file(config["path"])
|
||||
|
||||
if file is None:
|
||||
raise FileNotFoundError("File not found on VM: {:}".format(config["path"]))
|
||||
|
||||
return None
|
||||
#raise FileNotFoundError("File not found on VM: {:}".format(config["path"]))
|
||||
with open(_path, "wb") as f:
|
||||
f.write(file)
|
||||
|
||||
|
||||
23
desktop_env/evaluators/getters/general.py
Normal file
23
desktop_env/evaluators/getters/general.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from typing import Dict
|
||||
|
||||
import os
|
||||
import requests
|
||||
|
||||
|
||||
def get_string(env, config: Dict[str, str]) -> str:
|
||||
"""
|
||||
Config:
|
||||
string (str)
|
||||
"""
|
||||
|
||||
return config["string"]
|
||||
|
||||
def get_command_line(env, config: Dict[str, str]) -> str:
|
||||
"""
|
||||
Config:
|
||||
string (str)
|
||||
"""
|
||||
|
||||
f = os.popen(config["command"])
|
||||
|
||||
return f.read()
|
||||
@@ -1,5 +1,6 @@
|
||||
import logging
|
||||
from typing import TypeVar
|
||||
#from typing import Dict, List
|
||||
|
||||
logger = logging.getLogger("desktopenv.getters.misc")
|
||||
|
||||
@@ -11,3 +12,8 @@ def get_rule(env, config: R) -> R:
|
||||
Returns the rule as-is.
|
||||
"""
|
||||
return config["rules"]
|
||||
|
||||
def get_accessibility_tree(env, *args) -> str:
|
||||
accessibility_tree: str = env.controller.get_accessibility_tree()
|
||||
logger.debug("AT@eval: %s", accessibility_tree)
|
||||
return accessibility_tree
|
||||
|
||||
Reference in New Issue
Block a user