def __init__(self, scope_provider, glob_args=None): from textx.scoping import ModelLoader ModelLoader.__init__(self) self.scope_provider = scope_provider self.glob_args = {} if glob_args: self.set_glob_args(glob_args)
def __init__(self, scope_provider, glob_args=None, search_path=None, importAs=False, importURI_converter=None, importURI_to_scope_name=None): """ Creates a new ImportURI Provider. Args: scope_provider: The underlying scope provider to be used to locate mode items glob_args: arguments for the glob module (you can load model elements using globbing. With this arg you can enable, e.g., recursion while globbing. This option is irrelevant when using a search path. search_path: a list with path strings used to find files. Without this information (None), the current model file location indicates where to search files. importAs: activate importAs feature (see class documentation). importURI_converter: Callable to convert the importURI attribute to a filename pattern (default: None). importURI_to_scope_name: Callable to define a name based on the rule instance containing the importURI attribute. With this you can set the name of the importURI object to something dependent of the original importURI value (caution: for an FQN based lookup, this name should NOT contain dots '.'). """ from textx.scoping import ModelLoader ModelLoader.__init__(self) self.scope_provider = scope_provider if (glob_args is not None) and (search_path is not None): raise Exception("you cannot use globbing together with a " "search path") self.glob_args = {} self.search_path = search_path self.importAs = importAs if importURI_converter is not None: self.importURI_converter = importURI_converter else: self.importURI_converter = lambda x: x self.importURI_to_scope_name = importURI_to_scope_name if glob_args: self.set_glob_args(glob_args)
def __init__(self, scope_provider, glob_args=None, search_path=None): """ Creates a new ImportURI Provider. Args: scope_provider: The underlying scope provider to be used to locate mode items glob_args: arguments for the glob module (you can load model elements using globbing. With this arg you can enable, e.g., recursion while globbing. This option is irrelevant when using a search path. search_path: a list with path strings used to find files. Without this information (None), the current model file location indicates where to search files. """ from textx.scoping import ModelLoader ModelLoader.__init__(self) self.scope_provider = scope_provider if (glob_args is not None) and (search_path is not None): raise Exception("you cannot use globbing together with a " "search path") self.glob_args = {} self.search_path = search_path if glob_args: self.set_glob_args(glob_args)