Browse Source

Correct typo and improve flexibility

pull/179/head
Oliverpool 9 years ago
parent
commit
3790bc979b
  1. 2
      patacrep/content/song.py
  2. 8
      patacrep/utils.py
  3. 1
      test/test_content/glob.control
  4. 1
      test/test_content/glob.source

2
patacrep/content/song.py

@ -78,7 +78,7 @@ def parse(keyword, argument, contentlist, config):
if not os.path.isdir(songdir.datadir): if not os.path.isdir(songdir.datadir):
continue continue
with files.chdir(songdir.datadir): with files.chdir(songdir.datadir):
# Starting with Python 3.5 glog can be recursive: **/*.csg for instance # Starting with Python 3.5 glob can be recursive: **/*.csg for instance
# for filename in glob.iglob(os.path.join(songdir.subpath, elem), recursive=True): # for filename in glob.iglob(os.path.join(songdir.subpath, elem), recursive=True):
for filename in glob.iglob(os.path.join(songdir.subpath, elem)): for filename in glob.iglob(os.path.join(songdir.subpath, elem)):
LOGGER.debug('Parsing file "{}"'.format(filename)) LOGGER.debug('Parsing file "{}"'.format(filename))

8
patacrep/utils.py

@ -80,9 +80,9 @@ def yesno(string):
)) ))
@contextlib.contextmanager @contextlib.contextmanager
def logging_reduced(module_name): def logging_reduced(module_name, tmp_level=logging.CRITICAL):
logger = logging.getLogger(module_name) logger = logging.getLogger(module_name)
previous_loglevel = logger.getEffectiveLevel() old_level = logger.getEffectiveLevel()
logger.setLevel(logging.CRITICAL) logger.setLevel(tmp_level)
yield yield
logger.setLevel(previous_loglevel) logger.setLevel(old_level)

1
test/test_content/glob.control

@ -0,0 +1 @@
["chordpro.csg"]

1
test/test_content/glob.source

@ -0,0 +1 @@
["*.csg"]
Loading…
Cancel
Save