当前位置: 首页>>代码示例>>Python>>正文


Python config.DEBUG属性代码示例

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


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

示例1: make_app

# 需要导入模块: import config [as 别名]
# 或者: from config import DEBUG [as 别名]
def make_app():
    static_path = os.path.join(os.path.dirname(__file__), "static")
    settings = {
        'static_path': static_path,
        'debug': config.DEBUG
    }
    return tornado.web.Application([
        (r"/", MainHandler),
        (r"/updates", UpdatesHandler),
        (r"/static/(.*)", tornado.web.StaticFileHandler, {'path': static_path}),
    ], **settings) 
开发者ID:aluminiumgeek,项目名称:goodbye-mihome,代码行数:13,代码来源:w.py

示例2: debug

# 需要导入模块: import config [as 别名]
# 或者: from config import DEBUG [as 别名]
def debug(msg):
  if DEBUG:
    log(msg) 
开发者ID:joxeankoret,项目名称:nightmare,代码行数:5,代码来源:nfp_log.py

示例3: msg

# 需要导入模块: import config [as 别名]
# 或者: from config import DEBUG [as 别名]
def msg(string, level=INFO):
    """ Handle messages; this takes care of logging and
    debug checking, as well as output colors
    """

    string = "[%s] %s" % (timestamp(), string)
    color_string = None
    if 'linux' in platform.platform().lower():
        if level is INFO:
            color_string = '%s%s%s' % ('\033[32m', string, '\033[0m')
        elif level is DEBUG:
            color_string = '%s%s%s' % ('\033[34m', string, '\033[0m')
        elif level is ERROR:
            color_string = '%s%s%s' % ('\033[31m', string, '\033[0m')
        else:
            color_string = string

    if not color_string:
        color_string = string

    if level is DEBUG and not config.DEBUG:
        return

    if not level is LOG:
        print color_string

    log(string) 
开发者ID:hatRiot,项目名称:PeachOrchard,代码行数:29,代码来源:utility.py

示例4: preprocess_for_test_raw_output

# 需要导入模块: import config [as 别名]
# 或者: from config import DEBUG [as 别名]
def preprocess_for_test_raw_output(image, output_height, output_width, data_format='NCHW', scope=None):
  """Preprocesses the given image for evaluation.

  Args:
    image: A `Tensor` representing an image of arbitrary size.
    output_height: The height of the image after preprocessing.
    output_width: The width of the image after preprocessing.

  Returns:
    A preprocessed image.
  """
  with tf.name_scope(scope, 'vgg_test_image_raw_output', [image, output_height, output_width]):
    # Crop the central region of the image with an area containing 87.5% of
    # the original image.
    image = tf.image.resize_bilinear(image, [output_height, output_width], align_corners=False)
    image = tf.squeeze(image, [0])
    image.set_shape([output_height, output_width, 3])

    if config.DEBUG:
      save_image_op = tf.py_func(_save_image,
                                  [image],
                                  tf.int64, stateful=True)
      image = tf.Print(image, [save_image_op])

    image = tf.to_float(image)
    normarlized_image = _mean_image_subtraction(image, [_R_MEAN, _G_MEAN, _B_MEAN])
    if data_format == 'NCHW':
      normarlized_image = tf.transpose(normarlized_image, perm=(2, 0, 1))
    return tf.expand_dims(normarlized_image/255., 0) 
开发者ID:HiKapok,项目名称:tf.fashionAI,代码行数:31,代码来源:preprocessing.py

示例5: run

# 需要导入模块: import config [as 别名]
# 或者: from config import DEBUG [as 别名]
def run():
        # Takes run parameters from configuration.
        serverurl = urlparse(config.SERVER_BASE_URL)
        mhn.run(debug=config.DEBUG, host='0.0.0.0',
                port=serverurl.port) 
开发者ID:CommunityHoneyNetwork,项目名称:CHN-Server,代码行数:7,代码来源:manage.py

示例6: runlocal

# 需要导入模块: import config [as 别名]
# 或者: from config import DEBUG [as 别名]
def runlocal():
        serverurl = urlparse(config.SERVER_BASE_URL)
        mhn.run(debug=config.DEBUG, host='0.0.0.0',
                port=serverurl.port) 
开发者ID:CommunityHoneyNetwork,项目名称:CHN-Server,代码行数:6,代码来源:manage.py

示例7: runserver

# 需要导入模块: import config [as 别名]
# 或者: from config import DEBUG [as 别名]
def runserver():

	port = int(os.environ.get('PORT', DEFAULT_PORT))
	app.run(host=DEFAULT_HOST, port=port, debug=DEBUG)

#------------------------------ 
开发者ID:muneeb-ali,项目名称:apache-flask,代码行数:8,代码来源:runserver.py

示例8: __init__

# 需要导入模块: import config [as 别名]
# 或者: from config import DEBUG [as 别名]
def __init__(self, form, lemma, cpostag, postag, feats):
        self.form = form
        self.lemma = lemma
        self.cpostag = cpostag
        self.postag = postag
        self._feats = feats

        if DEBUG:
            self.validate()

        self._fmap = None 
开发者ID:TurkuNLP,项目名称:Finnish-dep-parser,代码行数:13,代码来源:morphoconllu.py

示例9: get

# 需要导入模块: import config [as 别名]
# 或者: from config import DEBUG [as 别名]
def get(self):
        """Serve the form page.
        """
        logging.info('SelfJoinPage.GET')
        logging.info('headers: %s', self.request.headers.items())
        logging.info('params: %s', self.request.params.items())
        logging.info('body: %s', self.request.body)

        # Make sure (as best we can) that this is being requested from a site
        # that's allowed to embed our join form.
        # This is such a weak check that I'm not sure it's worth it.
        #if not config.DEBUG:
        #    if not self.request.referer or \
        #       urlparse(self.request.referer).hostname not in config.ALLOWED_EMBED_REFERERS:
        #        webapp2.abort(403, detail='bad referer')

        csrf_token = helpers.get_csrf_token(self.request)

        volunteer_interests = gapps.get_volunteer_interests()
        skills_categories = gapps.get_skills_categories()

        template_values = {
            'FIELDS': config.FIELDS,
            'csrf_token': csrf_token,
            'volunteer_interests': volunteer_interests,
            'skills_categories': skills_categories,
            'config': config,
        }
        template = JINJA_ENVIRONMENT.get_template('self-serve-join.jinja')

        helpers.set_csrf_cookie(self.response, csrf_token)
        self.response.write(template.render(template_values)) 
开发者ID:adam-p,项目名称:danforth-east,代码行数:34,代码来源:self-serve.py

示例10: post

# 需要导入模块: import config [as 别名]
# 或者: from config import DEBUG [as 别名]
def post(self):
        """Create the new volunteer.
        """
        logging.info('SelfVolunteerPage.POST')
        logging.info('headers: %s' % self.request.headers.items())
        logging.info('params: %s' % self.request.params.items())
        logging.info('body: %s' % self.request.body)

        # Make sure (as best we can) that this is being requested from a site
        # that's allowed to embed our join form.
        # This is such a weak check that I'm not sure it's worth it.
        #if not config.DEBUG:
        #    if not self.request.referer or \
        #       urlparse(self.request.referer).hostname not in config.ALLOWED_EMBED_REFERERS:
        #        webapp2.abort(403, detail='bad referer')
        # TODO: Use new CSRF approach that doesn't need cookies.
        #helpers.check_csrf(self.request)

        # TODO: Don't hardcode key
        referrer = self.request.params.get('_referrer') or self.request.referer

        # Create a dict of the volunteer info.
        new_volunteer = gapps.volunteer_dict_from_request(self.request,
                                                          referrer)

        gapps.join_volunteer_from_dict(new_volunteer)

        self.response.write('success')

        # Queue the welcome email
        taskqueue.add(url='/tasks/new-volunteer-mail', params=new_volunteer) 
开发者ID:adam-p,项目名称:danforth-east,代码行数:33,代码来源:self-serve.py

示例11: debug_print

# 需要导入模块: import config [as 别名]
# 或者: from config import DEBUG [as 别名]
def debug_print(message, color=Colors.NONE):
    """ A method which prints if DEBUG is set """
    if config.DEBUG:
        print(color + message + Colors.NONE) 
开发者ID:ReconInfoSec,项目名称:web-traffic-generator,代码行数:6,代码来源:gen.py

示例12: run_server

# 需要导入模块: import config [as 别名]
# 或者: from config import DEBUG [as 别名]
def run_server():
    context = None

    if USE_SSL and os.path.isfile(SSL_KEY_FILE) and os.path.isfile(SSL_CERT_FILE):
        context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
        context.load_cert_chain(SSL_CERT_FILE, SSL_KEY_FILE)
        loggingserver.info('Using SSL, open interface in HTTPS')

    loggingserver.info('Web interface starting')
    app.run(
        host=LISTEN_ADDRESS,
        port=LISTEN_PORT,
        debug=DEBUG,
        ssl_context=context
    ) 
开发者ID:CERT-W,项目名称:certitude,代码行数:17,代码来源:web.py

示例13: log

# 需要导入模块: import config [as 别名]
# 或者: from config import DEBUG [as 别名]
def log(self, txt, send_telegram=False, color=None):
        if not DEBUG:
            return

        value = datetime.now()
        if len(self) > 0:
            value = self.data0.datetime.datetime()

        if color:
            txt = colored(txt, color)

        print('[%s] %s' % (value.strftime("%d-%m-%y %H:%M"), txt))
        if send_telegram:
            send_telegram_message(txt) 
开发者ID:rodrigo-brito,项目名称:backtrader-binance-bot,代码行数:16,代码来源:base.py

示例14: preprocess_for_eval

# 需要导入模块: import config [as 别名]
# 或者: from config import DEBUG [as 别名]
def preprocess_for_eval(image, classid, shape, output_height, output_width, key_x, key_y, key_v, norm_table, data_format, category, bbox_border, heatmap_sigma, heatmap_size, resize_side, scope=None):
  """Preprocesses the given image for evaluation.

  Args:
    image: A `Tensor` representing an image of arbitrary size.
    output_height: The height of the image after preprocessing.
    output_width: The width of the image after preprocessing.
    resize_side: The smallest side of the image for aspect-preserving resizing.

  Returns:
    A preprocessed image.
  """
  with tf.name_scope(scope, 'vgg_eval_image', [image, output_height, output_width]):
    # Crop the central region of the image with an area containing 87.5% of
    # the original image.
    fkey_x, fkey_y = tf.cast(key_x, tf.float32)/tf.cast(shape[1], tf.float32), tf.cast(key_y, tf.float32)/tf.cast(shape[0], tf.float32)
    image = tf.expand_dims(image, 0)
    image = tf.image.resize_bilinear(image, [output_height, output_width], align_corners=False)
    image = tf.squeeze(image, [0])
    image.set_shape([output_height, output_width, 3])
    image = tf.to_float(image)

    ikey_x = tf.cast(tf.round(fkey_x * heatmap_size), tf.int64)
    ikey_y = tf.cast(tf.round(fkey_y * heatmap_size), tf.int64)

    targets, isvalid = draw_labelmap(ikey_x, ikey_y, heatmap_sigma, heatmap_size)

    norm_gather_ind = tf.stack([norm_table[0].lookup(classid), norm_table[1].lookup(classid)], axis=-1)

    key_x = tf.cast(tf.round(fkey_x * output_width), tf.int64)
    key_y = tf.cast(tf.round(fkey_y * output_height), tf.int64)

    norm_x, norm_y = tf.cast(tf.gather(key_x, norm_gather_ind), tf.float32), tf.cast(tf.gather(key_y, norm_gather_ind), tf.float32)
    norm_x, norm_y = tf.squeeze(norm_x), tf.squeeze(norm_y)
    norm_value = tf.pow(tf.pow(norm_x[0] - norm_x[1], 2.) + tf.pow(norm_y[0] - norm_y[1], 2.), .5)

    if config.DEBUG:
      save_image_op = tf.py_func(save_image_with_heatmap,
                                  [image, targets,
                                  config.left_right_group_map[category][0],
                                  config.left_right_group_map[category][1],
                                  config.left_right_group_map[category][2],
                                  [output_height, output_width],
                                  heatmap_size],
                                  tf.int64, stateful=True)
      with tf.control_dependencies([save_image_op]):
        normarlized_image = _mean_image_subtraction(image, [_R_MEAN, _G_MEAN, _B_MEAN])
    else:
      normarlized_image = _mean_image_subtraction(image, [_R_MEAN, _G_MEAN, _B_MEAN])

    if data_format == 'NCHW':
      normarlized_image = tf.transpose(normarlized_image, perm=(2, 0, 1))
    return normarlized_image/255., targets, key_v, isvalid, norm_value 
开发者ID:HiKapok,项目名称:tf.fashionAI,代码行数:55,代码来源:preprocessing.py

示例15: preprocess_for_test

# 需要导入模块: import config [as 别名]
# 或者: from config import DEBUG [as 别名]
def preprocess_for_test(image, file_name, shape, output_height, output_width, data_format='NCHW', bbox_border=25., heatmap_sigma=1., heatmap_size=64, pred_df=None, scope=None):
  """Preprocesses the given image for evaluation.

  Args:
    image: A `Tensor` representing an image of arbitrary size.
    output_height: The height of the image after preprocessing.
    output_width: The width of the image after preprocessing.

  Returns:
    A preprocessed image.
  """
  with tf.name_scope(scope, 'vgg_test_image', [image, output_height, output_width]):
    # Crop the central region of the image with an area containing 87.5% of
    # the original image.

    if pred_df is not None:
      xmin, ymin, xmax, ymax  = [table_.lookup(file_name) for table_ in pred_df]
      #xmin, ymin, xmax, ymax = [tf.to_float(b) for b in bbox_cord]
      #xmin = tf.Print(xmin, [file_name, xmin, ymin, xmax, ymax], summarize=500)
      height, width, channals = tf.unstack(shape, axis=0)
      xmin, ymin, xmax, ymax = xmin - 100, ymin - 80, xmax + 100, ymax + 80

      xmin, ymin, xmax, ymax = tf.clip_by_value(xmin, 0, width[0]-1), tf.clip_by_value(ymin, 0, height[0]-1), \
                              tf.clip_by_value(xmax, 0, width[0]-1), tf.clip_by_value(ymax, 0, height[0]-1)

      bbox_h = ymax - ymin
      bbox_w = xmax - xmin
      areas = bbox_h * bbox_w

      offsets=tf.stack([xmin, ymin], axis=0)
      crop_shape = tf.stack([bbox_h, bbox_w, channals[0]], axis=0)

      ymin, xmin, bbox_h, bbox_w = tf.cast(ymin, tf.int32), tf.cast(xmin, tf.int32), tf.cast(bbox_h, tf.int32), tf.cast(bbox_w, tf.int32)
      crop_image = tf.image.crop_to_bounding_box(image, ymin, xmin, bbox_h, bbox_w)

      image, shape, offsets = tf.cond(areas > 0, lambda : (crop_image, crop_shape, offsets),
                                      lambda : (image, shape, tf.constant([0, 0], tf.int64)))
      offsets.set_shape([2])
      shape.set_shape([3])
    else:
      offsets = tf.constant([0, 0], tf.int64)

    image = tf.expand_dims(image, 0)
    image = tf.image.resize_bilinear(image, [output_height, output_width], align_corners=False)
    image = tf.squeeze(image, [0])
    image.set_shape([output_height, output_width, 3])

    if config.DEBUG:
      save_image_op = tf.py_func(_save_image,
                                  [image],
                                  tf.int64, stateful=True)
      image = tf.Print(image, [save_image_op])

    image = tf.to_float(image)
    normarlized_image = _mean_image_subtraction(image, [_R_MEAN, _G_MEAN, _B_MEAN])
    if data_format == 'NCHW':
      normarlized_image = tf.transpose(normarlized_image, perm=(2, 0, 1))
    return normarlized_image/255., shape, offsets 
开发者ID:HiKapok,项目名称:tf.fashionAI,代码行数:60,代码来源:preprocessing.py


注:本文中的config.DEBUG属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。