return the name of a model cube file
16838
def mcube(self, **kwargs):
        
        kwargs_copy = self.base_dict.copy()
        kwargs_copy.update(**kwargs)
        kwargs_copy['dataset'] = kwargs.get('dataset', self.dataset(**kwargs))
        kwargs_copy['component'] = kwargs.get(
            'component', self.component(**kwargs))
        self._replace_none(kwargs_copy)        
        localpath = NameFactory.mcube_format.format(**kwargs_copy)
        if kwargs.get('fullpath', False):
            return self.fullpath(localpath=localpath)
        return localpath
1294127
def get_output_file(self, in_file, instance, field, **kwargs):
        """"""
        return NamedTemporaryFile(mode='rb', suffix='_%s_%s%s' % (
            get_model_name(instance), field.name, self.get_ext()), delete=False)
1071600
def get_model_name(model):
    
    opts = model._meta
    if django.VERSION[:2] < (1, 7):
        model_name = opts.module_name
    else:
        model_name = opts.model_name

    return model_name
1170580
def model_to_file(model, filename):
    
    with open(filename, 'wb') as f:
        pickle.dump(model, f)
140155
def auto_model_name_recognize(model_name):
    
    name_list = model_name.split('-')
    return ''.join(['%s%s' % (name[0].upper(), name[1:]) for name in name_list])
860600
def _get_file_name(tlobject):
    """"""
    name = tlobject.name if isinstance(tlobject, TLObject) else tlobject
    # Courtesy of http://stackoverflow.com/a/1176023/4759433
    s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
    result = re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
    return '{}.html'.format(result)
841163
def _get_reference(self):
        
        super()._get_reference()
        self.cubeA_body_id = self.sim.model.body_name2id("cubeA")
        self.cubeB_body_id = self.sim.model.body_name2id("cubeB")
        self.l_finger_geom_ids = [
            self.sim.model.geom_name2id(x) for x in self.gripper.left_finger_geoms
        ]
        self.r_finger_geom_ids = [
            self.sim.model.geom_name2id(x) for x in self.gripper.right_finger_geoms
        ]
        self.cubeA_geom_id = self.sim.model.geom_name2id("cubeA")
        self.cubeB_geom_id = self.sim.model.geom_name2id("cubeB")
714341
def get_filesnames(self):
        """"""
        self._update()
        projects = set(list(self._tasks.keys()) + self._task_projects + ['all_projects', 'unaffiliated'])
        return [join(self._data_location, p.split()[0]) for p in projects]
1194191
public KerasModelBuilder modelYamlFilename(String modelYamlFilename) throws IOException {
        checkForExistence(modelYamlFilename);
        this.modelJson = new String(Files.readAllBytes(Paths.get(modelYamlFilename)));
        return this;
    }
562865
function name(file, implicit){
  function rel(name){
    return name ? String(name).replace(/^\//, '') : name;
  }

  if (file.filename)
    file.graphName = file.filename;

  if (file.sourceFilename)
    file.graphName = file.sourceFilename;

  if (!file.graphName && implicit && file.inline && file.htmlFile)
    return rel(file.htmlFile.filename);

  return rel(file.graphName);
}
260001
def get_name_for_model(cls, model):
        
        key = cls.get_model_key(model)
        model_str = cls._get_model_str(model)
        service = cls._registry[key]
        if model_str in service['resources']:
            return '{}.{}'.format(service['name'], service['resources'][model_str]['name'])
        else:
            return service['name']
470459
def _make_ltcube_file_list(ltsumfile, num_files):
    
    outbasename = os.path.basename(ltsumfile)
    lt_list_file = ltsumfile.replace('fits', 'lst')
    outfile = open(lt_list_file, 'w')
    for i in range(num_files):
        split_key = "%06i" % i
        output_dir = os.path.join(NAME_FACTORY.base_dict['basedir'], 'counts_cubes', split_key)
        filepath = os.path.join(output_dir, outbasename.replace('.fits', '_%s.fits' % split_key))
        outfile.write(filepath)
        outfile.write("\n")
    outfile.close()
    return '@' + lt_list_file
1147069
def list_cubes(self):
        
        for file_name in os.listdir(self.directory):
            if '.' in file_name:
                name, ext = file_name.rsplit('.', 1)
                if ext.lower() == 'json':
                    yield name
560690
def save_model(self, file_name='model.sbgn'):
        
        model = self.print_model()
        with open(file_name, 'wb') as fh:
            fh.write(model)
219661
def _file_name(self, dtype_out_time, extension='nc'):
        """"""
        if dtype_out_time is None:
            dtype_out_time = ''
        out_lbl = utils.io.data_out_label(self.intvl_out, dtype_out_time,
                                          dtype_vert=self.dtype_out_vert)
        in_lbl = utils.io.data_in_label(self.intvl_in, self.dtype_in_time,
                                        self.dtype_in_vert)
        start_year = utils.times.infer_year(self.start_date)
        end_year = utils.times.infer_year(self.end_date)
        yr_lbl = utils.io.yr_label((start_year, end_year))
        return '.'.join(
            [self.name, out_lbl, in_lbl, self.model.name,
             self.run.name, yr_lbl, extension]
        ).replace('..', '.')
1311242
def _load_cube_pkg(pkg, cube):
    '''
    
    '''
    try:
        # First, assume the cube module is available
        # with the name exactly as written
        fromlist = map(str, [cube])
        mcubes = __import__(pkg, fromlist=fromlist)
        return getattr(mcubes, cube)
    except AttributeError:
        # if that fails, try to guess the cube module
        # based on cube 'standard naming convention'
        # ie, group_cube -> from group.cube import CubeClass
        _pkg, _mod, _cls = cube_pkg_mod_cls(cube)
        fromlist = map(str, [_cls])
        mcubes = __import__('%s.%s.%s' % (pkg, _pkg, _mod),
                            fromlist=fromlist)
        return getattr(mcubes, _cls)
391729
def table_name(self):
        
        if self._cube.ndim < 3 and not self.ca_as_0th:
            return None

        title = self._cube.name
        table_name = self._cube.labels()[0][self._index]
        return "%s: %s" % (title, table_name)