Define the default output filenames for drizzle products,
            these are based on the original rootname of the image
            filename should be just 1 filename, so call this in a loop
            for chip names contained inside a file.
327177
def _setOutputNames(self,rootname,suffix='_drz'):
        
        # Define FITS output filenames for intermediate products

        # Build names based on final DRIZZLE output name
        # where 'output' normally would have been created
        #   by 'process_input()'
        #
        outFinal = rootname+suffix+'.fits'
        outSci = rootname+suffix+'_sci.fits'
        outWeight = rootname+suffix+'_wht.fits'
        outContext = rootname+suffix+'_ctx.fits'
        outMedian = rootname+'_med.fits'

        # Build names based on input name
        origFilename = self._filename.replace('.fits','_OrIg.fits')
        outSky = rootname + '_sky.fits'
        outSingle = rootname+'_single_sci.fits'
        outSWeight = rootname+'_single_wht.fits'
        crCorImage = rootname+'_crclean.fits'

        # Build outputNames dictionary
        fnames={
            'origFilename': origFilename,
            'outFinal': outFinal,
            'outMedian': outMedian,
            'outSci': outSci,
            'outWeight': outWeight,
            'outContext': outContext,
            'outSingle': outSingle,
            'outSWeight': outSWeight,
            'outSContext': None,
            'outSky': outSky,
            'crcorImage': crCorImage,
            'ivmFile': None
        }

        return fnames
796960
def _checkpoint_out_filenames(self):
        
        out_filenames = []
        if self.Parameters['-n'].isOn():
            out_name = str(self.Parameters['-n'].Value)
            walk_root = self.WorkingDir
            if self.Parameters['-w'].isOn():
                walk_root = str(self.Parameters['-w'].Value)
            for tup in walk(walk_root):
                dpath, dnames, dfiles = tup
                if dpath == walk_root:
                    for gen_file in dfiles:
                        if out_name in gen_file and "checkpoint" in gen_file:
                            out_filenames.append(walk_root + gen_file)
                    break

        else:
            raise ValueError, "No output file specified."
        return out_filenames
1168471
def _default_output_dir():
  """"""
  try:
    dataset_name = gin.query_parameter("inputs.dataset_name")
  except ValueError:
    dataset_name = "random"
  dir_name = "{model_name}_{dataset_name}_{timestamp}".format(
      model_name=gin.query_parameter("train.model").configurable.name,
      dataset_name=dataset_name,
      timestamp=datetime.datetime.now().strftime("%Y%m%d_%H%M"),
  )
  dir_path = os.path.join("~", "trax", dir_name)
  print()
  trax.log("No --output_dir specified")
  return dir_path
819276
def get_config_filename(args):
    ''''''
    experiment_id = check_experiment_id(args)
    if experiment_id is None:
        print_error('Please set the experiment id!')
        exit(1)
    experiment_config = Experiments()
    experiment_dict = experiment_config.get_all_experiments()
    return experiment_dict[experiment_id]['fileName']
1049366
def set_default_names(data):
    """"""
    if all(name is not None for name in data.index.names):
        return data

    data = data.copy()
    if data.index.nlevels > 1:
        names = [name if name is not None else 'level_{}'.format(i)
                 for i, name in enumerate(data.index.names)]
        data.index.names = names
    else:
        data.index.name = data.index.name or 'index'
    return data
727649
def _module_name(filename):
        

        absfile = os.path.abspath(filename)
        match = filename

        for base in [''] + sys.path:
            base = os.path.abspath(base)
            if absfile.startswith(base):
                match = absfile[len(base):]
                break

        return SUFFIX_RE.sub('', match).lstrip('/').replace('/', '.')
438047
def _create_cache_filename(self, cache_dir=None, **kwargs):
        """"""
        cache_dir = cache_dir or '.'
        hash_str = self.get_hash(**kwargs)

        return os.path.join(cache_dir, 'resample_lut-' + hash_str + '.npz')
188402
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 nmrstarlib.VERBOSE:
                        print("Processing file: {}".format(os.path.abspath(fname)))
                    if GenericFilePath.is_compressed(fname):
                        if nmrstarlib.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 GenericFilePath.is_url(source):
            yield source

        elif source.isdigit():
            try:
                urlopen(nmrstarlib.BMRB_REST + source)
                yield nmrstarlib.BMRB_REST + source
            except HTTPError:
                urlopen(nmrstarlib.PDB_REST + source + ".cif")
                yield nmrstarlib.PDB_REST + source + ".cif"

        elif re.match("[\w\d]{4}", source):
            yield nmrstarlib.PDB_REST + source + ".cif"

        else:
            raise TypeError("Unknown file source.")
430216
def find_source_files_from_list(self, file_names):
        
        for file_name in file_names:
            if os.path.exists(file_name):
                routine_name = os.path.splitext(os.path.basename(file_name))[0]
                if routine_name not in self._source_file_names:
                    self._source_file_names[routine_name] = file_name
                else:
                    self._io.error("Files '{0}' and '{1}' have the same basename.".
                                   format(self._source_file_names[routine_name], file_name))
                    self.error_file_names.add(file_name)
            else:
                self._io.error("File not exists: '{0}'".format(file_name))
                self.error_file_names.add(file_name)
666246
def _candidate_filenames():
    
    while True:
        random_stub = ''.join([
            random.choice(string.ascii_letters + string.digits)
            for _ in range(5)
        ])
        yield 'specktre_%s.png' % random_stub
827764
def output_names(self):
        """"""
        if self.binded:
            return self._curr_module.output_names
        else:
            symbol, _, _ = self._call_sym_gen(self._default_bucket_key)
            return symbol.list_outputs()
895204
def get_filename(self, runSetName, fileExtension):
        '''
        
        '''

        fileName = self.benchmark.output_base_name + ".results."

        if runSetName:
            fileName += runSetName + "."

        return fileName + fileExtension
767182
def filename_match(filename, patterns, default=True):
    
    if not patterns:
        return default
    return any(fnmatch(filename, pattern) for pattern in patterns)
847986
def calc_filenames(self, is_correct: bool, actual_output: bool, threshold=0.5) -> list:
        """"""
        return [
            filename
            for output, target, filename in zip(self.outputs, self.targets, self.filenames)
            if ((output > threshold) == bool(target)) == is_correct and actual_output == bool(output > threshold)
        ]
428551
def diamond_assignment_output_basename(self, out_path):
        ''''''
        return os.path.join(self.outdir, out_path, "%s_diamond_assignment" % out_path)
803741
def set_regionfiles(self, filenames):
        
        for filename in filenames:
            # Assume that filenames have the name r.<x-digit>.<z-digit>.<extension>
            m = re.match(r"r.(\-?\d+).(\-?\d+)."+self.extension, os.path.basename(filename))
            if m:
                x = int(m.group(1))
                z = int(m.group(2))
            else:
                # Only raised if a .mca of .mcr file exists which does not comply to the
                #  r.<x-digit>.<z-digit>.<extension> filename format. This may raise false
                # errors if a copy is made, e.g. "r.0.-1 copy.mca". If this is an issue, override
                # get_filenames(). In most cases, it is an error, and we like to raise that.
                # Changed, no longer raise error, because we want to continue the loop.
                # raise UnknownWorldFormat("Unrecognized filename format %s" % os.path.basename(filename))
                # TODO: log to stderr using logging facility.
                pass
            self.regionfiles[(x,z)] = filename
1239110
private String generateFileName() {
        int checksum = 1;

        Set<TypeId<?>> typesKeySet = types.keySet();
        Iterator<TypeId<?>> it = typesKeySet.iterator();
        int[] checksums = new int[typesKeySet.size()];
        int i = 0;

        while (it.hasNext()) {
            TypeId<?> typeId = it.next();
            TypeDeclaration decl = getTypeDeclaration(typeId);
            Set<MethodId> methodSet = decl.methods.keySet();
            if (decl.supertype != null) {
                int sum = 31 * decl.supertype.hashCode() + decl.interfaces.hashCode();
                checksums[i++] = 31 * sum + methodSet.hashCode();
            }
        }
        Arrays.sort(checksums);

        for (int sum : checksums) {
            checksum *= 31;
            checksum += sum;
        }

        return "Generated_" + checksum +".jar";
    }