コード例 #1
0
    def remove_entry_points(self, names):
        """
        removes `names` from the set of entry points to track.

        `names` can be a single object or an iterable.
        """
        names = util.return_set(names)
        util.remove_from_set(self.entry_point_names,
                             names)
コード例 #2
0
    def remove_entry_points(self, names):
        """
        removes `names` from the set of entry points to track.

        `names` can be a single object or an iterable.
        """
        names = util.return_set(names)
        util.remove_from_set(self.entry_point_names,
                             names)
コード例 #3
0
 def _remove_blacklisted(self, filepaths):
     """
     internal helper method to remove the blacklisted filepaths
     from `filepaths`.
     """
     filepaths = util.remove_from_set(filepaths, self.blacklisted_filepaths)
     return filepaths
コード例 #4
0
ファイル: file_manager.py プロジェクト: benhoff/pluginmanager
 def _remove_blacklisted(self, filepaths):
     """
     internal helper method to remove the blacklisted filepaths
     from `filepaths`.
     """
     filepaths = util.remove_from_set(filepaths, self.blacklisted_filepaths)
     return filepaths
コード例 #5
0
ファイル: test_util.py プロジェクト: benhoff/pluginmanager
    def test_remove_from_set(self):
        obj_1 = object()
        obj_2 = object()
        test_set = set((obj_1, obj_2))
        remove_set = set((obj_2,))

        result_set = util.remove_from_set(test_set, remove_set)
        self.assertIn(obj_1, result_set)
        self.assertNotIn(obj_2, result_set)
コード例 #6
0
    def test_remove_from_set(self):
        obj_1 = object()
        obj_2 = object()
        test_set = set((obj_1, obj_2))
        remove_set = set((obj_2, ))

        result_set = util.remove_from_set(test_set, remove_set)
        self.assertIn(obj_1, result_set)
        self.assertNotIn(obj_2, result_set)
コード例 #7
0
    def remove_blacklisted_filepaths(self, filepaths):
        """
        Removes `filepaths` from blacklisted filepaths

        Recommend passing in absolute filepaths but method will attempt
        to convert to absolute filepaths based on current working directory.
        """
        filepaths = util.to_absolute_paths(filepaths)
        black_paths = self.blacklisted_filepaths
        black_paths = util.remove_from_set(black_paths, filepaths)
コード例 #8
0
ファイル: file_manager.py プロジェクト: benhoff/pluginmanager
    def remove_blacklisted_filepaths(self, filepaths):
        """
        Removes `filepaths` from blacklisted filepaths

        Recommend passing in absolute filepaths but method will attempt
        to convert to absolute filepaths based on current working directory.
        """
        filepaths = util.to_absolute_paths(filepaths)
        black_paths = self.blacklisted_filepaths
        black_paths = util.remove_from_set(black_paths, filepaths)
コード例 #9
0
    def remove_plugin_filepaths(self, filepaths):
        """
        Removes `filepaths` from `self.plugin_filepaths`.
        Recommend passing in absolute filepaths. Method will
        attempt to convert to absolute paths if not passed in.

        `filepaths` can be a single object or an iterable.
        """
        filepaths = util.to_absolute_paths(filepaths)
        self.plugin_filepaths = util.remove_from_set(self.plugin_filepaths,
                                                     filepaths)
コード例 #10
0
ファイル: file_manager.py プロジェクト: benhoff/pluginmanager
    def remove_plugin_filepaths(self, filepaths):
        """
        Removes `filepaths` from `self.plugin_filepaths`.
        Recommend passing in absolute filepaths. Method will
        attempt to convert to absolute paths if not passed in.

        `filepaths` can be a single object or an iterable.
        """
        filepaths = util.to_absolute_paths(filepaths)
        self.plugin_filepaths = util.remove_from_set(self.plugin_filepaths,
                                                     filepaths)
コード例 #11
0
    def _remove_blacklisted(self, directories):
        """
        Attempts to remove the blacklisted directories from `directories`
        and then returns whatever is left in the set.

        Called from the `collect_directories` method.
        """
        directories = util.to_absolute_paths(directories)
        directories = util.remove_from_set(directories,
                                           self.blacklisted_directories)

        return directories
コード例 #12
0
    def remove_blacklisted_directories(self, directories):
        """
        Attempts to remove the `directories` from the set of blacklisted
        directories. If a particular directory is not found in the set of
        blacklisted, method will continue on silently.

        `directories` may be a single instance or an iterable. Recommend
        passing in absolute paths. Method will try to convert to an absolute
        path if it is not already using the current working directory.
        """
        directories = util.to_absolute_paths(directories)
        black_dirs = self.blacklisted_directories
        black_dirs = util.remove_from_set(black_dirs, directories)
コード例 #13
0
    def remove_directories(self, directories):
        """
        Removes any `directories` from the set of plugin directories.

        `directories` may be a single object or an iterable.

        Recommend passing in all paths as absolute, but the method will
        attemmpt to convert all paths to absolute if they are not already
        based on the current working directory.
        """
        directories = util.to_absolute_paths(directories)
        self.plugin_directories = util.remove_from_set(self.plugin_directories,
                                                       directories)
コード例 #14
0
ファイル: file_manager.py プロジェクト: benhoff/pluginmanager
    def set_blacklisted_filepaths(self, filepaths, remove_from_stored=True):
        """
        Sets internal blacklisted filepaths to filepaths.
        If `remove_from_stored` is `True`, any `filepaths` in
        `self.plugin_filepaths` will be automatically removed.

        Recommend passing in absolute filepaths but method will attempt
        to convert to absolute filepaths based on current working directory.
        """
        filepaths = util.to_absolute_paths(filepaths)
        self.blacklisted_filepaths = filepaths
        if remove_from_stored:
            self.plugin_filepaths = util.remove_from_set(self.plugin_filepaths,
                                                         filepaths)
コード例 #15
0
    def set_blacklisted_filepaths(self, filepaths, remove_from_stored=True):
        """
        Sets internal blacklisted filepaths to filepaths.
        If `remove_from_stored` is `True`, any `filepaths` in
        `self.plugin_filepaths` will be automatically removed.

        Recommend passing in absolute filepaths but method will attempt
        to convert to absolute filepaths based on current working directory.
        """
        filepaths = util.to_absolute_paths(filepaths)
        self.blacklisted_filepaths = filepaths
        if remove_from_stored:
            self.plugin_filepaths = util.remove_from_set(
                self.plugin_filepaths, filepaths)
コード例 #16
0
ファイル: file_manager.py プロジェクト: benhoff/pluginmanager
    def set_plugin_filepaths(self, filepaths, except_blacklisted=True):
        """
        Sets `filepaths` to the `self.plugin_filepaths`. Recommend passing
        in absolute filepaths. Method will attempt to convert to
        absolute paths if they are not already.

        `filepaths` can be a single object or an iterable.

        If `except_blacklisted` is `True`, all `filepaths` that
        have been blacklisted will not be set.
        """
        filepaths = util.to_absolute_paths(filepaths)
        if except_blacklisted:
            filepaths = util.remove_from_set(filepaths,
                                             self.blacklisted_filepaths)

        self.plugin_filepaths = filepaths
コード例 #17
0
    def set_plugin_filepaths(self, filepaths, except_blacklisted=True):
        """
        Sets `filepaths` to the `self.plugin_filepaths`. Recommend passing
        in absolute filepaths. Method will attempt to convert to
        absolute paths if they are not already.

        `filepaths` can be a single object or an iterable.

        If `except_blacklisted` is `True`, all `filepaths` that
        have been blacklisted will not be set.
        """
        filepaths = util.to_absolute_paths(filepaths)
        if except_blacklisted:
            filepaths = util.remove_from_set(filepaths,
                                             self.blacklisted_filepaths)

        self.plugin_filepaths = filepaths
コード例 #18
0
    def set_blacklisted_directories(self,
                                    directories,
                                    remove_from_stored_directories=True):
        """
        Sets the `directories` to be blacklisted. Blacklisted directories will
        not be returned or searched recursively when calling
        `collect_directories`.

        This will replace the previously stored set of blacklisted
        paths.

        `directories` may be a single instance or an iterable. Recommend
        passing in absolute paths. Method will try to convert to absolute path
        based on current working directory.
        """
        absolute_paths = util.to_absolute_paths(directories)
        self.blacklisted_directories = absolute_paths
        if remove_from_stored_directories:
            plug_dirs = self.plugin_directories
            plug_dirs = util.remove_from_set(plug_dirs,
                                             directories)
コード例 #19
0
    def add_blacklisted_directories(self,
                                    directories,
                                    remove_from_stored_directories=True):

        """
        Adds `directories` to be blacklisted. Blacklisted directories will not
        be returned or searched recursively when calling the
        `collect_directories` method.

        `directories` may be a single instance or an iterable. Recommend
        passing in absolute paths, but method will try to convert to absolute
        paths based on the current working directory.

        If `remove_from_stored_directories` is true, all `directories`
        will be removed from `self.plugin_directories`
        """
        absolute_paths = util.to_absolute_paths(directories)
        self.blacklisted_directories.update(absolute_paths)
        if remove_from_stored_directories:
            plug_dirs = self.plugin_directories
            plug_dirs = util.remove_from_set(plug_dirs,
                                             directories)
コード例 #20
0
 def remove_entry_points(self, names):
     names = util.return_set(names)
     util.remove_from_set(self.entry_point_names,
                          names)