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


Python Logr.info方法代码示例

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


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

示例1: get_usage

# 需要导入模块: from logr import Logr [as 别名]
# 或者: from logr.Logr import info [as 别名]
    def get_usage(self, month=None, year=None):
        if not month:
            month = datetime.date.today().month
        if not year:
            year = datetime.date.today().year

        # Check if we have already cached the result
        obj_hash = self.cache_hash(month, year)
        if self.cache_valid(obj_hash):
            return self.cache[obj_hash]['result']

        # Ensure we are logged in
        if not self.conn:
            self.login()

        result = None

        try:
            Logr.info("Retrieving latest data usage details")
            usage = self.conn.get_usage(month, year)

            result = {
                'total': usage.total,
                'days': usage.days
            }
        except CompassConnectionException:
            pass

        # Cache the result
        self.cache[obj_hash] = {
            'result': result,
            'date': datetime.datetime.utcnow()
        }

        return result
开发者ID:fuzeman,项目名称:SmartUsageMeter,代码行数:37,代码来源:compass.py

示例2: load_directory

# 需要导入模块: from logr import Logr [as 别名]
# 或者: from logr.Logr import info [as 别名]
    def load_directory(self, sub_dir, base_type):
        # Load directory module first
        m = __import__(sub_dir)

        for module_name in getattr(self, sub_dir):
            Logr.info("Loading '%s.%s'" % (sub_dir, module_name))

            __import__(sub_dir + '.' + module_name)
            module = getattr(m, module_name)

            # Find classes that extend the 'base_type' base class
            module_class = None
            for name, obj in inspect.getmembers(module, inspect.isclass):
                if obj is not base_type and issubclass(obj, base_type):
                    if module_class is None:
                        module_class = obj
                    else:
                        Logr.warning("Only one class is allowed per module")

            if module_class is not None:
                spec = {
                    'module_name': sub_dir + '.' + module_name,
                    'module': module,
                    'class': module_class,
                    'detail': module_class.__detail__,
                    'options': module_class.__options__
                }
                getattr(self, sub_dir)[module_name] = spec
                self.modules[sub_dir + '.' + module_name] = spec
            else:
                Logr.warning("Unable to find class inside module '%s.%s'" % (sub_dir, module_name))
开发者ID:fuzeman,项目名称:SmartUsageMeter,代码行数:33,代码来源:module_loader.py

示例3: run

# 需要导入模块: from logr import Logr [as 别名]
# 或者: from logr.Logr import info [as 别名]
    def run(self, titles):
        titles = distinct([simplify(title) for title in titles])

        Logr.info(str(titles))

        Logr.debug("------------------------------------------------------------")

        root, tails = self.parse(titles)

        Logr.debug("--------------------------PARSE-----------------------------")

        for node in root:
            print_tree(node)

        Logr.debug("--------------------------MERGE-----------------------------")

        self.merge(root)

        Logr.debug("--------------------------FINAL-----------------------------")

        for node in root:
            print_tree(node)

        Logr.debug("--------------------------RESULT-----------------------------")

        scores = {}
        results = []

        for tail in tails:
            score, value, original_value = tail.full_value()

            if value in scores:
                scores[value] += score
            else:
                results.append((value, original_value))
                scores[value] = score

                Logr.debug("%s %s %s", score, value, original_value)

        sorted_results = sorted(results, key=lambda item: (scores[item[0]], item[1]), reverse = True)

        return [result[0] for result in sorted_results]
开发者ID:fuzeman,项目名称:QueryCondenser,代码行数:44,代码来源:merge.py

示例4: construct_patterns

# 需要导入模块: from logr import Logr [as 别名]
# 或者: from logr.Logr import info [as 别名]
    def construct_patterns(self, pattern_groups):
        compile_start = datetime.now()
        compile_count = 0

        for group_name, patterns in pattern_groups:
            if group_name not in self.regex:
                self.regex[group_name] = []

            # Transform into weight groups
            if type(patterns[0]) is str or type(patterns[0][0]) not in [int, float]:
                patterns = [(1.0, patterns)]

            for weight, patterns in patterns:
                weight_patterns = []

                for pattern in patterns:
                    # Transform into multi-fragment patterns
                    if type(pattern) is str:
                        pattern = (pattern,)

                    if type(pattern) is tuple and len(pattern) == 2:
                        if type(pattern[0]) is str and is_list_type(pattern[1], str):
                            pattern = (pattern,)

                    result = []
                    for value in pattern:
                        if type(value) is tuple:
                            if len(value) == 2:
                                # Construct OR-list pattern
                                value = value[0] % '|'.join(value[1])
                            elif len(value) == 1:
                                value = value[0]

                        result.append(re.compile(value, re.IGNORECASE))
                        compile_count += 1

                    weight_patterns.append(tuple(result))

                self.regex[group_name].append((weight, weight_patterns))

        Logr.info("Compiled %s patterns in %ss", compile_count, delta_seconds(datetime.now() - compile_start))
开发者ID:ANTH040,项目名称:CouchPotatoServer,代码行数:43,代码来源:matcher.py

示例5: construct_patterns

# 需要导入模块: from logr import Logr [as 别名]
# 或者: from logr.Logr import info [as 别名]
    def construct_patterns(self, pattern_groups):
        compile_start = datetime.now()
        compile_count = 0

        for group_name, patterns in pattern_groups:
            if group_name not in self.regex:
                self.regex[group_name] = []

            # Transform into weight groups
            if type(patterns[0]) is str or type(patterns[0][0]) not in [int, float]:
                patterns = [(1.0, patterns)]

            for weight, patterns in patterns:
                weight_patterns = []

                for pattern in [CaperPattern.construct(v) for v in patterns if v]:
                    compile_count += pattern.compile()
                    weight_patterns.append(pattern)

                self.regex[group_name].append((weight, weight_patterns))

        Logr.info("Compiled %s patterns in %ss", compile_count, delta_seconds(datetime.now() - compile_start))
开发者ID:Danik1601,项目名称:Plex-Trakt-Scrobbler,代码行数:24,代码来源:matcher.py

示例6: __init__

# 需要导入模块: from logr import Logr [as 别名]
# 或者: from logr.Logr import info [as 别名]
    def __init__(self, debug=False):
        if not SceneParser.matcher:
            SceneParser.matcher = Matcher(PATTERN_GROUPS)
            Logr.info("Fragment matcher for %s created", self.__class__.__name__)

        super(SceneParser, self).__init__(SceneParser.matcher, debug)
开发者ID:cabre012,项目名称:Plex-Trakt-Scrobbler,代码行数:8,代码来源:scene.py

示例7: load

# 需要导入模块: from logr import Logr [as 别名]
# 或者: from logr.Logr import info [as 别名]
 def load(self):
     self.load_directory('sources', Source)
     Logr.info("Finished loading modules")
开发者ID:fuzeman,项目名称:SmartUsageMeter,代码行数:5,代码来源:module_loader.py


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