本文整理汇总了Python中thumbor.importer.Importer类的典型用法代码示例。如果您正苦于以下问题:Python Importer类的具体用法?Python Importer怎么用?Python Importer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Importer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_import_item_should_be_proper_item
def test_import_item_should_be_proper_item(self):
importer = Importer(self.get_config())
importer.import_modules()
data = {
'ENGINE': pil_engine,
'GIF_ENGINE': gif_engine,
'LOADER': http_loader,
'STORAGE': file_storage,
'UPLOAD_PHOTO_STORAGE': file_storage,
'RESULT_STORAGE': result_file_storage,
'DETECTORS': (face_detector,),
'FILTERS': (rgb_filter,),
}
for key, value in data.iteritems():
prop, default_value = (None, None)
if hasattr(importer, key.lower()):
prop, default_value = (getattr(importer, key.lower()), value)
if prop is tuple:
for index, item in enumerate(prop):
expect(item).not_to_be_null()
expect(item).to_equal(default_value[index])
else:
expect(prop).not_to_be_null()
expect(prop).to_equal(default_value)
开发者ID:GDxU,项目名称:thumbor,代码行数:26,代码来源:test_importer.py
示例2: get_context
def get_context():
conf = Config()
conf.ENGINE = "thumbor.engines.pil"
imp = Importer(conf)
imp.import_modules()
imp.filters = [Filter]
return Context(None, conf, imp)
开发者ID:expertise-com,项目名称:thumbor,代码行数:7,代码来源:fill_filter_vows.py
示例3: main
def main(arguments=None):
"""Runs thumbor server with the specified arguments."""
server_parameters = get_server_parameters(arguments)
logging.basicConfig(level=getattr(logging, server_parameters.log_level.upper()))
lookup_paths = [os.curdir, expanduser("~"), "/etc/", dirname(__file__)]
config = Config.load(server_parameters.config_path, conf_name="thumbor.conf", lookup_paths=lookup_paths)
importer = Importer(config)
importer.import_modules()
if server_parameters.security_key is None:
server_parameters.security_key = config.SECURITY_KEY
if not isinstance(server_parameters.security_key, basestring):
raise RuntimeError(
"No security key was found for this instance of thumbor. Please provide one using the conf file or a security key file."
)
context = Context(server=server_parameters, config=config, importer=importer)
application = ThumborServiceApp(context)
server = HTTPServer(application)
server.bind(context.server.port, context.server.ip)
server.start(1)
try:
logging.debug("thumbor running at %s:%d" % (context.server.ip, context.server.port))
tornado.ioloop.IOLoop.instance().start()
except KeyboardInterrupt:
print
print "-- thumbor closed by user interruption --"
开发者ID:brunomvsouza,项目名称:thumbor,代码行数:33,代码来源:server.py
示例4: setUp
def setUp(self, *args, **kwargs):
super(FakeRotateEngineRotateFilterTestCase, self).setUp(*args, **kwargs)
conf = Config()
imp = Importer(conf)
imp.filters = [Filter]
self.context = Context(None, conf, imp)
self.context.request = RequestParameters()
开发者ID:gi11es,项目名称:thumbor,代码行数:7,代码来源:test_rotate.py
示例5: get_app
def get_app(self):
cfg = Config.load(fixture_for("encrypted_handler_conf.py"))
importer = Importer(cfg)
importer.import_modules()
ctx = Context(None, cfg, importer)
application = ThumborServiceApp(ctx)
return application
开发者ID:mikelikespie,项目名称:thumbor,代码行数:7,代码来源:crypto_handler_vows.py
示例6: get_app
def get_app(self):
cfg = Config(SECURITY_KEY='ACME-SEC')
server_params = ServerParameters(None, None, None, None, None, None)
server_params.gifsicle_path = which('gifsicle')
cfg.DETECTORS = [
'thumbor.detectors.face_detector',
'thumbor.detectors.profile_detector',
'thumbor.detectors.glasses_detector',
'thumbor.detectors.feature_detector',
]
cfg.STORAGE = 'thumbor.storages.no_storage'
cfg.LOADER = 'thumbor.loaders.file_loader'
cfg.FILE_LOADER_ROOT_PATH = os.path.join(os.path.dirname(__file__), 'imgs')
cfg.ENGINE = getattr(self, 'engine', None)
cfg.USE_GIFSICLE_ENGINE = True
cfg.FFMPEG_PATH = which('ffmpeg')
cfg.ENGINE_THREADPOOL_SIZE = 10
cfg.OPTIMIZERS = [
'thumbor.optimizers.gifv',
]
if not cfg.ENGINE:
return None
importer = Importer(cfg)
importer.import_modules()
ctx = Context(server_params, cfg, importer)
application = ThumborServiceApp(ctx)
return application
开发者ID:Bladrak,项目名称:thumbor,代码行数:30,代码来源:__init__.py
示例7: topic
def topic(self):
conf = Config()
conf.ENGINE = 'thumbor.engines.pil'
imp = Importer(conf)
imp.import_modules()
imp.filters = [Filter]
return Context(None, conf, imp)
开发者ID:achellies,项目名称:thumbor,代码行数:7,代码来源:fill_filter_vows.py
示例8: get_app
def get_app(self):
storage_path = '/tmp/thumbor-engines-test/'
if exists(storage_path):
rmtree(storage_path)
self.timeout_handle = None
cfg = Config(SECURITY_KEY='ACME-SEC', FILE_STORAGE_ROOT_PATH=storage_path)
server_params = ServerParameters(None, None, None, None, None, None)
cfg.DETECTORS = [
'thumbor.detectors.face_detector',
'thumbor.detectors.profile_detector',
'thumbor.detectors.glasses_detector',
'thumbor.detectors.feature_detector',
]
conf_key = self._testMethodName.split('__')[1]
conf = CONFS.get(conf_key, None)
if conf:
for key, value in conf.items():
setattr(cfg, key, value)
importer = Importer(cfg)
importer.import_modules()
ctx = Context(server_params, cfg, importer)
application = ThumborServiceApp(ctx)
return application
开发者ID:abhishekgodhani,项目名称:thumbor,代码行数:28,代码来源:engines_test.py
示例9: main
def main(arguments=None):
'''Runs thumbor server with the specified arguments.'''
server_parameters = get_server_parameters(arguments)
logging.basicConfig(level=getattr(logging, server_parameters.log_level.upper()))
config = Config.load(server_parameters.config_path)
importer = Importer(config)
importer.import_modules()
if server_parameters.security_key is not None:
config.SECURITY_KEY = server_parameters.security_key
if not isinstance(config.SECURITY_KEY, basestring):
raise RuntimeError('No security key was found for this instance of thumbor. Please provide one using the conf file or a security key file.')
context = Context(server=server_parameters, config=config, importer=importer)
application = ThumborServiceApp(context)
server = HTTPServer(application)
server.bind(context.server.port, context.server.ip)
server.start(1)
try:
tornado.ioloop.IOLoop.instance().start()
except KeyboardInterrupt:
print
print "-- thumbor closed by user interruption --"
开发者ID:mikelikespie,项目名称:thumbor,代码行数:27,代码来源:server.py
示例10: get_filter
def get_filter(self, filter_name, params_string="", config_context=None):
config = Config(
FILTERS=[filter_name],
LOADER='thumbor.loaders.file_loader',
FILE_LOADER_ROOT_PATH=join(dirname(realpath(__file__)), 'fixtures', 'filters')
)
importer = Importer(config)
importer.import_modules()
req = RequestParameters()
context = Context(config=config, importer=importer)
context.request = req
context.request.engine = context.modules.engine
if config_context is not None:
config_context(context)
self.context = context
fltr = importer.filters[0]
fltr.pre_compile()
context.transformer = Transformer(context)
return fltr(params_string, context=context)
开发者ID:GDxU,项目名称:thumbor,代码行数:26,代码来源:base.py
示例11: test_can_create_context_with_importer
def test_can_create_context_with_importer(self):
cfg = Config()
importer = Importer(cfg)
importer.import_modules()
ctx = Context(config=cfg, importer=importer)
expect(ctx.modules).not_to_be_null()
expect(ctx.modules.importer).to_equal(importer)
开发者ID:dannyeuu,项目名称:thumbor,代码行数:8,代码来源:test_context.py
示例12: get_context
def get_context(self):
cfg = Config()
cfg.HEALTHCHECK_ROUTE = '/'
importer = Importer(cfg)
importer.import_modules()
return Context(None, cfg, importer)
开发者ID:okor,项目名称:thumbor,代码行数:8,代码来源:test_healthcheck.py
示例13: get_importer
def get_importer(config):
importer = Importer(config)
importer.import_modules()
if importer.error_handler_class is not None:
importer.error_handler = importer.error_handler_class(config)
return importer
开发者ID:beenanner,项目名称:thumbor,代码行数:8,代码来源:server.py
示例14: test_single_item_should_equal_file_storage
def test_single_item_should_equal_file_storage(self):
importer = Importer(None)
importer.import_item(
config_key='file_storage',
item_value='thumbor.storages.file_storage',
class_name='Storage'
)
expect(importer.file_storage).to_equal(file_storage)
开发者ID:GDxU,项目名称:thumbor,代码行数:8,代码来源:test_importer.py
示例15: topic
def topic(self, test_item):
test_data, config = test_item
importer = Importer(config)
importer.import_modules()
if hasattr(importer, test_data[0].lower()):
return (getattr(importer, test_data[0].lower()), test_data[1])
return (None, None)
开发者ID:mikelikespie,项目名称:thumbor,代码行数:8,代码来源:importer_vows.py
示例16: get_app
def get_app(table):
cfg = Config(HBASE_STORAGE_TABLE=table, HBASE_STORAGE_SERVER_PORT=9090, STORAGE="thumbor_hbase.storage")
importer = Importer(cfg)
importer.import_modules()
server = ServerParameters(8888, "localhost", "thumbor.conf", None, "info", None)
ctx = Context(server, cfg, importer)
application = ThumborServiceApp(ctx)
return application
开发者ID:heynemann,项目名称:thumbor_hbase,代码行数:9,代码来源:storage_vows.py
示例17: topic
def topic(self):
conf = Config()
conf.METRICS = 'tc_librato.metrics.librato_metrics'
conf.LIBRATO_USER = 'test'
conf.LIBRATO_TOKEN = 'test'
conf.LIBRATO_NAME_PREFIX = 'test'
imp = Importer(conf)
imp.import_modules()
return Context(None, conf, imp)
开发者ID:thumbor-community,项目名称:librato,代码行数:9,代码来源:metrics_vows.py
示例18: get_app
def get_app(self):
cfg = Config.load(fixture_for('encrypted_handler_conf.py'))
server_params = ServerParameters(None, None, None, None, None, None)
server_params.security_key = 'HandlerVows'
importer = Importer(cfg)
importer.import_modules()
ctx = Context(server_params, cfg, importer)
application = ThumborServiceApp(ctx)
return application
开发者ID:MechanisM,项目名称:thumbor,代码行数:9,代码来源:crypto_handler_vows.py
示例19: topic
def topic(self):
importer = Importer(None)
importer.import_item(
config_key='detectors', is_multiple=True,
item_value=(
'thumbor.detectors.feature_detector',
'thumbor.detectors.feature_detector'
)
)
return importer.detectors
开发者ID:5um1th,项目名称:thumbor,代码行数:10,代码来源:importer_vows.py
示例20: topic
def topic(self):
conf = Config()
imp = Importer(conf)
imp.filters = [Filter]
ctx = Context(None, conf, imp)
ctx.request = RequestParameters()
filter_instances = ctx.filters_factory.create_instances(ctx, "format(invalid)")
filter_instances[0].run()
开发者ID:Hazer,项目名称:thumbor,代码行数:10,代码来源:format_filter_vows.py
注:本文中的thumbor.importer.Importer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论