rucio-clients 32.8.6__py3-none-any.whl → 35.8.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of rucio-clients might be problematic. Click here for more details.

Files changed (92) hide show
  1. rucio/__init__.py +0 -1
  2. rucio/alembicrevision.py +1 -2
  3. rucio/client/__init__.py +0 -1
  4. rucio/client/accountclient.py +45 -25
  5. rucio/client/accountlimitclient.py +37 -9
  6. rucio/client/baseclient.py +199 -154
  7. rucio/client/client.py +2 -3
  8. rucio/client/configclient.py +19 -6
  9. rucio/client/credentialclient.py +9 -4
  10. rucio/client/didclient.py +238 -63
  11. rucio/client/diracclient.py +13 -5
  12. rucio/client/downloadclient.py +162 -51
  13. rucio/client/exportclient.py +4 -4
  14. rucio/client/fileclient.py +3 -4
  15. rucio/client/importclient.py +4 -4
  16. rucio/client/lifetimeclient.py +21 -5
  17. rucio/client/lockclient.py +18 -8
  18. rucio/client/{metaclient.py → metaconventionsclient.py} +18 -15
  19. rucio/client/pingclient.py +0 -1
  20. rucio/client/replicaclient.py +15 -5
  21. rucio/client/requestclient.py +35 -19
  22. rucio/client/rseclient.py +133 -51
  23. rucio/client/ruleclient.py +29 -22
  24. rucio/client/scopeclient.py +8 -6
  25. rucio/client/subscriptionclient.py +47 -35
  26. rucio/client/touchclient.py +8 -4
  27. rucio/client/uploadclient.py +166 -82
  28. rucio/common/__init__.py +0 -1
  29. rucio/common/cache.py +4 -4
  30. rucio/common/config.py +52 -47
  31. rucio/common/constants.py +69 -2
  32. rucio/common/constraints.py +0 -1
  33. rucio/common/didtype.py +24 -22
  34. rucio/common/exception.py +281 -222
  35. rucio/common/extra.py +0 -1
  36. rucio/common/logging.py +54 -38
  37. rucio/common/pcache.py +122 -101
  38. rucio/common/plugins.py +153 -0
  39. rucio/common/policy.py +4 -4
  40. rucio/common/schema/__init__.py +17 -10
  41. rucio/common/schema/atlas.py +7 -5
  42. rucio/common/schema/belleii.py +7 -5
  43. rucio/common/schema/domatpc.py +7 -5
  44. rucio/common/schema/escape.py +7 -5
  45. rucio/common/schema/generic.py +8 -6
  46. rucio/common/schema/generic_multi_vo.py +7 -5
  47. rucio/common/schema/icecube.py +7 -5
  48. rucio/common/stomp_utils.py +0 -1
  49. rucio/common/stopwatch.py +0 -1
  50. rucio/common/test_rucio_server.py +2 -2
  51. rucio/common/types.py +262 -17
  52. rucio/common/utils.py +743 -451
  53. rucio/rse/__init__.py +3 -4
  54. rucio/rse/protocols/__init__.py +0 -1
  55. rucio/rse/protocols/bittorrent.py +184 -0
  56. rucio/rse/protocols/cache.py +1 -2
  57. rucio/rse/protocols/dummy.py +1 -2
  58. rucio/rse/protocols/gfal.py +12 -10
  59. rucio/rse/protocols/globus.py +7 -7
  60. rucio/rse/protocols/gsiftp.py +2 -3
  61. rucio/rse/protocols/http_cache.py +1 -2
  62. rucio/rse/protocols/mock.py +1 -2
  63. rucio/rse/protocols/ngarc.py +1 -2
  64. rucio/rse/protocols/posix.py +12 -13
  65. rucio/rse/protocols/protocol.py +116 -52
  66. rucio/rse/protocols/rclone.py +6 -7
  67. rucio/rse/protocols/rfio.py +4 -5
  68. rucio/rse/protocols/srm.py +9 -10
  69. rucio/rse/protocols/ssh.py +8 -9
  70. rucio/rse/protocols/storm.py +2 -3
  71. rucio/rse/protocols/webdav.py +17 -14
  72. rucio/rse/protocols/xrootd.py +23 -17
  73. rucio/rse/rsemanager.py +19 -7
  74. rucio/vcsversion.py +4 -4
  75. rucio/version.py +5 -13
  76. rucio_clients-35.8.0.data/data/requirements.client.txt +15 -0
  77. {rucio_clients-32.8.6.data → rucio_clients-35.8.0.data}/data/rucio_client/merge_rucio_configs.py +2 -5
  78. {rucio_clients-32.8.6.data → rucio_clients-35.8.0.data}/scripts/rucio +87 -85
  79. {rucio_clients-32.8.6.data → rucio_clients-35.8.0.data}/scripts/rucio-admin +45 -32
  80. {rucio_clients-32.8.6.dist-info → rucio_clients-35.8.0.dist-info}/METADATA +13 -13
  81. rucio_clients-35.8.0.dist-info/RECORD +88 -0
  82. {rucio_clients-32.8.6.dist-info → rucio_clients-35.8.0.dist-info}/WHEEL +1 -1
  83. {rucio_clients-32.8.6.dist-info → rucio_clients-35.8.0.dist-info}/licenses/AUTHORS.rst +3 -0
  84. rucio/common/schema/cms.py +0 -478
  85. rucio/common/schema/lsst.py +0 -423
  86. rucio_clients-32.8.6.data/data/requirements.txt +0 -55
  87. rucio_clients-32.8.6.dist-info/RECORD +0 -88
  88. {rucio_clients-32.8.6.data → rucio_clients-35.8.0.data}/data/etc/rse-accounts.cfg.template +0 -0
  89. {rucio_clients-32.8.6.data → rucio_clients-35.8.0.data}/data/etc/rucio.cfg.atlas.client.template +0 -0
  90. {rucio_clients-32.8.6.data → rucio_clients-35.8.0.data}/data/etc/rucio.cfg.template +0 -0
  91. {rucio_clients-32.8.6.dist-info → rucio_clients-35.8.0.dist-info}/licenses/LICENSE +0 -0
  92. {rucio_clients-32.8.6.dist-info → rucio_clients-35.8.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,153 @@
1
+ # Copyright European Organization for Nuclear Research (CERN) since 2012
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ import importlib
16
+ import os
17
+ from collections.abc import Callable
18
+ from configparser import NoOptionError, NoSectionError
19
+ from typing import Any, TypeVar
20
+
21
+ from rucio.common import config
22
+ from rucio.common.exception import InvalidAlgorithmName
23
+
24
+ PolicyPackageAlgorithmsT = TypeVar('PolicyPackageAlgorithmsT', bound='PolicyPackageAlgorithms')
25
+
26
+
27
+ class PolicyPackageAlgorithms:
28
+ """
29
+ Base class for Rucio Policy Package Algorithms
30
+
31
+ ALGORITHMS is of type Dict[str, Dict[str. Callable[..., Any]]]
32
+ where the key is the algorithm type and the value is a dictionary of algorithm names and their callables
33
+ """
34
+ _ALGORITHMS: dict[str, dict[str, Callable[..., Any]]] = {}
35
+ _loaded_policy_modules = False
36
+
37
+ def __init__(self) -> None:
38
+ if not self._loaded_policy_modules:
39
+ self._register_all_policy_package_algorithms()
40
+ self._loaded_policy_modules = True
41
+
42
+ @classmethod
43
+ def _get_one_algorithm(cls: type[PolicyPackageAlgorithmsT], algorithm_type: str, name: str) -> Callable[..., Any]:
44
+ """
45
+ Get the algorithm from the dictionary of algorithms
46
+ """
47
+ return cls._ALGORITHMS[algorithm_type][name]
48
+
49
+ @classmethod
50
+ def _get_algorithms(cls: type[PolicyPackageAlgorithmsT], algorithm_type: str) -> dict[str, Callable[..., Any]]:
51
+ """
52
+ Get the dictionary of algorithms for a given type
53
+ """
54
+ return cls._ALGORITHMS[algorithm_type]
55
+
56
+ @classmethod
57
+ def _register(
58
+ cls: type[PolicyPackageAlgorithmsT],
59
+ algorithm_type: str, algorithm_dict: dict[str, Callable[..., Any]]) -> None:
60
+ """
61
+ Provided a dictionary of callable function,
62
+ and the associated algorithm type,
63
+ register it as one of the valid algorithms.
64
+ """
65
+ if algorithm_type in cls._ALGORITHMS:
66
+ cls._ALGORITHMS[algorithm_type].update(algorithm_dict)
67
+ else:
68
+ cls._ALGORITHMS[algorithm_type] = algorithm_dict
69
+
70
+ @classmethod
71
+ def _supports(cls: type[PolicyPackageAlgorithmsT], algorithm_type: str, name: str) -> bool:
72
+ """
73
+ Check if a algorithm is supported by the plugin
74
+ """
75
+ return name in cls._ALGORITHMS.get(algorithm_type, {})
76
+
77
+ @classmethod
78
+ def _register_all_policy_package_algorithms(cls: type[PolicyPackageAlgorithmsT]) -> None:
79
+ '''
80
+ Loads all the algorithms of a given type from the policy package(s) and registers them
81
+ :param algorithm_type: the type of algorithm to register (e.g. 'lfn2pfn')
82
+ :param dictionary: the dictionary to register them in
83
+ :param vo: the name of the relevant VO (None for single VO)
84
+ '''
85
+ try:
86
+ multivo = config.config_get_bool('common', 'multi_vo')
87
+ except (NoOptionError, NoSectionError):
88
+ multivo = False
89
+ if not multivo:
90
+ # single policy package
91
+ cls._try_importing_policy()
92
+ else:
93
+ # determine whether on client or server
94
+ client = False
95
+ if 'RUCIO_CLIENT_MODE' not in os.environ:
96
+ if not config.config_has_section('database') and config.config_has_section('client'):
97
+ client = True
98
+ else:
99
+ if os.environ['RUCIO_CLIENT_MODE']:
100
+ client = True
101
+
102
+ # on client, only register algorithms for selected VO
103
+ if client:
104
+ if 'RUCIO_VO' in os.environ:
105
+ vo = os.environ['RUCIO_VO']
106
+ else:
107
+ try:
108
+ vo = str(config.config_get('client', 'vo'))
109
+ except (NoOptionError, NoSectionError):
110
+ vo = 'def'
111
+ cls._try_importing_policy(vo)
112
+ # on server, list all VOs and register their algorithms
113
+ else:
114
+ from rucio.core.vo import list_vos
115
+ # policy package per VO
116
+ vos = list_vos()
117
+ for vo in vos:
118
+ cls._try_importing_policy(vo['vo'])
119
+
120
+ @classmethod
121
+ def _try_importing_policy(cls: type[PolicyPackageAlgorithmsT], vo: str = "") -> None:
122
+ try:
123
+ # import from utils here to avoid circular import
124
+ from rucio.common.utils import check_policy_package_version
125
+
126
+ env_name = 'RUCIO_POLICY_PACKAGE' + ('' if not vo else '_' + vo.upper())
127
+ package = getattr(os.environ, env_name, "")
128
+ if not package:
129
+ package = str(config.config_get('policy', 'package' + ('' if not vo else '-' + vo)))
130
+
131
+ check_policy_package_version(package)
132
+ module = importlib.import_module(package)
133
+
134
+ if hasattr(module, 'get_algorithms'):
135
+ all_algorithms = module.get_algorithms()
136
+
137
+ # for backward compatibility, rename 'surl' to 'non_deterministic_pfn' here
138
+ if 'surl' in all_algorithms:
139
+ all_algorithms['non_deterministic_pfn'] = all_algorithms['surl']
140
+
141
+ # check that the names are correctly prefixed for multi-VO
142
+ if vo:
143
+ for _, algorithms in all_algorithms.items():
144
+ for k in algorithms.keys():
145
+ if not k.lower().startswith(vo.lower()):
146
+ raise InvalidAlgorithmName(k, vo)
147
+
148
+ # Updates the dictionary with the algorithms from the policy package
149
+ for algorithm_type, algorithm_dict in all_algorithms.items():
150
+ cls._register(algorithm_type, algorithm_dict)
151
+
152
+ except (NoOptionError, NoSectionError, ImportError):
153
+ pass
rucio/common/policy.py CHANGED
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  # Copyright European Organization for Nuclear Research (CERN) since 2012
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,6 +16,7 @@ import json
17
16
  import os
18
17
  from configparser import NoOptionError, NoSectionError
19
18
  from functools import wraps
19
+ from typing import Any
20
20
 
21
21
  from dogpile.cache import make_region
22
22
  from dogpile.cache.api import NoValue
@@ -28,7 +28,7 @@ REGION = make_region().configure('dogpile.cache.memory',
28
28
  expiration_time=900)
29
29
 
30
30
 
31
- def get_policy():
31
+ def get_policy() -> str:
32
32
  policy = REGION.get('policy')
33
33
  if isinstance(policy, NoValue):
34
34
  try:
@@ -39,7 +39,7 @@ def get_policy():
39
39
  return policy
40
40
 
41
41
 
42
- def get_scratchdisk_lifetime():
42
+ def get_scratchdisk_lifetime() -> int:
43
43
  scratchdisk_lifetime = REGION.get('scratchdisk_lifetime')
44
44
  if isinstance(scratchdisk_lifetime, NoValue):
45
45
  try:
@@ -51,7 +51,7 @@ def get_scratchdisk_lifetime():
51
51
  return scratchdisk_lifetime
52
52
 
53
53
 
54
- def get_lifetime_policy():
54
+ def get_lifetime_policy() -> dict[str, list[dict[str, Any]]]:
55
55
  lifetime_dict = REGION.get('lifetime_dict')
56
56
  if isinstance(lifetime_dict, NoValue):
57
57
  lifetime_dict = {'data': [], 'mc': [], 'valid': [], 'other': []}
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  # Copyright European Organization for Nuclear Research (CERN) since 2012
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,15 +15,19 @@
16
15
  import importlib
17
16
  from configparser import NoOptionError, NoSectionError
18
17
  from os import environ
18
+ from typing import TYPE_CHECKING, Any
19
19
 
20
20
  from rucio.common import config, exception
21
21
  from rucio.common.utils import check_policy_package_version
22
22
 
23
+ if TYPE_CHECKING:
24
+ from types import ModuleType
25
+
23
26
  # dictionary of schema modules for each VO
24
- schema_modules = {}
27
+ schema_modules: dict[str, "ModuleType"] = {}
25
28
 
26
29
  # list of unique SCOPE_NAME_REGEXP values from all schemas
27
- scope_name_regexps = []
30
+ scope_name_regexps: list[str] = []
28
31
 
29
32
  try:
30
33
  multivo = config.config_get_bool('common', 'multi_vo', check_config_table=False)
@@ -57,14 +60,16 @@ if not multivo:
57
60
 
58
61
  try:
59
62
  module = importlib.import_module(POLICY)
63
+ except ModuleNotFoundError:
64
+ raise exception.PolicyPackageNotFound(POLICY)
60
65
  except ImportError:
61
- raise exception.PolicyPackageNotFound('Module ' + POLICY + ' not found')
66
+ raise exception.ErrorLoadingPolicyPackage(POLICY)
62
67
 
63
68
  schema_modules["def"] = module
64
69
  scope_name_regexps.append(module.SCOPE_NAME_REGEXP)
65
70
 
66
71
 
67
- def load_schema_for_vo(vo):
72
+ def load_schema_for_vo(vo: str) -> None:
68
73
  GENERIC_FALLBACK = 'generic_multi_vo'
69
74
  if config.config_has_section('policy'):
70
75
  try:
@@ -87,25 +92,27 @@ def load_schema_for_vo(vo):
87
92
 
88
93
  try:
89
94
  module = importlib.import_module(POLICY)
95
+ except ModuleNotFoundError:
96
+ raise exception.PolicyPackageNotFound(POLICY)
90
97
  except ImportError:
91
- raise exception.PolicyPackageNotFound('Module ' + POLICY + ' not found')
98
+ raise exception.ErrorLoadingPolicyPackage(POLICY)
92
99
 
93
100
  schema_modules[vo] = module
94
101
 
95
102
 
96
- def validate_schema(name, obj, vo='def'):
103
+ def validate_schema(name: str, obj: Any, vo: str = 'def') -> None:
97
104
  if vo not in schema_modules:
98
105
  load_schema_for_vo(vo)
99
106
  schema_modules[vo].validate_schema(name, obj)
100
107
 
101
108
 
102
- def get_schema_value(key, vo='def'):
109
+ def get_schema_value(key: str, vo: str = 'def') -> Any:
103
110
  if vo not in schema_modules:
104
111
  load_schema_for_vo(vo)
105
112
  return getattr(schema_modules[vo], key)
106
113
 
107
114
 
108
- def get_scope_name_regexps():
115
+ def get_scope_name_regexps() -> list[str]:
109
116
  """ returns a list of all unique SCOPE_NAME_REGEXPs from all schemas """
110
117
 
111
118
  if len(scope_name_regexps) == 0:
@@ -121,7 +128,7 @@ def get_scope_name_regexps():
121
128
  return scope_name_regexps
122
129
 
123
130
 
124
- def insert_scope_name(urls):
131
+ def insert_scope_name(urls: tuple[str, ...]) -> tuple[str, str]:
125
132
  """
126
133
  given a tuple of URLs for webpy with '%s' as a placeholder for
127
134
  SCOPE_NAME_REGEXP, return a finalised tuple of URLs that will work for all
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  # Copyright European Organization for Nuclear Research (CERN) since 2012
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,7 +12,7 @@
13
12
  # See the License for the specific language governing permissions and
14
13
  # limitations under the License.
15
14
 
16
- from jsonschema import validate, ValidationError
15
+ from jsonschema import ValidationError, validate
17
16
 
18
17
  from rucio.common.exception import InvalidObject
19
18
 
@@ -21,7 +20,8 @@ ACCOUNT_LENGTH = 25
21
20
 
22
21
  ACCOUNT = {"description": "Account name",
23
22
  "type": "string",
24
- "pattern": "^[a-z0-9-_]{1,%s}$" % ACCOUNT_LENGTH}
23
+ "maxLength": ACCOUNT_LENGTH,
24
+ "pattern": "^[a-z0-9-_]+$"}
25
25
 
26
26
  ACCOUNTS = {"description": "Array of accounts",
27
27
  "type": "array",
@@ -49,7 +49,8 @@ SCOPE_LENGTH = 25
49
49
 
50
50
  SCOPE = {"description": "Scope name",
51
51
  "type": "string",
52
- "pattern": "^[a-zA-Z_\\-.0-9]{1,%s}$" % SCOPE_LENGTH}
52
+ "maxLength": SCOPE_LENGTH,
53
+ "pattern": "^[a-zA-Z_\\-.0-9]+$"}
53
54
 
54
55
  R_SCOPE = {"description": "Scope name",
55
56
  "type": "string",
@@ -59,7 +60,8 @@ NAME_LENGTH = 250
59
60
 
60
61
  NAME = {"description": "Data Identifier name",
61
62
  "type": "string",
62
- "pattern": "^[A-Za-z0-9][A-Za-z0-9\\.\\-\\_]{1,%s}$" % NAME_LENGTH}
63
+ "maxLength": NAME_LENGTH,
64
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9\\.\\-\\_]*$"}
63
65
 
64
66
  R_NAME = {"description": "Data Identifier name",
65
67
  "type": "string",
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  # Copyright European Organization for Nuclear Research (CERN) since 2012
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,7 +12,7 @@
13
12
  # See the License for the specific language governing permissions and
14
13
  # limitations under the License.
15
14
 
16
- from jsonschema import validate, ValidationError
15
+ from jsonschema import ValidationError, validate
17
16
 
18
17
  from rucio.common.exception import InvalidObject
19
18
 
@@ -21,7 +20,8 @@ ACCOUNT_LENGTH = 25
21
20
 
22
21
  ACCOUNT = {"description": "Account name",
23
22
  "type": "string",
24
- "pattern": "^[a-z0-9-_]{1,%s}$" % ACCOUNT_LENGTH}
23
+ "maxLength": ACCOUNT_LENGTH,
24
+ "pattern": "^[a-z0-9-_]+$"}
25
25
 
26
26
  ACCOUNTS = {"description": "Array of accounts",
27
27
  "type": "array",
@@ -47,7 +47,8 @@ SCOPE_LENGTH = 25
47
47
 
48
48
  SCOPE = {"description": "Scope name",
49
49
  "type": "string",
50
- "pattern": "^[a-zA-Z_\\-.0-9]{1,%s}$" % SCOPE_LENGTH}
50
+ "maxLength": SCOPE_LENGTH,
51
+ "pattern": "^[a-zA-Z_\\-.0-9]+$"}
51
52
 
52
53
  R_SCOPE = {"description": "Scope name",
53
54
  "type": "string",
@@ -57,7 +58,8 @@ NAME_LENGTH = 250
57
58
 
58
59
  NAME = {"description": "Data Identifier name",
59
60
  "type": "string",
60
- "pattern": r"^/[A-Za-z0-9\.\-\_\+\/]{1,%s}$" % NAME_LENGTH}
61
+ "maxLength": NAME_LENGTH,
62
+ "pattern": r"^/[A-Za-z0-9\.\-\_\+\/]+$"}
61
63
 
62
64
  R_NAME = {"description": "Data Identifier name",
63
65
  "type": "string",
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  # Copyright European Organization for Nuclear Research (CERN) since 2012
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,7 +12,7 @@
13
12
  # See the License for the specific language governing permissions and
14
13
  # limitations under the License.
15
14
 
16
- from jsonschema import validate, ValidationError
15
+ from jsonschema import ValidationError, validate
17
16
 
18
17
  from rucio.common.exception import InvalidObject
19
18
 
@@ -21,7 +20,8 @@ ACCOUNT_LENGTH = 25
21
20
 
22
21
  ACCOUNT = {"description": "Account name",
23
22
  "type": "string",
24
- "pattern": "^[a-z0-9-_]{1,%s}$" % ACCOUNT_LENGTH}
23
+ "maxLength": ACCOUNT_LENGTH,
24
+ "pattern": "^[a-z0-9-_]+$"}
25
25
 
26
26
  ACCOUNTS = {"description": "Array of accounts",
27
27
  "type": "array",
@@ -42,7 +42,8 @@ SCOPE_LENGTH = 25
42
42
 
43
43
  SCOPE = {"description": "Scope name",
44
44
  "type": "string",
45
- "pattern": "^[a-zA-Z_\\-.0-9]{1,%s}$" % SCOPE_LENGTH}
45
+ "maxLength": SCOPE_LENGTH,
46
+ "pattern": "^[a-zA-Z_\\-.0-9]+$"}
46
47
 
47
48
  R_SCOPE = {"description": "Scope name",
48
49
  "type": "string",
@@ -52,7 +53,8 @@ NAME_LENGTH = 250
52
53
 
53
54
  NAME = {"description": "Data Identifier name",
54
55
  "type": "string",
55
- "pattern": "^[A-Za-z0-9][A-Za-z0-9\\.\\-\\_]{1,%s}$" % NAME_LENGTH}
56
+ "maxLength": NAME_LENGTH,
57
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9\\.\\-\\_]*$"}
56
58
 
57
59
  R_NAME = {"description": "Data Identifier name",
58
60
  "type": "string",
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  # Copyright European Organization for Nuclear Research (CERN) since 2012
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,7 +12,7 @@
13
12
  # See the License for the specific language governing permissions and
14
13
  # limitations under the License.
15
14
 
16
- from jsonschema import validate, ValidationError
15
+ from jsonschema import ValidationError, validate
17
16
 
18
17
  from rucio.common.exception import InvalidObject
19
18
 
@@ -21,7 +20,8 @@ ACCOUNT_LENGTH = 25
21
20
 
22
21
  ACCOUNT = {"description": "Account name",
23
22
  "type": "string",
24
- "pattern": "^[a-zA-Z0-9-_]{1,%s}$" % ACCOUNT_LENGTH}
23
+ "maxLength": ACCOUNT_LENGTH,
24
+ "pattern": "^[a-zA-Z0-9-_]+$"}
25
25
 
26
26
  ACCOUNTS = {"description": "Array of accounts",
27
27
  "type": "array",
@@ -48,7 +48,8 @@ SCOPE_LENGTH = 25
48
48
 
49
49
  SCOPE = {"description": "Scope name",
50
50
  "type": "string",
51
- "pattern": "^[a-zA-Z_\\-.0-9]{1,%s}$" % SCOPE_LENGTH}
51
+ "maxLength": SCOPE_LENGTH,
52
+ "pattern": "^[a-zA-Z_\\-.0-9]+$"}
52
53
 
53
54
  R_SCOPE = {"description": "Scope name",
54
55
  "type": "string",
@@ -58,7 +59,8 @@ NAME_LENGTH = 250
58
59
 
59
60
  NAME = {"description": "Data Identifier name",
60
61
  "type": "string",
61
- "pattern": "^[A-Za-z0-9][A-Za-z0-9\\.\\-\\_]{1,%s}$" % NAME_LENGTH}
62
+ "maxLength": NAME_LENGTH,
63
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9\\.\\-\\_]*$"}
62
64
 
63
65
  R_NAME = {"description": "Data Identifier name",
64
66
  "type": "string",
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  # Copyright European Organization for Nuclear Research (CERN) since 2012
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,7 +12,7 @@
13
12
  # See the License for the specific language governing permissions and
14
13
  # limitations under the License.
15
14
 
16
- from jsonschema import validate, ValidationError
15
+ from jsonschema import ValidationError, validate
17
16
 
18
17
  from rucio.common.exception import InvalidObject
19
18
 
@@ -21,7 +20,8 @@ ACCOUNT_LENGTH = 25
21
20
 
22
21
  ACCOUNT = {"description": "Account name",
23
22
  "type": "string",
24
- "pattern": "^[a-z0-9-_]{1,%s}$" % ACCOUNT_LENGTH}
23
+ "maxLength": ACCOUNT_LENGTH,
24
+ "pattern": "^[a-z0-9-_]+$"}
25
25
 
26
26
  ACCOUNTS = {"description": "Array of accounts",
27
27
  "type": "array",
@@ -47,7 +47,8 @@ SCOPE_LENGTH = 25
47
47
 
48
48
  SCOPE = {"description": "Scope name",
49
49
  "type": "string",
50
- "pattern": "^[a-zA-Z_\\-.0-9]{1,%s}$" % SCOPE_LENGTH}
50
+ "maxLength": SCOPE_LENGTH,
51
+ "pattern": "^[a-zA-Z_\\-.0-9]+$"}
51
52
 
52
53
  R_SCOPE = {"description": "Scope name",
53
54
  "type": "string",
@@ -57,7 +58,8 @@ NAME_LENGTH = 250
57
58
 
58
59
  NAME = {"description": "Data Identifier name",
59
60
  "type": "string",
60
- "pattern": "^[A-Za-z0-9][A-Za-z0-9\\.\\-\\_]{1,%s}$" % NAME_LENGTH}
61
+ "maxLength": NAME_LENGTH,
62
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9\\.\\-\\_]*$"}
61
63
 
62
64
  R_NAME = {"description": "Data Identifier name",
63
65
  "type": "string",
@@ -289,7 +291,7 @@ R_DIDS = {"description": "Array of Data Identifiers(DIDs)",
289
291
  "minItems": 1,
290
292
  "maxItems": 1000}
291
293
 
292
- ATTACHMENT = {"description": "Attachement",
294
+ ATTACHMENT = {"description": "Attachment",
293
295
  "type": "object",
294
296
  "properties": {"scope": SCOPE,
295
297
  "name": NAME,
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  # Copyright European Organization for Nuclear Research (CERN) since 2012
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,7 +12,7 @@
13
12
  # See the License for the specific language governing permissions and
14
13
  # limitations under the License.
15
14
 
16
- from jsonschema import validate, ValidationError
15
+ from jsonschema import ValidationError, validate
17
16
 
18
17
  from rucio.common.exception import InvalidObject
19
18
 
@@ -21,7 +20,8 @@ ACCOUNT_LENGTH = 29
21
20
 
22
21
  ACCOUNT = {"description": "Account name",
23
22
  "type": "string",
24
- "pattern": "^[a-z0-9-_]{1,%s}$" % (ACCOUNT_LENGTH - 4)}
23
+ "maxLength": ACCOUNT_LENGTH - 4,
24
+ "pattern": "^[a-z0-9-_]+$"}
25
25
 
26
26
 
27
27
  ACCOUNTS = {"description": "Array of accounts",
@@ -48,7 +48,8 @@ SCOPE_LENGTH = 29
48
48
 
49
49
  SCOPE = {"description": "Scope name",
50
50
  "type": "string",
51
- "pattern": "^[a-zA-Z_\\-.0-9]{1,%s}$" % (SCOPE_LENGTH - 4)}
51
+ "maxLength": SCOPE_LENGTH - 4,
52
+ "pattern": "^[a-zA-Z_\\-.0-9]+$"}
52
53
 
53
54
  R_SCOPE = {"description": "Scope name",
54
55
  "type": "string",
@@ -58,7 +59,8 @@ NAME_LENGTH = 250
58
59
 
59
60
  NAME = {"description": "Data Identifier name",
60
61
  "type": "string",
61
- "pattern": "^[A-Za-z0-9][A-Za-z0-9\\.\\-\\_]{1,%s}$" % NAME_LENGTH}
62
+ "maxLength": NAME_LENGTH,
63
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9\\.\\-\\_]*$"}
62
64
 
63
65
  R_NAME = {"description": "Data Identifier name",
64
66
  "type": "string",
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  # Copyright European Organization for Nuclear Research (CERN) since 2012
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,7 +12,7 @@
13
12
  # See the License for the specific language governing permissions and
14
13
  # limitations under the License.
15
14
 
16
- from jsonschema import validate, ValidationError
15
+ from jsonschema import ValidationError, validate
17
16
 
18
17
  from rucio.common.exception import InvalidObject
19
18
 
@@ -21,7 +20,8 @@ ACCOUNT_LENGTH = 25
21
20
 
22
21
  ACCOUNT = {"description": "Account name",
23
22
  "type": "string",
24
- "pattern": "^[a-z0-9-_]{1,%s}$" % ACCOUNT_LENGTH}
23
+ "maxLength": ACCOUNT_LENGTH,
24
+ "pattern": "^[a-z0-9-_]+$"}
25
25
 
26
26
  ACCOUNTS = {"description": "Array of accounts",
27
27
  "type": "array",
@@ -47,7 +47,8 @@ SCOPE_LENGTH = 25
47
47
 
48
48
  SCOPE = {"description": "Scope name",
49
49
  "type": "string",
50
- "pattern": "^[a-zA-Z_\\-.0-9]{1,%s}$" % SCOPE_LENGTH}
50
+ "maxLength": SCOPE_LENGTH,
51
+ "pattern": "^[a-zA-Z_\\-.0-9]+$"}
51
52
 
52
53
  R_SCOPE = {"description": "Scope name",
53
54
  "type": "string",
@@ -58,7 +59,8 @@ NAME_LENGTH = 500
58
59
 
59
60
  NAME = {"description": "IceCube Data Identifier name",
60
61
  "type": "string",
61
- "pattern": r"^\/[A-Za-z0-9][A-Za-z0-9\\.\\-\\_\/\#]{1,%s}$" % NAME_LENGTH}
62
+ "maxLength": NAME_LENGTH,
63
+ "pattern": r"^\/[A-Za-z0-9][A-Za-z0-9\\.\\-\\_\/\#]*$"}
62
64
 
63
65
  # read name
64
66
  R_NAME = NAME
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  # Copyright European Organization for Nuclear Research (CERN) since 2012
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
rucio/common/stopwatch.py CHANGED
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  # Copyright European Organization for Nuclear Research (CERN) since 2012
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  # Copyright European Organization for Nuclear Research (CERN) since 2012
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +16,8 @@ import unittest
17
16
  from os import remove
18
17
  from os.path import basename
19
18
 
20
- from rucio.common.utils import generate_uuid as uuid, execute
19
+ from rucio.common.utils import execute
20
+ from rucio.common.utils import generate_uuid as uuid
21
21
 
22
22
 
23
23
  def file_generator(size=2048, namelen=10):