MCPcopy Index your code
hub / github.com/microsoft/SandDance / _join_translated

Function _join_translated

python/jupyter-widget/setupbase.py:660–682  ·  view source on GitHub ↗

Join translated glob pattern parts. This is different from a simple join, as care need to be taken to allow ** to match ZERO or more directories.

(translated_parts, os_sep_class)

Source from the content-addressed store, hash-verified

658
659
660def _join_translated(translated_parts, os_sep_class):
661 """Join translated glob pattern parts.
662
663 This is different from a simple join, as care need to be taken
664 to allow ** to match ZERO or more directories.
665 """
666 res = ''
667 for part in translated_parts[:-1]:
668 if part == '.*':
669 # drop separator, since it is optional
670 # (** matches ZERO or more dirs)
671 res += part
672 else:
673 res += part + os_sep_class
674
675 if translated_parts[-1] == '.*':
676 # Final part is **
677 res += '.+'
678 # Follow stdlib/git convention of matching all sub files/directories:
679 res += '({os_sep_class}?.*)?'.format(os_sep_class=os_sep_class)
680 else:
681 res += translated_parts[-1]
682 return res
683
684
685def _translate_glob_part(pat):

Callers 1

_translate_globFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected