diff options
| author | jvoisin | 2013-10-30 18:44:02 +0000 |
|---|---|---|
| committer | jvoisin | 2013-10-30 18:44:02 +0000 |
| commit | ff431ae30521f294ce4d97d31b19db93cb7c0195 (patch) | |
| tree | 1ba0af34082607a318e74a068ed95bc3dd455271 /MAT/mat.py | |
| parent | a646ebbd3a0f54b43fc610134d2ebb39b5c4c732 (diff) | |
More pep8 conformance
Diffstat (limited to 'MAT/mat.py')
| -rw-r--r-- | MAT/mat.py | 8 |
1 files changed, 6 insertions, 2 deletions
| @@ -31,6 +31,7 @@ logging.basicConfig(filename=fname, level=LOGGING_LEVEL) | |||
| 31 | 31 | ||
| 32 | import strippers # this is loaded here because we need LOGGING_LEVEL | 32 | import strippers # this is loaded here because we need LOGGING_LEVEL |
| 33 | 33 | ||
| 34 | |||
| 34 | def get_logo(): | 35 | def get_logo(): |
| 35 | ''' Return the path to the logo | 36 | ''' Return the path to the logo |
| 36 | ''' | 37 | ''' |
| @@ -41,6 +42,7 @@ def get_logo(): | |||
| 41 | elif os.path.isfile('/usr/local/share/pixmaps/mat.png'): | 42 | elif os.path.isfile('/usr/local/share/pixmaps/mat.png'): |
| 42 | return '/usr/local/share/pixmaps/mat.png' | 43 | return '/usr/local/share/pixmaps/mat.png' |
| 43 | 44 | ||
| 45 | |||
| 44 | def get_datadir(): | 46 | def get_datadir(): |
| 45 | ''' Return the path to the data directory | 47 | ''' Return the path to the data directory |
| 46 | ''' | 48 | ''' |
| @@ -51,6 +53,7 @@ def get_datadir(): | |||
| 51 | elif os.path.isdir('/usr/share/mat/'): | 53 | elif os.path.isdir('/usr/share/mat/'): |
| 52 | return '/usr/share/mat/' | 54 | return '/usr/share/mat/' |
| 53 | 55 | ||
| 56 | |||
| 54 | def list_supported_formats(): | 57 | def list_supported_formats(): |
| 55 | ''' Return a list of all locally supported fileformat. | 58 | ''' Return a list of all locally supported fileformat. |
| 56 | It parses that FORMATS file, and removes locally | 59 | It parses that FORMATS file, and removes locally |
| @@ -70,6 +73,7 @@ def list_supported_formats(): | |||
| 70 | 73 | ||
| 71 | return localy_supported | 74 | return localy_supported |
| 72 | 75 | ||
| 76 | |||
| 73 | class XMLParser(xml.sax.handler.ContentHandler): | 77 | class XMLParser(xml.sax.handler.ContentHandler): |
| 74 | ''' Parse the supported format xml, and return a corresponding | 78 | ''' Parse the supported format xml, and return a corresponding |
| 75 | list of dict | 79 | list of dict |
| @@ -132,7 +136,7 @@ def create_class_file(name, backup, **kwargs): | |||
| 132 | logging.error('%s is not a valid file' % name) | 136 | logging.error('%s is not a valid file' % name) |
| 133 | return None | 137 | return None |
| 134 | 138 | ||
| 135 | if not os.access(name, os.R_OK): #check read permissions | 139 | if not os.access(name, os.R_OK): # check read permissions |
| 136 | logging.error('%s is is not readable' % name) | 140 | logging.error('%s is is not readable' % name) |
| 137 | return None | 141 | return None |
| 138 | 142 | ||
| @@ -156,7 +160,7 @@ def create_class_file(name, backup, **kwargs): | |||
| 156 | 160 | ||
| 157 | if mime == 'application/zip': # some formats are zipped stuff | 161 | if mime == 'application/zip': # some formats are zipped stuff |
| 158 | if mimetypes.guess_type(name)[0]: | 162 | if mimetypes.guess_type(name)[0]: |
| 159 | mime = mimetypes.guess_type(name)[0] | 163 | mime = mimetypes.guess_type(name)[0] |
| 160 | 164 | ||
| 161 | if mime.startswith('application/vnd.oasis.opendocument'): | 165 | if mime.startswith('application/vnd.oasis.opendocument'): |
| 162 | mime = 'application/opendocument' # opendocument fileformat | 166 | mime = 'application/opendocument' # opendocument fileformat |
