Returns the relative path for given `key`
496250
def relative_path(self, key):
    ''''''
    key = str(key)                # stringify
    key = key.replace(':', '/')   # turn namespace delimiters into slashes
    key = key[1:]                 # remove first slash (absolute)
    if not self.case_sensitive:
      key = key.lower()           # coerce to lowercase
    return os.path.normpath(key)
338784
def keypath(self, key):
        
        return fs.path(self.path, self.escape_key(key))
920880
public function find($key)
    {
        $path = $this->finder->find($name);

        if ($path && !in_array($path, $this->paths)) {
            array_unshift($this->paths, $path);
        }

        return parent::find($name);
    }
1239262
def GetKeyByPath(self, key_path):
    
    root_key_path, _, key_path = key_path.partition(
        definitions.KEY_PATH_SEPARATOR)

    # Resolve a root key alias.
    root_key_path = root_key_path.upper()
    root_key_path = self._ROOT_KEY_ALIASES.get(root_key_path, root_key_path)

    if root_key_path not in self._ROOT_KEYS:
      raise RuntimeError('Unsupported root key: {0:s}'.format(root_key_path))

    key_path = definitions.KEY_PATH_SEPARATOR.join([root_key_path, key_path])
    key_path_upper = key_path.upper()

    for virtual_key_path, virtual_key_callback in self._VIRTUAL_KEYS:
      virtual_key_path_upper = virtual_key_path.upper()
      if key_path_upper.startswith(virtual_key_path_upper):
        key_path_suffix = key_path[len(virtual_key_path):]

        callback_function = getattr(self, virtual_key_callback)
        virtual_key = callback_function(key_path_suffix)
        if not virtual_key:
          raise RuntimeError('Unable to resolve virtual key: {0:s}.'.format(
              virtual_key_path))

        return virtual_key

    key_path_prefix_upper, registry_file = self._GetFileByPath(key_path_upper)
    if not registry_file:
      return None

    if not key_path_upper.startswith(key_path_prefix_upper):
      raise RuntimeError('Key path prefix mismatch.')

    key_path_suffix = key_path[len(key_path_prefix_upper):]
    key_path = key_path_suffix or definitions.KEY_PATH_SEPARATOR
    return registry_file.GetKeyByPath(key_path)
788722
def relative_path(path):
    
    return os.path.join(os.path.dirname(__file__), path)
908472
def key_to_path(self, key):
        """"""
        return os.path.join(self.cache_dir, key[:2], key[2:4],
                            key[4:] + '.pkl')
874966
def GetSubkeyByPath(self, key_path):
    
    if not self._registry_key and self._registry:
      self._GetKeyFromRegistry()

    subkey = self
    for path_segment in key_paths.SplitKeyPath(key_path):
      subkey = subkey.GetSubkeyByName(path_segment)
      if not subkey:
        break

    return subkey
913499
private static String getPathForKey(Key k) {
    final int off = k._kb[0]==Key.DVEC ? Vec.KEY_PREFIX_LEN : 0;
    return new String(k._kb,off,k._kb.length-off);
  }
242947
private function getTtlPath(Memento\Key $key = null)
    {
        return $this->getKeyPath($this->groupKey ? null : $key);
    }
1195084
def GetSubkeyByPath(self, key_path):
    
    subkey = self
    for path_segment in key_paths.SplitKeyPath(key_path):
      subkey = subkey.GetSubkeyByName(path_segment)
      if not subkey:
        break

    return subkey
833007
def hash_key_path(hash, *path)
      result = nil

      path.each do |key|
        return nil unless hash.respond_to? :"[]"
        result = hash = hash[key]
      end

      return result
    end
841662
private function getFilePath($key) {
        $key = md5($key);
        return $this->directory.$key[0].DIRECTORY_SEPARATOR.$key[1].DIRECTORY_SEPARATOR.substr($key, 2);
    }
630431
def relative_path(sub_directory='', function_index=1):
    
    frm = inspect.currentframe()
    for i in range(function_index):
        frm = frm.f_back
    if frm.f_code.co_name == 'run_code':
        frm = frm.f_back

    if not isinstance(sub_directory, list):
        sub_directory = sub_directory.replace('\\','/').split('/')

    path = os.path.split(frm.f_code.co_filename)[0]
    if sub_directory:
        path = os.path.abspath(os.path.join(path, *sub_directory))
    return path
709319
function relative(path){
  var startX = 0
  var startY = 0
  var x = 0
  var y = 0

  return path.map(function(seg){
    seg = seg.slice()
    var type = seg[0]
    var command = type.toLowerCase()

    // is absolute
    if (type != command) {
      seg[0] = command
      switch (type) {
        case 'A':
          seg[6] -= x
          seg[7] -= y
          break
        case 'V':
          seg[1] -= y
          break
        case 'H':
          seg[1] -= x
          break
        default:
          for (var i = 1; i < seg.length;) {
            seg[i++] -= x
            seg[i++] -= y
          }
      }
    }

    // update cursor state
    switch (command) {
      case 'z':
        x = startX
        y = startY
        break
      case 'h':
        x += seg[1]
        break
      case 'v':
        y += seg[1]
        break
      case 'm':
        x += seg[1]
        y += seg[2]
        startX += seg[1]
        startY += seg[2]
        break
      default:
        x += seg[seg.length - 2]
        y += seg[seg.length - 1]
    }

    return seg
  })
}
1165797
def get_thumbpath(self, path, key, format):
        
        relpath = os.path.dirname(path)
        thumbsdir = self.get_thumbsdir(path)
        name, _ = os.path.splitext(os.path.basename(path))
        name = '{}.{}.{}'.format(name, key, format.lower())
        return os.path.join(relpath, thumbsdir, name)
409010
private File getKeyPath(final Key key) {
        KeyType keyType = null;
        if (key instanceof PrivateKey) {
            keyType = KeyType.PRIVATE;
        } else if (key instanceof PublicKey) {
            keyType = KeyType.PUBLIC;
        } else if (key instanceof SecretKey) {
            keyType = KeyType.SECRET;
        }
        return getKeyPath(keyType);
    }
549430
def make_path_relative(path):
    
    if os.path.isabs(path):
        drive_s,path = os.path.splitdrive(path)

        import re
        if not drive_s:
            path=re.compile("/*(.*)").findall(path)[0]
        else:
            path=path[1:]

    assert( not os.path.isabs( path ) ), path
    return path