python config_Python config.update方法代码示例

本文整理汇总了Python中fapws.config.update方法的典型用法代码示例。如果您正苦于以下问题:Python config.update方法的具体用法?Python config.update怎么用?Python config.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块fapws.config的用法示例。

在下文中一共展示了config.update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

​点赞 7

# 需要导入模块: from fapws import config [as 别名]

# 或者: from fapws.config import update [as 别名]

def __init__(self, source=None, name=None, lookup=[], encoding='utf8', **settings):

""" Create a new template.

If the source parameter (str or buffer) is missing, the name argument

is used to guess a template filename. Subclasses can assume that

self.source and/or self.filename are set. Both are strings.

The lookup, encoding and settings parameters are stored as instance

variables.

The lookup parameter stores a list containing directory paths.

The encoding parameter should be used to decode byte strings or files.

The settings parameter contains a dict for engine-specific settings.

"""

self.name = name

self.source = source.read() if hasattr(source, 'read') else source

self.filename = source.filename if hasattr(source, 'filename') else None

self.lookup = [os.path.abspath(x) for x in lookup]

self.encoding = encoding

self.settings = self.settings.copy() # Copy from class variable

self.settings.update(settings) # Apply

if not self.source and self.name:

self.filename = self.search(self.name, self.lookup)

if not self.filename:

raise TemplateError('Template %s not found.' % repr(name))

if not self.source and not self.filename:

raise TemplateError('No template specified.')

self.prepare(**self.settings)

开发者ID:Autodesk,项目名称:arnold-usd,代码行数:27,

示例2: view

​点赞 6

# 需要导入模块: from fapws import config [as 别名]

# 或者: from fapws.config import update [as 别名]

def view(tpl_name, **defaults):

''' Decorator: renders a template for a handler.

The handler can control its behavior like that:

- return a dict of template vars to fill out the template

- return something other than a dict and the view decorator will not

process the template, but return the handler result as is.

This includes returning a HTTPResponse(dict) to get,

for instance, JSON with autojson or other castfilters.

'''

def decorator(func):

@functools.wraps(func)

def wrapper(*args, **kwargs):

result = func(*args, **kwargs)

if isinstance(result, (dict, DictMixin)):

tplvars = defaults.copy()

tplvars.update(result)

return template(tpl_name, **tplvars)

elif result is None:

return template(tpl_name, defaults)

return result

return wrapper

return decorator

开发者ID:Autodesk,项目名称:arnold-usd,代码行

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
使用QTimer对象代替QBasicTimer对象,修改程序class MyWindow(QWidget): def init(self): super().init() self.thread_list = [] self.color_photo_dir = os.path.join(os.getcwd(), "color_photos") self.depth_photo_dir = os.path.join(os.getcwd(), "depth_photos") self.image_thread = None self.saved_color_photos = 0 # 定义 saved_color_photos 属性 self.saved_depth_photos = 0 # 定义 saved_depth_photos 属性 self.init_ui() def init_ui(self): self.ui = uic.loadUi("C:/Users/wyt/Desktop/D405界面/intelrealsense1.ui") self.open_btn = self.ui.pushButton self.color_image_chose_btn = self.ui.pushButton_3 self.depth_image_chose_btn = self.ui.pushButton_4 self.open_btn.clicked.connect(self.open) self.color_image_chose_btn.clicked.connect(lambda: self.chose_dir(self.ui.lineEdit, "color")) self.depth_image_chose_btn.clicked.connect(lambda: self.chose_dir(self.ui.lineEdit_2, "depth")) def open(self): self.profile = self.pipeline.start(self.config) self.is_camera_opened = True self.label.setText('相机已打开') self.label.setStyleSheet('color:green') self.open_btn.setEnabled(False) self.close_btn.setEnabled(True) self.image_thread = ImageThread(self.pipeline, self.color_label, self.depth_label, self.interval, self.color_photo_dir, self.depth_photo_dir, self._dgl) self.image_thread.saved_color_photos_signal.connect(self.update_saved_color_photos_label) self.image_thread.saved_depth_photos_signal.connect(self.update_saved_depth_photos_label) self.image_thread.start() def chose_dir(self, line_edit, button_type): my_thread = MyThread(line_edit, button_type) my_thread.finished_signal.connect(self.update_line_edit) self.thread_list.append(my_thread) my_thread.start()
05-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值