Skip to content

Commit

Permalink
Simplified recursive fetching of .bsb files
Browse files Browse the repository at this point in the history
  • Loading branch information
mp4096 committed Sep 20, 2016
1 parent b9f1124 commit 9e16c62
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions blockschaltbilder/boilerplate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .bsb import Blockschaltbild
import codecs
import fnmatch
from fnmatch import fnmatch
import os
import re

Expand Down Expand Up @@ -170,7 +170,7 @@ def _convert_single_file(filename):
"""

# Check file extension
if not fnmatch.fnmatch(filename, '*.bsb'):
if not fnmatch(filename, '*.bsb'):
raise ValueError("The input file must have a 'bsb' extension")

# Open this file and read all its contents into a list
Expand Down Expand Up @@ -199,10 +199,8 @@ def _find_bsb_files(root_directory):
"""
for root, dirs, files in os.walk(root_directory):
for basename in files:
if fnmatch.fnmatch(basename, '*.bsb'):
filename = os.path.join(root, basename)
yield filename
for basename in filter(lambda n: fnmatch(n, "*.bsb"), files):
yield os.path.join(root, basename)


def convert_to_tikz(paths):
Expand Down

0 comments on commit 9e16c62

Please sign in to comment.