Return the random directory name chosen to use for tool / workflow output
969103
def random_outdir():  # type: () -> Text
    
    # compute this once and store it as a function attribute - each subsequent call will return the same value
    if not hasattr(random_outdir, 'outdir'):
        random_outdir.outdir = '/' + ''.join([random.choice(string.ascii_letters) for _ in range(6)])  # type: ignore  # nosec
    return random_outdir.outdir
318209
def _get_random_name(name_list):
        
        length = len(name_list)
        index = random.randrange(length)

        return name_list[index]['name']
1189805
def _make_command_filename(self, exe):
        """"""

        outfn = os.path.join(self.commons['cmddir'], self.name(),
                             self._mangle_command(exe))

        # check for collisions
        if os.path.exists(outfn):
            inc = 2
            while True:
                newfn = "%s_%d" % (outfn, inc)
                if not os.path.exists(newfn):
                    outfn = newfn
                    break
                inc += 1

        return outfn
217676
def dev_dir(self) -> str:
        
        user = self.user()
        folder = self.random.choice(['Development', 'Dev'])
        stack = self.random.choice(PROGRAMMING_LANGS)
        return str(self._pathlib_home / user / folder / stack)
36684
def _generate_filenames(sources):
    
    for source in sources:
        if os.path.isdir(source):
            for path, dirlist, filelist in os.walk(source):
                for fname in filelist:
                    if GenericFilePath.is_compressed(fname):
                        if VERBOSE:
                            print("Skipping compressed file: {}".format(os.path.abspath(fname)))
                        continue
                    else:
                        yield os.path.join(path, fname)

        elif os.path.isfile(source):
            yield source

        elif source.isdigit():
            analysis_id = "AN{}".format(source.zfill(6))
            url = MWREST.format(analysis_id)
            yield url

        elif GenericFilePath.is_url(source):
            yield source

        else:
            raise TypeError("Unknown file source.")
1304819
def get_dir(self):
        
        if "-WD" in sys.argv and self.FIRST_RUN:
            ind = sys.argv.index('-WD')
            self.WD = os.path.abspath(sys.argv[ind+1])
            os.chdir(self.WD)
            self.WD = os.getcwd()
            self.dir_path.SetValue(self.WD)
        else:
            self.on_change_dir_button(None)
            #self.WD = os.getcwd()

        self.FIRST_RUN = False
402249
def rel_path(name, available_tools):
        
        if name == '@' or name == '.' or name == '/':
            name = ''
        multi_tool = '@' in name
        for tool in available_tools:
            t_name = tool[0].lower()
            if multi_tool:
                if name.split('@')[-1] == t_name.split('@')[-1]:
                    return t_name, t_name
            else:
                if name == t_name.split('/')[-1]:
                    return t_name, tool[0]
                elif name == '' and t_name.split('@')[-1] == 'unspecified':
                    return '', ''
        return None, None
197875
def get_DIR(self):
        
        dlg = wx.DirDialog(self, "Choose a directory:", defaultPath=self.currentDirectory,
                           style=wx.DD_DEFAULT_STYLE | wx.DD_NEW_DIR_BUTTON | wx.DD_CHANGE_DIR)
        ok = self.show_dlg(dlg)
        if ok == wx.ID_OK:
            new_WD = dlg.GetPath()
            dlg.Destroy()
        else:
            new_WD = os.getcwd()
            dlg.Destroy()
        return new_WD
460276
def get_dl_dirname(url):
  """"""
  checksum = hashlib.sha256(tf.compat.as_bytes(url)).hexdigest()
  return get_dl_fname(url, checksum)
1274639
def _generate_output_dir(settings, path):
        

        relpath = os.path.relpath(settings.root,path)
        count = relpath.count(os.sep) + 1

        return relpath+os.path.sep, count
704325
def output_dir(self, *args) -> str:
        
        return os.path.join(self.project_dir, 'output', *args)
3210
def _get_whl_from_dir(cls, install_dir):
    """"""
    dist_dir = cls._get_dist_dir(install_dir)
    dists = glob.glob(os.path.join(dist_dir, '*.whl'))
    if len(dists) == 0:
      raise cls.BuildLocalPythonDistributionsError(
        'No distributions were produced by python_create_distribution task.\n'
        'dist_dir: {}, install_dir: {}'
        .format(dist_dir, install_dir))
    if len(dists) > 1:
      # TODO: is this ever going to happen?
      raise cls.BuildLocalPythonDistributionsError('Ambiguous local python distributions found: {}'
                                                   .format(dists))
    return dists[0]
1239397
def get_vs_dir_from_tool_dir(self):
        
        index = self.tool_dir.find(r'Common7\Tools')
        return self.tool_dir[:index]
586501
def select_directory(self, edit):
        """"""
        basedir = to_text_string(edit.text())
        if not osp.isdir(basedir):
            basedir = getcwd_or_home()
        title = _("")
        directory = getexistingdirectory(self, title, basedir)
        if directory:
            edit.setText(directory)
1147272
function determineArtifactName( generator ) {
   if( generator.name ) {
      return generator.name;
   }
   if( generator.env.cwd !== generator.destinationRoot() && generator.options.directory.length === 0) {
      var artifactPath = path.relative( generator.destinationRoot(), generator.env.cwd );
      return path.basename( artifactPath );
   }
   return '';
}
1081708
def get_output_dir(self, nb):
        """"""
        self.package_dir, self.package_name = self.get_package_dir_name(nb)

        return join(self.package_dir, self.package_name)
181417
def generate_vars(project_name, project_dir):
    

    out = vary_name(project_name)
    out['random_key'] = make_random_key()
    out['settings_file'] = make_file_path(
        project_dir,
        project_name,
        path.join('src', project_name),
        'settings.py',
    )

    return out