From 68e4341fbf01c074851c3ebce475ef98adf17722 Mon Sep 17 00:00:00 2001 From: Ben Firshman Date: Thu, 19 Dec 2013 20:09:54 +0000 Subject: [PATCH] Compile name regex --- plum/service.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plum/service.py b/plum/service.py index 4cec3999d..de1d54409 100644 --- a/plum/service.py +++ b/plum/service.py @@ -160,15 +160,15 @@ class Service(object): return image_id -name_regex = '^([^_]+)_([^_]+)_(\d+)$' +NAME_RE = re.compile(r'^([^_]+)_([^_]+)_(\d+)$') def is_valid_name(name): - return (re.match(name_regex, name) is not None) + return (NAME_RE.match(name) is not None) def parse_name(name): - match = re.match(name_regex, name) + match = NAME_RE.match(name) (project, service_name, suffix) = match.groups() return (project, service_name, int(suffix))