Skip to content

Commit

Permalink
replace ConfigParser's 'readfp' by 'read_string'
Browse files Browse the repository at this point in the history
fixes "DeprecationWarning: This method will be removed in Python 3.12. Use
parser.read_file instead", and will marginally improve performance
  • Loading branch information
deronnax authored and yeisonvargasf committed Oct 16, 2023
1 parent 74da89e commit a3d83e8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions dparse/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import re
import sys

from io import StringIO

from configparser import ConfigParser, NoOptionError
from pathlib import PurePath

Expand Down Expand Up @@ -305,7 +303,7 @@ def parse(self):
:return:
"""
parser = ConfigParser()
parser.readfp(StringIO(self.obj.content))
parser.read_string(self.obj.content)
for section in parser.sections():
try:
content = parser.get(section=section, option="deps")
Expand Down Expand Up @@ -413,7 +411,7 @@ def parse(self):
class SetupCfgParser(Parser):
def parse(self):
parser = ConfigParser()
parser.readfp(StringIO(self.obj.content))
parser.read_string(self.obj.content)
for section in parser.values():
if section.name == 'options':
options = 'install_requires', 'setup_requires', 'test_require'
Expand Down

0 comments on commit a3d83e8

Please sign in to comment.