File: convertTmplPathToModuleName.py

package info (click to toggle)
scribus 1.5.8%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 179,080 kB
  • sloc: cpp: 483,300; python: 65,124; xml: 14,334; ansic: 2,484; sh: 192; perl: 95; makefile: 79
file content (20 lines) | stat: -rw-r--r-- 528 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import os.path
import string

letters = None
try:
    letters = string.ascii_letters
except AttributeError:
    letters = string.letters

l = ['_'] * 256
for c in string.digits + letters:
    l[ord(c)] = c
_pathNameTransChars = ''.join(l)
del l, c

def convertTmplPathToModuleName(tmplPath,
                                _pathNameTransChars=_pathNameTransChars,
                                splitdrive=os.path.splitdrive,
                                ):
    return splitdrive(tmplPath)[1].translate(_pathNameTransChars)