Python pytz 模块,OLSON_VERSION 实例源码

我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用pytz.OLSON_VERSION

项目:true_review    作者:lucadealfaro    | 项目源码 | 文件源码
def open_resource(self, name):
        """Opens a resource from the zoneinfo subdir for reading."""
        name_parts = name.lstrip('/').split('/')
        if os.path.pardir in name_parts:
            raise ValueError('Bad path segment: %r' % os.path.pardir)

        cache_key = 'pytz.zoneinfo.%s.%s' % (pytz.OLSON_VERSION, name)
        zonedata = memcache.get(cache_key)
        if zonedata is None:
            zonedata = get_zoneinfo().read('zoneinfo/' + '/'.join(name_parts))
            memcache.add(cache_key, zonedata)
            logging.info('Added timezone to memcache: %s' % cache_key)
        else:
            logging.info('Loaded timezone from memcache: %s' % cache_key)

        return StringIO(zonedata)
项目:enkiWS    作者:juliettef    | 项目源码 | 文件源码
def open_resource(self, name):
        """Opens a resource from the zoneinfo subdir for reading."""
        name_parts = name.lstrip('/').split('/')
        if os.path.pardir in name_parts:
            raise ValueError('Bad path segment: %r' % os.path.pardir)

        cache_key = 'pytz.zoneinfo.%s.%s' % (pytz.OLSON_VERSION, name)
        zonedata = memcache.get(cache_key)
        if zonedata is None:
            zonedata = get_zoneinfo().read('zoneinfo/' + '/'.join(name_parts))
            memcache.add(cache_key, zonedata)
            logging.info('Added timezone to memcache: %s' % cache_key)
        else:
            logging.info('Loaded timezone from memcache: %s' % cache_key)

        return StringIO(zonedata)
项目:flow-dashboard    作者:onejgordon    | 项目源码 | 文件源码
def open_resource(self, name):
        """Opens a resource from the zoneinfo subdir for reading."""
        # Import nested here so we can run setup.py without GAE.
        from google.appengine.api import memcache
        from pytz import OLSON_VERSION

        name_parts = name.lstrip('/').split('/')
        if os.path.pardir in name_parts:
            raise ValueError('Bad path segment: %r' % os.path.pardir)

        cache_key = 'pytz.zoneinfo.%s.%s' % (OLSON_VERSION, name)
        zonedata = memcache.get(cache_key)
        if zonedata is None:
            zonedata = get_zoneinfo().read('zoneinfo/' + '/'.join(name_parts))
            memcache.add(cache_key, zonedata)
            log.info('Added timezone to memcache: %s' % cache_key)
        else:
            log.info('Loaded timezone from memcache: %s' % cache_key)

        return StringIO(zonedata)
项目:epg-dk.bundle    作者:ukdtom    | 项目源码 | 文件源码
def testVersion(self):
        # Ensuring the correct version of pytz has been loaded
        self.assertEqual(EXPECTED_VERSION, pytz.__version__,
                'Incorrect pytz version loaded. Import path is stuffed '
                'or this test needs updating. (Wanted %s, got %s)'
                % (EXPECTED_VERSION, pytz.__version__))

        self.assertEqual(EXPECTED_OLSON_VERSION, pytz.OLSON_VERSION,
                'Incorrect pytz version loaded. Import path is stuffed '
                'or this test needs updating. (Wanted %s, got %s)'
                % (EXPECTED_OLSON_VERSION, pytz.OLSON_VERSION))
项目:FMoviesPlus.bundle    作者:coder-alpha    | 项目源码 | 文件源码
def testVersion(self):
        # Ensuring the correct version of pytz has been loaded
        self.assertEqual(EXPECTED_VERSION, pytz.__version__,
                'Incorrect pytz version loaded. Import path is stuffed '
                'or this test needs updating. (Wanted %s, got %s)'
                % (EXPECTED_VERSION, pytz.__version__))

        self.assertEqual(EXPECTED_OLSON_VERSION, pytz.OLSON_VERSION,
                'Incorrect pytz version loaded. Import path is stuffed '
                'or this test needs updating. (Wanted %s, got %s)'
                % (EXPECTED_OLSON_VERSION, pytz.OLSON_VERSION))
项目:pyfiddleio    作者:priyankcommits    | 项目源码 | 文件源码
def testVersion(self):
        # Ensuring the correct version of pytz has been loaded
        self.assertEqual(EXPECTED_VERSION, pytz.__version__,
                'Incorrect pytz version loaded. Import path is stuffed '
                'or this test needs updating. (Wanted %s, got %s)'
                % (EXPECTED_VERSION, pytz.__version__))

        self.assertEqual(EXPECTED_OLSON_VERSION, pytz.OLSON_VERSION,
                'Incorrect pytz version loaded. Import path is stuffed '
                'or this test needs updating. (Wanted %s, got %s)'
                % (EXPECTED_OLSON_VERSION, pytz.OLSON_VERSION))
项目:LSTM-GA-StockTrader    作者:MartinLidy    | 项目源码 | 文件源码
def testVersion(self):
        # Ensuring the correct version of pytz has been loaded
        self.assertEqual(EXPECTED_VERSION, pytz.__version__,
                'Incorrect pytz version loaded. Import path is stuffed '
                'or this test needs updating. (Wanted %s, got %s)'
                % (EXPECTED_VERSION, pytz.__version__))

        self.assertEqual(EXPECTED_OLSON_VERSION, pytz.OLSON_VERSION,
                'Incorrect pytz version loaded. Import path is stuffed '
                'or this test needs updating. (Wanted %s, got %s)'
                % (EXPECTED_OLSON_VERSION, pytz.OLSON_VERSION))