Kill off a 2.7-ism
This commit is contained in:
@@ -12,11 +12,14 @@
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import argparse
|
||||
import base64
|
||||
import hashlib
|
||||
import hmac
|
||||
import os
|
||||
import logging
|
||||
import requests.auth
|
||||
import six
|
||||
import time
|
||||
@@ -35,9 +38,15 @@ class BaseAuth(requests.auth.AuthBase):
|
||||
def __init__(self, service, **kwargs):
|
||||
self.args = kwargs
|
||||
self.config = service.config
|
||||
self.log = service.log.getChild(self.__class__.__name__)
|
||||
self.service = service
|
||||
|
||||
# Yes, service.log.getChild is shorter, but it was added in 2.7.
|
||||
if service.log is logging.root:
|
||||
self.log = logging.getLogger(self.__class__.__name__)
|
||||
else:
|
||||
self.log = logging.getLogger('{0}.{1}'.format(
|
||||
service.log.name, self.__class__.__name__))
|
||||
|
||||
def collect_arg_objs(self):
|
||||
return aggregate_subclass_fields(self.__class__, 'ARGS')
|
||||
|
||||
|
||||
@@ -12,13 +12,21 @@
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import ConfigParser
|
||||
import itertools
|
||||
import logging
|
||||
|
||||
class Config(object):
|
||||
def __init__(self, filenames, log=None):
|
||||
if log:
|
||||
self.log = log.getChild('config')
|
||||
# Yes, service.log.getChild is shorter, but it was added in 2.7.
|
||||
print dir(logging)
|
||||
if log is logging.root:
|
||||
self.log = logging.getChild('config')
|
||||
else:
|
||||
self.log = logging.getLogger('{0}.config'.format(log.name))
|
||||
else:
|
||||
self.log = _FakeLogger()
|
||||
self.globals = {}
|
||||
|
||||
Reference in New Issue
Block a user