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


Python counter.counter函数代码示例

本文整理汇总了Python中supervisor.medusa.counter.counter函数的典型用法代码示例。如果您正苦于以下问题:Python counter函数的具体用法?Python counter怎么用?Python counter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: __init__

 def __init__ (self, filesystem):
     self.filesystem = filesystem
     # count total hits
     self.hit_counter = counter()
     # count file deliveries
     self.file_counter = counter()
     # count cache hits
     self.cache_counter = counter()
开发者ID:GulsahKose,项目名称:supervisor,代码行数:8,代码来源:default_handler.py

示例2: __init__

    def __init__ (self, ip, port, resolver=None, logger_object=None):
        self.ip = ip
        self.port = port
        asyncore.dispatcher.__init__ (self)
        self.create_socket (socket.AF_INET, socket.SOCK_STREAM)

        self.handlers = []

        if not logger_object:
            logger_object = logger.file_logger (sys.stdout)

        self.set_reuse_addr()
        self.bind ((ip, port))

        # lower this to 5 if your OS complains
        self.listen (1024)

        host, port = self.socket.getsockname()
        if not ip:
            self.log_info('Computing default hostname', 'warning')
            ip = socket.gethostbyname (socket.gethostname())
        try:
            self.server_name = socket.gethostbyaddr (ip)[0]
        except socket.error:
            self.log_info('Cannot do reverse lookup', 'warning')
            self.server_name = ip       # use the IP address as the "hostname"

        self.server_port = port
        self.total_clients = counter()
        self.total_requests = counter()
        self.exceptions = counter()
        self.bytes_out = counter()
        self.bytes_in  = counter()

        if not logger_object:
            logger_object = logger.file_logger (sys.stdout)

        if resolver:
            self.logger = logger.resolving_logger (resolver, logger_object)
        else:
            self.logger = logger.unresolving_logger (logger_object)

        self.log_info (
                'Medusa (V%s) started at %s'
                '\n\tHostname: %s'
                '\n\tPort:%d'
                '\n' % (
                        VERSION_STRING,
                        time.ctime(time.time()),
                        self.server_name,
                        port,
                        )
                )
开发者ID:lmcdonough,项目名称:supervisor,代码行数:53,代码来源:http_server.py

示例3: __init__

 def __init__ (self, hostname='127.0.0.1', port=8023):
     asyncore.dispatcher.__init__(self)
     self.hostname = hostname
     self.port = port
     self.create_socket (socket.AF_INET, socket.SOCK_STREAM)
     self.set_reuse_addr()
     self.bind ((hostname, port))
     self.log_info('%s started on port %d' % (self.SERVER_IDENT, port))
     self.listen (5)
     self.closed             = 0
     self.failed_auths = 0
     self.total_sessions = counter()
     self.closed_sessions = counter()
开发者ID:lmcdonough,项目名称:supervisor,代码行数:13,代码来源:monitor.py

示例4: postbind

    def postbind(self):
        from supervisor.medusa.counter import counter
        from supervisor.medusa.http_server import VERSION_STRING

        self.listen(1024)

        self.total_clients = counter()
        self.total_requests = counter()
        self.exceptions = counter()
        self.bytes_out = counter()
        self.bytes_in  = counter()

        self.log_info (
                'Medusa (V%s) started at %s'
                '\n\tHostname: %s'
                '\n\tPort:%s'
                '\n' % (
                        VERSION_STRING,
                        time.ctime(time.time()),
                        self.server_name,
                        self.port,
                        )
                )
开发者ID:wowgeeker,项目名称:supervisor,代码行数:23,代码来源:http.py

示例5: __init__

    def __init__ (
            self,
            authorizer,
            hostname        =None,
            ip              ='',
            port            =21,
            resolver        =None,
            logger_object=logger.file_logger (sys.stdout)
            ):
        self.ip = ip
        self.port = port
        self.authorizer = authorizer

        if hostname is None:
            self.hostname = socket.gethostname()
        else:
            self.hostname = hostname

        # statistics
        self.total_sessions = counter()
        self.closed_sessions = counter()
        self.total_files_out = counter()
        self.total_files_in = counter()
        self.total_bytes_out = counter()
        self.total_bytes_in = counter()
        self.total_exceptions = counter()
        #
        asyncore.dispatcher.__init__ (self)
        self.create_socket (socket.AF_INET, socket.SOCK_STREAM)

        self.set_reuse_addr()
        self.bind ((self.ip, self.port))
        self.listen (5)

        if not logger_object:
            logger_object = sys.stdout

        if resolver:
            self.logger = logger.resolving_logger (resolver, logger_object)
        else:
            self.logger = logger.unresolving_logger (logger_object)

        self.log_info('FTP server started at %s\n\tAuthorizer:%s\n\tHostname: %s\n\tPort: %d' % (
                time.ctime(time.time()),
                repr (self.authorizer),
                self.hostname,
                self.port)
                )
开发者ID:GulsahKose,项目名称:supervisor,代码行数:48,代码来源:ftp_server.py

示例6: __init__

 def __init__ (self, filesystem):
     self.filesystem = filesystem
     self.hits = counter.counter()
     self.exceptions = counter.counter()
开发者ID:GulsahKose,项目名称:supervisor,代码行数:4,代码来源:script_handler.py

示例7: __init__

 def __init__ (self, request, file):
     self.buffer = ''
     self.request = request
     self.file = file
     self.got_header = 0
     self.bytes_out = counter.counter()
开发者ID:AhmadAabed,项目名称:supervisor-c9,代码行数:6,代码来源:thread_handler.py

示例8: __init__

 def __init__ (self, server='127.0.0.1'):
     resolver.__init__(self, server)
     self.cache = {}
     self.forward_requests = counter()
     self.reverse_requests = counter()
     self.cache_hits = counter()
开发者ID:lmcdonough,项目名称:supervisor,代码行数:6,代码来源:resolver.py

示例9: __init__

 def __init__(self, dict, handler, realm="default"):
     self.authorizer = dictionary_authorizer(dict)
     self.handler = handler
     self.realm = realm
     self.pass_count = counter.counter()
     self.fail_count = counter.counter()
开发者ID:GulsahKose,项目名称:supervisor,代码行数:6,代码来源:auth_handler.py

示例10: __init__

 def __init__ (self, pattern, redirect, regex_flag=re.IGNORECASE):
     self.pattern = pattern
     self.redirect = redirect
     self.patreg = re.compile (pattern, regex_flag)
     self.hits = counter.counter()
开发者ID:GulsahKose,项目名称:supervisor,代码行数:5,代码来源:redirecting_handler.py


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