Return a list of existing paths composed by all combinations of items from arguments.
(*args, **kws)
| 3173 | |
| 3174 | |
| 3175 | def combine_paths(*args, **kws): |
| 3176 | """ Return a list of existing paths composed by all combinations of |
| 3177 | items from arguments. |
| 3178 | """ |
| 3179 | r = [] |
| 3180 | for a in args: |
| 3181 | if not a: |
| 3182 | continue |
| 3183 | if is_string(a): |
| 3184 | a = [a] |
| 3185 | r.append(a) |
| 3186 | args = r |
| 3187 | if not args: |
| 3188 | return [] |
| 3189 | if len(args) == 1: |
| 3190 | result = reduce(lambda a, b: a + b, map(glob, args[0]), []) |
| 3191 | elif len(args) == 2: |
| 3192 | result = [] |
| 3193 | for a0 in args[0]: |
| 3194 | for a1 in args[1]: |
| 3195 | result.extend(glob(os.path.join(a0, a1))) |
| 3196 | else: |
| 3197 | result = combine_paths(*(combine_paths(args[0], args[1]) + args[2:])) |
| 3198 | log.debug('(paths: %s)', ','.join(result)) |
| 3199 | return result |
| 3200 | |
| 3201 | language_map = {'c': 0, 'c++': 1, 'f77': 2, 'f90': 3} |
| 3202 | inv_language_map = {0: 'c', 1: 'c++', 2: 'f77', 3: 'f90'} |
no test coverage detected