19 from ..robotapi
import normpath
20 from ..spec.iteminfo
import BlockKeywordInfo
25 def __init__(self, settings, libraries_need_refresh_listener,
43 _default_libraries = property
51 _default_kws = property
63 self.
_library_manager_library_manager.get_new_connection_to_library_database()
65 last_updated = library_database.get_library_last_updated(name, args)
67 if time.time() - last_updated > 10.0:
70 return library_database.fetch_library_keywords(name, args)
71 return self.
_library_manager_library_manager.get_and_insert_keywords(name, args)
73 library_database.close()
75 def _key(self, name, args):
76 return name, str(tuple(args
or ''))
80 key = self.
_key_key(name, args_with_alias)
90 args = tuple(args) + (
'WITH NAME', alias)
92 args = (
'WITH NAME', alias)
101 kws.extend(keywords_in_library)
104 obj1 =
BlockKeywordInfo(
'FOR',
'To create loops. Arguments: (scalars) loop_variables, selector: one of IN, IN RANGE, IN ENUMERATE, IN ZIP, values=scalars, lists, dictionaries. See `BuiltIn.FOR` docs at\n https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#for-loops.',
'ROBOT',
'BuiltIn',
'loop_variables',
'selector',
'*values')
106 obj2 =
BlockKeywordInfo(
'END',
'Ends `FOR` loops, `IF/ELSE`, `WHILE` and `TRY/EXCEPT` blocks. See `BuiltIn.FOR` docs at\n https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#for-loops.')
110 obj4 =
BlockKeywordInfo(
'WHILE',
'To create loops. Arguments: (boolean) condition, (optional) limit=counter or time. See `BuiltIn` docs at\n https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#while-loops.',
'ROBOT',
'BuiltIn',
'(boolean) condition',
'(optional) limit=')
112 obj5 =
BlockKeywordInfo(
'BREAK',
'To control loops. See `BuiltIn` docs at\n https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#loop-control-using-break-and-continue.')
114 obj6 =
BlockKeywordInfo(
'CONTINUE',
'To control loops. See `BuiltIn` docs at\n https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#loop-control-using-break-and-continue.')
116 obj7 =
BlockKeywordInfo(
'IF',
'To condition blocks of keywords. Arguments: (boolean) condition. See `BuiltIn` docs at\n https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#if-else-syntax.',
'ROBOT',
'BuiltIn',
'(boolean) condition')
118 obj8 =
BlockKeywordInfo(
'ELSE',
'To condition blocks of keywords. See `BuiltIn.IF` docs at\n https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#if-else-syntax.\n Note: See also TRY/EXCEPT.')
120 obj9 =
BlockKeywordInfo(
'ELSE IF',
'To condition blocks of keywords. Arguments: (boolean) condition. See `BuiltIn.IF` docs at\n https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#if-else-syntax.',
'ROBOT',
'BuiltIn',
'(boolean) condition')
122 obj10 =
BlockKeywordInfo(
'TRY',
'To prevent test failures based on messages from keywords. See `BuiltIn.TRY` docs at\n https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#try-except-syntax.')
124 obj11 =
BlockKeywordInfo(
'EXCEPT',
'To prevent test failures based on messages from keywords.\n\nArguments: (optional) message=string, (optional) glob, regex, scalar, (optional) type, glob or error capture setting.\n\n See `BuiltIn.TRY` docs at\n https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#try-except-syntax.',
'ROBOT',
'BuiltIn',
'*options')
126 obj12 =
BlockKeywordInfo(
'FINALLY',
'To prevent test failures based on messages from keywords. See `BuiltIn.TRY` docs at\n https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#try-except-syntax.')
132 for libsetting
in self.
_settings_settings[
'auto imports'] + [
'BuiltIn']:
134 default_libs[name] = self.
_get_library_get_library(name, args)
138 parts = libsetting.split(
'|')
140 return parts[0],
None
141 return parts[0], parts[1:]
151 if key
in self.
_cache_cache:
152 key_time, values = self.
_cache_cache[key]
158 return (time.time() - key_time) < self.
_timeout_timeout
160 def put(self, key, values):
161 self.
_cache_cache[key] = (time.time(), values)
165 return self._resource_files[name]
167 path =
normpath(os.path.join(os.path.dirname(source), name))
168 return self._resource_files[path]
def put(self, key, values)
def __init__(self, timeout=0.5)
def _is_valid(self, key_time)
def _get_from_cache(self, source, name)
def _get_library(self, name, args)
def _build_default_kws(self)
def get_library_keywords(self, name, args=None, alias=None)
def _get_name_and_args(self, libsetting)
def __init__(self, settings, libraries_need_refresh_listener, library_manager)
def _key(self, name, args)
def _alias_to_args(self, alias, args)
def get_all_cached_library_names(self)
_libraries_need_refresh_listener
def _get_default_libraries(self)
def _default_libraries(self)
def set_library_manager(self, library_manager)
def get_default_keywords(self)
Special Info for FOR and END, documentation and since 5.0, IF, ELSE, ELSEIF, WHILE,...
def normpath(path, case_normalize=False)
Replacement for os.path.normpath with some enhancements.