Skip to content

Commit

Permalink
Replace lib imports with importlib (#192)
Browse files Browse the repository at this point in the history
Co-authored-by: Florian CASTELAIN <castelain.florianext@matmut.fr>
Co-authored-by: Matthieu Monsch <1216372+mtth@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 8, 2023
1 parent 7c65ae6 commit cc3f128
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ In [3]: with CLIENT.read('models/2.json', encoding='utf-8') as reader:

## Features

* Python (2 and 3) bindings for the [WebHDFS][] (and [HttpFS][]) API,
* Python 3 bindings for the [WebHDFS][] (and [HttpFS][]) API,
supporting both secure and insecure clusters.
* Command line interface to transfer files and start an interactive client
shell, with aliases for convenient namenode URL caching.
Expand Down
2 changes: 1 addition & 1 deletion hdfs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import logging as lg


__version__ = '2.7.0'
__version__ = '2.7.1'
__license__ = 'MIT'


Expand Down
7 changes: 6 additions & 1 deletion hdfs/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from .client import Client
from .util import HdfsError
from functools import wraps
from imp import load_source
from logging.handlers import TimedRotatingFileHandler
from six.moves.configparser import ParsingError, RawConfigParser
from tempfile import gettempdir
Expand All @@ -21,6 +20,12 @@
import os.path as osp
import sys

try:
# Python 3.12 and above
from importlib import load_source
except ImportError:
# Below Python 3.12
from imp import load_source

_logger = lg.getLogger(__name__)

Expand Down
7 changes: 6 additions & 1 deletion test/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@
"""Test that the examples run correctly."""

from hdfs import Config
from imp import load_source
from six import add_metaclass
from test.util import _IntegrationTest
import os
import os.path as osp
import pytest

try:
# Python 3.12 and above
from importlib import load_source
except ImportError:
# Below Python 3.12
from imp import load_source

class _ExamplesType(type):

Expand Down

0 comments on commit cc3f128

Please sign in to comment.