]> Savannah Git Hosting - gnulib.git/commitdiff
vfs: __contains__ is a part of base VFS
authorDmitry Selyutin <ghostmansd@gmail.com>
Sun, 22 Oct 2017 16:46:06 +0000 (19:46 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Sun, 22 Oct 2017 19:30:14 +0000 (22:30 +0300)
pygnulib/vfs.py

index 6180263ec4d88e1c9c333e00b7cf08bfaccd7309..1809e412763249e5c9bb92e84f62e38002975124 100644 (file)
@@ -35,6 +35,14 @@ class Base:
         return "{}.{}{{{}}}".format(module, name, repr(self.__prefix))
 
 
+    def __contains__(self, name):
+        path = _os_.path.normpath(name)
+        if _os_.path.isabs(name):
+            raise ValueError("name must be a relative path")
+        path = _os_.path.join(self.__prefix, name)
+        return _os_.path.exists(path)
+
+
     def __getitem__(self, name):
         _type_assert_("name", name, str)
         parts = []
@@ -79,14 +87,6 @@ class Project(Base):
         self.__patch = None
 
 
-    def __contains__(self, name):
-        path = _os_.path.normpath(name)
-        if _os_.path.isabs(name):
-            raise ValueError("name must be a relative path")
-        path = _os_.path.join(self.__prefix, name)
-        return _os_.path.exists(path)
-
-
     @property
     def patch(self):
         """path to patch binary"""