From 71dfa2d20aea6646ed52900aa762de708300edab Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin <ghostmansd@gmail.com> Date: Sun, 22 Oct 2017 19:46:06 +0300 Subject: [PATCH] vfs: __contains__ is a part of base VFS --- pygnulib/vfs.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pygnulib/vfs.py b/pygnulib/vfs.py index 6180263ec4..1809e41276 100644 --- a/pygnulib/vfs.py +++ b/pygnulib/vfs.py @@ -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""" -- 2.39.5