Convert console port types to slugs (#3569)

This commit is contained in:
Jeremy Stretch
2019-11-06 16:56:46 -05:00
parent 48dcd2d2b9
commit 8cb7eb0382
8 changed files with 70 additions and 115 deletions

View File

@@ -21,7 +21,7 @@ class ConsolePortTypes:
TYPE_USB_MICRO_B = 'usb-micro-b'
TYPE_OTHER = 'other'
TYPE_CHOICES = (
CHOICES = (
('Serial', (
(TYPE_DE9, 'DE-9'),
(TYPE_DB25, 'DB-25'),
@@ -41,26 +41,6 @@ class ConsolePortTypes:
)),
)
@classmethod
def slug_to_integer(cls, slug):
"""
Provide backward-compatible mapping of the type slug to integer.
"""
return {
# Slug: integer
cls.TYPE_DE9: CONSOLE_TYPE_DE9,
cls.TYPE_DB25: CONSOLE_TYPE_DB25,
cls.TYPE_RJ45: CONSOLE_TYPE_RJ45,
cls.TYPE_USB_A: CONSOLE_TYPE_USB_A,
cls.TYPE_USB_B: CONSOLE_TYPE_USB_B,
cls.TYPE_USB_C: CONSOLE_TYPE_USB_C,
cls.TYPE_USB_MINI_A: CONSOLE_TYPE_USB_MINI_A,
cls.TYPE_USB_MINI_B: CONSOLE_TYPE_USB_MINI_B,
cls.TYPE_USB_MICRO_A: CONSOLE_TYPE_USB_MICRO_A,
cls.TYPE_USB_MICRO_B: CONSOLE_TYPE_USB_MICRO_B,
cls.TYPE_OTHER: CONSOLE_TYPE_OTHER,
}.get(slug)
#
# Power port types