dcicutils 7.4.2.1b10__py3-none-any.whl → 7.4.2.1b12__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of dcicutils might be problematic. Click here for more details.

@@ -65,7 +65,8 @@ class ProjectRegistry:
65
65
  REQUIRED_PROJECT_ATTRS = ['NAME']
66
66
 
67
67
  NON_INHERITED_PROJECT_ATTRS = [
68
- 'REPO_NAME', 'PYPI_NAME', 'PACKAGE_NAME', 'PRETTY_NAME', 'APP_NAME', 'APP_PRETTY_NAME'
68
+ # PYPROJECT_NAME and PACKAGE_NAME are also in this set but handled by special case.
69
+ 'REPO_NAME', 'PYPI_NAME', 'PRETTY_NAME', 'APP_NAME', 'APP_PRETTY_NAME'
69
70
  ]
70
71
 
71
72
  @classmethod
@@ -81,6 +82,10 @@ class ProjectRegistry:
81
82
 
82
83
  Since fourfront and cgap-portal don't occupy the same space, no confusion should result.
83
84
  """
85
+
86
+ protected_project_bindings = [('PYPROJECT_NAME', '_PYPROJECT_NAME', pyproject_name, False),
87
+ ('PACKAGE_NAME', '_PACKAGE_NAME', None, True)]
88
+
84
89
  def _wrap_class(the_class):
85
90
  the_class_name = the_class.__name__
86
91
  if not issubclass(the_class, Project):
@@ -88,16 +93,19 @@ class ProjectRegistry:
88
93
 
89
94
  explicit_attrs = the_class.__dict__
90
95
 
91
- explicit_pyproject_name = explicit_attrs.get('PYPROJECT_NAME')
92
- if explicit_pyproject_name:
93
- message = f"Explicit {the_class_name}.PYPROJECT_NAME={explicit_pyproject_name!r} is not permitted."
94
- if explicit_pyproject_name != pyproject_name:
95
- message += f" An assignment to {pyproject_name!r} is intended to be managed implicitly."
96
+ for public_attr, private_attr, default_val, assign_ok in protected_project_bindings:
97
+ if private_attr in explicit_attrs:
98
+ raise ValueError(f"{private_attr} is an internally managed variable. You must not set it.")
99
+ if public_attr in explicit_attrs:
100
+ explicit_val = explicit_attrs[public_attr]
101
+ if assign_ok:
102
+ setattr(the_class, public_attr, getattr(Project, public_attr))
103
+ setattr(the_class, private_attr, explicit_val)
104
+ else:
105
+ raise ValueError(f"Explicit {the_class_name}.{public_attr}={explicit_val!r} is not permitted."
106
+ f" This assignment is intended to be managed implicitly.")
96
107
  else:
97
- message += " This assignment is intended to be managed implicitly."
98
- raise ValueError(message)
99
- else:
100
- the_class._PYPROJECT_NAME = pyproject_name # no need for the caller to say this redundantly
108
+ setattr(the_class, private_attr, default_val)
101
109
 
102
110
  for attr in cls.REQUIRED_PROJECT_ATTRS:
103
111
  if attr not in explicit_attrs:
@@ -105,7 +113,7 @@ class ProjectRegistry:
105
113
 
106
114
  for attr in cls.NON_INHERITED_PROJECT_ATTRS:
107
115
  if attr not in explicit_attrs:
108
- setattr(cls, attr, Project.__dict__[attr])
116
+ delattr(the_class, attr)
109
117
 
110
118
  lower_registry_name = pyproject_name.lower()
111
119
  for x in ['cgap-portal', 'fourfront', 'smaht']:
@@ -260,7 +268,7 @@ class Project:
260
268
  # Other exported dirs, such as scripts or tests should be in later entries.
261
269
  package_name = poetry_data['packages'][0]['include']
262
270
  else:
263
- package_name = cls.PYPROJECT_NAME
271
+ package_name = cls.PYPI_NAME or cls.PYPROJECT_NAME
264
272
  cls._PACKAGE_NAME = package_name
265
273
  return package_name
266
274
 
@@ -277,7 +285,7 @@ class Project:
277
285
 
278
286
  @classproperty
279
287
  def APP_NAME(cls): # noQA - PyCharm wants the variable name to be self
280
- return cls.PACKAGE_NAME.replace('-portal', '').replace('encoded-', '')
288
+ return cls.REPO_NAME.replace('-portal', '').replace('encoded-', '')
281
289
 
282
290
  @classproperty
283
291
  def APP_PRETTY_NAME(cls): # noQA - PyCharm wants the variable name to be self
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dcicutils
3
- Version: 7.4.2.1b10
3
+ Version: 7.4.2.1b12
4
4
  Summary: Utility package for interacting with the 4DN Data Portal and other 4DN resources
5
5
  Home-page: https://github.com/4dn-dcic/utils
6
6
  License: MIT
@@ -32,7 +32,7 @@ dcicutils/log_utils.py,sha256=7pWMc6vyrorUZQf-V-M3YC6zrPgNhuV_fzm9xqTPph0,10883
32
32
  dcicutils/misc_utils.py,sha256=s_6_6X1It5dklv6UOd4XfZdtbw8xWwpOysWbclUdYNA,90749
33
33
  dcicutils/obfuscation_utils.py,sha256=fo2jOmDRC6xWpYX49u80bVNisqRRoPskFNX3ymFAmjw,5963
34
34
  dcicutils/opensearch_utils.py,sha256=V2exmFYW8Xl2_pGFixF4I2Cc549Opwe4PhFi5twC0M8,1017
35
- dcicutils/project_utils.py,sha256=LaDoM0gRtEv7OvtSZiZGbXsxReg3SpVSTMoVIpxigTs,14795
35
+ dcicutils/project_utils.py,sha256=foVjezP7iTX8BXSpWiMfAuJaOZYB4N9TxtsBrJu2nqs,15271
36
36
  dcicutils/qa_checkers.py,sha256=Pd40yGTxMsae1IZP86qWExBQ9kFiEMQIrsi5sWA55WE,20234
37
37
  dcicutils/qa_utils.py,sha256=r_vpLlxnsN8FDM_X_XO1KPotuZYAjptICcY4HJurj5Q,154684
38
38
  dcicutils/redis_tools.py,sha256=rqGtnVUjNjTlCdL1EMKuEhEMAgRJMiXZJkrKuX255QA,6509
@@ -44,8 +44,8 @@ dcicutils/snapshot_utils.py,sha256=ymP7PXH6-yEiXAt75w0ldQFciGNqWBClNxC5gfX2FnY,2
44
44
  dcicutils/ssl_certificate_utils.py,sha256=F0ifz_wnRRN9dfrfsz7aCp4UDLgHEY8LaK7PjnNvrAQ,9707
45
45
  dcicutils/task_utils.py,sha256=MF8ujmTD6-O2AC2gRGPHyGdUrVKgtr8epT5XU8WtNjk,8082
46
46
  dcicutils/trace_utils.py,sha256=g8kwV4ebEy5kXW6oOrEAUsurBcCROvwtZqz9fczsGRE,1769
47
- dcicutils-7.4.2.1b10.dist-info/LICENSE.txt,sha256=_lknlhA5bbBFtUCrhmOtUogQuvKDYd_AkLCRcjPoMBc,1098
48
- dcicutils-7.4.2.1b10.dist-info/METADATA,sha256=Q0l0X3qwAwQ6UTKkZmb1q37xlUpiFi3EkeclzHU8Q8E,3003
49
- dcicutils-7.4.2.1b10.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
50
- dcicutils-7.4.2.1b10.dist-info/entry_points.txt,sha256=xUFTG_l0IJJFMY-WLeijpjCzTv3_3cdmXVqClOeuIGs,74
51
- dcicutils-7.4.2.1b10.dist-info/RECORD,,
47
+ dcicutils-7.4.2.1b12.dist-info/LICENSE.txt,sha256=_lknlhA5bbBFtUCrhmOtUogQuvKDYd_AkLCRcjPoMBc,1098
48
+ dcicutils-7.4.2.1b12.dist-info/METADATA,sha256=jeFslfCBl-o1kt2NhoKeGKexQqs-QYp_q_M22zjNrWM,3003
49
+ dcicutils-7.4.2.1b12.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
50
+ dcicutils-7.4.2.1b12.dist-info/entry_points.txt,sha256=xUFTG_l0IJJFMY-WLeijpjCzTv3_3cdmXVqClOeuIGs,74
51
+ dcicutils-7.4.2.1b12.dist-info/RECORD,,