def setUp(self): self.sf = serverfiles.ServerFiles(server="http://localhost:12345/") t = time.time() while time.time( ) - t < 1.: #wait for at most 1 second for server process to come online try: self.sf.info("domain1", "withinfo") break except: pass self.path = tempfile.mkdtemp() self.lf = serverfiles.LocalFiles(path=self.path, serverfiles=self.sf)
def scan_url(topdir: str, include_patterns: Tuple[str] = ("*",), exclude_patterns: Tuple[str] = (".*",)) -> List[str]: try: files = serverfiles.ServerFiles(topdir).listfiles() except ConnectionError: return [] include_patterns = include_patterns or ("*",) paths = [] for filename in files: path = topdir + "/".join(filename) if matches_any(path, include_patterns) and \ not matches_any(path, exclude_patterns): paths.append(path) return paths
def __init__(self): self.local_data = os.path.join(data_dir(versioned=False), 'sentiment/') self.serverfiles = serverfiles.ServerFiles(self.server_url) self.localfiles = serverfiles.LocalFiles(self.local_data, serverfiles=self.serverfiles) self._supported_languages = []
def __init__(self): self.local_data = os.path.join(data_dir(versioned=False), 'udpipe/') self.serverfiles = serverfiles.ServerFiles(self.server_url) self.localfiles = serverfiles.LocalFiles(self.local_data, serverfiles=self.serverfiles)
import os import serverfiles from Orange.misc.environ import data_dir import orangecontrib.infrared # loads file readers server = serverfiles.ServerFiles("http://193.2.72.57/infrared-data/") localfiles = serverfiles.LocalFiles( os.path.join(data_dir(), "orange-infrared"), serverfiles=server) def spectra20nea(): return localfiles.localpath_download("spectra20.nea") def dust(): localfiles.localpath_download("20160831_06_Paris_25x_highmag.dat") return localfiles.localpath_download("20160831_06_Paris_25x_highmag.hdr")
if __name__ == '__main__': def start_server(): class Handler(SimpleHTTPRequestHandler): def __init__(self, *args, **kwargs): super().__init__(*args, directory='serverfiles/', **kwargs) httpd = HTTPServer(('localhost', 8000), Handler) httpd.serve_forever() p = Process(target=start_server) p.start() prepare_gene_serverfiles() prepare_marker_genes_serverfiles() prepare_homologene_serverfiles() prepare_dictybase_serverfiles() prepare_go_serverfiles() prepare_gene_sets_serverfiles() prepare_taxonomy_serverfiles() info = list( serverfiles.ServerFiles( server='http://localhost:8000/').allinfo().items()) with open('serverfiles/__INFO__', 'wt') as f: json.dump(info, f) shutil.make_archive('serverfiles_dump', 'gztar', root_dir='serverfiles/') p.terminate()