Show info about the product cache.

    :param cache_dir: Root of the DEM cache folder.
    :param product: DEM product choice.
160433
def info(cache_dir=CACHE_DIR, product=DEFAULT_PRODUCT):
    
    datasource_root, _ = ensure_setup(cache_dir, product)
    util.check_call_make(datasource_root, targets=['info'])
159125
def _get_cache_contents(self):
        
        if not os.path.isdir(self._path):
            return []

        def sort_key(name):
            path, stamp = self._get_cache_dir(name)
            try:
                return os.stat(stamp).st_mtime
            except OSError:
                return 0

        names = os.listdir(self._path)
        names.sort(key=sort_key, reverse=True)
        return names
797387
def image_cache(article_cache, img_dir):
    
    log.debug('Looking for image directory in the cache')
    if os.path.isdir(article_cache):
        log.info('Cached image directory found: {0}'.format(article_cache))
        shutil.copytree(article_cache, img_dir)
        return True
    return False
1090107
def ensure_app_cache_dir(appname, *args):
    
    import utool as ut
    dpath = get_app_cache_dir(appname, *args)
    ut.ensuredir(dpath)
    return dpath
772200
def get_accumulator_dir(cachedir):
    '''
    
    '''
    fn_ = os.path.join(cachedir, 'accumulator')
    if not os.path.isdir(fn_):
        # accumulator_dir is not present, create it
        os.makedirs(fn_)
    return fn_
153962
def _apply_dvs_product_info(product_info_spec, product_info_dict):
    '''
    
    '''
    if product_info_dict.get('name'):
        product_info_spec.name = product_info_dict['name']
    if product_info_dict.get('vendor'):
        product_info_spec.vendor = product_info_dict['vendor']
    if product_info_dict.get('version'):
        product_info_spec.version = product_info_dict['version']
1308638
def file_show(context, id, file_id):
    
    result = dci_file.get(context, id=file_id)
    utils.format_output(result, context.format)
1241212
def cd(doi):
    

    parts = doi.split(':')

    if len(parts) == 2:
        container_name, product_name = parts[0], parts[1]
    elif len(parts) == 1 and os.environ.get('CONTAINER_NAME'):
        # interpret poi as product name if already zapped into a product in order
        # to enable simply switching products by doing ape zap prod.
        product_name = parts[0]
        container_name = os.environ.get('CONTAINER_NAME')
    else:
        print('unable to parse context - format: <container_name>:<product_name>')
        sys.exit(1)

    if container_name not in tasks.get_containers():
        print('No such container')
    else:
        if product_name:
            if product_name not in tasks.get_products(container_name):
                print('No such product')
            else:
                print(tasks.conf.SOURCE_HEADER)
                print('cd ' + tasks.get_product_dir(container_name, product_name))
        else:
            print(tasks.conf.SOURCE_HEADER)
            print('cd ' + tasks.get_container_dir(container_name))
1155586
def cache_dir() -> str:
        """"""
        if config.VENDOR is None:
            raise RuntimeError("modelforge is not configured; look at modelforge.configuration. "
                               "Depending on your objective you may or may not want to create a "
                               "modelforgecfg.py file which sets VENDOR and the rest.")
        return os.path.join("~", "." + config.VENDOR)
197308
def cache_path(self, name):
        
        return os.path.join(self._path, self.CACHE_DIR, name)
981178
public function show(Product $product)
    {
        $product->load('group', 'category');

        //increasing product counters, in order to have a suggestion orden
        (new ProductsRepository)->increment('view_counts', $product);

        //saving the product tags into users preferences
        if (trim($product->tags) != '' && auth()->check()) {
            auth()->user()->updatePreferences('product_viewed', $product->tags);
        }

        return view('products.detailProd', [
            'suggestions' => Suggestions\Suggest::for('product_viewed')->shake()->get('product_viewed'),
            'reviews' => OrderDetail::ReviewsFor($product->id),
            'allWishes' => Order::forSignedUser('wishlist'),
            'features' => Feature::filterable()->get(),
            'product' => $product,
        ]);
    }
196775
def download(client, target_dir):
    """"""
    print('')
    print("download inappproducts")
    print('---------------------')
    products = client.list_inappproducts()

    for product in products:
        path = os.path.join(target_dir, 'products')
        del product['packageName']
        mkdir_p(path)
        with open(os.path.join(path, product['sku'] + '.json'), 'w') as outfile:
            print("save product for {0}".format(product['sku']))
            json.dump(
                product, outfile, sort_keys=True,
                indent=4, separators=(',', ': '))
773393
def cache_resource(dest_dir=@local_cache_dir, options={})
      unless dest_dir
        raise ArgumentError, "Must specify destination directory when creating resource", caller
      end
      self.local_cache_dir=dest_dir
      @size = update_cache(@url, @local_path, options)
      if options[:include_pack_gz]
        @relative_local_path_pack_gz = "#{@relative_local_path}.pack.gz"
        @local_path_pack_gz = "#{dest_dir}/#{@relative_local_path_pack_gz}"
        @size_pack_gz = update_cache(@url_pack_gz, @local_path_pack_gz, options)
      end
      @signature_verified ? @size : @signature_verified
    end
814732
def user_cache_dir(self):
        """"""
        directory = appdirs.user_cache_dir(self.appname, self.appauthor,
                              version=self.version)
        if self.create:
            self._ensure_directory_exists(directory)
        return directory
99014
def make_image_cache(img_cache):
    
    log.info('Initiating the image cache at {0}'.format(img_cache))
    if not os.path.isdir(img_cache):
        utils.mkdir_p(img_cache)
        utils.mkdir_p(os.path.join(img_cache, '10.1371'))
        utils.mkdir_p(os.path.join(img_cache, '10.3389'))
292653
def cache_info(cache_dir, cache_key):
    
    filename = os.path.join(cache_dir, cache_key)
    return os.path.getmtime(filename) if os.path.exists(filename) else 0
351280
def results_cache_path(self) -> str:
        
        if not self.project:
            return ''
        return os.path.join(
            self.project.results_path,
            '.cache',
            'steps',
            '{}.json'.format(self.id)
        )