repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
devassistant/devassistant
devassistant/gui/main_window.py
MainWindow._create_notebook_page
def _create_notebook_page(self, assistant): """ This function is used for create tab page for notebook. Input arguments are: assistant - used for collecting all info about assistants and subassistants """ #frame = self._create_frame() grid_lang = self.gui_helper.c...
python
def _create_notebook_page(self, assistant): """ This function is used for create tab page for notebook. Input arguments are: assistant - used for collecting all info about assistants and subassistants """ #frame = self._create_frame() grid_lang = self.gui_helper.c...
[ "def", "_create_notebook_page", "(", "self", ",", "assistant", ")", ":", "#frame = self._create_frame()", "grid_lang", "=", "self", ".", "gui_helper", ".", "create_gtk_grid", "(", ")", "scrolled_window", "=", "self", ".", "gui_helper", ".", "create_scrolled_window", ...
This function is used for create tab page for notebook. Input arguments are: assistant - used for collecting all info about assistants and subassistants
[ "This", "function", "is", "used", "for", "create", "tab", "page", "for", "notebook", ".", "Input", "arguments", "are", ":", "assistant", "-", "used", "for", "collecting", "all", "info", "about", "assistants", "and", "subassistants" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/main_window.py#L117-L155
train
devassistant/devassistant
devassistant/gui/main_window.py
MainWindow._open_path_window
def _open_path_window(self): """ Hides this window and opens path window. Passes all needed data and kwargs. """ self.data['top_assistant'] = self.top_assistant self.data['current_main_assistant'] = self.get_current_main_assistant() self.data['kwargs'] = self.kwar...
python
def _open_path_window(self): """ Hides this window and opens path window. Passes all needed data and kwargs. """ self.data['top_assistant'] = self.top_assistant self.data['current_main_assistant'] = self.get_current_main_assistant() self.data['kwargs'] = self.kwar...
[ "def", "_open_path_window", "(", "self", ")", ":", "self", ".", "data", "[", "'top_assistant'", "]", "=", "self", ".", "top_assistant", "self", ".", "data", "[", "'current_main_assistant'", "]", "=", "self", ".", "get_current_main_assistant", "(", ")", "self",...
Hides this window and opens path window. Passes all needed data and kwargs.
[ "Hides", "this", "window", "and", "opens", "path", "window", ".", "Passes", "all", "needed", "data", "and", "kwargs", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/main_window.py#L163-L172
train
devassistant/devassistant
devassistant/gui/main_window.py
MainWindow.sub_menu_pressed
def sub_menu_pressed(self, widget, event): """ Function serves for getting full assistant path and collects the information from GUI """ for index, data in enumerate(self.dev_assistant_path): index += 1 if settings.SUBASSISTANT_N_STRING.format(index) in se...
python
def sub_menu_pressed(self, widget, event): """ Function serves for getting full assistant path and collects the information from GUI """ for index, data in enumerate(self.dev_assistant_path): index += 1 if settings.SUBASSISTANT_N_STRING.format(index) in se...
[ "def", "sub_menu_pressed", "(", "self", ",", "widget", ",", "event", ")", ":", "for", "index", ",", "data", "in", "enumerate", "(", "self", ".", "dev_assistant_path", ")", ":", "index", "+=", "1", "if", "settings", ".", "SUBASSISTANT_N_STRING", ".", "forma...
Function serves for getting full assistant path and collects the information from GUI
[ "Function", "serves", "for", "getting", "full", "assistant", "path", "and", "collects", "the", "information", "from", "GUI" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/main_window.py#L174-L185
train
devassistant/devassistant
devassistant/gui/main_window.py
MainWindow.get_current_main_assistant
def get_current_main_assistant(self): """ Function return current assistant """ current_page = self.notebook.get_nth_page(self.notebook.get_current_page()) return current_page.main_assistant
python
def get_current_main_assistant(self): """ Function return current assistant """ current_page = self.notebook.get_nth_page(self.notebook.get_current_page()) return current_page.main_assistant
[ "def", "get_current_main_assistant", "(", "self", ")", ":", "current_page", "=", "self", ".", "notebook", ".", "get_nth_page", "(", "self", ".", "notebook", ".", "get_current_page", "(", ")", ")", "return", "current_page", ".", "main_assistant" ]
Function return current assistant
[ "Function", "return", "current", "assistant" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/main_window.py#L187-L192
train
devassistant/devassistant
devassistant/gui/main_window.py
MainWindow.btn_clicked
def btn_clicked(self, widget, data=None): """ Function is used for case that assistant does not have any subassistants """ self.kwargs['subassistant_0'] = self.get_current_main_assistant().name self.kwargs['subassistant_1'] = data if 'subassistant_2' in self.kwarg...
python
def btn_clicked(self, widget, data=None): """ Function is used for case that assistant does not have any subassistants """ self.kwargs['subassistant_0'] = self.get_current_main_assistant().name self.kwargs['subassistant_1'] = data if 'subassistant_2' in self.kwarg...
[ "def", "btn_clicked", "(", "self", ",", "widget", ",", "data", "=", "None", ")", ":", "self", ".", "kwargs", "[", "'subassistant_0'", "]", "=", "self", ".", "get_current_main_assistant", "(", ")", ".", "name", "self", ".", "kwargs", "[", "'subassistant_1'"...
Function is used for case that assistant does not have any subassistants
[ "Function", "is", "used", "for", "case", "that", "assistant", "does", "not", "have", "any", "subassistants" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/main_window.py#L194-L203
train
devassistant/devassistant
devassistant/gui/main_window.py
MainWindow.open_window
def open_window(self, widget, data=None): """ Function opens Main Window and in case of previously created project is switches to /home directory This is fix in case that da creats a project and project was deleted and GUI was not closed yet """ if data is not Non...
python
def open_window(self, widget, data=None): """ Function opens Main Window and in case of previously created project is switches to /home directory This is fix in case that da creats a project and project was deleted and GUI was not closed yet """ if data is not Non...
[ "def", "open_window", "(", "self", ",", "widget", ",", "data", "=", "None", ")", ":", "if", "data", "is", "not", "None", ":", "self", ".", "data", "=", "data", "os", ".", "chdir", "(", "os", ".", "path", ".", "expanduser", "(", "'~'", ")", ")", ...
Function opens Main Window and in case of previously created project is switches to /home directory This is fix in case that da creats a project and project was deleted and GUI was not closed yet
[ "Function", "opens", "Main", "Window", "and", "in", "case", "of", "previously", "created", "project", "is", "switches", "to", "/", "home", "directory", "This", "is", "fix", "in", "case", "that", "da", "creats", "a", "project", "and", "project", "was", "del...
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/main_window.py#L224-L235
train
devassistant/devassistant
devassistant/gui/main_window.py
MainWindow.btn_press_event
def btn_press_event(self, widget, event): """ Function is used for showing Popup menu """ if event.type == Gdk.EventType.BUTTON_PRESS: if event.button.button == 1: widget.popup(None, None, None, None, event.button.button, event.tim...
python
def btn_press_event(self, widget, event): """ Function is used for showing Popup menu """ if event.type == Gdk.EventType.BUTTON_PRESS: if event.button.button == 1: widget.popup(None, None, None, None, event.button.button, event.tim...
[ "def", "btn_press_event", "(", "self", ",", "widget", ",", "event", ")", ":", "if", "event", ".", "type", "==", "Gdk", ".", "EventType", ".", "BUTTON_PRESS", ":", "if", "event", ".", "button", ".", "button", "==", "1", ":", "widget", ".", "popup", "(...
Function is used for showing Popup menu
[ "Function", "is", "used", "for", "showing", "Popup", "menu" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/main_window.py#L237-L246
train
devassistant/devassistant
devassistant/gui/__init__.py
run_gui
def run_gui(): """ Function for running DevAssistant GUI """ try: from gi.repository import Gtk except ImportError as ie: pass except RuntimeError as e: sys.stderr.write(GUI_MESSAGE) sys.stderr.write("%s: %r" % (e.__class__.__name__, utils.exc_as_decoded_string(e)...
python
def run_gui(): """ Function for running DevAssistant GUI """ try: from gi.repository import Gtk except ImportError as ie: pass except RuntimeError as e: sys.stderr.write(GUI_MESSAGE) sys.stderr.write("%s: %r" % (e.__class__.__name__, utils.exc_as_decoded_string(e)...
[ "def", "run_gui", "(", ")", ":", "try", ":", "from", "gi", ".", "repository", "import", "Gtk", "except", "ImportError", "as", "ie", ":", "pass", "except", "RuntimeError", "as", "e", ":", "sys", ".", "stderr", ".", "write", "(", "GUI_MESSAGE", ")", "sys...
Function for running DevAssistant GUI
[ "Function", "for", "running", "DevAssistant", "GUI" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/__init__.py#L14-L50
train
devassistant/devassistant
devassistant/yaml_assistant.py
needs_fully_loaded
def needs_fully_loaded(method): """Wraps all publicly callable methods of YamlAssistant. If the assistant was loaded from cache, this decorator will fully load it first time a publicly callable method is used. """ @functools.wraps(method) def inner(self, *args, **kwargs): if not self.ful...
python
def needs_fully_loaded(method): """Wraps all publicly callable methods of YamlAssistant. If the assistant was loaded from cache, this decorator will fully load it first time a publicly callable method is used. """ @functools.wraps(method) def inner(self, *args, **kwargs): if not self.ful...
[ "def", "needs_fully_loaded", "(", "method", ")", ":", "@", "functools", ".", "wraps", "(", "method", ")", "def", "inner", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "fully_loaded", ":", "loaded_yaml", ...
Wraps all publicly callable methods of YamlAssistant. If the assistant was loaded from cache, this decorator will fully load it first time a publicly callable method is used.
[ "Wraps", "all", "publicly", "callable", "methods", "of", "YamlAssistant", ".", "If", "the", "assistant", "was", "loaded", "from", "cache", "this", "decorator", "will", "fully", "load", "it", "first", "time", "a", "publicly", "callable", "method", "is", "used",...
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/yaml_assistant.py#L19-L32
train
devassistant/devassistant
devassistant/yaml_assistant.py
YamlAssistant.default_icon_path
def default_icon_path(self): """Returns default path to icon of this assistant. Assuming self.path == "/foo/assistants/crt/python/django.yaml" For image format in [png, svg]: 1) Take the path of this assistant and strip it of load path (=> "crt/python/django.yaml") ...
python
def default_icon_path(self): """Returns default path to icon of this assistant. Assuming self.path == "/foo/assistants/crt/python/django.yaml" For image format in [png, svg]: 1) Take the path of this assistant and strip it of load path (=> "crt/python/django.yaml") ...
[ "def", "default_icon_path", "(", "self", ")", ":", "supported_exts", "=", "[", "'.png'", ",", "'.svg'", "]", "stripped", "=", "self", ".", "path", ".", "replace", "(", "os", ".", "path", ".", "join", "(", "self", ".", "load_path", ",", "'assistants'", ...
Returns default path to icon of this assistant. Assuming self.path == "/foo/assistants/crt/python/django.yaml" For image format in [png, svg]: 1) Take the path of this assistant and strip it of load path (=> "crt/python/django.yaml") 2) Substitute its extension fo...
[ "Returns", "default", "path", "to", "icon", "of", "this", "assistant", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/yaml_assistant.py#L95-L116
train
devassistant/devassistant
devassistant/yaml_assistant.py
YamlAssistant.proper_kwargs
def proper_kwargs(self, section, kwargs): """Returns kwargs updated with proper meta variables (like __assistant__). If this method is run repeatedly with the same section and the same kwargs, it always modifies kwargs in the same way. """ kwargs['__section__'] = section ...
python
def proper_kwargs(self, section, kwargs): """Returns kwargs updated with proper meta variables (like __assistant__). If this method is run repeatedly with the same section and the same kwargs, it always modifies kwargs in the same way. """ kwargs['__section__'] = section ...
[ "def", "proper_kwargs", "(", "self", ",", "section", ",", "kwargs", ")", ":", "kwargs", "[", "'__section__'", "]", "=", "section", "kwargs", "[", "'__assistant__'", "]", "=", "self", "kwargs", "[", "'__env__'", "]", "=", "copy", ".", "deepcopy", "(", "os...
Returns kwargs updated with proper meta variables (like __assistant__). If this method is run repeatedly with the same section and the same kwargs, it always modifies kwargs in the same way.
[ "Returns", "kwargs", "updated", "with", "proper", "meta", "variables", "(", "like", "__assistant__", ")", ".", "If", "this", "method", "is", "run", "repeatedly", "with", "the", "same", "section", "and", "the", "same", "kwargs", "it", "always", "modifies", "k...
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/yaml_assistant.py#L141-L158
train
devassistant/devassistant
devassistant/yaml_assistant.py
YamlAssistant.dependencies
def dependencies(self, kwargs=None, expand_only=False): """Returns all dependencies of this assistant with regards to specified kwargs. If expand_only == False, this method returns list of mappings of dependency types to actual dependencies (keeps order, types can repeat), e.g. Example:...
python
def dependencies(self, kwargs=None, expand_only=False): """Returns all dependencies of this assistant with regards to specified kwargs. If expand_only == False, this method returns list of mappings of dependency types to actual dependencies (keeps order, types can repeat), e.g. Example:...
[ "def", "dependencies", "(", "self", ",", "kwargs", "=", "None", ",", "expand_only", "=", "False", ")", ":", "# we can't use {} as a default for kwargs, as that initializes the dict only once in Python", "# and uses the same dict in all subsequent calls of this method", "if", "not",...
Returns all dependencies of this assistant with regards to specified kwargs. If expand_only == False, this method returns list of mappings of dependency types to actual dependencies (keeps order, types can repeat), e.g. Example: [{'rpm', ['rubygems']}, {'gem', ['mygem']}, {'rpm', ['spam...
[ "Returns", "all", "dependencies", "of", "this", "assistant", "with", "regards", "to", "specified", "kwargs", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/yaml_assistant.py#L202-L228
train
devassistant/devassistant
devassistant/package_managers.py
PackageManager.get_perm_prompt
def get_perm_prompt(cls, package_list): """ Return text for prompt (do you want to install...), to install given packages. """ if cls == PackageManager: raise NotImplementedError() ln = len(package_list) plural = 's' if ln > 1 else '' return cls.permis...
python
def get_perm_prompt(cls, package_list): """ Return text for prompt (do you want to install...), to install given packages. """ if cls == PackageManager: raise NotImplementedError() ln = len(package_list) plural = 's' if ln > 1 else '' return cls.permis...
[ "def", "get_perm_prompt", "(", "cls", ",", "package_list", ")", ":", "if", "cls", "==", "PackageManager", ":", "raise", "NotImplementedError", "(", ")", "ln", "=", "len", "(", "package_list", ")", "plural", "=", "'s'", "if", "ln", ">", "1", "else", "''",...
Return text for prompt (do you want to install...), to install given packages.
[ "Return", "text", "for", "prompt", "(", "do", "you", "want", "to", "install", "...", ")", "to", "install", "given", "packages", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/package_managers.py#L56-L64
train
devassistant/devassistant
devassistant/package_managers.py
GentooPackageManager._try_get_current_manager
def _try_get_current_manager(cls): """ Try to detect a package manager used in a current Gentoo system. """ if utils.get_distro_name().find('gentoo') == -1: return None if 'PACKAGE_MANAGER' in os.environ: pm = os.environ['PACKAGE_MANAGER'] if pm == 'paludis': ...
python
def _try_get_current_manager(cls): """ Try to detect a package manager used in a current Gentoo system. """ if utils.get_distro_name().find('gentoo') == -1: return None if 'PACKAGE_MANAGER' in os.environ: pm = os.environ['PACKAGE_MANAGER'] if pm == 'paludis': ...
[ "def", "_try_get_current_manager", "(", "cls", ")", ":", "if", "utils", ".", "get_distro_name", "(", ")", ".", "find", "(", "'gentoo'", ")", "==", "-", "1", ":", "return", "None", "if", "'PACKAGE_MANAGER'", "in", "os", ".", "environ", ":", "pm", "=", "...
Try to detect a package manager used in a current Gentoo system.
[ "Try", "to", "detect", "a", "package", "manager", "used", "in", "a", "current", "Gentoo", "system", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/package_managers.py#L607-L637
train
devassistant/devassistant
devassistant/package_managers.py
GentooPackageManager.is_current_manager_equals_to
def is_current_manager_equals_to(cls, pm): """Returns True if this package manager is usable, False otherwise.""" if hasattr(cls, 'works_result'): return cls.works_result is_ok = bool(cls._try_get_current_manager() == pm) setattr(cls, 'works_result', is_ok) return is_...
python
def is_current_manager_equals_to(cls, pm): """Returns True if this package manager is usable, False otherwise.""" if hasattr(cls, 'works_result'): return cls.works_result is_ok = bool(cls._try_get_current_manager() == pm) setattr(cls, 'works_result', is_ok) return is_...
[ "def", "is_current_manager_equals_to", "(", "cls", ",", "pm", ")", ":", "if", "hasattr", "(", "cls", ",", "'works_result'", ")", ":", "return", "cls", ".", "works_result", "is_ok", "=", "bool", "(", "cls", ".", "_try_get_current_manager", "(", ")", "==", "...
Returns True if this package manager is usable, False otherwise.
[ "Returns", "True", "if", "this", "package", "manager", "is", "usable", "False", "otherwise", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/package_managers.py#L640-L646
train
devassistant/devassistant
devassistant/package_managers.py
DependencyInstaller.get_package_manager
def get_package_manager(self, dep_t): """Choose proper package manager and return it.""" mgrs = managers.get(dep_t, []) for manager in mgrs: if manager.works(): return manager if not mgrs: err = 'No package manager for dependency type "{dep_t}"'.fo...
python
def get_package_manager(self, dep_t): """Choose proper package manager and return it.""" mgrs = managers.get(dep_t, []) for manager in mgrs: if manager.works(): return manager if not mgrs: err = 'No package manager for dependency type "{dep_t}"'.fo...
[ "def", "get_package_manager", "(", "self", ",", "dep_t", ")", ":", "mgrs", "=", "managers", ".", "get", "(", "dep_t", ",", "[", "]", ")", "for", "manager", "in", "mgrs", ":", "if", "manager", ".", "works", "(", ")", ":", "return", "manager", "if", ...
Choose proper package manager and return it.
[ "Choose", "proper", "package", "manager", "and", "return", "it", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/package_managers.py#L836-L849
train
devassistant/devassistant
devassistant/package_managers.py
DependencyInstaller._process_dependency
def _process_dependency(self, dep_t, dep_l): """Add dependencies into self.dependencies, possibly also adding system packages that contain non-distro package managers (e.g. if someone wants to install dependencies with pip and pip is not present, it will get installed through RPM on RPM ...
python
def _process_dependency(self, dep_t, dep_l): """Add dependencies into self.dependencies, possibly also adding system packages that contain non-distro package managers (e.g. if someone wants to install dependencies with pip and pip is not present, it will get installed through RPM on RPM ...
[ "def", "_process_dependency", "(", "self", ",", "dep_t", ",", "dep_l", ")", ":", "if", "dep_t", "not", "in", "managers", ":", "err", "=", "'No package manager for dependency type \"{dep_t}\"'", ".", "format", "(", "dep_t", "=", "dep_t", ")", "raise", "exceptions...
Add dependencies into self.dependencies, possibly also adding system packages that contain non-distro package managers (e.g. if someone wants to install dependencies with pip and pip is not present, it will get installed through RPM on RPM based systems, etc. Skips dependencies that are...
[ "Add", "dependencies", "into", "self", ".", "dependencies", "possibly", "also", "adding", "system", "packages", "that", "contain", "non", "-", "distro", "package", "managers", "(", "e", ".", "g", ".", "if", "someone", "wants", "to", "install", "dependencies", ...
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/package_managers.py#L851-L879
train
devassistant/devassistant
devassistant/package_managers.py
DependencyInstaller._ask_to_confirm
def _ask_to_confirm(self, ui, pac_man, *to_install): """ Return True if user wants to install packages, False otherwise """ ret = DialogHelper.ask_for_package_list_confirm( ui, prompt=pac_man.get_perm_prompt(to_install), package_list=to_install, ) return bool(ret)
python
def _ask_to_confirm(self, ui, pac_man, *to_install): """ Return True if user wants to install packages, False otherwise """ ret = DialogHelper.ask_for_package_list_confirm( ui, prompt=pac_man.get_perm_prompt(to_install), package_list=to_install, ) return bool(ret)
[ "def", "_ask_to_confirm", "(", "self", ",", "ui", ",", "pac_man", ",", "*", "to_install", ")", ":", "ret", "=", "DialogHelper", ".", "ask_for_package_list_confirm", "(", "ui", ",", "prompt", "=", "pac_man", ".", "get_perm_prompt", "(", "to_install", ")", ","...
Return True if user wants to install packages, False otherwise
[ "Return", "True", "if", "user", "wants", "to", "install", "packages", "False", "otherwise" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/package_managers.py#L881-L887
train
devassistant/devassistant
devassistant/package_managers.py
DependencyInstaller._install_dependencies
def _install_dependencies(self, ui, debug): """Install missing dependencies""" for dep_t, dep_l in self.dependencies: if not dep_l: continue pkg_mgr = self.get_package_manager(dep_t) pkg_mgr.works() to_resolve = [] for dep in de...
python
def _install_dependencies(self, ui, debug): """Install missing dependencies""" for dep_t, dep_l in self.dependencies: if not dep_l: continue pkg_mgr = self.get_package_manager(dep_t) pkg_mgr.works() to_resolve = [] for dep in de...
[ "def", "_install_dependencies", "(", "self", ",", "ui", ",", "debug", ")", ":", "for", "dep_t", ",", "dep_l", "in", "self", ".", "dependencies", ":", "if", "not", "dep_l", ":", "continue", "pkg_mgr", "=", "self", ".", "get_package_manager", "(", "dep_t", ...
Install missing dependencies
[ "Install", "missing", "dependencies" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/package_managers.py#L889-L933
train
devassistant/devassistant
devassistant/package_managers.py
DependencyInstaller.install
def install(self, struct, ui, debug=False): """ This is the only method that should be called from outside. Call it like: `DependencyInstaller(struct)` and it will install packages which are not present on system (it uses package managers specified by `struct` structure) ...
python
def install(self, struct, ui, debug=False): """ This is the only method that should be called from outside. Call it like: `DependencyInstaller(struct)` and it will install packages which are not present on system (it uses package managers specified by `struct` structure) ...
[ "def", "install", "(", "self", ",", "struct", ",", "ui", ",", "debug", "=", "False", ")", ":", "# the system dependencies should always go first", "self", ".", "__add_dependencies", "(", "self", ".", "get_system_deptype_shortcut", "(", ")", ",", "[", "]", ")", ...
This is the only method that should be called from outside. Call it like: `DependencyInstaller(struct)` and it will install packages which are not present on system (it uses package managers specified by `struct` structure)
[ "This", "is", "the", "only", "method", "that", "should", "be", "called", "from", "outside", ".", "Call", "it", "like", ":", "DependencyInstaller", "(", "struct", ")", "and", "it", "will", "install", "packages", "which", "are", "not", "present", "on", "syst...
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/package_managers.py#L935-L949
train
devassistant/devassistant
devassistant/cache.py
Cache.refresh_role
def refresh_role(self, role, file_hierarchy): """Checks and refreshes (if needed) all assistants with given role. Args: role: role of assistants to refresh file_hierarchy: hierarchy as returned by devassistant.yaml_assistant_loader.\ YamlAssistantLoad...
python
def refresh_role(self, role, file_hierarchy): """Checks and refreshes (if needed) all assistants with given role. Args: role: role of assistants to refresh file_hierarchy: hierarchy as returned by devassistant.yaml_assistant_loader.\ YamlAssistantLoad...
[ "def", "refresh_role", "(", "self", ",", "role", ",", "file_hierarchy", ")", ":", "if", "role", "not", "in", "self", ".", "cache", ":", "self", ".", "cache", "[", "role", "]", "=", "{", "}", "was_change", "=", "self", ".", "_refresh_hierarchy_recursive",...
Checks and refreshes (if needed) all assistants with given role. Args: role: role of assistants to refresh file_hierarchy: hierarchy as returned by devassistant.yaml_assistant_loader.\ YamlAssistantLoader.get_assistants_file_hierarchy
[ "Checks", "and", "refreshes", "(", "if", "needed", ")", "all", "assistants", "with", "given", "role", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/cache.py#L78-L92
train
devassistant/devassistant
devassistant/cache.py
Cache._refresh_hierarchy_recursive
def _refresh_hierarchy_recursive(self, cached_hierarchy, file_hierarchy): """Recursively goes through given corresponding hierarchies from cache and filesystem and adds/refreshes/removes added/changed/removed assistants. Args: cached_hierarchy: the respective hierarchy part from cur...
python
def _refresh_hierarchy_recursive(self, cached_hierarchy, file_hierarchy): """Recursively goes through given corresponding hierarchies from cache and filesystem and adds/refreshes/removes added/changed/removed assistants. Args: cached_hierarchy: the respective hierarchy part from cur...
[ "def", "_refresh_hierarchy_recursive", "(", "self", ",", "cached_hierarchy", ",", "file_hierarchy", ")", ":", "was_change", "=", "False", "cached_ass", "=", "set", "(", "cached_hierarchy", ".", "keys", "(", ")", ")", "new_ass", "=", "set", "(", "file_hierarchy",...
Recursively goes through given corresponding hierarchies from cache and filesystem and adds/refreshes/removes added/changed/removed assistants. Args: cached_hierarchy: the respective hierarchy part from current cache (for format see Cache class docstring) ...
[ "Recursively", "goes", "through", "given", "corresponding", "hierarchies", "from", "cache", "and", "filesystem", "and", "adds", "/", "refreshes", "/", "removes", "added", "/", "changed", "/", "removed", "assistants", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/cache.py#L94-L139
train
devassistant/devassistant
devassistant/cache.py
Cache._ass_needs_refresh
def _ass_needs_refresh(self, cached_ass, file_ass): """Checks if assistant needs refresh. Assistant needs refresh iff any of following conditions is True: - stored source file is different than given source file - stored assistant ctime is lower than current source file ctime - ...
python
def _ass_needs_refresh(self, cached_ass, file_ass): """Checks if assistant needs refresh. Assistant needs refresh iff any of following conditions is True: - stored source file is different than given source file - stored assistant ctime is lower than current source file ctime - ...
[ "def", "_ass_needs_refresh", "(", "self", ",", "cached_ass", ",", "file_ass", ")", ":", "if", "cached_ass", "[", "'source'", "]", "!=", "file_ass", "[", "'source'", "]", ":", "return", "True", "if", "os", ".", "path", ".", "getctime", "(", "file_ass", "[...
Checks if assistant needs refresh. Assistant needs refresh iff any of following conditions is True: - stored source file is different than given source file - stored assistant ctime is lower than current source file ctime - stored list of subassistants is different than given list of su...
[ "Checks", "if", "assistant", "needs", "refresh", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/cache.py#L141-L167
train
devassistant/devassistant
devassistant/cache.py
Cache._ass_refresh_attrs
def _ass_refresh_attrs(self, cached_ass, file_ass): """Completely refreshes cached assistant from file. Args: cached_ass: an assistant from cache hierarchy (for format see Cache class docstring) file_ass: the respective assistant from filesystem hierarchy...
python
def _ass_refresh_attrs(self, cached_ass, file_ass): """Completely refreshes cached assistant from file. Args: cached_ass: an assistant from cache hierarchy (for format see Cache class docstring) file_ass: the respective assistant from filesystem hierarchy...
[ "def", "_ass_refresh_attrs", "(", "self", ",", "cached_ass", ",", "file_ass", ")", ":", "# we need to process assistant in custom way to see unexpanded args, etc.", "loaded_ass", "=", "yaml_loader", ".", "YamlLoader", ".", "load_yaml_by_path", "(", "file_ass", "[", "'source...
Completely refreshes cached assistant from file. Args: cached_ass: an assistant from cache hierarchy (for format see Cache class docstring) file_ass: the respective assistant from filesystem hierarchy (for format see what refresh_role accept...
[ "Completely", "refreshes", "cached", "assistant", "from", "file", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/cache.py#L169-L203
train
devassistant/devassistant
devassistant/cache.py
Cache._new_ass_hierarchy
def _new_ass_hierarchy(self, file_ass): """Returns a completely new cache hierarchy for given assistant file. Args: file_ass: the assistant from filesystem hierarchy to create cache hierarchy for (for format see what refresh_role accepts) Returns: ...
python
def _new_ass_hierarchy(self, file_ass): """Returns a completely new cache hierarchy for given assistant file. Args: file_ass: the assistant from filesystem hierarchy to create cache hierarchy for (for format see what refresh_role accepts) Returns: ...
[ "def", "_new_ass_hierarchy", "(", "self", ",", "file_ass", ")", ":", "ret_struct", "=", "{", "'source'", ":", "''", ",", "'subhierarchy'", ":", "{", "}", ",", "'attrs'", ":", "{", "}", ",", "'snippets'", ":", "{", "}", "}", "ret_struct", "[", "'source'...
Returns a completely new cache hierarchy for given assistant file. Args: file_ass: the assistant from filesystem hierarchy to create cache hierarchy for (for format see what refresh_role accepts) Returns: the newly created cache hierarchy
[ "Returns", "a", "completely", "new", "cache", "hierarchy", "for", "given", "assistant", "file", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/cache.py#L205-L224
train
devassistant/devassistant
devassistant/cache.py
Cache._get_snippet_ctime
def _get_snippet_ctime(self, snip_name): """Returns and remembers (during this DevAssistant invocation) last ctime of given snippet. Calling ctime costs lost of time and some snippets, like common_args, are used widely, so we don't want to call ctime bazillion times on them during one i...
python
def _get_snippet_ctime(self, snip_name): """Returns and remembers (during this DevAssistant invocation) last ctime of given snippet. Calling ctime costs lost of time and some snippets, like common_args, are used widely, so we don't want to call ctime bazillion times on them during one i...
[ "def", "_get_snippet_ctime", "(", "self", ",", "snip_name", ")", ":", "if", "snip_name", "not", "in", "self", ".", "snip_ctimes", ":", "snippet", "=", "yaml_snippet_loader", ".", "YamlSnippetLoader", ".", "get_snippet_by_name", "(", "snip_name", ")", "self", "."...
Returns and remembers (during this DevAssistant invocation) last ctime of given snippet. Calling ctime costs lost of time and some snippets, like common_args, are used widely, so we don't want to call ctime bazillion times on them during one invocation. Args: snip_name: nam...
[ "Returns", "and", "remembers", "(", "during", "this", "DevAssistant", "invocation", ")", "last", "ctime", "of", "given", "snippet", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/cache.py#L226-L241
train
devassistant/devassistant
devassistant/lang.py
expand_dependencies_section
def expand_dependencies_section(section, kwargs): """Expands dependency section, e.g. substitues "use: foo" for its contents, but doesn't evaluate conditions nor substitue variables.""" deps = [] for dep in section: for dep_type, dep_list in dep.items(): if dep_type in ['call', 'use...
python
def expand_dependencies_section(section, kwargs): """Expands dependency section, e.g. substitues "use: foo" for its contents, but doesn't evaluate conditions nor substitue variables.""" deps = [] for dep in section: for dep_type, dep_list in dep.items(): if dep_type in ['call', 'use...
[ "def", "expand_dependencies_section", "(", "section", ",", "kwargs", ")", ":", "deps", "=", "[", "]", "for", "dep", "in", "section", ":", "for", "dep_type", ",", "dep_list", "in", "dep", ".", "items", "(", ")", ":", "if", "dep_type", "in", "[", "'call'...
Expands dependency section, e.g. substitues "use: foo" for its contents, but doesn't evaluate conditions nor substitue variables.
[ "Expands", "dependency", "section", "e", ".", "g", ".", "substitues", "use", ":", "foo", "for", "its", "contents", "but", "doesn", "t", "evaluate", "conditions", "nor", "substitue", "variables", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/lang.py#L125-L139
train
devassistant/devassistant
devassistant/lang.py
parse_for
def parse_for(control_line): """Returns name of loop control variable(s), iteration type (in/word_in) and expression to iterate on. For example: - given "for $i in $foo", returns (['i'], '$foo') - given "for ${i} in $(ls $foo)", returns (['i'], '$(ls $foo)') - given "for $k, $v in $foo", return...
python
def parse_for(control_line): """Returns name of loop control variable(s), iteration type (in/word_in) and expression to iterate on. For example: - given "for $i in $foo", returns (['i'], '$foo') - given "for ${i} in $(ls $foo)", returns (['i'], '$(ls $foo)') - given "for $k, $v in $foo", return...
[ "def", "parse_for", "(", "control_line", ")", ":", "error", "=", "'For loop call must be in form \\'for $var in expression\\', got: '", "+", "control_line", "regex", "=", "re", ".", "compile", "(", "r'for\\s+(\\${?\\S+}?)(?:\\s*,\\s+(\\${?\\S+}?))?\\s+(in|word_in)\\s+(\\S.+)'", "...
Returns name of loop control variable(s), iteration type (in/word_in) and expression to iterate on. For example: - given "for $i in $foo", returns (['i'], '$foo') - given "for ${i} in $(ls $foo)", returns (['i'], '$(ls $foo)') - given "for $k, $v in $foo", returns (['k', 'v'], '$foo')
[ "Returns", "name", "of", "loop", "control", "variable", "(", "s", ")", "iteration", "type", "(", "in", "/", "word_in", ")", "and", "expression", "to", "iterate", "on", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/lang.py#L260-L283
train
devassistant/devassistant
devassistant/lang.py
get_for_control_var_and_eval_expr
def get_for_control_var_and_eval_expr(comm_type, kwargs): """Returns tuple that consists of control variable name and iterable that is result of evaluated expression of given for loop. For example: - given 'for $i in $(echo "foo bar")' it returns (['i'], ['foo', 'bar']) - given 'for $i, $j in $foo'...
python
def get_for_control_var_and_eval_expr(comm_type, kwargs): """Returns tuple that consists of control variable name and iterable that is result of evaluated expression of given for loop. For example: - given 'for $i in $(echo "foo bar")' it returns (['i'], ['foo', 'bar']) - given 'for $i, $j in $foo'...
[ "def", "get_for_control_var_and_eval_expr", "(", "comm_type", ",", "kwargs", ")", ":", "# let possible exceptions bubble up", "control_vars", ",", "iter_type", ",", "expression", "=", "parse_for", "(", "comm_type", ")", "eval_expression", "=", "evaluate_expression", "(", ...
Returns tuple that consists of control variable name and iterable that is result of evaluated expression of given for loop. For example: - given 'for $i in $(echo "foo bar")' it returns (['i'], ['foo', 'bar']) - given 'for $i, $j in $foo' it returns (['i', 'j'], [('foo', 'bar')])
[ "Returns", "tuple", "that", "consists", "of", "control", "variable", "name", "and", "iterable", "that", "is", "result", "of", "evaluated", "expression", "of", "given", "for", "loop", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/lang.py#L286-L313
train
devassistant/devassistant
devassistant/lang.py
get_section_from_condition
def get_section_from_condition(if_section, else_section, kwargs): """Returns section that should be used from given if/else sections by evaluating given condition. Args: if_section - section with if clause else_section - section that *may* be else clause (just next section after if_section,...
python
def get_section_from_condition(if_section, else_section, kwargs): """Returns section that should be used from given if/else sections by evaluating given condition. Args: if_section - section with if clause else_section - section that *may* be else clause (just next section after if_section,...
[ "def", "get_section_from_condition", "(", "if_section", ",", "else_section", ",", "kwargs", ")", ":", "# check if else section is really else", "skip", "=", "True", "if", "else_section", "is", "not", "None", "and", "else_section", "[", "0", "]", "==", "'else'", "e...
Returns section that should be used from given if/else sections by evaluating given condition. Args: if_section - section with if clause else_section - section that *may* be else clause (just next section after if_section, this method will check if it really is else); pos...
[ "Returns", "section", "that", "should", "be", "used", "from", "given", "if", "/", "else", "sections", "by", "evaluating", "given", "condition", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/lang.py#L316-L338
train
devassistant/devassistant
devassistant/lang.py
get_catch_vars
def get_catch_vars(catch): """Returns 2-tuple with names of catch control vars, e.g. for "catch $was_exc, $exc" it returns ('was_exc', 'err'). Args: catch: the whole catch line Returns: 2-tuple with names of catch control variables Raises: exceptions.YamlSyntaxError if the...
python
def get_catch_vars(catch): """Returns 2-tuple with names of catch control vars, e.g. for "catch $was_exc, $exc" it returns ('was_exc', 'err'). Args: catch: the whole catch line Returns: 2-tuple with names of catch control variables Raises: exceptions.YamlSyntaxError if the...
[ "def", "get_catch_vars", "(", "catch", ")", ":", "catch_re", "=", "re", ".", "compile", "(", "r'catch\\s+(\\${?\\S+}?),\\s*(\\${?\\S+}?)'", ")", "res", "=", "catch_re", ".", "match", "(", "catch", ")", "if", "res", "is", "None", ":", "err", "=", "'Catch must...
Returns 2-tuple with names of catch control vars, e.g. for "catch $was_exc, $exc" it returns ('was_exc', 'err'). Args: catch: the whole catch line Returns: 2-tuple with names of catch control variables Raises: exceptions.YamlSyntaxError if the catch line is malformed
[ "Returns", "2", "-", "tuple", "with", "names", "of", "catch", "control", "vars", "e", ".", "g", ".", "for", "catch", "$was_exc", "$exc", "it", "returns", "(", "was_exc", "err", ")", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/lang.py#L341-L359
train
devassistant/devassistant
devassistant/lang.py
assign_variable
def assign_variable(variable, log_res, res, kwargs): """Assigns given result (resp. logical result and result) to a variable (resp. to two variables). log_res and res are already computed result of an exec/input section. For example: $foo~: $spam and $eggs $log_res, $foo~: $spam and $eggs $foo...
python
def assign_variable(variable, log_res, res, kwargs): """Assigns given result (resp. logical result and result) to a variable (resp. to two variables). log_res and res are already computed result of an exec/input section. For example: $foo~: $spam and $eggs $log_res, $foo~: $spam and $eggs $foo...
[ "def", "assign_variable", "(", "variable", ",", "log_res", ",", "res", ",", "kwargs", ")", ":", "if", "variable", ".", "endswith", "(", "'~'", ")", ":", "variable", "=", "variable", "[", ":", "-", "1", "]", "comma_count", "=", "variable", ".", "count",...
Assigns given result (resp. logical result and result) to a variable (resp. to two variables). log_res and res are already computed result of an exec/input section. For example: $foo~: $spam and $eggs $log_res, $foo~: $spam and $eggs $foo: some: struct $log_res, $foo: some: ...
[ "Assigns", "given", "result", "(", "resp", ".", "logical", "result", "and", "result", ")", "to", "a", "variable", "(", "resp", ".", "to", "two", "variables", ")", ".", "log_res", "and", "res", "are", "already", "computed", "result", "of", "an", "exec", ...
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/lang.py#L362-L397
train
devassistant/devassistant
devassistant/lang.py
Interpreter.symbol
def symbol(self, id, bp=0): """ Adds symbol 'id' to symbol_table if it does not exist already, if it does it merely updates its binding power and returns it's symbol class """ try: s = self.symbol_table[id] except KeyError: class s(self.sy...
python
def symbol(self, id, bp=0): """ Adds symbol 'id' to symbol_table if it does not exist already, if it does it merely updates its binding power and returns it's symbol class """ try: s = self.symbol_table[id] except KeyError: class s(self.sy...
[ "def", "symbol", "(", "self", ",", "id", ",", "bp", "=", "0", ")", ":", "try", ":", "s", "=", "self", ".", "symbol_table", "[", "id", "]", "except", "KeyError", ":", "class", "s", "(", "self", ".", "symbol_base", ")", ":", "pass", "s", ".", "id...
Adds symbol 'id' to symbol_table if it does not exist already, if it does it merely updates its binding power and returns it's symbol class
[ "Adds", "symbol", "id", "to", "symbol_table", "if", "it", "does", "not", "exist", "already", "if", "it", "does", "it", "merely", "updates", "its", "binding", "power", "and", "returns", "it", "s", "symbol", "class" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/lang.py#L451-L468
train
devassistant/devassistant
devassistant/lang.py
Interpreter.advance
def advance(self, id=None): """ Advance to next token, optionally check that current token is 'id' """ if id and self.token.id != id: raise SyntaxError("Expected {0}".format(id)) self.token = self.next()
python
def advance(self, id=None): """ Advance to next token, optionally check that current token is 'id' """ if id and self.token.id != id: raise SyntaxError("Expected {0}".format(id)) self.token = self.next()
[ "def", "advance", "(", "self", ",", "id", "=", "None", ")", ":", "if", "id", "and", "self", ".", "token", ".", "id", "!=", "id", ":", "raise", "SyntaxError", "(", "\"Expected {0}\"", ".", "format", "(", "id", ")", ")", "self", ".", "token", "=", ...
Advance to next token, optionally check that current token is 'id'
[ "Advance", "to", "next", "token", "optionally", "check", "that", "current", "token", "is", "id" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/lang.py#L470-L477
train
devassistant/devassistant
devassistant/lang.py
Interpreter.method
def method(self, symbol_name): """ A decorator - adds the decorated method to symbol 'symbol_name' """ s = self.symbol(symbol_name) def bind(fn): setattr(s, fn.__name__, fn) return bind
python
def method(self, symbol_name): """ A decorator - adds the decorated method to symbol 'symbol_name' """ s = self.symbol(symbol_name) def bind(fn): setattr(s, fn.__name__, fn) return bind
[ "def", "method", "(", "self", ",", "symbol_name", ")", ":", "s", "=", "self", ".", "symbol", "(", "symbol_name", ")", "def", "bind", "(", "fn", ")", ":", "setattr", "(", "s", ",", "fn", ".", "__name__", ",", "fn", ")", "return", "bind" ]
A decorator - adds the decorated method to symbol 'symbol_name'
[ "A", "decorator", "-", "adds", "the", "decorated", "method", "to", "symbol", "symbol_name" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/lang.py#L479-L488
train
devassistant/devassistant
devassistant/lang.py
Interpreter.parse
def parse(self, expression): """ Evaluates 'expression' and returns it's value(s) """ if isinstance(expression, (list, dict)): return (True if expression else False, expression) if sys.version_info[0] > 2: self.next = self.tokenize(expression).__next__ ...
python
def parse(self, expression): """ Evaluates 'expression' and returns it's value(s) """ if isinstance(expression, (list, dict)): return (True if expression else False, expression) if sys.version_info[0] > 2: self.next = self.tokenize(expression).__next__ ...
[ "def", "parse", "(", "self", ",", "expression", ")", ":", "if", "isinstance", "(", "expression", ",", "(", "list", ",", "dict", ")", ")", ":", "return", "(", "True", "if", "expression", "else", "False", ",", "expression", ")", "if", "sys", ".", "vers...
Evaluates 'expression' and returns it's value(s)
[ "Evaluates", "expression", "and", "returns", "it", "s", "value", "(", "s", ")" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/lang.py#L534-L545
train
devassistant/devassistant
devassistant/dapi/platforms.py
get_platforms_set
def get_platforms_set(): '''Returns set of all possible platforms''' # arch and mageia are not in Py2 _supported_dists, so we add them manually # Ubuntu adds itself to the list on Ubuntu platforms = set([x.lower() for x in platform._supported_dists]) platforms |= set(['darwin', 'arch', 'mageia', 'ub...
python
def get_platforms_set(): '''Returns set of all possible platforms''' # arch and mageia are not in Py2 _supported_dists, so we add them manually # Ubuntu adds itself to the list on Ubuntu platforms = set([x.lower() for x in platform._supported_dists]) platforms |= set(['darwin', 'arch', 'mageia', 'ub...
[ "def", "get_platforms_set", "(", ")", ":", "# arch and mageia are not in Py2 _supported_dists, so we add them manually", "# Ubuntu adds itself to the list on Ubuntu", "platforms", "=", "set", "(", "[", "x", ".", "lower", "(", ")", "for", "x", "in", "platform", ".", "_supp...
Returns set of all possible platforms
[ "Returns", "set", "of", "all", "possible", "platforms" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/platforms.py#L4-L10
train
devassistant/devassistant
devassistant/utils.py
find_file_in_load_dirs
def find_file_in_load_dirs(relpath): """If given relative path exists in one of DevAssistant load paths, return its full path. Args: relpath: a relative path, e.g. "assitants/crt/test.yaml" Returns: absolute path of the file, e.g. "/home/x/.devassistant/assistanta/crt/test.yaml ...
python
def find_file_in_load_dirs(relpath): """If given relative path exists in one of DevAssistant load paths, return its full path. Args: relpath: a relative path, e.g. "assitants/crt/test.yaml" Returns: absolute path of the file, e.g. "/home/x/.devassistant/assistanta/crt/test.yaml ...
[ "def", "find_file_in_load_dirs", "(", "relpath", ")", ":", "if", "relpath", ".", "startswith", "(", "os", ".", "path", ".", "sep", ")", ":", "relpath", "=", "relpath", ".", "lstrip", "(", "os", ".", "path", ".", "sep", ")", "for", "ld", "in", "settin...
If given relative path exists in one of DevAssistant load paths, return its full path. Args: relpath: a relative path, e.g. "assitants/crt/test.yaml" Returns: absolute path of the file, e.g. "/home/x/.devassistant/assistanta/crt/test.yaml or None if file is not found
[ "If", "given", "relative", "path", "exists", "in", "one", "of", "DevAssistant", "load", "paths", "return", "its", "full", "path", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/utils.py#L109-L126
train
devassistant/devassistant
devassistant/utils.py
run_exitfuncs
def run_exitfuncs(): """Function that behaves exactly like Python's atexit, but runs atexit functions in the order in which they were registered, not reversed. """ exc_info = None for func, targs, kargs in _exithandlers: try: func(*targs, **kargs) except SystemExit: ...
python
def run_exitfuncs(): """Function that behaves exactly like Python's atexit, but runs atexit functions in the order in which they were registered, not reversed. """ exc_info = None for func, targs, kargs in _exithandlers: try: func(*targs, **kargs) except SystemExit: ...
[ "def", "run_exitfuncs", "(", ")", ":", "exc_info", "=", "None", "for", "func", ",", "targs", ",", "kargs", "in", "_exithandlers", ":", "try", ":", "func", "(", "*", "targs", ",", "*", "*", "kargs", ")", "except", "SystemExit", ":", "exc_info", "=", "...
Function that behaves exactly like Python's atexit, but runs atexit functions in the order in which they were registered, not reversed.
[ "Function", "that", "behaves", "exactly", "like", "Python", "s", "atexit", "but", "runs", "atexit", "functions", "in", "the", "order", "in", "which", "they", "were", "registered", "not", "reversed", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/utils.py#L149-L163
train
devassistant/devassistant
devassistant/utils.py
strip_prefix
def strip_prefix(string, prefix, regex=False): """Strip the prefix from the string If 'regex' is specified, prefix is understood as a regular expression.""" if not isinstance(string, six.string_types) or not isinstance(prefix, six.string_types): msg = 'Arguments to strip_prefix must be string types...
python
def strip_prefix(string, prefix, regex=False): """Strip the prefix from the string If 'regex' is specified, prefix is understood as a regular expression.""" if not isinstance(string, six.string_types) or not isinstance(prefix, six.string_types): msg = 'Arguments to strip_prefix must be string types...
[ "def", "strip_prefix", "(", "string", ",", "prefix", ",", "regex", "=", "False", ")", ":", "if", "not", "isinstance", "(", "string", ",", "six", ".", "string_types", ")", "or", "not", "isinstance", "(", "prefix", ",", "six", ".", "string_types", ")", "...
Strip the prefix from the string If 'regex' is specified, prefix is understood as a regular expression.
[ "Strip", "the", "prefix", "from", "the", "string" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/utils.py#L190-L203
train
devassistant/devassistant
devassistant/utils.py
strip_suffix
def strip_suffix(string, suffix, regex=False): """Strip the suffix from the string. If 'regex' is specified, suffix is understood as a regular expression.""" if not isinstance(string, six.string_types) or not isinstance(suffix, six.string_types): msg = 'Arguments to strip_suffix must be string type...
python
def strip_suffix(string, suffix, regex=False): """Strip the suffix from the string. If 'regex' is specified, suffix is understood as a regular expression.""" if not isinstance(string, six.string_types) or not isinstance(suffix, six.string_types): msg = 'Arguments to strip_suffix must be string type...
[ "def", "strip_suffix", "(", "string", ",", "suffix", ",", "regex", "=", "False", ")", ":", "if", "not", "isinstance", "(", "string", ",", "six", ".", "string_types", ")", "or", "not", "isinstance", "(", "suffix", ",", "six", ".", "string_types", ")", "...
Strip the suffix from the string. If 'regex' is specified, suffix is understood as a regular expression.
[ "Strip", "the", "suffix", "from", "the", "string", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/utils.py#L206-L219
train
devassistant/devassistant
devassistant/utils.py
_strip
def _strip(string, pattern): """Return complement of pattern in string""" m = re.compile(pattern).search(string) if m: return string[0:m.start()] + string[m.end():len(string)] else: return string
python
def _strip(string, pattern): """Return complement of pattern in string""" m = re.compile(pattern).search(string) if m: return string[0:m.start()] + string[m.end():len(string)] else: return string
[ "def", "_strip", "(", "string", ",", "pattern", ")", ":", "m", "=", "re", ".", "compile", "(", "pattern", ")", ".", "search", "(", "string", ")", "if", "m", ":", "return", "string", "[", "0", ":", "m", ".", "start", "(", ")", "]", "+", "string"...
Return complement of pattern in string
[ "Return", "complement", "of", "pattern", "in", "string" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/utils.py#L222-L229
train
devassistant/devassistant
devassistant/cli/cli_runner.py
CliRunner.register_console_logging_handler
def register_console_logging_handler(cls, lgr, level=logging.INFO): """Registers console logging handler to given logger.""" console_handler = logger.DevassistantClHandler(sys.stdout) if console_handler.stream.isatty(): console_handler.setFormatter(logger.DevassistantClColorFormatter...
python
def register_console_logging_handler(cls, lgr, level=logging.INFO): """Registers console logging handler to given logger.""" console_handler = logger.DevassistantClHandler(sys.stdout) if console_handler.stream.isatty(): console_handler.setFormatter(logger.DevassistantClColorFormatter...
[ "def", "register_console_logging_handler", "(", "cls", ",", "lgr", ",", "level", "=", "logging", ".", "INFO", ")", ":", "console_handler", "=", "logger", ".", "DevassistantClHandler", "(", "sys", ".", "stdout", ")", "if", "console_handler", ".", "stream", ".",...
Registers console logging handler to given logger.
[ "Registers", "console", "logging", "handler", "to", "given", "logger", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/cli/cli_runner.py#L21-L30
train
devassistant/devassistant
devassistant/cli/cli_runner.py
CliRunner.run
def run(cls): """Runs the whole cli: 1. Registers console logging handler 2. Creates argparser from all assistants and actions 3. Parses args and decides what to run 4. Runs a proper assistant or action """ sigint_handler.override() # set settings.USE_CAC...
python
def run(cls): """Runs the whole cli: 1. Registers console logging handler 2. Creates argparser from all assistants and actions 3. Parses args and decides what to run 4. Runs a proper assistant or action """ sigint_handler.override() # set settings.USE_CAC...
[ "def", "run", "(", "cls", ")", ":", "sigint_handler", ".", "override", "(", ")", "# set settings.USE_CACHE before constructing parser, since constructing", "# parser requires loaded assistants", "settings", ".", "USE_CACHE", "=", "False", "if", "'--no-cache'", "in", "sys", ...
Runs the whole cli: 1. Registers console logging handler 2. Creates argparser from all assistants and actions 3. Parses args and decides what to run 4. Runs a proper assistant or action
[ "Runs", "the", "whole", "cli", ":" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/cli/cli_runner.py#L37-L81
train
devassistant/devassistant
devassistant/cli/cli_runner.py
CliRunner.inform_of_short_bin_name
def inform_of_short_bin_name(cls, binary): """Historically, we had "devassistant" binary, but we chose to go with shorter "da". We still allow "devassistant", but we recommend using "da". """ binary = os.path.splitext(os.path.basename(binary))[0] if binary != 'da': ms...
python
def inform_of_short_bin_name(cls, binary): """Historically, we had "devassistant" binary, but we chose to go with shorter "da". We still allow "devassistant", but we recommend using "da". """ binary = os.path.splitext(os.path.basename(binary))[0] if binary != 'da': ms...
[ "def", "inform_of_short_bin_name", "(", "cls", ",", "binary", ")", ":", "binary", "=", "os", ".", "path", ".", "splitext", "(", "os", ".", "path", ".", "basename", "(", "binary", ")", ")", "[", "0", "]", "if", "binary", "!=", "'da'", ":", "msg", "=...
Historically, we had "devassistant" binary, but we chose to go with shorter "da". We still allow "devassistant", but we recommend using "da".
[ "Historically", "we", "had", "devassistant", "binary", "but", "we", "chose", "to", "go", "with", "shorter", "da", ".", "We", "still", "allow", "devassistant", "but", "we", "recommend", "using", "da", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/cli/cli_runner.py#L84-L93
train
devassistant/devassistant
devassistant/gui/path_window.py
PathWindow.get_full_dir_name
def get_full_dir_name(self): """ Function returns a full dir name """ return os.path.join(self.dir_name.get_text(), self.entry_project_name.get_text())
python
def get_full_dir_name(self): """ Function returns a full dir name """ return os.path.join(self.dir_name.get_text(), self.entry_project_name.get_text())
[ "def", "get_full_dir_name", "(", "self", ")", ":", "return", "os", ".", "path", ".", "join", "(", "self", ".", "dir_name", ".", "get_text", "(", ")", ",", "self", ".", "entry_project_name", ".", "get_text", "(", ")", ")" ]
Function returns a full dir name
[ "Function", "returns", "a", "full", "dir", "name" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/path_window.py#L65-L69
train
devassistant/devassistant
devassistant/gui/path_window.py
PathWindow.next_window
def next_window(self, widget, data=None): """ Function opens the run Window who executes the assistant project creation """ # check whether deps-only is selected deps_only = ('deps_only' in self.args and self.args['deps_only']['checkbox'].get_active()) # preserve...
python
def next_window(self, widget, data=None): """ Function opens the run Window who executes the assistant project creation """ # check whether deps-only is selected deps_only = ('deps_only' in self.args and self.args['deps_only']['checkbox'].get_active()) # preserve...
[ "def", "next_window", "(", "self", ",", "widget", ",", "data", "=", "None", ")", ":", "# check whether deps-only is selected", "deps_only", "=", "(", "'deps_only'", "in", "self", ".", "args", "and", "self", ".", "args", "[", "'deps_only'", "]", "[", "'checkb...
Function opens the run Window who executes the assistant project creation
[ "Function", "opens", "the", "run", "Window", "who", "executes", "the", "assistant", "project", "creation" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/path_window.py#L71-L130
train
devassistant/devassistant
devassistant/gui/path_window.py
PathWindow._build_flags
def _build_flags(self): """ Function builds kwargs variable for run_window """ # Check if all entries for selected arguments are nonempty for arg_dict in [x for x in self.args.values() if self.arg_is_selected(x)]: if 'entry' in arg_dict and not arg_dict['entry'].get_t...
python
def _build_flags(self): """ Function builds kwargs variable for run_window """ # Check if all entries for selected arguments are nonempty for arg_dict in [x for x in self.args.values() if self.arg_is_selected(x)]: if 'entry' in arg_dict and not arg_dict['entry'].get_t...
[ "def", "_build_flags", "(", "self", ")", ":", "# Check if all entries for selected arguments are nonempty", "for", "arg_dict", "in", "[", "x", "for", "x", "in", "self", ".", "args", ".", "values", "(", ")", "if", "self", ".", "arg_is_selected", "(", "x", ")", ...
Function builds kwargs variable for run_window
[ "Function", "builds", "kwargs", "variable", "for", "run_window" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/path_window.py#L132-L161
train
devassistant/devassistant
devassistant/gui/path_window.py
PathWindow.open_window
def open_window(self, data=None): """ Function opens the Options dialog """ self.args = dict() if data is not None: self.top_assistant = data.get('top_assistant', None) self.current_main_assistant = data.get('current_main_assistant', None) self...
python
def open_window(self, data=None): """ Function opens the Options dialog """ self.args = dict() if data is not None: self.top_assistant = data.get('top_assistant', None) self.current_main_assistant = data.get('current_main_assistant', None) self...
[ "def", "open_window", "(", "self", ",", "data", "=", "None", ")", ":", "self", ".", "args", "=", "dict", "(", ")", "if", "data", "is", "not", "None", ":", "self", ".", "top_assistant", "=", "data", ".", "get", "(", "'top_assistant'", ",", "None", "...
Function opens the Options dialog
[ "Function", "opens", "the", "Options", "dialog" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/path_window.py#L177-L236
train
devassistant/devassistant
devassistant/gui/path_window.py
PathWindow._check_box_toggled
def _check_box_toggled(self, widget, data=None): """ Function manipulates with entries and buttons. """ active = widget.get_active() arg_name = data if 'entry' in self.args[arg_name]: self.args[arg_name]['entry'].set_sensitive(active) if 'browse_btn' ...
python
def _check_box_toggled(self, widget, data=None): """ Function manipulates with entries and buttons. """ active = widget.get_active() arg_name = data if 'entry' in self.args[arg_name]: self.args[arg_name]['entry'].set_sensitive(active) if 'browse_btn' ...
[ "def", "_check_box_toggled", "(", "self", ",", "widget", ",", "data", "=", "None", ")", ":", "active", "=", "widget", ".", "get_active", "(", ")", "arg_name", "=", "data", "if", "'entry'", "in", "self", ".", "args", "[", "arg_name", "]", ":", "self", ...
Function manipulates with entries and buttons.
[ "Function", "manipulates", "with", "entries", "and", "buttons", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/path_window.py#L238-L250
train
devassistant/devassistant
devassistant/gui/path_window.py
PathWindow._deps_only_toggled
def _deps_only_toggled(self, widget, data=None): """ Function deactivate options in case of deps_only and opposite """ active = widget.get_active() self.dir_name.set_sensitive(not active) self.entry_project_name.set_sensitive(not active) self.dir_name_browse_btn.s...
python
def _deps_only_toggled(self, widget, data=None): """ Function deactivate options in case of deps_only and opposite """ active = widget.get_active() self.dir_name.set_sensitive(not active) self.entry_project_name.set_sensitive(not active) self.dir_name_browse_btn.s...
[ "def", "_deps_only_toggled", "(", "self", ",", "widget", ",", "data", "=", "None", ")", ":", "active", "=", "widget", ".", "get_active", "(", ")", "self", ".", "dir_name", ".", "set_sensitive", "(", "not", "active", ")", "self", ".", "entry_project_name", ...
Function deactivate options in case of deps_only and opposite
[ "Function", "deactivate", "options", "in", "case", "of", "deps_only", "and", "opposite" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/path_window.py#L252-L260
train
devassistant/devassistant
devassistant/gui/path_window.py
PathWindow.prev_window
def prev_window(self, widget, data=None): """ Function returns to Main Window """ self.path_window.hide() self.parent.open_window(widget, self.data)
python
def prev_window(self, widget, data=None): """ Function returns to Main Window """ self.path_window.hide() self.parent.open_window(widget, self.data)
[ "def", "prev_window", "(", "self", ",", "widget", ",", "data", "=", "None", ")", ":", "self", ".", "path_window", ".", "hide", "(", ")", "self", ".", "parent", ".", "open_window", "(", "widget", ",", "self", ".", "data", ")" ]
Function returns to Main Window
[ "Function", "returns", "to", "Main", "Window" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/path_window.py#L262-L267
train
devassistant/devassistant
devassistant/gui/path_window.py
PathWindow.browse_path
def browse_path(self, window): """ Function opens the file chooser dialog for settings project dir """ text = self.gui_helper.create_file_chooser_dialog("Choose project directory", self.path_window, name="Select") if text is not None: self.dir_name.set_text(text)
python
def browse_path(self, window): """ Function opens the file chooser dialog for settings project dir """ text = self.gui_helper.create_file_chooser_dialog("Choose project directory", self.path_window, name="Select") if text is not None: self.dir_name.set_text(text)
[ "def", "browse_path", "(", "self", ",", "window", ")", ":", "text", "=", "self", ".", "gui_helper", ".", "create_file_chooser_dialog", "(", "\"Choose project directory\"", ",", "self", ".", "path_window", ",", "name", "=", "\"Select\"", ")", "if", "text", "is"...
Function opens the file chooser dialog for settings project dir
[ "Function", "opens", "the", "file", "chooser", "dialog", "for", "settings", "project", "dir" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/path_window.py#L275-L281
train
devassistant/devassistant
devassistant/gui/path_window.py
PathWindow._add_table_row
def _add_table_row(self, arg, number, row): """ Function adds options to a grid """ self.args[arg.name] = dict() self.args[arg.name]['arg'] = arg check_box_title = arg.flags[number][2:].title() self.args[arg.name]['label'] = check_box_title align = self.gu...
python
def _add_table_row(self, arg, number, row): """ Function adds options to a grid """ self.args[arg.name] = dict() self.args[arg.name]['arg'] = arg check_box_title = arg.flags[number][2:].title() self.args[arg.name]['label'] = check_box_title align = self.gu...
[ "def", "_add_table_row", "(", "self", ",", "arg", ",", "number", ",", "row", ")", ":", "self", ".", "args", "[", "arg", ".", "name", "]", "=", "dict", "(", ")", "self", ".", "args", "[", "arg", ".", "name", "]", "[", "'arg'", "]", "=", "arg", ...
Function adds options to a grid
[ "Function", "adds", "options", "to", "a", "grid" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/path_window.py#L283-L356
train
devassistant/devassistant
devassistant/gui/path_window.py
PathWindow.browse_clicked
def browse_clicked(self, widget, data=None): """ Function sets the directory to entry """ text = self.gui_helper.create_file_chooser_dialog("Please select directory", self.path_window) if text is not None: data.set_text(text)
python
def browse_clicked(self, widget, data=None): """ Function sets the directory to entry """ text = self.gui_helper.create_file_chooser_dialog("Please select directory", self.path_window) if text is not None: data.set_text(text)
[ "def", "browse_clicked", "(", "self", ",", "widget", ",", "data", "=", "None", ")", ":", "text", "=", "self", ".", "gui_helper", ".", "create_file_chooser_dialog", "(", "\"Please select directory\"", ",", "self", ".", "path_window", ")", "if", "text", "is", ...
Function sets the directory to entry
[ "Function", "sets", "the", "directory", "to", "entry" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/path_window.py#L358-L364
train
devassistant/devassistant
devassistant/gui/path_window.py
PathWindow.project_name_changed
def project_name_changed(self, widget, data=None): """ Function controls whether run button is enabled """ if widget.get_text() != "": self.run_btn.set_sensitive(True) else: self.run_btn.set_sensitive(False) self.update_full_label()
python
def project_name_changed(self, widget, data=None): """ Function controls whether run button is enabled """ if widget.get_text() != "": self.run_btn.set_sensitive(True) else: self.run_btn.set_sensitive(False) self.update_full_label()
[ "def", "project_name_changed", "(", "self", ",", "widget", ",", "data", "=", "None", ")", ":", "if", "widget", ".", "get_text", "(", ")", "!=", "\"\"", ":", "self", ".", "run_btn", ".", "set_sensitive", "(", "True", ")", "else", ":", "self", ".", "ru...
Function controls whether run button is enabled
[ "Function", "controls", "whether", "run", "button", "is", "enabled" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/path_window.py#L373-L381
train
devassistant/devassistant
devassistant/gui/path_window.py
PathWindow.dir_name_changed
def dir_name_changed(self, widget, data=None): """ Function is used for controlling label Full Directory project name and storing current project directory in configuration manager """ config_manager.set_config_value("da.project_dir", self.dir_name.get_text()) ...
python
def dir_name_changed(self, widget, data=None): """ Function is used for controlling label Full Directory project name and storing current project directory in configuration manager """ config_manager.set_config_value("da.project_dir", self.dir_name.get_text()) ...
[ "def", "dir_name_changed", "(", "self", ",", "widget", ",", "data", "=", "None", ")", ":", "config_manager", ".", "set_config_value", "(", "\"da.project_dir\"", ",", "self", ".", "dir_name", ".", "get_text", "(", ")", ")", "self", ".", "update_full_label", "...
Function is used for controlling label Full Directory project name and storing current project directory in configuration manager
[ "Function", "is", "used", "for", "controlling", "label", "Full", "Directory", "project", "name", "and", "storing", "current", "project", "directory", "in", "configuration", "manager" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/path_window.py#L383-L391
train
devassistant/devassistant
devassistant/yaml_checker.py
YamlChecker.check
def check(self): """Checks whether loaded yaml is well-formed according to syntax defined for version 0.9.0 and later. Raises: YamlError: (containing a meaningful message) when the loaded Yaml is not well formed """ if not isinstance(self.parsed_yaml,...
python
def check(self): """Checks whether loaded yaml is well-formed according to syntax defined for version 0.9.0 and later. Raises: YamlError: (containing a meaningful message) when the loaded Yaml is not well formed """ if not isinstance(self.parsed_yaml,...
[ "def", "check", "(", "self", ")", ":", "if", "not", "isinstance", "(", "self", ".", "parsed_yaml", ",", "dict", ")", ":", "msg", "=", "'In {0}:\\n'", ".", "format", "(", "self", ".", "sourcefile", ")", "msg", "+=", "'Assistants and snippets must be Yaml mapp...
Checks whether loaded yaml is well-formed according to syntax defined for version 0.9.0 and later. Raises: YamlError: (containing a meaningful message) when the loaded Yaml is not well formed
[ "Checks", "whether", "loaded", "yaml", "is", "well", "-", "formed", "according", "to", "syntax", "defined", "for", "version", "0", ".", "9", ".", "0", "and", "later", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/yaml_checker.py#L34-L54
train
devassistant/devassistant
devassistant/yaml_checker.py
YamlChecker._check_args
def _check_args(self, source): '''Validate the argument section. Args may be either a dict or a list (to allow multiple positional args). ''' path = [source] args = self.parsed_yaml.get('args', {}) self._assert_struct_type(args, 'args', (dict, list), path) path.a...
python
def _check_args(self, source): '''Validate the argument section. Args may be either a dict or a list (to allow multiple positional args). ''' path = [source] args = self.parsed_yaml.get('args', {}) self._assert_struct_type(args, 'args', (dict, list), path) path.a...
[ "def", "_check_args", "(", "self", ",", "source", ")", ":", "path", "=", "[", "source", "]", "args", "=", "self", ".", "parsed_yaml", ".", "get", "(", "'args'", ",", "{", "}", ")", "self", ".", "_assert_struct_type", "(", "args", ",", "'args'", ",", ...
Validate the argument section. Args may be either a dict or a list (to allow multiple positional args).
[ "Validate", "the", "argument", "section", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/yaml_checker.py#L80-L96
train
devassistant/devassistant
devassistant/yaml_checker.py
YamlChecker._assert_command_dict
def _assert_command_dict(self, struct, name, path=None, extra_info=None): """Checks whether struct is a command dict (e.g. it's a dict and has 1 key-value pair.""" self._assert_dict(struct, name, path, extra_info) if len(struct) != 1: err = [self._format_error_path(path + [name])] ...
python
def _assert_command_dict(self, struct, name, path=None, extra_info=None): """Checks whether struct is a command dict (e.g. it's a dict and has 1 key-value pair.""" self._assert_dict(struct, name, path, extra_info) if len(struct) != 1: err = [self._format_error_path(path + [name])] ...
[ "def", "_assert_command_dict", "(", "self", ",", "struct", ",", "name", ",", "path", "=", "None", ",", "extra_info", "=", "None", ")", ":", "self", ".", "_assert_dict", "(", "struct", ",", "name", ",", "path", ",", "extra_info", ")", "if", "len", "(", ...
Checks whether struct is a command dict (e.g. it's a dict and has 1 key-value pair.
[ "Checks", "whether", "struct", "is", "a", "command", "dict", "(", "e", ".", "g", ".", "it", "s", "a", "dict", "and", "has", "1", "key", "-", "value", "pair", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/yaml_checker.py#L221-L230
train
devassistant/devassistant
devassistant/yaml_checker.py
YamlChecker._assert_struct_type
def _assert_struct_type(self, struct, name, types, path=None, extra_info=None): """Asserts that given structure is of any of given types. Args: struct: structure to check name: displayable name of the checked structure (e.g. "run_foo" for section run_foo) types: list...
python
def _assert_struct_type(self, struct, name, types, path=None, extra_info=None): """Asserts that given structure is of any of given types. Args: struct: structure to check name: displayable name of the checked structure (e.g. "run_foo" for section run_foo) types: list...
[ "def", "_assert_struct_type", "(", "self", ",", "struct", ",", "name", ",", "types", ",", "path", "=", "None", ",", "extra_info", "=", "None", ")", ":", "wanted_yaml_typenames", "=", "set", "(", ")", "for", "t", "in", "types", ":", "wanted_yaml_typenames",...
Asserts that given structure is of any of given types. Args: struct: structure to check name: displayable name of the checked structure (e.g. "run_foo" for section run_foo) types: list/tuple of types that are allowed for given struct path: list with a source file...
[ "Asserts", "that", "given", "structure", "is", "of", "any", "of", "given", "types", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/yaml_checker.py#L242-L273
train
devassistant/devassistant
devassistant/dapi/licenses.py
_split_license
def _split_license(license): '''Returns all individual licenses in the input''' return (x.strip() for x in (l for l in _regex.split(license) if l))
python
def _split_license(license): '''Returns all individual licenses in the input''' return (x.strip() for x in (l for l in _regex.split(license) if l))
[ "def", "_split_license", "(", "license", ")", ":", "return", "(", "x", ".", "strip", "(", ")", "for", "x", "in", "(", "l", "for", "l", "in", "_regex", ".", "split", "(", "license", ")", "if", "l", ")", ")" ]
Returns all individual licenses in the input
[ "Returns", "all", "individual", "licenses", "in", "the", "input" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/licenses.py#L47-L49
train
devassistant/devassistant
devassistant/dapi/licenses.py
match
def match(license): '''Returns True if given license field is correct Taken from rpmlint. It's named match() to mimic a compiled regexp.''' if license not in VALID_LICENSES: for l1 in _split_license(license): if l1 in VALID_LICENSES: continue for l2 in _s...
python
def match(license): '''Returns True if given license field is correct Taken from rpmlint. It's named match() to mimic a compiled regexp.''' if license not in VALID_LICENSES: for l1 in _split_license(license): if l1 in VALID_LICENSES: continue for l2 in _s...
[ "def", "match", "(", "license", ")", ":", "if", "license", "not", "in", "VALID_LICENSES", ":", "for", "l1", "in", "_split_license", "(", "license", ")", ":", "if", "l1", "in", "VALID_LICENSES", ":", "continue", "for", "l2", "in", "_split_license", "(", "...
Returns True if given license field is correct Taken from rpmlint. It's named match() to mimic a compiled regexp.
[ "Returns", "True", "if", "given", "license", "field", "is", "correct", "Taken", "from", "rpmlint", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/licenses.py#L52-L65
train
devassistant/devassistant
devassistant/command_runners.py
register_command_runner
def register_command_runner(arg): """Decorator that registers a command runner. Accepts either: - CommandRunner directly or - String prefix to register a command runner under (returning a decorator) """ if isinstance(arg, str): def inner(command_runner): command_runners.setdefau...
python
def register_command_runner(arg): """Decorator that registers a command runner. Accepts either: - CommandRunner directly or - String prefix to register a command runner under (returning a decorator) """ if isinstance(arg, str): def inner(command_runner): command_runners.setdefau...
[ "def", "register_command_runner", "(", "arg", ")", ":", "if", "isinstance", "(", "arg", ",", "str", ")", ":", "def", "inner", "(", "command_runner", ")", ":", "command_runners", ".", "setdefault", "(", "arg", ",", "[", "]", ")", "command_runners", "[", "...
Decorator that registers a command runner. Accepts either: - CommandRunner directly or - String prefix to register a command runner under (returning a decorator)
[ "Decorator", "that", "registers", "a", "command", "runner", ".", "Accepts", "either", ":" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/command_runners.py#L42-L61
train
devassistant/devassistant
devassistant/dapi/dapver.py
compare
def compare(ver1, ver2): '''Version comparing, returns 0 if are the same, returns >0 if first is bigger, <0 if first is smaller, excepts valid version''' if ver1 == ver2: return 0 ver1 = _cut(ver1) ver2 = _cut(ver2) # magic multiplier m = 1 # if the first one is shorter, repl...
python
def compare(ver1, ver2): '''Version comparing, returns 0 if are the same, returns >0 if first is bigger, <0 if first is smaller, excepts valid version''' if ver1 == ver2: return 0 ver1 = _cut(ver1) ver2 = _cut(ver2) # magic multiplier m = 1 # if the first one is shorter, repl...
[ "def", "compare", "(", "ver1", ",", "ver2", ")", ":", "if", "ver1", "==", "ver2", ":", "return", "0", "ver1", "=", "_cut", "(", "ver1", ")", "ver2", "=", "_cut", "(", "ver2", ")", "# magic multiplier", "m", "=", "1", "# if the first one is shorter, repla...
Version comparing, returns 0 if are the same, returns >0 if first is bigger, <0 if first is smaller, excepts valid version
[ "Version", "comparing", "returns", "0", "if", "are", "the", "same", "returns", ">", "0", "if", "first", "is", "bigger", "<0", "if", "first", "is", "smaller", "excepts", "valid", "version" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/dapver.py#L1-L26
train
devassistant/devassistant
devassistant/dapi/dapver.py
_cut
def _cut(ver): '''Cuts the version to array, excepts valid version''' ver = ver.split('.') for i, part in enumerate(ver): try: ver[i] = int(part) except: if part[-len('dev'):] == 'dev': ver[i] = int(part[:-len('dev')]) ver.append(-3) ...
python
def _cut(ver): '''Cuts the version to array, excepts valid version''' ver = ver.split('.') for i, part in enumerate(ver): try: ver[i] = int(part) except: if part[-len('dev'):] == 'dev': ver[i] = int(part[:-len('dev')]) ver.append(-3) ...
[ "def", "_cut", "(", "ver", ")", ":", "ver", "=", "ver", ".", "split", "(", "'.'", ")", "for", "i", ",", "part", "in", "enumerate", "(", "ver", ")", ":", "try", ":", "ver", "[", "i", "]", "=", "int", "(", "part", ")", "except", ":", "if", "p...
Cuts the version to array, excepts valid version
[ "Cuts", "the", "version", "to", "array", "excepts", "valid", "version" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/dapver.py#L29-L45
train
devassistant/devassistant
devassistant/cli/argparse_generator.py
ArgparseGenerator.generate_argument_parser
def generate_argument_parser(cls, tree, actions={}): """Generates argument parser for given assistant tree and actions. Args: tree: assistant tree as returned by devassistant.assistant_base.AssistantBase.get_subassistant_tree actions: dict mapping actions (deva...
python
def generate_argument_parser(cls, tree, actions={}): """Generates argument parser for given assistant tree and actions. Args: tree: assistant tree as returned by devassistant.assistant_base.AssistantBase.get_subassistant_tree actions: dict mapping actions (deva...
[ "def", "generate_argument_parser", "(", "cls", ",", "tree", ",", "actions", "=", "{", "}", ")", ":", "cur_as", ",", "cur_subas", "=", "tree", "parser", "=", "devassistant_argparse", ".", "ArgumentParser", "(", "argument_default", "=", "argparse", ".", "SUPPRES...
Generates argument parser for given assistant tree and actions. Args: tree: assistant tree as returned by devassistant.assistant_base.AssistantBase.get_subassistant_tree actions: dict mapping actions (devassistant.actions.Action subclasses) to their ...
[ "Generates", "argument", "parser", "for", "given", "assistant", "tree", "and", "actions", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/cli/argparse_generator.py#L15-L48
train
devassistant/devassistant
devassistant/cli/argparse_generator.py
ArgparseGenerator.add_subassistants_to
def add_subassistants_to(cls, parser, assistant_tuple, level, alias=None): """Adds assistant from given part of assistant tree and all its subassistants to a given argument parser. Args: parser: instance of devassistant_argparse.ArgumentParser assistant_tuple: part of as...
python
def add_subassistants_to(cls, parser, assistant_tuple, level, alias=None): """Adds assistant from given part of assistant tree and all its subassistants to a given argument parser. Args: parser: instance of devassistant_argparse.ArgumentParser assistant_tuple: part of as...
[ "def", "add_subassistants_to", "(", "cls", ",", "parser", ",", "assistant_tuple", ",", "level", ",", "alias", "=", "None", ")", ":", "name", "=", "alias", "or", "assistant_tuple", "[", "0", "]", ".", "name", "p", "=", "parser", ".", "add_parser", "(", ...
Adds assistant from given part of assistant tree and all its subassistants to a given argument parser. Args: parser: instance of devassistant_argparse.ArgumentParser assistant_tuple: part of assistant tree (see generate_argument_parser doc) level: level of subassista...
[ "Adds", "assistant", "from", "given", "part", "of", "assistant", "tree", "and", "all", "its", "subassistants", "to", "a", "given", "argument", "parser", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/cli/argparse_generator.py#L61-L88
train
devassistant/devassistant
devassistant/cli/argparse_generator.py
ArgparseGenerator.add_action_to
def add_action_to(cls, parser, action, subactions, level): """Adds given action to given parser Args: parser: instance of devassistant_argparse.ArgumentParser action: devassistant.actions.Action subclass subactions: dict with subactions - {SubA: {SubB: {}}, SubC: {}}...
python
def add_action_to(cls, parser, action, subactions, level): """Adds given action to given parser Args: parser: instance of devassistant_argparse.ArgumentParser action: devassistant.actions.Action subclass subactions: dict with subactions - {SubA: {SubB: {}}, SubC: {}}...
[ "def", "add_action_to", "(", "cls", ",", "parser", ",", "action", ",", "subactions", ",", "level", ")", ":", "p", "=", "parser", ".", "add_parser", "(", "action", ".", "name", ",", "description", "=", "action", ".", "description", ",", "argument_default", ...
Adds given action to given parser Args: parser: instance of devassistant_argparse.ArgumentParser action: devassistant.actions.Action subclass subactions: dict with subactions - {SubA: {SubB: {}}, SubC: {}}
[ "Adds", "given", "action", "to", "given", "parser" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/cli/argparse_generator.py#L91-L111
train
devassistant/devassistant
devassistant/gui/run_window.py
format_entry
def format_entry(record, show_level=False, colorize=False): """ Format a log entry according to its level and context """ if show_level: log_str = u'{}: {}'.format(record.levelname, record.getMessage()) else: log_str = record.getMessage() if colorize and record.levelname in LOG_...
python
def format_entry(record, show_level=False, colorize=False): """ Format a log entry according to its level and context """ if show_level: log_str = u'{}: {}'.format(record.levelname, record.getMessage()) else: log_str = record.getMessage() if colorize and record.levelname in LOG_...
[ "def", "format_entry", "(", "record", ",", "show_level", "=", "False", ",", "colorize", "=", "False", ")", ":", "if", "show_level", ":", "log_str", "=", "u'{}: {}'", ".", "format", "(", "record", ".", "levelname", ",", "record", ".", "getMessage", "(", "...
Format a log entry according to its level and context
[ "Format", "a", "log", "entry", "according", "to", "its", "level", "and", "context" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/run_window.py#L28-L40
train
devassistant/devassistant
devassistant/gui/run_window.py
switch_cursor
def switch_cursor(cursor_type, parent_window): """ Functions switches the cursor to cursor type """ watch = Gdk.Cursor(cursor_type) window = parent_window.get_root_window() window.set_cursor(watch)
python
def switch_cursor(cursor_type, parent_window): """ Functions switches the cursor to cursor type """ watch = Gdk.Cursor(cursor_type) window = parent_window.get_root_window() window.set_cursor(watch)
[ "def", "switch_cursor", "(", "cursor_type", ",", "parent_window", ")", ":", "watch", "=", "Gdk", ".", "Cursor", "(", "cursor_type", ")", "window", "=", "parent_window", ".", "get_root_window", "(", ")", "window", ".", "set_cursor", "(", "watch", ")" ]
Functions switches the cursor to cursor type
[ "Functions", "switches", "the", "cursor", "to", "cursor", "type" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/run_window.py#L42-L48
train
devassistant/devassistant
devassistant/gui/run_window.py
RunLoggingHandler.emit
def emit(self, record): """ Function inserts log messages to list_view """ msg = record.getMessage() list_store = self.list_view.get_model() Gdk.threads_enter() if msg: # Underline URLs in the record message msg = replace_markup_chars(recor...
python
def emit(self, record): """ Function inserts log messages to list_view """ msg = record.getMessage() list_store = self.list_view.get_model() Gdk.threads_enter() if msg: # Underline URLs in the record message msg = replace_markup_chars(recor...
[ "def", "emit", "(", "self", ",", "record", ")", ":", "msg", "=", "record", ".", "getMessage", "(", ")", "list_store", "=", "self", ".", "list_view", ".", "get_model", "(", ")", "Gdk", ".", "threads_enter", "(", ")", "if", "msg", ":", "# Underline URLs ...
Function inserts log messages to list_view
[ "Function", "inserts", "log", "messages", "to", "list_view" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/run_window.py#L62-L93
train
devassistant/devassistant
devassistant/gui/run_window.py
RunWindow.open_window
def open_window(self, widget, data=None): """ Function opens the run window """ if data is not None: self.kwargs = data.get('kwargs', None) self.top_assistant = data.get('top_assistant', None) self.current_main_assistant = data.get('current_main_assist...
python
def open_window(self, widget, data=None): """ Function opens the run window """ if data is not None: self.kwargs = data.get('kwargs', None) self.top_assistant = data.get('top_assistant', None) self.current_main_assistant = data.get('current_main_assist...
[ "def", "open_window", "(", "self", ",", "widget", ",", "data", "=", "None", ")", ":", "if", "data", "is", "not", "None", ":", "self", ".", "kwargs", "=", "data", ".", "get", "(", "'kwargs'", ",", "None", ")", "self", ".", "top_assistant", "=", "dat...
Function opens the run window
[ "Function", "opens", "the", "run", "window" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/run_window.py#L144-L175
train
devassistant/devassistant
devassistant/gui/run_window.py
RunWindow.remove_link_button
def remove_link_button(self): """ Function removes link button from Run Window """ if self.link is not None: self.info_box.remove(self.link) self.link.destroy() self.link = None
python
def remove_link_button(self): """ Function removes link button from Run Window """ if self.link is not None: self.info_box.remove(self.link) self.link.destroy() self.link = None
[ "def", "remove_link_button", "(", "self", ")", ":", "if", "self", ".", "link", "is", "not", "None", ":", "self", ".", "info_box", ".", "remove", "(", "self", ".", "link", ")", "self", ".", "link", ".", "destroy", "(", ")", "self", ".", "link", "=",...
Function removes link button from Run Window
[ "Function", "removes", "link", "button", "from", "Run", "Window" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/run_window.py#L183-L190
train
devassistant/devassistant
devassistant/gui/run_window.py
RunWindow.delete_event
def delete_event(self, widget, event, data=None): """ Event cancels the project creation """ if not self.close_win: if self.thread.isAlive(): dlg = self.gui_helper.create_message_dialog("Do you want to cancel project creation?", ...
python
def delete_event(self, widget, event, data=None): """ Event cancels the project creation """ if not self.close_win: if self.thread.isAlive(): dlg = self.gui_helper.create_message_dialog("Do you want to cancel project creation?", ...
[ "def", "delete_event", "(", "self", ",", "widget", ",", "event", ",", "data", "=", "None", ")", ":", "if", "not", "self", ".", "close_win", ":", "if", "self", ".", "thread", ".", "isAlive", "(", ")", ":", "dlg", "=", "self", ".", "gui_helper", ".",...
Event cancels the project creation
[ "Event", "cancels", "the", "project", "creation" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/run_window.py#L192-L212
train
devassistant/devassistant
devassistant/gui/run_window.py
RunWindow.list_view_changed
def list_view_changed(self, widget, event, data=None): """ Function shows last rows. """ adj = self.scrolled_window.get_vadjustment() adj.set_value(adj.get_upper() - adj.get_page_size())
python
def list_view_changed(self, widget, event, data=None): """ Function shows last rows. """ adj = self.scrolled_window.get_vadjustment() adj.set_value(adj.get_upper() - adj.get_page_size())
[ "def", "list_view_changed", "(", "self", ",", "widget", ",", "event", ",", "data", "=", "None", ")", ":", "adj", "=", "self", ".", "scrolled_window", ".", "get_vadjustment", "(", ")", "adj", ".", "set_value", "(", "adj", ".", "get_upper", "(", ")", "-"...
Function shows last rows.
[ "Function", "shows", "last", "rows", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/run_window.py#L214-L219
train
devassistant/devassistant
devassistant/gui/run_window.py
RunWindow.disable_buttons
def disable_buttons(self): """ Function disables buttons """ self.main_btn.set_sensitive(False) self.back_btn.hide() self.info_label.set_label('<span color="#FFA500">In progress...</span>') self.disable_close_window() if self.link is not None: ...
python
def disable_buttons(self): """ Function disables buttons """ self.main_btn.set_sensitive(False) self.back_btn.hide() self.info_label.set_label('<span color="#FFA500">In progress...</span>') self.disable_close_window() if self.link is not None: ...
[ "def", "disable_buttons", "(", "self", ")", ":", "self", ".", "main_btn", ".", "set_sensitive", "(", "False", ")", "self", ".", "back_btn", ".", "hide", "(", ")", "self", ".", "info_label", ".", "set_label", "(", "'<span color=\"#FFA500\">In progress...</span>'"...
Function disables buttons
[ "Function", "disables", "buttons" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/run_window.py#L233-L242
train
devassistant/devassistant
devassistant/gui/run_window.py
RunWindow.allow_buttons
def allow_buttons(self, message="", link=True, back=True): """ Function allows buttons """ self.info_label.set_label(message) self.allow_close_window() if link and self.link is not None: self.link.set_sensitive(True) self.link.show_all() if...
python
def allow_buttons(self, message="", link=True, back=True): """ Function allows buttons """ self.info_label.set_label(message) self.allow_close_window() if link and self.link is not None: self.link.set_sensitive(True) self.link.show_all() if...
[ "def", "allow_buttons", "(", "self", ",", "message", "=", "\"\"", ",", "link", "=", "True", ",", "back", "=", "True", ")", ":", "self", ".", "info_label", ".", "set_label", "(", "message", ")", "self", ".", "allow_close_window", "(", ")", "if", "link",...
Function allows buttons
[ "Function", "allows", "buttons" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/run_window.py#L244-L255
train
devassistant/devassistant
devassistant/gui/run_window.py
RunWindow.dev_assistant_start
def dev_assistant_start(self): """ Thread executes devassistant API. """ #logger_gui.info("Thread run") path = self.top_assistant.get_selected_subassistant_path(**self.kwargs) kwargs_decoded = dict() for k, v in self.kwargs.items(): kwargs_decoded[k] =...
python
def dev_assistant_start(self): """ Thread executes devassistant API. """ #logger_gui.info("Thread run") path = self.top_assistant.get_selected_subassistant_path(**self.kwargs) kwargs_decoded = dict() for k, v in self.kwargs.items(): kwargs_decoded[k] =...
[ "def", "dev_assistant_start", "(", "self", ")", ":", "#logger_gui.info(\"Thread run\")", "path", "=", "self", ".", "top_assistant", ".", "get_selected_subassistant_path", "(", "*", "*", "self", ".", "kwargs", ")", "kwargs_decoded", "=", "dict", "(", ")", "for", ...
Thread executes devassistant API.
[ "Thread", "executes", "devassistant", "API", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/run_window.py#L257-L298
train
devassistant/devassistant
devassistant/gui/run_window.py
RunWindow.debug_btn_clicked
def debug_btn_clicked(self, widget, data=None): """ Event in case that debug button is pressed. """ self.store.clear() self.thread = threading.Thread(target=self.logs_update) self.thread.start()
python
def debug_btn_clicked(self, widget, data=None): """ Event in case that debug button is pressed. """ self.store.clear() self.thread = threading.Thread(target=self.logs_update) self.thread.start()
[ "def", "debug_btn_clicked", "(", "self", ",", "widget", ",", "data", "=", "None", ")", ":", "self", ".", "store", ".", "clear", "(", ")", "self", ".", "thread", "=", "threading", ".", "Thread", "(", "target", "=", "self", ".", "logs_update", ")", "se...
Event in case that debug button is pressed.
[ "Event", "in", "case", "that", "debug", "button", "is", "pressed", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/run_window.py#L300-L306
train
devassistant/devassistant
devassistant/gui/run_window.py
RunWindow.logs_update
def logs_update(self): """ Function updates logs. """ Gdk.threads_enter() if not self.debugging: self.debugging = True self.debug_btn.set_label('Info logs') else: self.debugging = False self.debug_btn.set_label('Debug logs')...
python
def logs_update(self): """ Function updates logs. """ Gdk.threads_enter() if not self.debugging: self.debugging = True self.debug_btn.set_label('Info logs') else: self.debugging = False self.debug_btn.set_label('Debug logs')...
[ "def", "logs_update", "(", "self", ")", ":", "Gdk", ".", "threads_enter", "(", ")", "if", "not", "self", ".", "debugging", ":", "self", ".", "debugging", "=", "True", "self", ".", "debug_btn", ".", "set_label", "(", "'Info logs'", ")", "else", ":", "se...
Function updates logs.
[ "Function", "updates", "logs", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/run_window.py#L308-L327
train
devassistant/devassistant
devassistant/gui/run_window.py
RunWindow.clipboard_btn_clicked
def clipboard_btn_clicked(self, widget, data=None): """ Function copies logs to clipboard. """ _clipboard_text = [] for record in self.debug_logs['logs']: if self.debugging: _clipboard_text.append(format_entry(record, show_level=True)) else...
python
def clipboard_btn_clicked(self, widget, data=None): """ Function copies logs to clipboard. """ _clipboard_text = [] for record in self.debug_logs['logs']: if self.debugging: _clipboard_text.append(format_entry(record, show_level=True)) else...
[ "def", "clipboard_btn_clicked", "(", "self", ",", "widget", ",", "data", "=", "None", ")", ":", "_clipboard_text", "=", "[", "]", "for", "record", "in", "self", ".", "debug_logs", "[", "'logs'", "]", ":", "if", "self", ".", "debugging", ":", "_clipboard_...
Function copies logs to clipboard.
[ "Function", "copies", "logs", "to", "clipboard", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/run_window.py#L330-L345
train
devassistant/devassistant
devassistant/gui/run_window.py
RunWindow.back_btn_clicked
def back_btn_clicked(self, widget, data=None): """ Event for back button. This occurs in case of devassistant fail. """ self.remove_link_button() self.run_window.hide() self.parent.path_window.path_window.show()
python
def back_btn_clicked(self, widget, data=None): """ Event for back button. This occurs in case of devassistant fail. """ self.remove_link_button() self.run_window.hide() self.parent.path_window.path_window.show()
[ "def", "back_btn_clicked", "(", "self", ",", "widget", ",", "data", "=", "None", ")", ":", "self", ".", "remove_link_button", "(", ")", "self", ".", "run_window", ".", "hide", "(", ")", "self", ".", "parent", ".", "path_window", ".", "path_window", ".", ...
Event for back button. This occurs in case of devassistant fail.
[ "Event", "for", "back", "button", ".", "This", "occurs", "in", "case", "of", "devassistant", "fail", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/run_window.py#L347-L354
train
devassistant/devassistant
devassistant/gui/run_window.py
RunWindow.main_btn_clicked
def main_btn_clicked(self, widget, data=None): """ Button switches to Dev Assistant GUI main window """ self.remove_link_button() data = dict() data['debugging'] = self.debugging self.run_window.hide() self.parent.open_window(widget, data)
python
def main_btn_clicked(self, widget, data=None): """ Button switches to Dev Assistant GUI main window """ self.remove_link_button() data = dict() data['debugging'] = self.debugging self.run_window.hide() self.parent.open_window(widget, data)
[ "def", "main_btn_clicked", "(", "self", ",", "widget", ",", "data", "=", "None", ")", ":", "self", ".", "remove_link_button", "(", ")", "data", "=", "dict", "(", ")", "data", "[", "'debugging'", "]", "=", "self", ".", "debugging", "self", ".", "run_win...
Button switches to Dev Assistant GUI main window
[ "Button", "switches", "to", "Dev", "Assistant", "GUI", "main", "window" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/run_window.py#L356-L364
train
devassistant/devassistant
devassistant/gui/run_window.py
RunWindow.list_view_row_clicked
def list_view_row_clicked(self, list_view, path, view_column): """ Function opens the firefox window with relevant link """ model = list_view.get_model() text = model[path][0] match = URL_FINDER.search(text) if match is not None: url = match.group(1) ...
python
def list_view_row_clicked(self, list_view, path, view_column): """ Function opens the firefox window with relevant link """ model = list_view.get_model() text = model[path][0] match = URL_FINDER.search(text) if match is not None: url = match.group(1) ...
[ "def", "list_view_row_clicked", "(", "self", ",", "list_view", ",", "path", ",", "view_column", ")", ":", "model", "=", "list_view", ".", "get_model", "(", ")", "text", "=", "model", "[", "path", "]", "[", "0", "]", "match", "=", "URL_FINDER", ".", "se...
Function opens the firefox window with relevant link
[ "Function", "opens", "the", "firefox", "window", "with", "relevant", "link" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/run_window.py#L366-L377
train
devassistant/devassistant
devassistant/remote_auth.py
GitHubAuth._github_create_twofactor_authorization
def _github_create_twofactor_authorization(cls, ui): """Create an authorization for a GitHub user using two-factor authentication. Unlike its non-two-factor counterpart, this method does not traverse the available authentications as they are not visible until the user logs in. ...
python
def _github_create_twofactor_authorization(cls, ui): """Create an authorization for a GitHub user using two-factor authentication. Unlike its non-two-factor counterpart, this method does not traverse the available authentications as they are not visible until the user logs in. ...
[ "def", "_github_create_twofactor_authorization", "(", "cls", ",", "ui", ")", ":", "try", ":", "try", ":", "# This is necessary to trigger sending a 2FA key to the user", "auth", "=", "cls", ".", "_user", ".", "create_authorization", "(", ")", "except", "cls", ".", "...
Create an authorization for a GitHub user using two-factor authentication. Unlike its non-two-factor counterpart, this method does not traverse the available authentications as they are not visible until the user logs in. Please note: cls._user's attributes are not accessibl...
[ "Create", "an", "authorization", "for", "a", "GitHub", "user", "using", "two", "-", "factor", "authentication", ".", "Unlike", "its", "non", "-", "two", "-", "factor", "counterpart", "this", "method", "does", "not", "traverse", "the", "available", "authenticat...
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/remote_auth.py#L105-L127
train
devassistant/devassistant
devassistant/remote_auth.py
GitHubAuth._github_create_simple_authorization
def _github_create_simple_authorization(cls): """Create a GitHub authorization for the given user in case they don't already have one. """ try: auth = None for a in cls._user.get_authorizations(): if a.note == 'DevAssistant': ...
python
def _github_create_simple_authorization(cls): """Create a GitHub authorization for the given user in case they don't already have one. """ try: auth = None for a in cls._user.get_authorizations(): if a.note == 'DevAssistant': ...
[ "def", "_github_create_simple_authorization", "(", "cls", ")", ":", "try", ":", "auth", "=", "None", "for", "a", "in", "cls", ".", "_user", ".", "get_authorizations", "(", ")", ":", "if", "a", ".", "note", "==", "'DevAssistant'", ":", "auth", "=", "a", ...
Create a GitHub authorization for the given user in case they don't already have one.
[ "Create", "a", "GitHub", "authorization", "for", "the", "given", "user", "in", "case", "they", "don", "t", "already", "have", "one", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/remote_auth.py#L131-L146
train
devassistant/devassistant
devassistant/remote_auth.py
GitHubAuth._github_store_authorization
def _github_store_authorization(cls, user, auth): """Store an authorization token for the given GitHub user in the git global config file. """ ClHelper.run_command("git config --global github.token.{login} {token}".format( login=user.login, token=auth.token), log_secret=Tr...
python
def _github_store_authorization(cls, user, auth): """Store an authorization token for the given GitHub user in the git global config file. """ ClHelper.run_command("git config --global github.token.{login} {token}".format( login=user.login, token=auth.token), log_secret=Tr...
[ "def", "_github_store_authorization", "(", "cls", ",", "user", ",", "auth", ")", ":", "ClHelper", ".", "run_command", "(", "\"git config --global github.token.{login} {token}\"", ".", "format", "(", "login", "=", "user", ".", "login", ",", "token", "=", "auth", ...
Store an authorization token for the given GitHub user in the git global config file.
[ "Store", "an", "authorization", "token", "for", "the", "given", "GitHub", "user", "in", "the", "git", "global", "config", "file", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/remote_auth.py#L149-L156
train
devassistant/devassistant
devassistant/remote_auth.py
GitHubAuth._start_ssh_agent
def _start_ssh_agent(cls): """Starts ssh-agent and returns the environment variables related to it""" env = dict() stdout = ClHelper.run_command('ssh-agent -s') lines = stdout.split('\n') for line in lines: if not line or line.startswith('echo '): cont...
python
def _start_ssh_agent(cls): """Starts ssh-agent and returns the environment variables related to it""" env = dict() stdout = ClHelper.run_command('ssh-agent -s') lines = stdout.split('\n') for line in lines: if not line or line.startswith('echo '): cont...
[ "def", "_start_ssh_agent", "(", "cls", ")", ":", "env", "=", "dict", "(", ")", "stdout", "=", "ClHelper", ".", "run_command", "(", "'ssh-agent -s'", ")", "lines", "=", "stdout", ".", "split", "(", "'\\n'", ")", "for", "line", "in", "lines", ":", "if", ...
Starts ssh-agent and returns the environment variables related to it
[ "Starts", "ssh", "-", "agent", "and", "returns", "the", "environment", "variables", "related", "to", "it" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/remote_auth.py#L159-L171
train
devassistant/devassistant
devassistant/remote_auth.py
GitHubAuth._github_create_ssh_key
def _github_create_ssh_key(cls): """Creates a local ssh key, if it doesn't exist already, and uploads it to Github.""" try: login = cls._user.login pkey_path = '{home}/.ssh/{keyname}'.format( home=os.path.expanduser('~'), keyname=settings.GITHUB_SS...
python
def _github_create_ssh_key(cls): """Creates a local ssh key, if it doesn't exist already, and uploads it to Github.""" try: login = cls._user.login pkey_path = '{home}/.ssh/{keyname}'.format( home=os.path.expanduser('~'), keyname=settings.GITHUB_SS...
[ "def", "_github_create_ssh_key", "(", "cls", ")", ":", "try", ":", "login", "=", "cls", ".", "_user", ".", "login", "pkey_path", "=", "'{home}/.ssh/{keyname}'", ".", "format", "(", "home", "=", "os", ".", "path", ".", "expanduser", "(", "'~'", ")", ",", ...
Creates a local ssh key, if it doesn't exist already, and uploads it to Github.
[ "Creates", "a", "local", "ssh", "key", "if", "it", "doesn", "t", "exist", "already", "and", "uploads", "it", "to", "Github", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/remote_auth.py#L174-L196
train
devassistant/devassistant
devassistant/remote_auth.py
GitHubAuth._github_ssh_key_exists
def _github_ssh_key_exists(cls): """Returns True if any key on Github matches a local key, else False.""" remote_keys = map(lambda k: k._key, cls._user.get_keys()) found = False pubkey_files = glob.glob(os.path.expanduser('~/.ssh/*.pub')) for rk in remote_keys: for pk...
python
def _github_ssh_key_exists(cls): """Returns True if any key on Github matches a local key, else False.""" remote_keys = map(lambda k: k._key, cls._user.get_keys()) found = False pubkey_files = glob.glob(os.path.expanduser('~/.ssh/*.pub')) for rk in remote_keys: for pk...
[ "def", "_github_ssh_key_exists", "(", "cls", ")", ":", "remote_keys", "=", "map", "(", "lambda", "k", ":", "k", ".", "_key", ",", "cls", ".", "_user", ".", "get_keys", "(", ")", ")", "found", "=", "False", "pubkey_files", "=", "glob", ".", "glob", "(...
Returns True if any key on Github matches a local key, else False.
[ "Returns", "True", "if", "any", "key", "on", "Github", "matches", "a", "local", "key", "else", "False", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/remote_auth.py#L208-L222
train
devassistant/devassistant
devassistant/remote_auth.py
GitHubAuth.github_authenticated
def github_authenticated(cls, func): """Does user authentication, creates SSH keys if needed and injects "_user" attribute into class/object bound to the decorated function. Don't call any other methods of this class manually, this should be everything you need. """ def inner(fun...
python
def github_authenticated(cls, func): """Does user authentication, creates SSH keys if needed and injects "_user" attribute into class/object bound to the decorated function. Don't call any other methods of this class manually, this should be everything you need. """ def inner(fun...
[ "def", "github_authenticated", "(", "cls", ",", "func", ")", ":", "def", "inner", "(", "func_cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "cls", ".", "_gh_module", ":", "logger", ".", "warning", "(", "'PyGithub not installed, s...
Does user authentication, creates SSH keys if needed and injects "_user" attribute into class/object bound to the decorated function. Don't call any other methods of this class manually, this should be everything you need.
[ "Does", "user", "authentication", "creates", "SSH", "keys", "if", "needed", "and", "injects", "_user", "attribute", "into", "class", "/", "object", "bound", "to", "the", "decorated", "function", ".", "Don", "t", "call", "any", "other", "methods", "of", "this...
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/remote_auth.py#L241-L265
train
devassistant/devassistant
devassistant/yaml_assistant_loader.py
YamlAssistantLoader.get_assistants
def get_assistants(cls, superassistants): """Returns list of assistants that are subassistants of given superassistants (I love this docstring). Args: roles: list of names of roles, defaults to all roles Returns: list of YamlAssistant instances with specified rol...
python
def get_assistants(cls, superassistants): """Returns list of assistants that are subassistants of given superassistants (I love this docstring). Args: roles: list of names of roles, defaults to all roles Returns: list of YamlAssistant instances with specified rol...
[ "def", "get_assistants", "(", "cls", ",", "superassistants", ")", ":", "_assistants", "=", "cls", ".", "load_all_assistants", "(", "superassistants", ")", "result", "=", "[", "]", "for", "supa", "in", "superassistants", ":", "result", ".", "extend", "(", "_a...
Returns list of assistants that are subassistants of given superassistants (I love this docstring). Args: roles: list of names of roles, defaults to all roles Returns: list of YamlAssistant instances with specified roles
[ "Returns", "list", "of", "assistants", "that", "are", "subassistants", "of", "given", "superassistants", "(", "I", "love", "this", "docstring", ")", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/yaml_assistant_loader.py#L16-L30
train
devassistant/devassistant
devassistant/yaml_assistant_loader.py
YamlAssistantLoader.load_all_assistants
def load_all_assistants(cls, superassistants): """Fills self._assistants with loaded YamlAssistant instances of requested roles. Tries to use cache (updated/created if needed). If cache is unusable, it falls back to loading all assistants. Args: roles: list of required assi...
python
def load_all_assistants(cls, superassistants): """Fills self._assistants with loaded YamlAssistant instances of requested roles. Tries to use cache (updated/created if needed). If cache is unusable, it falls back to loading all assistants. Args: roles: list of required assi...
[ "def", "load_all_assistants", "(", "cls", ",", "superassistants", ")", ":", "# mapping of assistant roles to lists of top-level assistant instances", "_assistants", "=", "{", "}", "# {'crt': CreatorAssistant, ...}", "superas_dict", "=", "dict", "(", "map", "(", "lambda", "a...
Fills self._assistants with loaded YamlAssistant instances of requested roles. Tries to use cache (updated/created if needed). If cache is unusable, it falls back to loading all assistants. Args: roles: list of required assistant roles
[ "Fills", "self", ".", "_assistants", "with", "loaded", "YamlAssistant", "instances", "of", "requested", "roles", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/yaml_assistant_loader.py#L33-L67
train
devassistant/devassistant
devassistant/yaml_assistant_loader.py
YamlAssistantLoader.get_assistants_from_cache_hierarchy
def get_assistants_from_cache_hierarchy(cls, cache_hierarchy, superassistant, role=settings.DEFAULT_ASSISTANT_ROLE): """Accepts cache_hierarch as described in devassistant.cache and returns instances of YamlAssistant (only with cached attributes) for loaded fi...
python
def get_assistants_from_cache_hierarchy(cls, cache_hierarchy, superassistant, role=settings.DEFAULT_ASSISTANT_ROLE): """Accepts cache_hierarch as described in devassistant.cache and returns instances of YamlAssistant (only with cached attributes) for loaded fi...
[ "def", "get_assistants_from_cache_hierarchy", "(", "cls", ",", "cache_hierarchy", ",", "superassistant", ",", "role", "=", "settings", ".", "DEFAULT_ASSISTANT_ROLE", ")", ":", "result", "=", "[", "]", "for", "name", ",", "attrs", "in", "cache_hierarchy", ".", "i...
Accepts cache_hierarch as described in devassistant.cache and returns instances of YamlAssistant (only with cached attributes) for loaded files Args: cache_hierarchy: structure as described in devassistant.cache role: role of all assistants in this hierarchy (we could find ...
[ "Accepts", "cache_hierarch", "as", "described", "in", "devassistant", ".", "cache", "and", "returns", "instances", "of", "YamlAssistant", "(", "only", "with", "cached", "attributes", ")", "for", "loaded", "files" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/yaml_assistant_loader.py#L70-L97
train
devassistant/devassistant
devassistant/yaml_assistant_loader.py
YamlAssistantLoader.get_assistants_from_file_hierarchy
def get_assistants_from_file_hierarchy(cls, file_hierarchy, superassistant, role=settings.DEFAULT_ASSISTANT_ROLE): """Accepts file_hierarch as returned by cls.get_assistant_file_hierarchy and returns instances of YamlAssistant for loaded files Args: ...
python
def get_assistants_from_file_hierarchy(cls, file_hierarchy, superassistant, role=settings.DEFAULT_ASSISTANT_ROLE): """Accepts file_hierarch as returned by cls.get_assistant_file_hierarchy and returns instances of YamlAssistant for loaded files Args: ...
[ "def", "get_assistants_from_file_hierarchy", "(", "cls", ",", "file_hierarchy", ",", "superassistant", ",", "role", "=", "settings", ".", "DEFAULT_ASSISTANT_ROLE", ")", ":", "result", "=", "[", "]", "warn_msg", "=", "'Failed to load assistant {source}, skipping subassista...
Accepts file_hierarch as returned by cls.get_assistant_file_hierarchy and returns instances of YamlAssistant for loaded files Args: file_hierarchy: structure as described in cls.get_assistants_file_hierarchy role: role of all assistants in this hierarchy (we could find ...
[ "Accepts", "file_hierarch", "as", "returned", "by", "cls", ".", "get_assistant_file_hierarchy", "and", "returns", "instances", "of", "YamlAssistant", "for", "loaded", "files" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/yaml_assistant_loader.py#L100-L134
train
devassistant/devassistant
devassistant/yaml_assistant_loader.py
YamlAssistantLoader.get_assistants_file_hierarchy
def get_assistants_file_hierarchy(cls, dirs): """Returns assistants file hierarchy structure (see below) representing assistant hierarchy in given directories. It works like this: 1. It goes through all *.yaml files in all given directories and adds them into hierarchy (if th...
python
def get_assistants_file_hierarchy(cls, dirs): """Returns assistants file hierarchy structure (see below) representing assistant hierarchy in given directories. It works like this: 1. It goes through all *.yaml files in all given directories and adds them into hierarchy (if th...
[ "def", "get_assistants_file_hierarchy", "(", "cls", ",", "dirs", ")", ":", "result", "=", "{", "}", "for", "d", "in", "filter", "(", "lambda", "d", ":", "os", ".", "path", ".", "exists", "(", "d", ")", ",", "dirs", ")", ":", "for", "f", "in", "fi...
Returns assistants file hierarchy structure (see below) representing assistant hierarchy in given directories. It works like this: 1. It goes through all *.yaml files in all given directories and adds them into hierarchy (if there are two files with same name in more directories, the...
[ "Returns", "assistants", "file", "hierarchy", "structure", "(", "see", "below", ")", "representing", "assistant", "hierarchy", "in", "given", "directories", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/yaml_assistant_loader.py#L137-L170
train
devassistant/devassistant
devassistant/yaml_assistant_loader.py
YamlAssistantLoader.assistant_from_yaml
def assistant_from_yaml(cls, source, y, superassistant, fully_loaded=True, role=settings.DEFAULT_ASSISTANT_ROLE): """Constructs instance of YamlAssistant loaded from given structure y, loaded from source file source. Args: source: path to assistant source...
python
def assistant_from_yaml(cls, source, y, superassistant, fully_loaded=True, role=settings.DEFAULT_ASSISTANT_ROLE): """Constructs instance of YamlAssistant loaded from given structure y, loaded from source file source. Args: source: path to assistant source...
[ "def", "assistant_from_yaml", "(", "cls", ",", "source", ",", "y", ",", "superassistant", ",", "fully_loaded", "=", "True", ",", "role", "=", "settings", ".", "DEFAULT_ASSISTANT_ROLE", ")", ":", "# In pre-0.9.0, we required assistant to be a mapping of {name: assistant_at...
Constructs instance of YamlAssistant loaded from given structure y, loaded from source file source. Args: source: path to assistant source file y: loaded yaml structure superassistant: superassistant of this assistant Returns: YamlAssistant instan...
[ "Constructs", "instance", "of", "YamlAssistant", "loaded", "from", "given", "structure", "y", "loaded", "from", "source", "file", "source", "." ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/yaml_assistant_loader.py#L173-L195
train
devassistant/devassistant
devassistant/yaml_snippet_loader.py
YamlSnippetLoader.get_snippet_by_name
def get_snippet_by_name(cls, name): """name is in dotted format, e.g. topsnippet.something.wantedsnippet""" name_with_dir_separators = name.replace('.', os.path.sep) loaded = yaml_loader.YamlLoader.load_yaml_by_relpath(cls.snippets_dirs, ...
python
def get_snippet_by_name(cls, name): """name is in dotted format, e.g. topsnippet.something.wantedsnippet""" name_with_dir_separators = name.replace('.', os.path.sep) loaded = yaml_loader.YamlLoader.load_yaml_by_relpath(cls.snippets_dirs, ...
[ "def", "get_snippet_by_name", "(", "cls", ",", "name", ")", ":", "name_with_dir_separators", "=", "name", ".", "replace", "(", "'.'", ",", "os", ".", "path", ".", "sep", ")", "loaded", "=", "yaml_loader", ".", "YamlLoader", ".", "load_yaml_by_relpath", "(", ...
name is in dotted format, e.g. topsnippet.something.wantedsnippet
[ "name", "is", "in", "dotted", "format", "e", ".", "g", ".", "topsnippet", ".", "something", ".", "wantedsnippet" ]
2dbfeaa666a64127263664d18969c55d19ecc83e
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/yaml_snippet_loader.py#L23-L32
train
hsolbrig/PyShEx
pyshex/shape_expressions_language/p5_6_schema_requirements.py
conforms
def conforms(cntxt: Context, n: Node, S: ShExJ.Shape) -> bool: """ `5.6.1 Schema Validation Requirement <http://shex.io/shex-semantics/#validation-requirement>`_ A graph G is said to conform with a schema S with a ShapeMap m when: Every, SemAct in the startActs of S has a successful evaluation of semA...
python
def conforms(cntxt: Context, n: Node, S: ShExJ.Shape) -> bool: """ `5.6.1 Schema Validation Requirement <http://shex.io/shex-semantics/#validation-requirement>`_ A graph G is said to conform with a schema S with a ShapeMap m when: Every, SemAct in the startActs of S has a successful evaluation of semA...
[ "def", "conforms", "(", "cntxt", ":", "Context", ",", "n", ":", "Node", ",", "S", ":", "ShExJ", ".", "Shape", ")", "->", "bool", ":", "# return semActsSatisfied(cntxt.schema.startActs, cntxt) and \\", "# all(reference_of(cntxt.schema, sa.shapeLabel) is not None and", ...
`5.6.1 Schema Validation Requirement <http://shex.io/shex-semantics/#validation-requirement>`_ A graph G is said to conform with a schema S with a ShapeMap m when: Every, SemAct in the startActs of S has a successful evaluation of semActsSatisfied. Every node n in m conforms to its associated shapeExp...
[ "5", ".", "6", ".", "1", "Schema", "Validation", "Requirement", "<http", ":", "//", "shex", ".", "io", "/", "shex", "-", "semantics", "/", "#validation", "-", "requirement", ">", "_", "A", "graph", "G", "is", "said", "to", "conform", "with", "a", "sc...
9d659cc36e808afd66d4a6d60e8ea21cb12eb744
https://github.com/hsolbrig/PyShEx/blob/9d659cc36e808afd66d4a6d60e8ea21cb12eb744/pyshex/shape_expressions_language/p5_6_schema_requirements.py#L14-L29
train