mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-15 01:32:53 -07:00
Moved configobj lib into its own folder and fixed imports for our config class to reflect the new path of the lib.
This commit is contained in:
parent
cea3e96274
commit
aa86f74c32
6 changed files with 10 additions and 8 deletions
1
lib/configobj/__init__.py
Normal file
1
lib/configobj/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
from .configobj import *
|
1
lib/configobj/_version.py
Normal file
1
lib/configobj/_version.py
Normal file
|
@ -0,0 +1 @@
|
|||
__version__ = '5.0.4'
|
|
@ -20,6 +20,7 @@ import sys
|
|||
from codecs import BOM_UTF8, BOM_UTF16, BOM_UTF16_BE, BOM_UTF16_LE
|
||||
|
||||
import six
|
||||
from _version import __version__
|
||||
|
||||
# imported lazily to avoid startup performance hit if it isn't used
|
||||
compiler = None
|
||||
|
@ -1233,7 +1234,7 @@ class ConfigObj(Section):
|
|||
self.filename = infile
|
||||
if os.path.isfile(infile):
|
||||
with open(infile, 'rb') as h:
|
||||
content = h.read() or []
|
||||
content = h.readlines() or []
|
||||
elif self.file_error:
|
||||
# raise an error if the file doesn't exist
|
||||
raise IOError('Config file not found: "%s".' % self.filename)
|
|
@ -1,7 +1,7 @@
|
|||
import os
|
||||
import shutil
|
||||
import nzbtomedia
|
||||
import lib.configobj
|
||||
from lib.configobj import *
|
||||
from itertools import chain
|
||||
|
||||
class Sections(dict):
|
||||
|
@ -34,7 +34,7 @@ class Sections(dict):
|
|||
to_return.update({section:{key:dict.__getitem__(subsection, key)}})
|
||||
return to_return
|
||||
|
||||
class Section(lib.configobj.Section):
|
||||
class Section(configobj.Section):
|
||||
def isenabled(section):
|
||||
# checks if subsection enabled, returns true/false if subsection specified otherwise returns true/false in {}
|
||||
if section:
|
||||
|
@ -60,11 +60,11 @@ class Section(lib.configobj.Section):
|
|||
result.update({section: subsection})
|
||||
return result
|
||||
|
||||
class ConfigObj(lib.configobj.ConfigObj, Section):
|
||||
class ConfigObj(configobj.ConfigObj, Section):
|
||||
def __init__(self, *args, **kw):
|
||||
if len(args) == 0:
|
||||
args = (nzbtomedia.CONFIG_FILE,)
|
||||
super(lib.configobj.ConfigObj, self).__init__(*args, **kw)
|
||||
super(configobj.ConfigObj, self).__init__(*args, **kw)
|
||||
self.interpolation = False
|
||||
|
||||
@staticmethod
|
||||
|
@ -331,7 +331,6 @@ class ConfigObj(lib.configobj.ConfigObj, Section):
|
|||
CFG_NEW.write()
|
||||
CFG_NEW.clear()
|
||||
|
||||
|
||||
lib.configobj.Section = Section
|
||||
lib.configobj.ConfigObj = ConfigObj
|
||||
configobj.Section = Section
|
||||
configobj.ConfigObj = ConfigObj
|
||||
config = ConfigObj
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue