Get the context of the file using full path name
431206
def get_file_contents(file_path):
  """"""
  full_path = os.path.join(package_dir, file_path)
  return open(full_path, 'r').read()
1083566
def find(name):
    """"""

    if op.exists(name):
        return name

    path = op.dirname(__file__) or '.'

    paths = [path] + config['include_path']

    for path in paths:
        filename = op.abspath(op.join(path, name))
        if op.exists(filename):
            return filename

        for d in os.listdir(path):
            fullpath = op.abspath(op.join(path, d))
            if op.isdir(fullpath):
                filename = op.abspath(op.join(fullpath, name))
                if op.exists(filename):
                    return filename

    return None
1110712
def get_root_path():
    """"""
    root_path = __file__
    return os.path.dirname(os.path.realpath(root_path))
985569
private function getFilePath()
    {
        $fullname = $this->fullName;
        $rootPath = $_SERVER['DOCUMENT_ROOT'];

        if (substr($fullname, 0, 1) != '/') {
            $fullname = '/' . $fullname;
        }

        return $rootPath . $fullname;
    }
530820
def _getFullPathName(self, containingNodes):
        
        assert isinstance(containingNodes, list)
        return [(self.options.fullPathNamespace, 'module')] + containingNodes
679991
def _search_path(self, directory_name, filename):
        """"""
        full_path = path.join(directory_name, filename)
        if path.exists(full_path):
            return full_path

        # Could not find the requested file in any of the directories
        return None
532765
function determinePartialName(partial_path, source_path, options) {
  var match, rel, abs,
    path_reg = /(\.\.?\/)?(.+)/;

  // use a regex to find whether or not this is a relative path  
  match = path_reg.exec(partial_path);
  if (match[1]) {
    // use os-appropriate separator
    rel = partial_path.replace('/', path.sep);

    // join the root, the source_path, and the relative path, then find the relative path from the root
    // this is the new "absolute"" path
    abs = path.relative(options.root, path.join(options.root, source_path, rel));
  } else {
    // use os-appropriate separator
    abs = match[2].replace('/', path.sep);
  }

  // now use the naming function to get the name
  return options.namingFn(abs, options);
}
26489
def _ResolveContext(self, context, name, raw_data, path=None):
    """"""
    if path is None:
      path = []

    for element in context:
      if element not in self.valid_contexts:
        raise InvalidContextError("Invalid context specified: %s" % element)

      if element in raw_data:
        context_raw_data = raw_data[element]

        value = context_raw_data.get(name)
        if value is not None:
          if isinstance(value, string_types):
            value = value.strip()

          yield context_raw_data, value, path + [element]

        # Recurse into the new context configuration.
        for context_raw_data, value, new_path in self._ResolveContext(
            context, name, context_raw_data, path=path + [element]):
          yield context_raw_data, value, new_path
1248590
def data_context_name(fn):
    
    return os.path.join(os.path.dirname(__file__), "template_data", fn)
1371401
def get_path_and_name(full_name):
    
    if full_name:
        parts = full_name.split("/")
        return ("/".join(parts[0:-1]), parts[-1]) if len(parts) > 1 else ("/", full_name)
    return None, None
1024632
function getFullFilename(filename) {
  if (p.isAbsolute(filename)) {
    return filename
  }
  return p.join(process.cwd(), filename)
}
931251
def _get_paths(self, fullname):
        
        real_path = os.path.join(*fullname[len(self.package_prefix):].split('.'))
        for base_path in sys.path:
            if base_path == '':
                # Empty string means process's cwd
                base_path = os.getcwd()
            path = os.path.join(base_path, real_path)
            yield path + '.ipynb'
            yield path + '.py'
            yield os.path.join(path, '__init__.ipynb')
            yield os.path.join(path, '__init__.py')
69069
def full(self):
        
        if self.path:
            if self.name:
                return 
            else:
                return self.path
            # end if
        else:
            if self.name:
                return self.name
            else:
                return ""
1010797
def get_root_path():
    """"""
    return os.path.realpath(os.path.join(os.path.dirname(__file__), os.pardir))
162095
def archive_context(filename):
    
    tmpdir = tempfile.mkdtemp()
    log.warn('Extracting in %s', tmpdir)
    old_wd = os.getcwd()
    try:
        os.chdir(tmpdir)
        with ContextualZipFile(filename) as archive:
            archive.extractall()

        # going in the directory
        subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])
        os.chdir(subdir)
        log.warn('Now working in %s', subdir)
        yield

    finally:
        os.chdir(old_wd)
        shutil.rmtree(tmpdir)
365755
def _find_file(self, path, silent=False):
        
        for filename in DEFAULT_FILENAMES:
            full_path = os.path.join(path, filename) if path else filename
            if os.path.exists(full_path):
                return full_path

        # Return default filename if silent
        if silent:
            return os.path.join(path, DEFAULT_FILENAME)

        raise ReadmeNotFoundError(path)
894653
def getfullfilename(file_path):
        ''' 
        '''
        warnings.warn("getfullfilename() is deprecated and will be removed in near future. Use chirptext.io.write_file() instead", DeprecationWarning)
        if file_path:
            return os.path.basename(file_path)
        else:
            return ''