Esempio n. 1
0
def blurthday():
    
    from imread import imread
    from pprint import pprint
    imfuckingshowalready = lambda mx: Image.fromarray(mx).show()
    
    identity = LUT()
    amatorka = LUT('amatorka')
    #miss_etikate = LUT('miss_etikate')
    #soft_elegance_1 = LUT('soft_elegance_1')
    #soft_elegance_2 = LUT('soft_elegance_2')
    
    im1 = imread(
        AppDirectoriesFinder().storages.get(
            'django_instakit').path(join(
                'django_instakit', 'img', '06-DSCN4771.JPG')))
    im2 = imread(
        AppDirectoriesFinder().storages.get(
            'django_instakit').path(join(
                'django_instakit', 'img',
                '430023_3625646599363_1219964362_3676052_834528487_n.jpg')))
    
    pprint(identity)
    pprint(amatorka)
    
    im9 = amatorka.transform(im1)
    pprint(im9)
    imfuckingshowalready(im9)
    print im1
    print im2
Esempio n. 2
0
File: maps.py Progetto: stikkas/inss
def _load_map(map_name):
    finder = AppDirectoriesFinder(app_names=['insoft'])
    map_file = finder.find('insoft/maps/%s.json' % map_name)
    with open(map_file) as f:
        data = json.loads(f.read())
        paths = sorted(data['pathes'].iteritems(), key=lambda l: l[1]['name'])
        locations = tuple([Location(key, val['name']) for key, val in paths])
        setattr(_cache, map_name, locations)
    def handle(self, *args, **options):

        self.with_version = options.get("with_version")
        self.keep_packages = options.get("keep_packages")

        temp_dir = getattr(settings, 'BWR_APP_TMP_FOLDER', 'tmp')
        temp_dir = os.path.abspath(temp_dir)

        # finders
        basefinder = BaseDirectoryFinder()
        appfinder = AppDirectoriesFinder()
        # Assume bower.json files are to be found in each app directory,
        # rather than in the app's static/ subdirectory:
        appfinder.source_dir = '.'

        finders = (
            basefinder,
            appfinder,
        )

        if os.path.exists(temp_dir):
            if not self.keep_packages:
                sys.stderr.write(
                    "\nWARNING:\n\n"
                    "  The temporary package installation directory exists, but the --keep-packages\n"
                    "  option has not been given.  In order to not delete anything which should be\n"
                    "  kept, %s will not be removed.\n\n"
                    "  Please remove it manually, or use the --keep-packages option to avoid this\n"
                    "  message.\n\n" % (temp_dir, ))
                self.keep_packages = True
        else:
            os.makedirs(temp_dir)

        for finder in finders:
            for path in finder.find('package.json', all=True):
                self.npm_install(path)

        for finder in finders:
            for path in finder.find('Gruntfile.json', all=True):
                self.grunt_default(path)

        for finder in finders:
            for path in finder.find('bower.json', all=True):
                self.get_bower_info(path)
                self.bower_install(path, temp_dir)

        bower_dir = os.path.join(temp_dir, 'bower_components')

        # nothing to clean
        if not os.path.exists(bower_dir):
            print('No components seems to have been found by bower, exiting.')
            sys.exit(0)

        self.clean_components_to_static_dir(bower_dir, path)

        if not self.keep_packages:
            shutil.rmtree(temp_dir)
 def get_value(self, context, **kwargs):
     appdirs = AppDirectoriesFinder()
     targets = []
     for app_name in appdirs.apps:
         app = app_name
         if '.' in app_name:
             oldpath, app = app_name.rsplit('.', 1)
         target = '%s/css/thadminjones.css' % app
         if appdirs.find_in_app(app_name, target):
             targets.append(target)
     return targets
Esempio n. 5
0
 def get_value(self, context, **kwargs):
     appdirs = AppDirectoriesFinder()
     targets = []
     for app_name in appdirs.apps:
         app = app_name
         if '.' in app_name:
             oldpath, app = app_name.rsplit('.', 1)
         target = '%s/css/thadminjones.css' % app
         if appdirs.find_in_app(app_name, target):
             targets.append(target)
     return targets
    def handle(self, *args, **options):

        self.with_version = options.get("with_version")
        self.keep_packages = options.get("keep_packages")

        temp_dir = getattr(settings, 'BWR_APP_TMP_FOLDER', 'tmp')
        temp_dir = os.path.abspath(temp_dir)

        # finders
        basefinder = BaseDirectoryFinder()
        appfinder = AppDirectoriesFinder()
        # Assume bower.json files are to be found in each app directory,
        # rather than in the app's static/ subdirectory:
        appfinder.source_dir = '.'

        finders = (basefinder, appfinder, )

        if os.path.exists(temp_dir):
            if not self.keep_packages:
                sys.stderr.write(
                    "\nWARNING:\n\n"
                    "  The temporary package installation directory exists, but the --keep-packages\n"
                    "  option has not been given.  In order to not delete anything which should be\n"
                    "  kept, %s will not be removed.\n\n"
                    "  Please remove it manually, or use the --keep-packages option to avoid this\n"
                    "  message.\n\n" % (temp_dir,))
                self.keep_packages = True
        else:
            os.makedirs(temp_dir)

        for finder in finders:
            for path in finder.find('package.json', all=True):
                self.npm_install(path)

        for finder in finders:
            for path in finder.find('Gruntfile.json', all=True):
                self.grunt_default(path)

        for finder in finders:
            for path in finder.find('bower.json', all=True):
                self.get_bower_info(path)
                self.bower_install(path, temp_dir)

        bower_dir = os.path.join(temp_dir, 'bower_components')

        # nothing to clean
        if not os.path.exists(bower_dir):
            print('No components seems to have been found by bower, exiting.')
            sys.exit(0)

        self.clean_components_to_static_dir(bower_dir, path)

        if not self.keep_packages:
            shutil.rmtree(temp_dir)
Esempio n. 7
0
def _can_symlink_static_files():
    from django.conf import settings

    finder = AppDirectoriesFinder()
    for path, storage in finder.list([]):
        # Get the first static file and use that as our source
        source_path = storage.path(path)
        break

    # Check that we can make a symlink between this file, and the static root
    # directory we are using.
    return symlink_capability_check(source_path, settings.STATIC_ROOT)
Esempio n. 8
0
 def list(self, ignore_patterns):
     """
     List all files in all app storages.
     """
     for path, storage in AppDirectoriesFinder.list(self, ignore_patterns):
         if self.is_dependency(path, storage):
             yield path, storage
Esempio n. 9
0
 def _read_png_matrix(cls, name):
     print "Reading LUT image: %s" % name
     return imread.imread(
         AppDirectoriesFinder().storages.get(
             'django_instakit').path(join(
                 'django_instakit', 'lut',
                 "%s.png" % name)))
Esempio n. 10
0
def walk_finders(path):
    """Find all qunit related files given the path component that comes
  after '/qunit/'

  Works similarly to 'os.walk' but returns just files and directories
  by surfing over all possible files.
  """
    # Get a file system path from url path
    path_comps = [c for c in path.split('/') if c != u'']
    tmp = os.sep.join(path_comps)
    file_path = os.path.join(settings.QUNIT_TEST_PATH, tmp)
    finder_files = []

    # Get list of files from app directories from app file finder
    adf = AppDirectoriesFinder()
    for fpath, filestorageobj in adf.list(''):
        if settings.QUNIT_TEST_PATH in fpath:
            finder_files.append((fpath, filestorageobj))

    # Get list of files from app directories from file system file finder
    # By adding this second, files in the project base override app specific files
    fsf = FileSystemFinder()
    for fpath, filestorageobj in fsf.list(''):
        if settings.QUNIT_TEST_PATH in fpath:
            finder_files.append((fpath, filestorageobj))

    # Form arrays of files in this directory and sub directories
    matchfiles = []
    subdirectories = []
    for ffile_path, fso in finder_files:
        split = ffile_path.split(file_path)
        if len(split) > 1:
            # Check to see if sub-directories exist
            path_split = split[1].split(os.sep)
            if len(path_split) > 1 and path_split[0] != u'':
                # this file indicates a sub directory
                subdirectories.append(path_split[0])
            else:
                # this is a file in this directory
                matchfiles.append((ffile_path, fso))

    # Get rid of duplicates
    subdirectories = list(set(subdirectories))  # array of strings
    matchfiles = list(set(matchfiles))  # array of tuples

    return (subdirectories, matchfiles)
Esempio n. 11
0
def tango_admin_css():
    """
    Inserts tango_admin css links.
    """
    appdirs = AppDirectoriesFinder()
    targets = []
    csslink = '<link rel="stylesheet" type="text/css" href="%s">'

    for app_name in appdirs.apps:
        app = app_name
        if '.' in app_name:
            oldpath, app = app_name.rsplit('.', 1)
        target = '%s/css/tango_admin.css' % app
        if appdirs.find_in_app(app_name, target):
            targets.append(target)

    return "\n".join(csslink % staticfiles_storage.url(x) for x in targets)
Esempio n. 12
0
    def handle(self, **options):
        default_static_dir = os.path.join(settings.WORKING_DIR, 'static')
        custom_static_dirs = filter(lambda x: x != default_static_dir,
                                    settings.STATICFILES_DIRS)

        finder = AppDirectoriesFinder()
        for app_name in finder.storages:
            location = finder.storages[app_name].location
            add_new_custom_dir = (location != default_static_dir
                                  and location not in custom_static_dirs)
            if add_new_custom_dir:
                custom_static_dirs.append(location)

        default_js_dir = os.path.join(default_static_dir, 'js')

        webpack_config_file = os.path.join(default_js_dir, 'webpack.config.js')

        webpack_bin = os.path.join(default_js_dir, 'node_modules/.bin/webpack')
        if os.name == 'nt':
            webpack_bin = '%s.cmd' % webpack_bin

        webpack_progress = ('--progress'
                            if options['progress'] or options['dev'] else '')
        webpack_colors = '--colors' if not options['no_color'] else ''

        webpack_args = [webpack_bin, '--config=%s' % webpack_config_file]
        if webpack_progress:
            webpack_args.append(webpack_progress)
        if webpack_colors:
            webpack_args.append(webpack_colors)

        if options['dev']:
            watch = '--watch' if options['watch'] else ''
            webpack_args.extend([watch, '--display-error-details'])
        else:
            os.environ['NODE_ENV'] = 'production'
            webpack_args.append("--bail")

        webpack_args.extend(options['extra'])

        static_base = link(settings.STATIC_URL)
        suffix = 'js/' if static_base.endswith('/') else '/js/'
        os.environ['WEBPACK_PUBLIC_PATH'] = static_base + suffix

        if custom_static_dirs:
            # XXX: review this for css
            # Append `js/` so that it's not necessary to reference it from the
            # `webpack.config.js` file
            custom_static_dirs = map(lambda x: os.path.join(x, 'js/'),
                                     custom_static_dirs)
            os.environ['WEBPACK_ROOT'] = ':'.join(custom_static_dirs)

        try:
            subprocess.call(webpack_args)
        except OSError:
            raise CommandError('webpack executable not found.\n'
                               'Make sure to install it by running '
                               '`cd %s && npm install`' % default_js_dir)
Esempio n. 13
0
 def handle(self, *args, **options):
     a = AppDirectoriesFinder()
     f = FileSystemFinder()
     print(f'Found installed apps : {a.apps}')
     print('Static localisations :')
     for key, dirs in a.storages.items():
         print(f'{key} ==> {dirs._location}')
     for key, dirs in f.storages.items():
         print(f'{key} ==> {dirs._location}')
Esempio n. 14
0
    def _check_template_exists(self, path):

        template = FileSystemFinder().find(path)
        if not template:
            template = AppDirectoriesFinder().find(path)
        if not template:
            raise InvalidTemplateError("%s is not a known template" % path)

        return template
Esempio n. 15
0
 def read_acv(self, name):
     print "Reading curves from %s.acv" % name
     acv_path = AppDirectoriesFinder().storages.get('django_instakit').path(
         join('django_instakit', 'acv', "%s.acv" % name))
     with open(acv_path, "rb") as acv_file:
         _, self.count = unpack("!hh", acv_file.read(4))
         for i in xrange(self.count):
             self.curves.append(
                 self.read_one_curve(acv_file, self.channel_name(i)))
Esempio n. 16
0
    def test_staticfiles(self):
        """
        Test whether django-staticfiles is properly configured.

        There are various reasons why this could fail:
         * App not loaded (not in get_apps())
         * models.py missing
         * Addon not appended to STATICFILES_PREPEND_LABEL_APPS
         * STATIC_ROOT is not absolute path
         * STATICFILES_MEDIA_DIRNAMES doesn't include 'media'
        """
        suffix = 'css/icons.css'
        for addons_root in settings.ADDONS_ROOTS:
            ref = os.path.realpath('%s/locks/static/locks/%s' % (addons_root, suffix))
            if os.path.exists(ref):
                break
        path = 'locks/%s' % suffix
        r = AppDirectoriesFinder()
        self.assertEqual(ref, r.find(path))
Esempio n. 17
0
def coffeescript(path):
    try:
        STATIC_ROOT = settings.STATIC_ROOT
    except AttributeError:
        STATIC_ROOT = settings.MEDIA_ROOT

    filename = os.path.split(path)[-1]

    try:
        from django.contrib.staticfiles.finders import \
            FileSystemFinder, AppDirectoriesFinder
        full_path = AppDirectoriesFinder().find(path)
        if not full_path:
            full_path = FileSystemFinder().find(path)
    except ImportError:
        # normal, non-statcfiles-enabled way:
        full_path = os.path.join(STATIC_ROOT, path)

    output_directory = os.path.join(STATIC_ROOT, COFFEESCRIPT_OUTPUT_DIR, os.path.dirname(path))

    hashed_mtime = get_hashed_mtime(full_path)

    if filename.endswith(".coffee"):
        base_filename = filename[:-7]
    else:
        base_filename = filename

    output_path = os.path.join(output_directory, "%s-%s.js" % (base_filename, hashed_mtime))

    if not os.path.exists(output_path):
        source_file = open(full_path)
        source = source_file.read()
        source_file.close()

        args = shlex.split("%s -c -s -p" % COFFEESCRIPT_EXECUTABLE, posix=POSIX_COMPATIBLE)
        p = subprocess.Popen(args, stdin=subprocess.PIPE,
                             stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        out, errors = p.communicate(source)
        if out:
            if not os.path.exists(output_directory):
                os.makedirs(output_directory)
            compiled_file = open(output_path, "w+")
            compiled_file.write(out)
            compiled_file.close()

            # Remove old files
            compiled_filename = os.path.split(output_path)[-1]
            for filename in os.listdir(output_directory):
                if filename.startswith(base_filename) and filename != compiled_filename:
                    os.remove(os.path.join(output_directory, filename))
        elif errors:
            logger.error(errors)
            return path

    return output_path[len(STATIC_ROOT):].replace(os.sep, '/').lstrip("/")
    def test_staticfiles(self):
        """
        Test whether django-staticfiles is properly configured.

        There are various reasons why this could fail:
         * App not loaded (not in get_apps())
         * models.py missing
         * Addon not appended to STATICFILES_PREPEND_LABEL_APPS
         * STATIC_ROOT is not absolute path
         * STATICFILES_MEDIA_DIRNAMES doesn't include 'media'
        """
        suffix = 'css/icons.css'
        for addons_root in settings.ADDONS_ROOTS:
            ref = os.path.realpath('%s/locks/static/locks/%s' %
                                   (addons_root, suffix))
            if os.path.exists(ref):
                break
        path = 'locks/%s' % suffix
        r = AppDirectoriesFinder()
        self.assertEqual(ref, r.find(path))
Esempio n. 19
0
def old_main():
    
    #imfuckingshowalready = lambda mx: Image.fromarray(mx).show()

    old_identity = AppDirectoriesFinder().storages.get(
           'django_instakit').path(join(
               'django_instakit', 'lut', 'identity.png'))

    im_old_identity = imread.imread(old_identity)
    im_identity = numpy.zeros_like(im_old_identity)

    for bx in xrange(0, 8):
        for by in xrange(0, 8):
            for r in xrange(0, 64):
                for g in xrange(0, 64):
                    im_identity[
                        int(g + by * 64),
                        int(r + bx * 64)] = numpy.array((
                            int(r * 255.0 / 63.0 + 0.5),
                            int(g * 255.0 / 63.0 + 0.5),
                                int((bx + by * 8.0) * 255.0 / 63.0 + 0.5)),
                                dtype=numpy.uint8)
    
    print "THE OLD: %s, %s, %s" % (
        im_old_identity.size, im_old_identity.shape,
        str(im_old_identity.dtype))
    #print im_old_identity
    print ""
    
    print "THE NEW: %s, %s, %s" % (
        im_identity.size, im_identity.shape,
        str(im_identity.dtype))
    #print im_identity
    print ""
    
    
    
    print "THE END: %s" % bool(im_old_identity.shape == im_identity.shape)
    #print im_old_identity == im_identity
    
    #imfuckingshowalready(im_identity)
    #imfuckingshowalready(im_old_identity)
    
    pil_im_old_identity = Image.fromarray(im_old_identity)
    pil_im_old_identity.save('/tmp/im_old_identity.jpg',
        format="JPEG")
    
    pil_im_identity = Image.fromarray(im_identity)
    pil_im_identity.save('/tmp/im_identity.jpg',
        format="JPEG")
Esempio n. 20
0
    def start_server_servestatic(self, options):
        """
        Start CherryPy server AND serve default static files

        Want SSL support?
        a. The new (3.1 or 3.2) way: Just set server.ssl_adapter to an SSLAdapter instance.
        b. The old way (deprecated way) is to set these attributes:

           server.ssl_certificate = <filename>
           server.ssl_private_key = <filename>

           But this is the only way from the management command line
           in the future I may need to adapt this to use a server.ssl_adapter

        """
        # debug?
        # print "options:"
        from django.conf import settings
        quit_command = (sys.platform
                        == 'win32') and 'CTRL-BREAK' or 'CONTROL-C'

        self.stdout.write("Validating models..")
        self.validate(display_num_errors=True)
        self.stdout.write(
            ("%(started_at)s\n"
             "Django version %(version)s, using settings %(settings)r\n"
             "cherrypy django_wsgiserver is running at http://%(addr)s:%(port)s/\n"
             "Quit the server with %(quit_command)s.\n") %
            {
                "started_at": datetime.now().strftime('%B %d, %Y - %X'),
                "version": self.get_version(),
                "settings": settings.SETTINGS_MODULE,
                "addr": options[
                    'host'],  # self._raw_ipv6 and '[%s]' % self.addr or self.addr,
                "port": options['port'],
                "quit_command": quit_command,
            })

        #logger.info("launching wsgiserver with the following options")
        #logger.info(pformat(options))
        if int(options['verbose']) >= 2:
            self.stdout.write("launching with the following options:\n")
            self.stdout.write(pformat(options))

        if options['daemonize'] and options['server_user'] and options[
                'server_group']:
            #ensure the that the daemon runs as specified user
            change_uid_gid(options['server_user'], options['server_group'])

        from django_wsgiserver.wsgiserver import CherryPyWSGIServer, WSGIPathInfoDispatcher
        #from cherrypy.wsgiserver import CherryPyWSGIServer, WSGIPathInfoDispatcher

        from django.core.handlers.wsgi import WSGIHandler
        from django.conf import settings
        app = WSGIHandler()  # serve the django content
        path = {
            '/': app
        }  # well will build up the serving url routing path below

        # Now work on serving the static content
        # note as of django 1.4, ADMIN_MEDIA_PREFIX is depreciated and instead uses django.contrib.staticfiles
        # so it is not an error for ADMIN_MEDIA_PREFIX to not be defined, I will test to see if exists
        # and print a warning that adminserve is activated but it's not defined.
        # so for django 1.4 (or 1.5 ?) staticserve=True => adminserve=True
        # so the choices
        # There are basically two ways for statics to be served
        # 1. in development, one often wants each application's static files to be served from within its file structure
        #    this is what the django runserver dose
        # 2. in production usually, all the static files are collected into a common storage region (files, S3, CDN) and a good webserver
        #    serve them from there

        # deprecated
        # if options['adminserve']: # serve the admin media too
        #     # AdminMediaHandler is middleware for local use
        #     #import django.core.servers.basehttp
        #     #adminapp = django.core.servers.basehttp.AdminMediaHandler(app)
        #     # another way to serve the admin media three application
        #     if settings.__dict__.has_key('ADMIN_MEDIA_PREFIX'):
        #         import django.contrib.admin

        #         path[settings.ADMIN_MEDIA_PREFIX] = django_wsgiserver.mediahandler.StaticFileWSGIApplication(
        #             os.path.join( django.contrib.admin.__path__[0], 'media'))
        #     else:
        #         print "Warning adminserve was selected BUT ADMIN_MEDIA_PREFIX was not defined"

        if options['staticserve']:
            try:
                if not settings.STATIC_URL or not settings.STATIC_ROOT:
                    # could use misconfigured exception (what is this in django)  instead of AttributeError
                    raise AttributeError, "settings.STATIC_URL = %s, settings.STATIC_ROOT=%s" % (
                        repr(settings.STATIC_URL), repr(settings.STATIC_ROOT))
            except AttributeError, msg:
                logger.error(msg)
                logger.error("****")
                logger.error(
                    "STATIC_URL and STATIC_ROOT  must be set in settings file for staticserve option to work in django_wsgiserver"
                )
                logger.error("****")
                raise

            if options['staticserve'] != 'collectstatic':
                if settings.STATICFILES_FINDERS:  # find the apps' static files and add them to the path
                    logger.debug("see settings.STATICFILES_FINDERS")
                    logger.debug(pformat(settings.STATICFILES_FINDERS))
                    from django.contrib.staticfiles.finders import AppDirectoriesFinder
                    app_static_finder = AppDirectoriesFinder(
                        settings.INSTALLED_APPS)
                    logger.debug("app_static_finder.storages:")
                    logger.debug(pformat(app_static_finder.storages))
                    for key, val in app_static_finder.storages.items():
                        logger.debug(key, " static location:", val.location)
                        # need to decide what to do with this in terms of the fusion of the app static directories
                        app_url = key.split('.')[
                            -1] + r'/'  # I'm not sure if it needs the end '/'
                        full_static_url = os.path.join(settings.STATIC_URL,
                                                       app_url)
                        full_dir_location = os.path.join(val.location, app_url)
                        logger.debug(full_static_url, full_dir_location)
                        path[
                            full_static_url] = django_wsgiserver.wsgiutil.StaticFileWSGIApplication(
                                full_dir_location)

            if options['servestaticdirs'] and hasattr(settings,
                                                      'STATICFILES_DIRS'):
                staticlocations = process_staticfiles_dirs(
                    settings.STATICFILES_DIRS)
                # debug !!!
                logger.debug("staticlocations::")
                logger.debug(pformat(staticlocations))
                for urlprefix, root in staticlocations:
                    path[os.path.join(
                        settings.STATIC_URL, urlprefix
                    )] = django_wsgiserver.wsgiutil.StaticFileWSGIApplication(
                        root)

            # One important thing is that there are two different ways to serve the static files
            # 1. convenient: serve each app's static files (assuming they follow convention)
            # 2. do a collectstatic and serve from that node -- likely this would be done more in a "production" scenario

            if options['staticserve'] == 'collectstatic':
                # and serve the root of the STATIC_URL ? hmm !!!
                path[
                    settings.
                    STATIC_URL] = django_wsgiserver.wsgiutil.StaticFileWSGIApplication(
                        settings.STATIC_ROOT)
                logger.warning(
                    "serving all static files from %s. *** Make sure you have done a fresh collectstatic operation ***"
                    % settings.STATIC_ROOT)
from django.template.context import RequestContext
from django.utils.translation import ugettext as _
from django.conf import settings
import os, shutil
from django.core.files import File
from django.core.management import call_command
from django_ace import AceWidget
from django.contrib.staticfiles.finders import AppDirectoriesFinder

try:
    from django.conf.urls import patterns, url
except ImportError:  # Django < 1.4
    from django.conf.urls.defaults import patterns, url


finder = AppDirectoriesFinder()

LESS_FILES = {
    'custom_less': finder.find('src/less/custom.less'),
}

if (not settings.DEBUG):
    for less_file in LESS_FILES:
        less_file_name = LESS_FILES.get(less_file)
        old_less_file_name = less_file_name + '.bak'
        if not os.access(old_less_file_name, os.R_OK):
            shutil.copy(less_file_name, old_less_file_name)


class StylesLessForm(forms.Form):
    custom_less = forms.CharField(
Esempio n. 22
0
            img.convert('RGB')
        if img.mode is '1':
            img.convert('L')
        if img.mode is 'L':
            return Image.eval(img, self.curves[0])
        # has to be RGB at this point
        img_channels = img.split()
        img_adjusted_channels = []
        for i in xrange(len(img_channels)):
            img_adjusted_channels.append(
                Image.eval(img_channels[i], lambda v: self.curves[i + 1](v)))
        return Image.merge('RGB', img_adjusted_channels)


if __name__ == '__main__':
    curve_files = AppDirectoriesFinder().storages.get(
        'django_instakit').listdir(join('django_instakit', 'acv'))[-1]
    curve_names = [curve_file.rstrip('.acv') for curve_file in curve_files]
    curve_sets = [
        CurveSet(name) for name in curve_names
        if not name.lower() == '.ds_store'
    ]

    image_files = AppDirectoriesFinder().storages.get(
        'django_instakit').listdir(join('django_instakit', 'img'))[-1]
    image_paths = map(
        lambda image_file: AppDirectoriesFinder().
        storages.get('django_instakit').path(
            join('django_instakit', 'img', image_file)), image_files)
    image_inputs = map(
        lambda image_path: Image.open(image_path).convert('RGB'), image_paths)