Commits

ta...@MacZiade.ingenidev  committed f5f2a1f

removed the owner api

  • Participants
  • Parent commits 7a6f12f

Comments (0)

Files changed (2)

     #
     # public APIs
     #
-    def file_users(self, path):
+    def get_file_users(self, path):
         """Returns Distribution instances for the projects that uses `path`."""
         for dist in self:
             if dist.uses(path):
                 yield dist
 
-    def owner(self, path):
-        """Returns the owner of `path`."""
-        users = [dist for dist in self if dist.uses(path)]
-        if len(users) == 1:
-            return users[0]
-        return None
 
 class ZippedDistributionDirectory(DistributionDirectory):
 
         Return Distribution instances.
         """
         for directory in self.values():
-            for dist in directory.file_users(path):
+            for dist in directory.get_file_users(path):
                 yield dist
 
 #
     """
     return _dist_dirs.get_file_users(path)
 
+

File test_pkgutil.py

 
 def test_directory():
     dir = DistributionDirectory(SITE_PKG)
-
-    dist = dir.owner('mercurial/filelog.pyc')
+    dist = list(dir.get_file_users('mercurial/filelog.pyc'))[0]
     assert dist.name == 'mercurial'
-    assert dir.owner('mercurial/filelog.py') is None
+    assert len(list(dir.get_file_users('mercurial/filelog.py'))) == 2
 
 def test_get_file_users():
     users = list(get_file_users('mercurial/filelog.py'))
 
 def test_zipped_directory():
     dir = ZippedDistributionDirectory(SITE_PKG+'.zip')
-    dist = dir.owner('mercurial/filelog.pyc')
+    dist = list(dir.get_file_users('mercurial/filelog.pyc'))[0]
     assert dist.name == 'mercurial'
-    assert dir.owner('mercurial/filelog.py') is None
+    assert len(list(dir.get_file_users('mercurial/filelog.py'))) == 2
 
 def setup_zip():
     sys.old = sys.path