From 3790bc979bf52af51e14aab337abde05eec0cef5 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Sun, 22 Nov 2015 14:23:37 +0100 Subject: [PATCH] Correct typo and improve flexibility --- patacrep/content/song.py | 2 +- patacrep/utils.py | 8 ++++---- test/test_content/glob.control | 1 + test/test_content/glob.source | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 test/test_content/glob.control create mode 100644 test/test_content/glob.source diff --git a/patacrep/content/song.py b/patacrep/content/song.py index eaef5663..c7925354 100755 --- a/patacrep/content/song.py +++ b/patacrep/content/song.py @@ -78,7 +78,7 @@ def parse(keyword, argument, contentlist, config): if not os.path.isdir(songdir.datadir): continue 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)): LOGGER.debug('Parsing file "{}"…'.format(filename)) diff --git a/patacrep/utils.py b/patacrep/utils.py index c096ac01..1b95b398 100644 --- a/patacrep/utils.py +++ b/patacrep/utils.py @@ -80,9 +80,9 @@ def yesno(string): )) @contextlib.contextmanager -def logging_reduced(module_name): +def logging_reduced(module_name, tmp_level=logging.CRITICAL): logger = logging.getLogger(module_name) - previous_loglevel = logger.getEffectiveLevel() - logger.setLevel(logging.CRITICAL) + old_level = logger.getEffectiveLevel() + logger.setLevel(tmp_level) yield - logger.setLevel(previous_loglevel) + logger.setLevel(old_level) diff --git a/test/test_content/glob.control b/test/test_content/glob.control new file mode 100644 index 00000000..a30583cc --- /dev/null +++ b/test/test_content/glob.control @@ -0,0 +1 @@ +["chordpro.csg"] \ No newline at end of file diff --git a/test/test_content/glob.source b/test/test_content/glob.source new file mode 100644 index 00000000..167ab6ab --- /dev/null +++ b/test/test_content/glob.source @@ -0,0 +1 @@ +["*.csg"] \ No newline at end of file