clear-skies 1.22.7__py3-none-any.whl → 1.22.9__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 clear-skies might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: clear-skies
3
- Version: 1.22.7
3
+ Version: 1.22.9
4
4
  Summary: A framework for building backends in the cloud
5
5
  Home-page: https://github.com/cmancone/clearskies
6
6
  License: MIT
@@ -74,7 +74,7 @@ clearskies/column_types/datetime.py,sha256=xtuZpUC9fA16i1oO80kPIx--8RDPuei9RdsDD
74
74
  clearskies/column_types/datetime_micro.py,sha256=ewQSniCc2MmNIyX2XNuNcCIwh5Fpf1HcvpLfzB8lz8g,382
75
75
  clearskies/column_types/email.py,sha256=qq0Yo_C3KxUqT68q2HWXocBBR4xwMqjxcIdgZRv218U,584
76
76
  clearskies/column_types/float.py,sha256=j8jJeBueSOusPtAFCWgLHYBncfLnqT1U7bh1zcAkYiA,1332
77
- clearskies/column_types/has_many.py,sha256=hQYV5I-mmC8-u_O225AP_2ylNQONQZ8dAr1P-XjdAO0,7521
77
+ clearskies/column_types/has_many.py,sha256=vcx6QU-LH-4hh_-LNfDBePt80hIFebSpTreGLh86pVc,7681
78
78
  clearskies/column_types/has_one.py,sha256=uphIPUuHLwwmhljLMaKKPujR6TYTT7onn-hHUF6S_IY,2230
79
79
  clearskies/column_types/integer.py,sha256=dGIluusPmhLRNg7PplOJLbQI2AXojqRBUHt8ekYWNVI,1386
80
80
  clearskies/column_types/json.py,sha256=TbZkdwCoZYhbALUxof2jENGfaq2i5TlcyBcmo7XzDGQ,652
@@ -122,7 +122,7 @@ clearskies/di/__init__.py,sha256=T7SgQNny2XAZQPeFkdmp1XxxmEVxtnpcRiGK8YflkwU,304
122
122
  clearskies/di/additional_config.py,sha256=PGWV-diJyqlx7WtYr4xV2Uo5W0-f4rmwdPWJRXq6V_8,592
123
123
  clearskies/di/additional_config_auto_import.py,sha256=m57IODPbnCAus9iDu3mDp42u4H87oPZvjAlBGoS8uRQ,111
124
124
  clearskies/di/di.py,sha256=4ZbOKpchVdl7-MOoKPsU_-AlZivwYCqcY0yaOZ96D0Q,15591
125
- clearskies/di/standard_dependencies.py,sha256=Qk1bBowoyptJRMYE6yjQR5Ix-DO7FXxIJk4ZdLj0Y6k,4616
125
+ clearskies/di/standard_dependencies.py,sha256=4cxWRjru5uKLW_1IJHKAgVu2cqc9gPcV0vZVm4HQxNg,4764
126
126
  clearskies/di/test_module/__init__.py,sha256=7YHQF7JHP0FdI7GdEGANSZ_t1EISQYhUNm1wqOg0NKw,88
127
127
  clearskies/di/test_module/another_module/__init__.py,sha256=8SRmHPDepLKGWTUSc1ucDF6U8mJPsNDsBDmBQCpzPWo,35
128
128
  clearskies/di/test_module/module_class.py,sha256=I_-wnMuHfbsvti-7d2Z4bXnr6deo__uvww9nds9qrlE,46
@@ -207,7 +207,7 @@ clearskies/tests/simple_api/models/__init__.py,sha256=nUA0W6fgXw_Bxa9CudkaDkC80t
207
207
  clearskies/tests/simple_api/models/status.py,sha256=PEhPbaQh5qdUNHp8O0gz91LOLENAEBtqSaHxUPXchaM,699
208
208
  clearskies/tests/simple_api/models/user.py,sha256=5_P4Tp1tTdX7PkMJ__epPM5MA7JAeVYGas69vcWloLc,819
209
209
  clearskies/tests/simple_api/users_api.py,sha256=KYXCgEofDxHeRdQK67txN5oYUPvxxmB8JTku7L-apk4,2344
210
- clear_skies-1.22.7.dist-info/LICENSE,sha256=3Ehd0g3YOpCj8sqj0Xjq5qbOtjjgk9qzhhD9YjRQgOA,1053
211
- clear_skies-1.22.7.dist-info/METADATA,sha256=pQoYwMvXFjfJ0UXI3x7VVvT3qwZrxBNq71TOc0OJYjs,1817
212
- clear_skies-1.22.7.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
213
- clear_skies-1.22.7.dist-info/RECORD,,
210
+ clear_skies-1.22.9.dist-info/LICENSE,sha256=3Ehd0g3YOpCj8sqj0Xjq5qbOtjjgk9qzhhD9YjRQgOA,1053
211
+ clear_skies-1.22.9.dist-info/METADATA,sha256=jJUINjTnq9DEn8oKxCaaKK6RruZUT0zRkVBJUGo3D0s,1817
212
+ clear_skies-1.22.9.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
213
+ clear_skies-1.22.9.dist-info/RECORD,,
@@ -4,6 +4,7 @@ from collections import OrderedDict
4
4
  from ..autodoc.schema import Array as AutoDocArray
5
5
  from ..autodoc.schema import Object as AutoDocObject
6
6
  from ..autodoc.schema import String as AutoDocString
7
+ from ..functional import validations
7
8
 
8
9
 
9
10
  class HasMany(Column):
@@ -50,7 +51,8 @@ class HasMany(Column):
50
51
  + f"'{model_class.__name__}'"
51
52
  )
52
53
  self.validate_models_class(configuration["child_models_class"])
53
- configuration["parent_id_column_name"] = model_class.id_column_name
54
+ if not configuration.get("parent_id_column_name"):
55
+ configuration["parent_id_column_name"] = model_class.id_column_name
54
56
 
55
57
  # if readable_child_columns is set then load up the child models/columns now, because we'll need it in the
56
58
  # _check_configuration step, but we don't want to load it there because we can't save it back into the config
@@ -120,7 +122,22 @@ class HasMany(Column):
120
122
  def provide(self, data, column_name):
121
123
  foreign_column_name = self.config("foreign_column_name")
122
124
  id_column_name = self.config("parent_id_column_name")
123
- return self.child_models.where(f"{foreign_column_name}={data[id_column_name]}")
125
+ children = self.child_models.where(f"{foreign_column_name}={data[id_column_name]}")
126
+
127
+ wheres = self.config("where", silent=True)
128
+ if not wheres:
129
+ return children
130
+
131
+ for index, where in enumerate(wheres):
132
+ if callable(where):
133
+ children = self.di.call_function(where, model=children, children=children, parent_data=data)
134
+ if not validations.is_model(children):
135
+ raise ValueError(
136
+ f"Configuration error for column '{self.name}' in model '{self.model_class.__name__}': when 'where' is a callable, it must return a models class, but when the callable in where entry #{index+1} was called, it did not return the models class"
137
+ )
138
+ else:
139
+ children = children.where(where)
140
+ return children
124
141
 
125
142
  def to_json(self, model):
126
143
  children = []
@@ -142,21 +159,7 @@ class HasMany(Column):
142
159
 
143
160
  @property
144
161
  def child_models(self):
145
- children = self.di.build(self.config("child_models_class"), cache=True)
146
- wheres = self.config("where", silent=True)
147
- if not wheres:
148
- return children
149
-
150
- for index, where in enumerate(wheres):
151
- if callable(where):
152
- children = self.di.call_function(where, model=children)
153
- if not children:
154
- raise ValueError(
155
- f"Configuration error for column '{self.name}' in model '{self.model_class.__name__}': when 'where' is a callable, it must return a models class, but when the callable in where entry #{index+1} was called, it did not return the models class"
156
- )
157
- else:
158
- children = children.where(where)
159
- return children
162
+ return self.di.build(self.config("child_models_class"), cache=True)
160
163
 
161
164
  def documentation(self, name=None, example=None, value=None):
162
165
  columns = self.get_child_columns()
@@ -123,7 +123,9 @@ class StandardDependencies(DI):
123
123
  return datetime.datetime.now(datetime.timezone.utc)
124
124
 
125
125
  def provide_input_output(self):
126
- raise AttributeError("The dependency injector requested an InputOutput but none has been configured")
126
+ raise AttributeError(
127
+ "The dependency injector requested an InputOutput but none has been configured. Alternatively, if you directly called `di.build('input_output')` then try again with `di.build('input_output', cache=True)`"
128
+ )
127
129
 
128
130
  def provide_authentication(self):
129
131
  raise AttributeError("The dependency injector requested an Authenticaiton method but none has been configured")