From 837cb95f2897411533cf35a62f50d62ca9ee3e3b Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Mon, 8 Sep 2014 15:37:55 -0400 Subject: [PATCH] 3644: Moved some common regex patterns into SDK --- sdk/python/arvados/util.py | 7 +++++++ services/fuse/arvados_fuse/__init__.py | 8 +------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sdk/python/arvados/util.py b/sdk/python/arvados/util.py index 0889ffcddd..ada1aec6ef 100644 --- a/sdk/python/arvados/util.py +++ b/sdk/python/arvados/util.py @@ -9,6 +9,13 @@ from arvados.collection import * HEX_RE = re.compile(r'^[0-9a-fA-F]+$') +portable_data_hash_pattern = re.compile(r'[0-9a-f]{32}\+\d+') +uuid_pattern = re.compile(r'[a-z0-9]{5}-[a-z0-9]{5}-[a-z0-9]{15}') +collection_uuid_pattern = re.compile(r'[a-z0-9]{5}-4zz18-[a-z0-9]{15}') +group_uuid_pattern = re.compile(r'[a-z0-9]{5}-j7d0g-[a-z0-9]{15}') +user_uuid_pattern = re.compile(r'[a-z0-9]{5}-tpzed-[a-z0-9]{15}') +link_uuid_pattern = re.compile(r'[a-z0-9]{5}-o0j2j-[a-z0-9]{15}') + def clear_tmpdir(path=None): """ Ensure the given directory (or TASK_TMPDIR if none given) diff --git a/services/fuse/arvados_fuse/__init__.py b/services/fuse/arvados_fuse/__init__.py index c3f913e961..4d2dfee546 100644 --- a/services/fuse/arvados_fuse/__init__.py +++ b/services/fuse/arvados_fuse/__init__.py @@ -19,16 +19,10 @@ import logging import time import calendar import threading +from arvados.util import portable_data_hash_pattern, uuid_pattern, collection_uuid_pattern, group_uuid_pattern, user_uuid_pattern, link_uuid_pattern _logger = logging.getLogger('arvados.arvados_fuse') -portable_data_hash_pattern = re.compile(r'[0-9a-f]{32}\+\d+') -uuid_pattern = re.compile(r'[a-z0-9]{5}-[a-z0-9]{5}-[a-z0-9]{15}') -collection_uuid_pattern = re.compile(r'[a-z0-9]{5}-4zz18-[a-z0-9]{15}') -group_uuid_pattern = re.compile(r'[a-z0-9]{5}-j7d0g-[a-z0-9]{15}') -user_uuid_pattern = re.compile(r'[a-z0-9]{5}-tpzed-[a-z0-9]{15}') -link_uuid_pattern = re.compile(r'[a-z0-9]{5}-o0j2j-[a-z0-9]{15}') - class SafeApi(object): '''Threadsafe wrapper for API object. This stores and returns a different api object per thread, because httplib2 which underlies apiclient is not -- 2.30.2