Returns tuple (logdir, telemetry_log_filepath, raw_telemetry_log_filepath)
512121
def log_paths():
    ''''''
    if opts.aircraft is not None:
        dirname = ""
        if opts.mission is not None:
            print(opts.mission)
            dirname += "%s/logs/%s/Mission%s" % (opts.aircraft, time.strftime("%Y-%m-%d"), opts.mission)
        else:
            dirname += "%s/logs/%s" % (opts.aircraft, time.strftime("%Y-%m-%d"))
        # dirname is currently relative.  Possibly add state_basedir:
        if mpstate.settings.state_basedir is not None:
            dirname = os.path.join(mpstate.settings.state_basedir,dirname)
        mkdir_p(dirname)
        highest = None
        for i in range(1, 10000):
            fdir = os.path.join(dirname, 'flight%u' % i)
            if not os.path.exists(fdir):
                break
            highest = fdir
        if mpstate.continue_mode and highest is not None:
            fdir = highest
        elif os.path.exists(fdir):
            print("Flight logs full")
            sys.exit(1)
        logname = 'flight.tlog'
        logdir = fdir
    else:
        logname = os.path.basename(opts.logfile)
        dir_path = os.path.dirname(opts.logfile)
        if not os.path.isabs(dir_path) and mpstate.settings.state_basedir is not None:
            dir_path = os.path.join(mpstate.settings.state_basedir,dir_path)

        logdir = dir_path

    mkdir_p(logdir)
    return (logdir,
            os.path.join(logdir, logname),
            os.path.join(logdir, logname + '.raw'))
73658
def file_list(self, tgt_env):
        '''
        
        '''
        files = set()
        symlinks = {}
        tree = self.get_tree(tgt_env)
        if not tree:
            # Not found, return empty objects
            return files, symlinks
        if self.root(tgt_env):
            try:
                tree = tree / self.root(tgt_env)
            except KeyError:
                return files, symlinks
            relpath = lambda path: os.path.relpath(path, self.root(tgt_env))
        else:
            relpath = lambda path: path
        add_mountpoint = lambda path: salt.utils.path.join(
            self.mountpoint(tgt_env), path, use_posixpath=True)
        for file_blob in tree.traverse():
            if not isinstance(file_blob, git.Blob):
                continue
            file_path = add_mountpoint(relpath(file_blob.path))
            files.add(file_path)
            if stat.S_ISLNK(file_blob.mode):
                stream = six.StringIO()
                file_blob.stream_data(stream)
                stream.seek(0)
                link_tgt = stream.read()
                stream.close()
                symlinks[file_path] = link_tgt
        return files, symlinks
719140
def get_log_path(config_file_name):
    ''''''
    stdout_full_path = os.path.join(NNICTL_HOME_DIR, config_file_name, 'stdout')
    stderr_full_path = os.path.join(NNICTL_HOME_DIR, config_file_name, 'stderr')
    return stdout_full_path, stderr_full_path
229294
private List<Path> getLocalLogDirs() throws IOException {
    String logDirs = System.getenv(ApplicationConstants.Environment.LOG_DIRS.toString());
    return COMMA_SPLITTER.splitToList(logDirs).stream().map(e -> new Path(e)).collect(Collectors.toList());
  }
377345
def _margtime_loglr(self, mf_snr, opt_snr):
        
        return special.logsumexp(mf_snr, b=self._deltat) - 0.5*opt_snr
210665
def create_zip_dir(zipfile_path, *file_list):
   
   try:
      if isinstance(file_list, (list, tuple)): #unfolding list of list or tuple
         if len(file_list) == 1:
            if isinstance(file_list[0], (list, tuple)): file_list = file_list[0]
      #converting string to iterable list
      if isinstance(file_list, str): file_list = [file_list]
      if file_list:
         with ZipFile(zipfile_path, 'w') as zf:
            for cur_file in file_list:
               if '/' in cur_file:
                  os.chdir('/'.join(cur_file.split('/')[:-1]))
               elif '/' in zipfile_path:
                  os.chdir('/'.join(zipfile_path.split('/')[:-1]))
               zf.write(cur_file.split('/')[-1])
      else:
         debug.log('Error: No Files in list!',zipfile_path+' was not created!')
   except Exception as e:
      debug.log('Error: Could not create zip dir! argtype: '+
                 str(type(file_list)), "FileList: "+ str(file_list),
                 "Errormessage: "+ str(e))
886238
def getDirectory(*args):
        
        result = QtGui.QFileDialog.getDirectory(*args)
        
        # PyQt4 returns just a string
        if type(result) is not tuple:
            return result, bool(result)
        
        # PySide returns a tuple of str, bool
        else:
            return result
470343
def _GetSubFileEntries(self):
    
    tar_file = self._file_system.GetTARFile()

    if self._directory is None:
      self._directory = self._GetDirectory()

    if self._directory and tar_file:
      for path_spec in self._directory.entries:
        location = getattr(path_spec, 'location', None)
        if location is None:
          continue

        kwargs = {}
        try:
          kwargs['tar_info'] = tar_file.getmember(location[1:])
        except KeyError:
          kwargs['is_virtual'] = True

        yield TARFileEntry(
            self._resolver_context, self._file_system, path_spec, **kwargs)
257143
def _get_files_generator(src_dir, files_list):
    
    if files_list:
        for d in files_list:
            yield {
                'src': os.path.join(src_dir, d['src']),
                'dst': _get_dst_dir(d['dst']),
                'post_commands': d.get('post_commands', []),
            }
1227622
def get_summaries_log_dir(decode_hp, output_dir, dataset_split):
  """"""
  child_dir = decode_hp.summaries_log_dir
  level_dir = "".join([str(level) for level in decode_hp.level_interp])
  if decode_hp.channel_interp == "all":
    rank_dir = "all"
  else:
    rank_dir = "rank_%d" % decode_hp.rank_interp
  child_dir = "%s/%s_%s" % (child_dir, level_dir, rank_dir)
  if dataset_split is not None:
    child_dir += "_{}".format(dataset_split)
  return os.path.join(output_dir, child_dir)
572707
def log_root(self):
        
        var_log = (
            os.path.join(sys.prefix, 'var', 'log')
            .replace('/usr/var', '/var')
        )
        if not os.path.isdir(var_log):
            os.makedirs(var_log)
        return var_log
859557
def get_log_filehandle(context):
    
    log_file_name = get_log_filename(context)
    makedirs(context.config['task_log_dir'])
    with open(log_file_name, "w", encoding="utf-8") as filehandle:
        yield filehandle
1302195
def readB1logfile(filename):
    
    dic = dict()
    # try to open. If this fails, an exception is raised
    with open(filename, 'rt', encoding='utf-8') as f:
        for l in f:
            l = l.strip()
            if l[0] in '#!%\'':
                continue  # treat this line as a comment
            try:
                # find the first tuple in _logfile_data where the first element of the
                # tuple is the starting of the line.
                ld = [ld_ for ld_ in _logfile_data if l.split(
                    ':', 1)[0].strip() == ld_[0]][0]
            except IndexError:
                # line is not recognized. We can still try to load it: find the first
                # semicolon. If found, the part of the line before it is stripped
                # from whitespaces and will be the key. The part after it is stripped
                # from whitespaces and parsed with misc.parse_number(). If no
                if ':' in l:
                    key, val = [x.strip() for x in l.split(':', 1)]
                    val = misc.parse_number(val)
                    dic[key] = val
                    try:
                        # fix the character encoding in files written by a
                        # previous version of this software.
                        dic[key] = dic[key].encode('latin2').decode('utf-8')
                    except (UnicodeDecodeError, UnicodeEncodeError, AttributeError):
                        pass
                else:
                    dic[l.strip()] = True
                continue
            try:
                reader = ld[3]
            except IndexError:
                reader = str
            rhs = l.split(':', 1)[1].strip()
            try:
                vals = reader(rhs)
            except ValueError:
                if rhs.lower() == 'none':
                    vals = None
                else:
                    raise
            if isinstance(ld[1], tuple):
                # more than one field names. The reader function should return a
                # tuple here, a value for each field.
                if len(vals) != len(ld[1]):
                    raise ValueError(
                        'Cannot read %d values from line %s in file!' % (len(ld[1]), l))
                dic.update(dict(list(zip(ld[1], vals))))
            else:
                dic[ld[1]] = vals
    dic['__Origin__'] = 'B1 log'
    dic['__particle__'] = 'photon'
    return dic
332931
def read(self, log_file):
        
        if os.path.isdir(os.path.dirname(log_file)) and os.path.isfile(log_file):
            with open(log_file, 'r') as LogFile:
                data = LogFile.readlines()
                data = "".join(line for line in data)
        else:
            data = ''
        return data
1079416
def file_logger(app, level=None):
    
    path = os.path.join(os.getcwd(), 'var', 'logs',  'app.log')

    max_bytes = 1024 * 1024 * 2
    file_handler = RotatingFileHandler(
        filename=path,
        mode='a',
        maxBytes=max_bytes,
        backupCount=10
    )

    if level is None: level = logging.INFO
    file_handler.setLevel(level)

    log_format  = '%(asctime)s %(levelname)s: %(message)s'
    log_format += ' [in %(pathname)s:%(lineno)d]'
    file_handler.setFormatter(logging.Formatter(log_format))

    return file_handler
656202
def list_directory(self, *args, **kwargs):
		
		return tuple(self.dav_client().list(self.session_path()))
711745
def listdir(self):
        """"""
        ls = os.listdir(self._folder)
        return [x for x in ls if os.path.splitext(x)[1][1:] == "log"]