move enums

This commit is contained in:
Maximilian Keßler 2022-02-06 00:12:54 +01:00
parent c669b15fc9
commit 406bf0bf7d
2 changed files with 50 additions and 48 deletions

View file

@ -1,54 +1,6 @@
from enum import Enum from enum import Enum
class TeXType(Enum):
TeXPackage = 'TeXPackage'
TeXClass = 'TeXClass'
TeXDocstrip = 'TeXDocstrip'
TeXDictionary = 'TeXDictionary'
TeXDocumentation = 'TeXDocumentation'
@staticmethod
def parse(tex_type: str):
switcher = {
'package': TeXType.TeXPackage,
'sty': TeXType.TeXPackage,
'class': TeXType.TeXClass,
'cls': TeXType.TeXClass,
'dictionary': TeXType.TeXDictionary,
'dict': TeXType.TeXDictionary,
'documentation': TeXType.TeXDocumentation,
'doc': TeXType.TeXDocumentation, # TODO: dangerous?
'dtx': TeXType.TeXDocstrip,
'docstrip': TeXType.TeXDocstrip,
'strip': TeXType.TeXDocstrip
}
if tex_type not in switcher.keys():
raise NotImplementedError
else:
return switcher[tex_type]
class TeXFlavour(Enum):
TeX = 'TeX'
LaTeX2e = 'LaTeX2e'
LaTeX3 = 'LaTeX3'
@staticmethod
def parse(flavour: str):
switcher = {
'1': TeXFlavour.TeX,
'2': TeXFlavour.LaTeX2e,
'2e': TeXFlavour.LaTeX2e,
'3': TeXFlavour.LaTeX3,
'TeX': TeXFlavour.TeX,
'LaTeX2e': TeXFlavour.LaTeX2e,
'LateX3': TeXFlavour.LaTeX3
}
if flavour not in switcher.keys():
raise NotImplementedError
else:
return switcher[flavour]
class PyTeXFileType(Enum): class PyTeXFileType(Enum):

View file

@ -10,3 +10,53 @@ class License(Enum):
LPPL = 0 LPPL = 0
GPLv3 = 1 GPLv3 = 1
MIT = 2 MIT = 2
class TeXType(Enum):
TeXPackage = 'TeXPackage'
TeXClass = 'TeXClass'
TeXDocstrip = 'TeXDocstrip'
TeXDictionary = 'TeXDictionary'
TeXDocumentation = 'TeXDocumentation'
@staticmethod
def parse(tex_type: str):
switcher = {
'package': TeXType.TeXPackage,
'sty': TeXType.TeXPackage,
'class': TeXType.TeXClass,
'cls': TeXType.TeXClass,
'dictionary': TeXType.TeXDictionary,
'dict': TeXType.TeXDictionary,
'documentation': TeXType.TeXDocumentation,
'doc': TeXType.TeXDocumentation, # TODO: dangerous?
'dtx': TeXType.TeXDocstrip,
'docstrip': TeXType.TeXDocstrip,
'strip': TeXType.TeXDocstrip
}
if tex_type not in switcher.keys():
raise NotImplementedError
else:
return switcher[tex_type]
class TeXFlavour(Enum):
TeX = 'TeX'
LaTeX2e = 'LaTeX2e'
LaTeX3 = 'LaTeX3'
@staticmethod
def parse(flavour: str):
switcher = {
'1': TeXFlavour.TeX,
'2': TeXFlavour.LaTeX2e,
'2e': TeXFlavour.LaTeX2e,
'3': TeXFlavour.LaTeX3,
'TeX': TeXFlavour.TeX,
'LaTeX2e': TeXFlavour.LaTeX2e,
'LateX3': TeXFlavour.LaTeX3
}
if flavour not in switcher.keys():
raise NotImplementedError
else:
return switcher[flavour]