
import logging
from smart_open import version

from .smart_open_lib import open, parse_uri, smart_open, register_compressor
from .s3 import iter_bucket as s3_iter_bucket

__all__ = [
    'open',
    'parse_uri',
    'register_compressor',
    's3_iter_bucket',
    'smart_open',
]


__version__ = version.__version__

logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())


import logging
from smart_open import version

logger = logging.getLogger(__name__)
if len(logger.handlers) == 0:
    logger.addHandler(logging.NullHandler())

from .smart_open_lib import open, parse_uri, smart_open, register_compressor
from .s3 import iter_bucket as s3_iter_bucket

__all__ = [
    'open',
    'parse_uri',
    'register_compressor',
    's3_iter_bucket',
    'smart_open',
]

__version__ = version.__version__

Configure logging handlers before submodule imports
Configure logging handlers before submodule imports

- Fix #474
- Fix #475

  
  import logging
  from smart_open import version
+ 
+ logger = logging.getLogger(__name__)
+ if len(logger.handlers) == 0:
+     logger.addHandler(logging.NullHandler())
  
  from .smart_open_lib import open, parse_uri, smart_open, register_compressor
  from .s3 import iter_bucket as s3_iter_bucket
  
  __all__ = [
      'open',
      'parse_uri',
      'register_compressor',
      's3_iter_bucket',
      'smart_open',
  ]
  
- 
  __version__ = version.__version__
  
- logger = logging.getLogger(__name__)
- logger.addHandler(logging.NullHandler())
- 
Configure logging handlers before submodule imports
## Code Before:

import logging
from smart_open import version

from .smart_open_lib import open, parse_uri, smart_open, register_compressor
from .s3 import iter_bucket as s3_iter_bucket

__all__ = [
    'open',
    'parse_uri',
    'register_compressor',
    's3_iter_bucket',
    'smart_open',
]


__version__ = version.__version__

logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())

## Instruction:
Configure logging handlers before submodule imports
## Code After:

import logging
from smart_open import version

logger = logging.getLogger(__name__)
if len(logger.handlers) == 0:
    logger.addHandler(logging.NullHandler())

from .smart_open_lib import open, parse_uri, smart_open, register_compressor
from .s3 import iter_bucket as s3_iter_bucket

__all__ = [
    'open',
    'parse_uri',
    'register_compressor',
    's3_iter_bucket',
    'smart_open',
]

__version__ = version.__version__
