Return :class:`pathlib.Path` object used for storing value.
492618
def file(self):
        """"""
        from abilian.services.repository import session_repository as repository

        return repository.get(self, self.uuid)
469657
def _path(self):  # type: () -> str
        
        if self._parent:
            return '{}.{}'.format(self._parent._path(), self._key_name())

        return self._key_name()
463593
def get_from_instance(self, instance):
        
        # walk the attribute path to get the value. Similarly to Django, first
        # try getting the value from a dict, then as a attribute lookup, and
        # then as a list index
        for attr in self._path:
            try: # dict lookup
                instance = instance[attr]
            except (TypeError, AttributeError, KeyError, ValueError, IndexError):
                try: # attr lookup
                    instance = getattr(instance, attr)
                except (TypeError, AttributeError):
                    try:  # list-index lookup
                        instance = instance[int(attr)]
                    except (IndexError,  # list index out of range
                            ValueError,  # invalid literal for int()
                            KeyError,    # current is a dict without `int(bit)` key
                            TypeError):  # unsubscriptable object
                                raise VariableLookupError("Failed lookup for key [%s] in %r" % (attr, instance))

            if callable(instance):
                instance = instance()
            elif instance is None:  # no sense walking down the path any further
                return None

        return instance
140763
def get_env_path(cls):
        
        return os.path.dirname(Finder.python()) + os.pathsep + os.environ['PATH']
300080
def choose_path():
    
    dirs = webview.create_file_dialog(webview.FOLDER_DIALOG)
    if dirs and len(dirs) > 0:
        directory = dirs[0]
        if isinstance(directory, bytes):
            directory = directory.decode("utf-8")

        response = {"status": "ok", "directory": directory}
    else:
        response = {"status": "cancel"}

    return jsonify(response)
542129
def paths(self, value):
        

        if value is not None:
            assert type(value) in (tuple, list), "'{0}' attribute: '{1}' type is not 'tuple' or 'list'!".format(
                "paths", value)
            for element in value:
                assert type(element) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format(
                    "paths", element)
                assert os.path.exists(element), "'{0}' attribute: '{1}' directory doesn't exists!".format("paths",
                                                                                                          element)
        self.__paths = value
406301
def _get_path():
    """"""
    if _path:
        return _path[0]
    environ_paths = set(os.environ['PATH'].split(':'))
    environ_paths.add('/usr/local/bin')
    environ_paths.add('/usr/bin')
    _path.append(':'.join(environ_paths))
    logger.debug('PATH = %s', _path[-1])
    return _path[0]
1106500
def get_path(self, url):
        
        cache_path = self._url_to_path(url)
        if os.path.exists(cache_path):
            return cache_path

        return None
650301
def _folder_to_dict(self, path):
        
        res = {}
        for key in os.listdir(path):
            if key.startswith('.'):
                continue
            key_path = os.path.join(path, key)
            if os.path.isfile(key_path):
                val = open(key_path).read()
                key = key.split('.')[0]
                res[key] = val
            else:
                res[key] = self._folder_to_dict(key_path)
        return res
615959
def existing_path(value):
    """"""
    if os.path.exists(value):
        return value
    else:
        raise argparse.ArgumentTypeError("Path {0} not found".format(value))
472875
def get_path(self, key):
        ""
        if key in self.keys():
            return (key,), self[key]
        else:
            key_path, res = (None, None)
            for sub_key, v in self.items():
                if isinstance(v, self.__class__):
                    key_path, res = v.get_path(key)
                elif hasattr(v, 'get'):
                    res = v.get(key)
                    key_path = (key,) if res is not None else None
                if res is not None and key_path is not None:
                    key_path = (sub_key,) + key_path
                    break
            return key_path, res
1087212
def _resolve_path(obj, path=None):
        
        if path:
            for attr_name in path.split('__'):
                obj = getattr(obj, attr_name)
        return obj
24706
def value_for_keypath(obj, path):
    
    val = obj
    for part in path.split('.'):
        match = re.match(list_index_re, part)
        if match is not None:
            val = _extract(val, match.group(1))
            if not isinstance(val, list) and not isinstance(val, tuple):
                raise TypeError('expected list/tuple')
            index = int(match.group(2))
            val = val[index]
        else:
            val = _extract(val, part)
        if val is None:
            return None
    return val
1193383
def path_for(self, *args):
        """"""
        if args and args[0].startswith(os.path.sep):
            return os.path.join(*args)
        return os.path.join(self._root_path or os.getcwd(), *args)
997845
def path(self) -> Tuple[InstanceKey]:
        """"""
        res = []
        inst: InstanceNode = self
        while inst.parinst:
            res.insert(0, inst._key)
            inst = inst.parinst
        return tuple(res)
1786
def get_object_from_path(path):
    
    try:
        return sys.IMPORT_CACHE[path]
    except KeyError:
        _path = path.split('.')
        module_path = '.'.join(_path[:-1])
        class_name = _path[-1]
        module = importlib.import_module(module_path)
        sys.IMPORT_CACHE[path] = getattr(module, class_name)
        return sys.IMPORT_CACHE[path]
884851
def path(self):
        
        if self.parent is None:
            return "/"
        else:
            return os.path.join(self.parent.path, self.name)