Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ConfigParser directly #52

Merged
merged 1 commit into from
Jan 5, 2022
Merged

Use ConfigParser directly #52

merged 1 commit into from
Jan 5, 2022

Conversation

pawamoy
Copy link
Contributor

@pawamoy pawamoy commented Nov 14, 2021

Apparently SafeConfigParser was renamed to ConfigParser in Python 3.2,
and the old SafeConfigParser name was kept for backward compatibility until Python 3.11.

Note: opening this to see how CI behaves. If it fails due to the changes in this PR,
I'll try to import SafeConfigParser first then ConfigParser if it fails.

Fixes #51

Apparently SafeConfigParser was renamed to ConfigParser in Python 3.2,
and the old SafeConfigParser name was kept for backward compatibility until Python 3.11.
@codecov
Copy link

codecov bot commented Nov 14, 2021

Codecov Report

Merging #52 (796af29) into master (1d0fe72) will not change coverage.
The diff coverage is 66.66%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #52   +/-   ##
=======================================
  Coverage   94.80%   94.80%           
=======================================
  Files          11       11           
  Lines         808      808           
=======================================
  Hits          766      766           
  Misses         42       42           
Impacted Files Coverage Δ
dparse/parser.py 87.68% <66.66%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1d0fe72...796af29. Read the comment docs.

@pawamoy
Copy link
Contributor Author

pawamoy commented Nov 14, 2021

I verified the statement above by looking at the code itself:

class SafeConfigParser(ConfigParser):
    """ConfigParser alias for backwards compatibility purposes."""

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        warnings.warn(
            "The SafeConfigParser class has been renamed to ConfigParser "
            "in Python 3.2. This alias will be removed in future versions."
            " Use ConfigParser directly instead.",
            DeprecationWarning, stacklevel=2
        )

@pawamoy
Copy link
Contributor Author

pawamoy commented Nov 14, 2021

Not sure why the codecov/patch job failed. Could you take a look @yeisonvargasf?

Also, I believe this change is safe since you seem to support Python versions down to 3.5 only.

@pawamoy
Copy link
Contributor Author

pawamoy commented Dec 18, 2021

A gentle ping 🙂
The change is safe to merge and release if you don't support Python versions before 3.2 😄

Copy link
Contributor

@pombredanne pombredanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ImportError: cannot import name 'SafeConfigParser' from 'configparser'
2 participants