| OLD | NEW |
| 1 # Copyright 2016 The LUCI Authors. All rights reserved. | 1 # Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed by the Apache v2.0 license that can be | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import re | 5 import re |
| 6 import types | 6 import types |
| 7 | 7 |
| 8 _SEGMENT_RE_BASE = r'[a-zA-Z0-9][a-zA-Z0-9:_\-.]*' | 8 _SEGMENT_RE_BASE = r'[a-zA-Z0-9][a-zA-Z0-9:_\-.]*' |
| 9 _STREAM_NAME_RE = re.compile('^(' + _SEGMENT_RE_BASE + ')(/' + | 9 _STREAM_NAME_RE = re.compile('^(' + _SEGMENT_RE_BASE + ')(/' + |
| 10 _SEGMENT_RE_BASE + ')*$') | 10 _SEGMENT_RE_BASE + ')*$') |
| 11 _MAX_STREAM_NAME_LENGTH = 4096 | 11 _MAX_STREAM_NAME_LENGTH = 4096 |
| 12 | 12 |
| 13 _MAX_TAG_KEY_LENGTH = 64 | 13 _MAX_TAG_KEY_LENGTH = 64 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 Args: | 36 Args: |
| 37 k (str): The tag key. | 37 k (str): The tag key. |
| 38 v (str): The tag value. | 38 v (str): The tag value. |
| 39 | 39 |
| 40 Raises: | 40 Raises: |
| 41 ValueError if the tag is not valid. | 41 ValueError if the tag is not valid. |
| 42 """ | 42 """ |
| 43 validate_stream_name(key, maxlen=_MAX_TAG_KEY_LENGTH) | 43 validate_stream_name(key, maxlen=_MAX_TAG_KEY_LENGTH) |
| 44 validate_stream_name(value, maxlen=_MAX_TAG_VALUE_LENGTH) | 44 validate_stream_name(value, maxlen=_MAX_TAG_VALUE_LENGTH) |
| OLD | NEW |