iterate over shared files and get their public URI
973426
def sharedFiles(self):
        ''
        for f in self.sharing.files.iterchildren():
            yield (f.attrib['name'], f.attrib['uuid'],
                'https://www.jottacloud.com/p/%s/%s' % (self.jfs.username, f.publicURI.text))
464474
def set_uri(self, uri):
        '''
        
        '''
        publicObj = self.get_public()
        if publicObj is not None:
            publicObj.set_uri(uri)
        else:
            publicObj = Cpublic()
            publicObj.set_uri(uri)
            self.set_public(publicObj)
1298441
def get_file_url(self, fid, public=None):
        
        try:
            volume_id, rest = fid.strip().split(",")
        except ValueError:
            raise BadFidFormat(
                "fid must be in format: <volume_id>,<file_name_hash>")
        file_location = self.get_file_location(volume_id)
        if public is None:
            public = self.use_public_url
        volume_url = file_location.public_url if public else file_location.url
        url = "http://{volume_url}/{fid}".format(
            volume_url=volume_url, fid=fid)
        return url
1205384
def get_file_contents(self, path, ref=github.GithubObject.NotSet):
        
        assert isinstance(path, (str, unicode)), path
        assert ref is github.GithubObject.NotSet or isinstance(ref, (str, unicode)), ref
        url_parameters = dict()
        if ref is not github.GithubObject.NotSet:
            url_parameters["ref"] = ref
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            self.url + "/contents/" + urllib.quote(path),
            parameters=url_parameters
        )
        if isinstance(data, list):
            return [
                github.ContentFile.ContentFile(self._requester, headers, item, completed=False)
                for item in data
            ]
        return github.ContentFile.ContentFile(self._requester, headers, data, completed=True)
399472
def fetchFiles(self):
        """"""
        print("Fetching files from {}".format(self.baseDir))
        files = glob(path.join(self.baseDir, '*'))
        filesDef = []
        for f in files:
            print("Found SPARQL file {}".format(f))
            relative = f.replace(self.baseDir, '')
            filesDef.append({
                'download_url': relative,
                'name': relative
            })
        return filesDef
32005
def ftp_listing_paths(ftpconn: FTP, root: str) -> Iterable[str]:
    """"""

    for current_path, dirs, files in ftp_walk(ftpconn, root):
        yield from (os.path.join(current_path, file) for file in files)
746855
function getFileList($rdir, $showHidden = false)
    {
        $filelist = '';
        if ($handle = opendir($rdir))
        {
            while (false !== ($file = readdir($handle)))
            {
                if ($file == '.' or $file == '..')
                {
                    continue;
                }

                if ($file{0} == "." and !$showHidden)
                {
                    continue;
                }

                $stats = stat($rdir . "/" . $file);
                if (is_dir($rdir . "/" . $file)) $mode = "d"; else $mode = "-";
                $moded = sprintf("%o", ($stats['mode'] & 000777));
                $mode1 = substr($moded, 0, 1);
                $mode2 = substr($moded, 1, 1);
                $mode3 = substr($moded, 2, 1);
                switch ($mode1) {
                    case "0":
                        $mode .= "---";
                        break;
                    case "1":
                        $mode .= "--x";
                        break;
                    case "2":
                        $mode .= "-w-";
                        break;
                    case "3":
                        $mode .= "-wx";
                        break;
                    case "4":
                        $mode .= "r--";
                        break;
                    case "5":
                        $mode .= "r-x";
                        break;
                    case "6":
                        $mode .= "rw-";
                        break;
                    case "7":
                        $mode .= "rwx";
                        break;
                }
                switch ($mode2) {
                    case "0":
                        $mode .= "---";
                        break;
                    case "1":
                        $mode .= "--x";
                        break;
                    case "2":
                        $mode .= "-w-";
                        break;
                    case "3":
                        $mode .= "-wx";
                        break;
                    case "4":
                        $mode .= "r--";
                        break;
                    case "5":
                        $mode .= "r-x";
                        break;
                    case "6":
                        $mode .= "rw-";
                        break;
                    case "7":
                        $mode .= "rwx";
                        break;
                }
                switch ($mode3) {
                    case "0":
                        $mode .= "---";
                        break;
                    case "1":
                        $mode .= "--x";
                        break;
                    case "2":
                        $mode .= "-w-";
                        break;
                    case "3":
                        $mode .= "-wx";
                        break;
                    case "4":
                        $mode .= "r--";
                        break;
                    case "5":
                        $mode .= "r-x";
                        break;
                    case "6":
                        $mode .= "rw-";
                        break;
                    case "7":
                        $mode .= "rwx";
                        break;
                }
                $uidfill = "";
                for ($i = strlen($stats['uid']); $i < 5; $i++) $uidfill .= " ";
                $gidfill = "";
                for ($i = strlen($stats['gid']); $i < 5; $i++) $gidfill .= " ";
                $sizefill = "";
                for ($i = strlen($stats['size']); $i < 11; $i++) $sizefill .= " ";
                $nlinkfill = "";
                for ($i = strlen($stats['nlink']); $i < 5; $i++) $nlinkfill .= " ";
                $mtime = date("M d H:i", $stats['mtime']);
                $filelist .= $mode . $nlinkfill . $stats['nlink'] . " " . $stats['uid'] . $uidfill . $stats['gid'] . $gidfill . $sizefill . $stats['size'] . " " . $mtime . " " . $file . "\r\n";
            }
            closedir($handle);
        }
        return $filelist;
    }
734206
def get_files(path:PathOrStr, extensions:Collection[str]=None, recurse:bool=False,
              include:Optional[Collection[str]]=None)->FilePathList:
    ""
    if recurse:
        res = []
        for i,(p,d,f) in enumerate(os.walk(path)):
            # skip hidden dirs
            if include is not None and i==0:  d[:] = [o for o in d if o in include]
            else:                             d[:] = [o for o in d if not o.startswith('.')]
            res += _get_files(path, p, f, extensions)
        return res
    else:
        f = [o.name for o in os.scandir(path) if o.is_file()]
        return _get_files(path, path, f, extensions)
205231
def get_files(self, common_name):
        """"""

        record = self.get_record(common_name)
        return TLSFileBundle(common_name).from_record(record)
172630
def _folder_get_content_iter(self, folder_key=None):
        """"""

        lookup_params = [
            {'content_type': 'folders', 'node': 'folders'},
            {'content_type': 'files', 'node': 'files'}
        ]

        for param in lookup_params:
            more_chunks = True
            chunk = 0
            while more_chunks:
                chunk += 1
                content = self.api.folder_get_content(
                    content_type=param['content_type'], chunk=chunk,
                    folder_key=folder_key)['folder_content']

                # empty folder/file list
                if not content[param['node']]:
                    break

                # no next page
                if content['more_chunks'] == 'no':
                    more_chunks = False

                for resource_info in content[param['node']]:
                    yield resource_info
303666
def local_open(url):
    """"""
    scheme, server, path, param, query, frag = urllib.parse.urlparse(url)
    filename = urllib.request.url2pathname(path)
    if os.path.isfile(filename):
        return urllib.request.urlopen(url)
    elif path.endswith('/') and os.path.isdir(filename):
        files = []
        for f in os.listdir(filename):
            filepath = os.path.join(filename, f)
            if f == 'index.html':
                with open(filepath, 'r') as fp:
                    body = fp.read()
                break
            elif os.path.isdir(filepath):
                f += '/'
            files.append('<a href="{name}">{name}</a>'.format(name=f))
        else:
            tmpl = (
                "<html><head><title>{url}</title>"
                "</head><body>{files}</body></html>")
            body = tmpl.format(url=url, files='\n'.join(files))
        status, message = 200, "OK"
    else:
        status, message, body = 404, "Path not found", "Not found"

    headers = {'content-type': 'text/html'}
    body_stream = six.StringIO(body)
    return urllib.error.HTTPError(url, status, message, headers, body_stream)
420836
def _get_fs(self, create_dir=True):
        """"""
        filedir = dirname(self.fileurl)
        filename = basename(self.fileurl)

        return (
            opener.opendir(filedir, writeable=True, create_dir=create_dir),
            filename
        )
196294
def key_file_public(self):
        '''
        '''
        if not hasattr(self, '_key_file_public'):
            self.key_file_public = '~/.ssh/{key}.pub'.format(key=self.key_name)
        return self._key_file_public
527247
function tryReaddir(filepath) {
  var ctx = { path: filepath, files: [] };
  try {
    ctx.files = fs.readdirSync(filepath);
    return ctx;
  } catch (err) {}
  try {
    ctx.path = path.dirname(filepath);
    ctx.files = fs.readdirSync(ctx.path);
    return ctx;
  } catch (err) {}
  return null;
}
1267050
def get_file(type_str, open_files, basedir):
    """"""
    if type_str not in open_files:
        filename = type_str+".html"
        encoding = 'utf-8'
        fd = codecs.open(os.path.join(basedir, filename), 'w', encoding)
        open_files[type_str] = fd
        write_html_header(fd, type_str, encoding)
    return open_files[type_str]
820593
def files(
            self):
        
        relatedFilesResultsList = []
        relatedFilesResultsList[:] = [dict(l)
                                      for l in self.relatedFilesResultsList]
        return relatedFilesResultsList
431165
def create_shared_link(opts={})
      raise UnshareableResource unless ['folder', 'file'].include?(type)

      opts = {
        access: 'open'
      }.merge(opts) if opts

      url = "#{RubyBox::API_URL}/#{resource_name}/#{id}"
      uri = URI.parse(url)

      request = Net::HTTP::Put.new(uri.path, {
        "Content-Type" => 'application/json'
      })

      request.body = JSON.dump({
        shared_link: opts
      })

      @raw_item = @session.request(uri, request)
      self
    end