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


Python logging.debug方法代码示例

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


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

示例1: create_scats

# 需要导入模块: import logging [as 别名]
# 或者: from logging import debug [as 别名]
def create_scats(self, varieties):
        self.scats = pd.DataFrame(columns=["x", "y", "color", "marker", "var"])
        for i, var in enumerate(varieties):
            self.legend.append(var)
            (x_array, y_array) = self.get_arrays(varieties, var)
            if len(x_array) <= 0:  # no data to graph!
                '''
                I am creating a single "position" for an agent that cannot
                be seen. This seems to fix the issue of colors being
                missmatched in the occasion that a group has no agents.
                '''
                x_array = [-1]
                y_array = [-1]
            elif len(x_array) != len(y_array):
                logging.debug("Array length mismatch in scatter plot")
                return
            color = get_color(varieties[var], i)
            marker = get_marker(varieties[var], i)
            scat = pd.DataFrame({"x": pd.Series(x_array),
                                 "y": pd.Series(y_array),
                                 "color": color,
                                 "marker": marker,
                                 "var": var})
            self.scats = self.scats.append(scat, ignore_index=True,
                                           sort=False) 
开发者ID:gcallah,项目名称:indras_net,代码行数:27,代码来源:display_methods.py

示例2: element_at

# 需要导入模块: import logging [as 别名]
# 或者: from logging import debug [as 别名]
def element_at(self, i):
        """
        Another way to treat the AgentPop as if it were really
        one big list.
        """
        if i < 0 or i > len(self):
            raise IndexError()
        else:
            for var in self.varieties_iter():
                l = len(self.vars[var]["agents"])
                logging.debug("Looking for element from "
                              + var + " at position "
                              + str(i) + " and var has len "
                              + str(l))
                if i < l:
                    # that means the agent is in this list
                    return self.vars[var]["agents"][i]
                else:
                    # otherwise, the agent lies in one of the
                    # remaining lists, so subtract the length
                    # of this one from i and continue.
                    i -= l 
开发者ID:gcallah,项目名称:indras_net,代码行数:24,代码来源:agent_pop.py

示例3: __marginal_util

# 需要导入模块: import logging [as 别名]
# 或者: from logging import debug [as 别名]
def __marginal_util(self, good, amt):
        """
        What is the marginal utility gained or lost
        from our current trade?
        """
        assert amt != 0
        g = self.goods[good]
        curr_amt = g["endow"]
        if amt < 0:
            u1 = 1
            u2 = 0
        else:
            u1 = 0
            u2 = 1
        util1 = g["util_func"](curr_amt + u1) + g["incr"]
        util2 = g["util_func"](curr_amt + amt + u2) + g["incr"]
        avg_util = (util1 + util2) / 2
        logging.debug("For %s; util1 = %i and util2 = %i"
                      % (self.name, util1, util2))
        return(avg_util * amt) 
开发者ID:gcallah,项目名称:indras_net,代码行数:22,代码来源:edgebox_model.py

示例4: printDebugInfo

# 需要导入模块: import logging [as 别名]
# 或者: from logging import debug [as 别名]
def printDebugInfo(dataHub):
    if dataHub.args.verbose > 3:
        info = []

        info.append("="*80)

        for allele in ["ref", "alt"]:
            for part in dataHub.variant.chromParts(allele):
                info.append(str(part))
            info.append("")
        logging.debug("\n".join(info))

    if dataHub.args.verbose > 9:
        info = []

        info.append("="*80)

        for allele in ["ref", "alt"]:
            for part in dataHub.variant.chromParts(allele):
                info.append(str(part.getSeq()))
            info.append("")
        logging.debug("\n".join(info)) 
开发者ID:svviz,项目名称:svviz,代码行数:24,代码来源:debug.py

示例5: random_optimize

# 需要导入模块: import logging [as 别名]
# 或者: from logging import debug [as 别名]
def random_optimize(GA, GB, n_iter=20):
    best_c = None
    best_order = None
    best_depth = None
    best_quality = -1
    for it in range(n_iter):
        c = random.randint(1, 7)
        order = random.randint(1, 10)
        depth = random.randint(1, 20)
        pairings = match(GA, GB, complexity=c, order=order, max_depth=depth)
        quality = compute_quality(GA, GB, pairings)
        if quality > best_quality:
            best_quality = quality
            best_c = c
            best_order = order
            best_depth = depth
    logging.debug('[random search] quality:%.2f c:%d o:%d d:%d' % (best_quality, best_c, best_order, best_depth))
    return best_quality, best_c, best_order, best_depth 
开发者ID:fabriziocosta,项目名称:EDeN,代码行数:20,代码来源:__init__.py

示例6: setup_events

# 需要导入模块: import logging [as 别名]
# 或者: from logging import debug [as 别名]
def setup_events(self):
        """Attaches the on_change event to the value property of the widget.

        The callback is set to the input_change method of this app.
        """
        super(StockApp, self).setup_events()

        logging.debug("%s" % str(self.source))
        # Slider event registration
        # self.source.on_change('selected', self, 'on_selection_change')
        print("+++++++++++++++++++++++++++++++++")
        print(self)
        self.stock_plot.on_change('value', self, 'input_change')
        # self.outliers_source.on_change('selected', self, 'on_selection_change')
        # for w in ["bins"]:
        #     getattr(self, w).on_change('value', self, 'input_change') 
开发者ID:mvaz,项目名称:osqf2015,代码行数:18,代码来源:stock.py

示例7: to_radians

# 需要导入模块: import logging [as 别名]
# 或者: from logging import debug [as 别名]
def to_radians(arr, is_delta=False):
    """Force data with units either degrees or radians to be radians."""
    # Infer the units from embedded metadata, if it's there.
    try:
        units = arr.units
    except AttributeError:
        pass
    else:
        if units.lower().startswith('degrees'):
            warn_msg = ("Conversion applied: degrees -> radians to array: "
                        "{}".format(arr))
            logging.debug(warn_msg)
            return np.deg2rad(arr)
    # Otherwise, assume degrees if the values are sufficiently large.
    threshold = 0.1*np.pi if is_delta else 4*np.pi
    if np.max(np.abs(arr)) > threshold:
        warn_msg = ("Conversion applied: degrees -> radians to array: "
                    "{}".format(arr))
        logging.debug(warn_msg)
        return np.deg2rad(arr)
    return arr 
开发者ID:spencerahill,项目名称:aospy,代码行数:23,代码来源:vertcoord.py

示例8: _rename_coords

# 需要导入模块: import logging [as 别名]
# 或者: from logging import debug [as 别名]
def _rename_coords(ds, attrs):
    """Rename coordinates to aospy's internal names."""
    for name_int, names_ext in attrs.items():
        # Check if coord is in dataset already.
        ds_coord_name = set(names_ext).intersection(set(ds.coords))
        if ds_coord_name:
            # Rename to the aospy internal name.
            try:
                ds = ds.rename({list(ds_coord_name)[0]: name_int})
                logging.debug("Rename coord from `{0}` to `{1}` for "
                              "Dataset `{2}`".format(ds_coord_name,
                                                     name_int, ds))
            # xarray throws a ValueError if the name already exists
            except ValueError:
                ds = ds
    return ds 
开发者ID:spencerahill,项目名称:aospy,代码行数:18,代码来源:model.py

示例9: connect

# 需要导入模块: import logging [as 别名]
# 或者: from logging import debug [as 别名]
def connect(self):
        if self.is_server:
            log.debug("waiting for client to connect...")
            s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            s.bind(('', self.port))
            s.settimeout(0.1)
            start_time = time.time()
            s.listen(0)
            while True:
                try:
                    conn, _ = s.accept()
                    self.conn = conn
                    break
                except socket.timeout:
                    pass
                if self.timeout > 0 and time.time() - start_time >= self.timeout:
                    s.close()
                    raise RuntimeError("Timeout exceeded (%ds)" % self.timeout)
            self.conn.setblocking(True)
        else:
            log.debug("connecting to server (%s:%d)...", self.ip, self.port)
            self.conn = socket.create_connection((self.ip, self.port), self.timeout) 
开发者ID:blackberry,项目名称:ALF,代码行数:24,代码来源:SockPuppet.py

示例10: run_code

# 需要导入模块: import logging [as 别名]
# 或者: from logging import debug [as 别名]
def run_code(self, function, *args, **kwargs):
        log.debug("%s() args:%s kwargs:%s on target", function.func_name, args, kwargs)
        data = {"cmd":self.CODE,
                "code":marshal.dumps(function.func_code),
                "name":function.func_name,
                "args":args,
                "kwargs":kwargs,
                "defaults":function.__defaults__,
                "closure":function.__closure__}
        self.send_data(data)
        log.debug("waiting for code to execute...")
        data = self.recv_data()
        if data["cmd"] == self.EXCEPT:
            log.debug("received exception")
            raise self._process_target_except(data)
        assert data["cmd"] == self.RETURN
        return data["value"] 
开发者ID:blackberry,项目名称:ALF,代码行数:19,代码来源:SockPuppet.py

示例11: keep

# 需要导入模块: import logging [as 别名]
# 或者: from logging import debug [as 别名]
def keep(self, yes):
        if self.tried is None:
            raise Exception("feedback before any value was generated")
        if yes:
            self.i += 1
            logging.debug("keeping chunk %d/%d (len==%d)", self.i, len(self.data), self.size)
        else:
            self.size -= len(self.data[self.i])
            self.data = self.tried
            #self.found_something = True # setting this to True causes the reduce loop to keep
                                         # going at chunk=1 until nothing more can be eliminated
            logging.debug("eliminated chunk %d/%d (len==%d)",
                          self.i + 1, len(self.data) + 1, self.size)
            if len(self.data) == 1:
                logging.debug("only one chunk left, assuming it is needed")
                self._reset()
        self.tried = None 
开发者ID:blackberry,项目名称:ALF,代码行数:19,代码来源:reduce.py

示例12: read_config

# 需要导入模块: import logging [as 别名]
# 或者: from logging import debug [as 别名]
def read_config(self):
    """Read the user's configuration file."""

    logging.debug('[VT Plugin] Reading user config file: %s', self.vt_cfgfile)
    config_file = configparser.RawConfigParser()
    config_file.read(self.vt_cfgfile)

    try:
      if config_file.get('General', 'auto_upload') == 'True':
        self.auto_upload = True
      else:
        self.auto_upload = False
      return True
    except:
      logging.error('[VT Plugin] Error reading the user config file.')
      return False 
开发者ID:VirusTotal,项目名称:vt-ida-plugin,代码行数:18,代码来源:plugin_loader.py

示例13: write_config

# 需要导入模块: import logging [as 别名]
# 或者: from logging import debug [as 别名]
def write_config(self):
    """Write user's configuration file."""

    logging.debug('[VT Plugin] Writing user config file: %s', self.vt_cfgfile)

    try:
      parser = configparser.ConfigParser()
      config_file = open(self.vt_cfgfile, 'w')
      parser.add_section('General')
      parser.set('General', 'auto_upload', str(self.auto_upload))
      parser.write(config_file)
      config_file.close()
    except:
      logging.error('[VT Plugin] Error while creating the user config file.')
      return False
    return True 
开发者ID:VirusTotal,项目名称:vt-ida-plugin,代码行数:18,代码来源:plugin_loader.py

示例14: check_version

# 需要导入模块: import logging [as 别名]
# 或者: from logging import debug [as 别名]
def check_version(self):
    """Return True if there's an update available."""

    user_agent = 'IDA Pro VT Plugin checkversion - v' + VT_IDA_PLUGIN_VERSION
    headers = {
        'User-Agent': user_agent,
        'Accept': 'application/json'
    }
    url = 'https://raw.githubusercontent.com/VirusTotal/vt-ida-plugin/master/VERSION'

    try:
      response = requests.get(url, headers=headers)
    except:
      logging.error('[VT Plugin] Unable to check for updates.')
      return False

    if response.status_code == 200:
      version = response.text.rstrip('\n')
      if self.__compare_versions(VT_IDA_PLUGIN_VERSION, version):
        logging.debug('[VT Plugin] Version %s is available !', version)
        return True
    return False 
开发者ID:VirusTotal,项目名称:vt-ida-plugin,代码行数:24,代码来源:plugin_loader.py

示例15: log

# 需要导入模块: import logging [as 别名]
# 或者: from logging import debug [as 别名]
def log(message, info=True, error=False, debug=False, _print=True):
    """
    Dirty function to log messages to file and also print on screen.
    :param message:
    :param info:
    :param error:
    :param debug:
    :return:
    """
    if _print is True:
        print(message)

    # remove ANSI color codes from logs
    # message_clean = re.compile(r'\x1b[^m]*m').sub('', message)

    if info is True:
        logging.info(message)
    elif error is not False:
        logging.error(message)
    elif debug is not False:
        logging.debug(message) 
开发者ID:mbusb,项目名称:multibootusb,代码行数:23,代码来源:osdriver.py


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