From 34259d5d9dcd129ad40f32c2e4a81c7d3e4acbe2 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Fri, 13 Oct 2017 14:29:55 -0400 Subject: [PATCH] Removed deprecated xstr and expand_pattern functions --- netbox/dcim/views.py | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index 387af4b61..13710c310 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -34,32 +34,6 @@ from .models import ( ) -EXPANSION_PATTERN = '\[(\d+-\d+)\]' - - -def xstr(s): - """ - Replace None with an empty string (for CSV export) - """ - return '' if s is None else str(s) - - -def expand_pattern(string): - """ - Expand a numeric pattern into a list of strings. Examples: - 'ge-0/0/[0-3]' => ['ge-0/0/0', 'ge-0/0/1', 'ge-0/0/2', 'ge-0/0/3'] - 'xe-0/[0-3]/[0-7]' => ['xe-0/0/0', 'xe-0/0/1', 'xe-0/0/2', ... 'xe-0/3/5', 'xe-0/3/6', 'xe-0/3/7'] - """ - lead, pattern, remnant = re.split(EXPANSION_PATTERN, string, maxsplit=1) - x, y = pattern.split('-') - for i in range(int(x), int(y) + 1): - if remnant: - for string in expand_pattern(remnant): - yield "{0}{1}{2}".format(lead, i, string) - else: - yield "{0}{1}".format(lead, i) - - class BulkDisconnectView(View): """ An extendable view for disconnection console/power/interface components in bulk.