Skip to content

Commit

Permalink
Merge pull request #737 from devsnd/py312
Browse files Browse the repository at this point in the history
Make compatible with Python 3.12
  • Loading branch information
devsnd authored Jun 26, 2024
2 parents 439bf27 + 8491c61 commit 92cf36c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
6 changes: 5 additions & 1 deletion cherrymusicserver/cherrymodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@
import json
import cherrypy
import audiotranscode
from imp import reload

try:
from imp import reload
except ModuleNotFoundError:
from importlib import reload

try:
from urllib.parse import quote
Expand Down
3 changes: 2 additions & 1 deletion cherrymusicserver/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,9 @@ def from_configparser(filepath):
except ImportError:
from backport.configparser import ConfigParser
cfgp = ConfigParser()
read_file = cfgp.read_file if hasattr(cfgp, "read_file") else cfgp.readfp
with open(filepath, encoding='utf-8') as fp:
cfgp.readfp(fp)
read_file(fp)
dic = OrderedDict()
for section_name in cfgp.sections():
if 'DEFAULT' == section_name:
Expand Down
6 changes: 5 additions & 1 deletion cherrymusicserver/resultorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@
fetched from the database by some mystic-voodoo-
hocuspocus heuristics"""

try:
from imp import reload
except ModuleNotFoundError:
from importlib import reload

from cherrymusicserver import pathprovider
from cherrymusicserver import log
import cherrymusicserver.tweak
from imp import reload
from cherrymusicserver.util import Performance

class ResultOrder:
Expand Down
6 changes: 5 additions & 1 deletion cherrymusicserver/sqlitecache.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
from contextlib import closing
from operator import itemgetter

try:
from imp import reload
except ModuleNotFoundError:
from importlib import reload

import cherrymusicserver as cherry
from cherrymusicserver import database
from cherrymusicserver import log
Expand All @@ -52,7 +57,6 @@
from cherrymusicserver.util import Performance
from cherrymusicserver.progress import ProgressTree, ProgressReporter
import cherrymusicserver.tweak
from imp import reload
import random

from backport import unichr
Expand Down

0 comments on commit 92cf36c

Please sign in to comment.