edsl 0.1.28__py3-none-any.whl → 0.1.29.dev1__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.
- edsl/__version__.py +1 -1
- edsl/coop/coop.py +1 -1
- edsl/jobs/Jobs.py +3 -2
- edsl/results/Results.py +10 -22
- edsl/scenarios/ScenarioList.py +13 -7
- edsl/study/Study.py +1 -1
- {edsl-0.1.28.dist-info → edsl-0.1.29.dev1.dist-info}/METADATA +1 -1
- {edsl-0.1.28.dist-info → edsl-0.1.29.dev1.dist-info}/RECORD +11 -11
- {edsl-0.1.28.dist-info → edsl-0.1.29.dev1.dist-info}/LICENSE +0 -0
- {edsl-0.1.28.dist-info → edsl-0.1.29.dev1.dist-info}/WHEEL +0 -0
- {edsl-0.1.28.dist-info → edsl-0.1.29.dev1.dist-info}/entry_points.txt +0 -0
edsl/__version__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.1.
|
1
|
+
__version__ = "0.1.29.dev1"
|
edsl/coop/coop.py
CHANGED
@@ -211,7 +211,7 @@ class Coop:
|
|
211
211
|
"version": o.get("version"),
|
212
212
|
"description": o.get("description"),
|
213
213
|
"visibility": o.get("visibility"),
|
214
|
-
"url": f"{self.url}/
|
214
|
+
"url": f"{self.url}/content/{o.get('uuid')}",
|
215
215
|
}
|
216
216
|
for o in response.json()
|
217
217
|
]
|
edsl/jobs/Jobs.py
CHANGED
@@ -368,7 +368,7 @@ class Jobs(Base):
|
|
368
368
|
if self.verbose:
|
369
369
|
print(message)
|
370
370
|
|
371
|
-
def _check_parameters(self, strict=False) -> None:
|
371
|
+
def _check_parameters(self, strict=False, warn = True) -> None:
|
372
372
|
"""Check if the parameters in the survey and scenarios are consistent.
|
373
373
|
|
374
374
|
>>> from edsl import QuestionFreeText
|
@@ -403,7 +403,8 @@ class Jobs(Base):
|
|
403
403
|
if strict:
|
404
404
|
raise ValueError(message)
|
405
405
|
else:
|
406
|
-
|
406
|
+
if warn:
|
407
|
+
warnings.warn(message)
|
407
408
|
|
408
409
|
def run(
|
409
410
|
self,
|
edsl/results/Results.py
CHANGED
@@ -757,10 +757,15 @@ class Results(UserList, Mixins, Base):
|
|
757
757
|
|
758
758
|
return Dataset(new_data)
|
759
759
|
|
760
|
-
def sort_by(self, columns, reverse: bool = False) -> Results:
|
760
|
+
def sort_by(self, *columns: str, reverse: bool = False) -> Results:
|
761
|
+
import warnings
|
762
|
+
warnings.warn("sort_by is deprecated. Use order_by instead.", DeprecationWarning)
|
763
|
+
return self.order_by(*columns, reverse=reverse)
|
764
|
+
|
765
|
+
def order_by(self, *columns: str, reverse: bool = False) -> Results:
|
761
766
|
"""Sort the results by one or more columns.
|
762
767
|
|
763
|
-
:param columns:
|
768
|
+
:param columns: One or more column names as strings.
|
764
769
|
:param reverse: A boolean that determines whether to sort in reverse order.
|
765
770
|
|
766
771
|
Each column name can be a single key, e.g. "how_feeling", or a dot-separated string, e.g. "answer.how_feeling".
|
@@ -768,7 +773,7 @@ class Results(UserList, Mixins, Base):
|
|
768
773
|
Example:
|
769
774
|
|
770
775
|
>>> r = Results.example()
|
771
|
-
>>> r.sort_by(
|
776
|
+
>>> r.sort_by('how_feeling', reverse=False).select('how_feeling').print()
|
772
777
|
┏━━━━━━━━━━━━━━┓
|
773
778
|
┃ answer ┃
|
774
779
|
┃ .how_feeling ┃
|
@@ -781,7 +786,7 @@ class Results(UserList, Mixins, Base):
|
|
781
786
|
├──────────────┤
|
782
787
|
│ Terrible │
|
783
788
|
└──────────────┘
|
784
|
-
>>> r.sort_by(
|
789
|
+
>>> r.sort_by('how_feeling', reverse=True).select('how_feeling').print()
|
785
790
|
┏━━━━━━━━━━━━━━┓
|
786
791
|
┃ answer ┃
|
787
792
|
┃ .how_feeling ┃
|
@@ -795,9 +800,6 @@ class Results(UserList, Mixins, Base):
|
|
795
800
|
│ Great │
|
796
801
|
└──────────────┘
|
797
802
|
"""
|
798
|
-
if isinstance(columns, str):
|
799
|
-
columns = [columns]
|
800
|
-
|
801
803
|
def to_numeric_if_possible(v):
|
802
804
|
try:
|
803
805
|
return float(v)
|
@@ -805,28 +807,14 @@ class Results(UserList, Mixins, Base):
|
|
805
807
|
return v
|
806
808
|
|
807
809
|
def sort_key(item):
|
808
|
-
# Create an empty list to store the key components for sorting
|
809
810
|
key_components = []
|
810
|
-
|
811
|
-
# Loop through each column specified in the sort
|
812
811
|
for col in columns:
|
813
|
-
# Parse the column into its data type and key
|
814
812
|
data_type, key = self._parse_column(col)
|
815
|
-
|
816
|
-
# Retrieve the value from the item based on the parsed data type and key
|
817
813
|
value = item.get_value(data_type, key)
|
818
|
-
|
819
|
-
# Convert the value to numeric if possible, and append it to the key components
|
820
814
|
key_components.append(to_numeric_if_possible(value))
|
821
|
-
|
822
|
-
# Convert the list of key components into a tuple to serve as the sorting key
|
823
815
|
return tuple(key_components)
|
824
816
|
|
825
|
-
new_data = sorted(
|
826
|
-
self.data,
|
827
|
-
key=sort_key,
|
828
|
-
reverse=reverse,
|
829
|
-
)
|
817
|
+
new_data = sorted(self.data, key=sort_key, reverse=reverse)
|
830
818
|
return Results(survey=self.survey, data=new_data, created_columns=None)
|
831
819
|
|
832
820
|
def filter(self, expression: str) -> Results:
|
edsl/scenarios/ScenarioList.py
CHANGED
@@ -119,7 +119,7 @@ class ScenarioList(Base, UserList, ScenarioListPdfMixin, ResultsExportMixin):
|
|
119
119
|
|
120
120
|
return ScenarioList(random.sample(self.data, n))
|
121
121
|
|
122
|
-
def expand(self, expand_field: str) -> ScenarioList:
|
122
|
+
def expand(self, expand_field: str, number_field = False) -> ScenarioList:
|
123
123
|
"""Expand the ScenarioList by a field.
|
124
124
|
|
125
125
|
Example:
|
@@ -133,9 +133,11 @@ class ScenarioList(Base, UserList, ScenarioListPdfMixin, ResultsExportMixin):
|
|
133
133
|
values = scenario[expand_field]
|
134
134
|
if not isinstance(values, Iterable) or isinstance(values, str):
|
135
135
|
values = [values]
|
136
|
-
for value in values:
|
136
|
+
for index, value in enumerate(values):
|
137
137
|
new_scenario = scenario.copy()
|
138
138
|
new_scenario[expand_field] = value
|
139
|
+
if number_field:
|
140
|
+
new_scenario[expand_field + '_number'] = index + 1
|
139
141
|
new_scenarios.append(new_scenario)
|
140
142
|
return ScenarioList(new_scenarios)
|
141
143
|
|
@@ -178,16 +180,20 @@ class ScenarioList(Base, UserList, ScenarioListPdfMixin, ResultsExportMixin):
|
|
178
180
|
|
179
181
|
return ScenarioList(new_data)
|
180
182
|
|
181
|
-
def order_by(self,
|
182
|
-
"""Order the scenarios by
|
183
|
+
def order_by(self, *fields: str, reverse: bool = False) -> ScenarioList:
|
184
|
+
"""Order the scenarios by one or more fields.
|
183
185
|
|
184
186
|
Example:
|
185
187
|
|
186
188
|
>>> s = ScenarioList([Scenario({'a': 1, 'b': 2}), Scenario({'a': 1, 'b': 1})])
|
187
|
-
>>> s.order_by('b')
|
189
|
+
>>> s.order_by('b', 'a')
|
188
190
|
ScenarioList([Scenario({'a': 1, 'b': 1}), Scenario({'a': 1, 'b': 2})])
|
189
191
|
"""
|
190
|
-
|
192
|
+
|
193
|
+
def get_sort_key(scenario: Any) -> tuple:
|
194
|
+
return tuple(scenario[field] for field in fields)
|
195
|
+
|
196
|
+
return ScenarioList(sorted(self, key=get_sort_key, reverse=reverse))
|
191
197
|
|
192
198
|
def filter(self, expression: str) -> ScenarioList:
|
193
199
|
"""
|
@@ -437,7 +443,7 @@ class ScenarioList(Base, UserList, ScenarioListPdfMixin, ResultsExportMixin):
|
|
437
443
|
pretty_labels: Optional[dict] = None,
|
438
444
|
filename: str = None,
|
439
445
|
):
|
440
|
-
print_scenario_list(self)
|
446
|
+
print_scenario_list(self[:max_rows])
|
441
447
|
|
442
448
|
def __getitem__(self, key: Union[int, slice]) -> Any:
|
443
449
|
"""Return the item at the given index.
|
edsl/study/Study.py
CHANGED
@@ -473,7 +473,7 @@ class Study:
|
|
473
473
|
obj_entry.push(refresh=refresh)
|
474
474
|
|
475
475
|
def __repr__(self):
|
476
|
-
return f"""Study(name = {self.name}, description = {self.description}, objects = {self.objects}, cache = {self.cache}, filename = {self.filename}, coop = {self.coop}, use_study_cache = {self.use_study_cache}, overwrite_on_change = {self.overwrite_on_change})"""
|
476
|
+
return f"""Study(name = {self.name}, description = {self.description}, objects = {self.objects}, cache = {self.cache}, filename = "{self.filename}", coop = {self.coop}, use_study_cache = {self.use_study_cache}, overwrite_on_change = {self.overwrite_on_change})"""
|
477
477
|
|
478
478
|
|
479
479
|
if __name__ == "__main__":
|
@@ -1,7 +1,7 @@
|
|
1
1
|
edsl/Base.py,sha256=7xc-2fmIGVx-yofU54w5eDU6WSl1AwgrNP2YncDd93M,8847
|
2
2
|
edsl/BaseDiff.py,sha256=RoVEh52UJs22yMa7k7jv8se01G62jJNWnBzaZngo-Ug,8260
|
3
3
|
edsl/__init__.py,sha256=p4GjE-YbPKoGhGY4YULtJ4N4Sb8hx2GVeLa2UIxj8_U,1347
|
4
|
-
edsl/__version__.py,sha256=
|
4
|
+
edsl/__version__.py,sha256=ZM9fzsLnBYnHLisEQKPZIhnHnvCp-zegZOzwrlIwCZ8,28
|
5
5
|
edsl/agents/Agent.py,sha256=_PvcQIjeJpyn-ZLOPl3d8f0UZ2AmW-PuHjl9nuhzOEY,25955
|
6
6
|
edsl/agents/AgentList.py,sha256=6zHzs7jQFBnNQIRz_zYGDyTGptyvqSqciVwr7kxwyEk,8479
|
7
7
|
edsl/agents/Invigilator.py,sha256=vUjNsQrE724Cepr1XvOp2CTER7GBGZ8XoVl6yzfbeP0,10061
|
@@ -31,7 +31,7 @@ edsl/conversation/car_buying.py,sha256=70nCXQNCc2kR-NBY6YOPHfkuZ5g7nww2r4GwlYosV
|
|
31
31
|
edsl/conversation/mug_negotiation.py,sha256=mjvAqErD4AjN3G2za2c-X-3axOShW-zAJUeiJqTxVPA,2616
|
32
32
|
edsl/conversation/next_speaker_utilities.py,sha256=bqr5JglCd6bdLc9IZ5zGOAsmN2F4ERiubSMYvZIG7qk,3629
|
33
33
|
edsl/coop/__init__.py,sha256=4iZCwJSzJVyjBYk8ggGxY2kZjq9dXVT1jhyPDNyew4I,115
|
34
|
-
edsl/coop/coop.py,sha256=
|
34
|
+
edsl/coop/coop.py,sha256=JvRgnZqQfuO-2idiW3etAk2RNZ9yaAzmLMYt8KZ0qhU,24840
|
35
35
|
edsl/coop/utils.py,sha256=OVfVUIBCH5ATj0yFLe0Ui0_KYGwwzWsVHqyavVVaN_w,3773
|
36
36
|
edsl/data/Cache.py,sha256=f7tuzuA7T4C9qp8BP45UamcmJbvH8RGClr9lbf7PS1s,14880
|
37
37
|
edsl/data/CacheEntry.py,sha256=AnZBUautQc19KhE6NkI87U_P9wDZI2eu-8B1XopPTOI,7235
|
@@ -65,7 +65,7 @@ edsl/inference_services/rate_limits_cache.py,sha256=HYslviz7mxF9U4CUTPAkoyBsiXjS
|
|
65
65
|
edsl/inference_services/registry.py,sha256=-Yz86do-KZraunIrziVs9b95EbY-__JUnQb5Ulni7KI,483
|
66
66
|
edsl/inference_services/write_available.py,sha256=NNwhATlaMp8IYY635MSx-oYxt5X15acjAfaqYCo_I1Y,285
|
67
67
|
edsl/jobs/Answers.py,sha256=mtSjlRbVJbqZKA6DBngEwDxIfloRAKkrsTRriMTPRD4,1493
|
68
|
-
edsl/jobs/Jobs.py,sha256=
|
68
|
+
edsl/jobs/Jobs.py,sha256=zRJMeqeOSrkZrVvoc3KUw1dXW6C30imtVCWKTglpxZw,27061
|
69
69
|
edsl/jobs/__init__.py,sha256=aKuAyd_GoalGj-k7djOoVwEbFUE2XLPlikXaA1_8yAg,32
|
70
70
|
edsl/jobs/buckets/BucketCollection.py,sha256=LA8DBVwMdeTFCbSDI0S2cDzfi_Qo6kRizwrG64tE8S4,1844
|
71
71
|
edsl/jobs/buckets/ModelBuckets.py,sha256=1_WPi1wV5k8kO9TuLEA7tDt9rF_myaC5XKyf4T0EmQ8,1969
|
@@ -142,7 +142,7 @@ edsl/questions/question_registry.py,sha256=7JvkwFzItwNTXjMwbdfpbZQT_WAXOBxjlSJGC
|
|
142
142
|
edsl/questions/settings.py,sha256=Qk2imv_7N8uFGLoTEr163lbaKPbD2Begd17Hbh4GZKA,290
|
143
143
|
edsl/results/Dataset.py,sha256=v_6e1khpfs5Ft-b7GgTKhitr4l9sys4rb_4z-dOdj68,7737
|
144
144
|
edsl/results/Result.py,sha256=IvUFq23LwlBP7JN1QDap1fPTTIPUC0QlYEE4lsiKRqI,13913
|
145
|
-
edsl/results/Results.py,sha256=
|
145
|
+
edsl/results/Results.py,sha256=r13Rog0bNwHbV5Uat6YKTf-6zH2_sBqLbdsbfnV9zAE,34575
|
146
146
|
edsl/results/ResultsDBMixin.py,sha256=Dv34yBuF5tkeoYnzbN1YwuBwKh1T-Y77YOYcWlu-GLY,7883
|
147
147
|
edsl/results/ResultsExportMixin.py,sha256=KQ1GE2JDzrnl4XkyAGnCdgiFtF_mZrhFNDfkNPg_8C8,20501
|
148
148
|
edsl/results/ResultsFetchMixin.py,sha256=VEa0TKDcXbnTinSKs9YaE4WjOSLmlp9Po1_9kklFvSo,848
|
@@ -152,14 +152,14 @@ edsl/results/__init__.py,sha256=2YcyiVtXi-3vIV0ZzOy1PqBLm2gaziufJVi4fdNrAt8,80
|
|
152
152
|
edsl/scenarios/Scenario.py,sha256=C2HPOcP8YypcWffay6AA4cSPlD35xeMywiDomLCRHcY,14768
|
153
153
|
edsl/scenarios/ScenarioHtmlMixin.py,sha256=EmugmbPJYW5eZS30rM6pDMDQD9yrrvHjmgZWB1qBfq4,1882
|
154
154
|
edsl/scenarios/ScenarioImageMixin.py,sha256=VJ5FqyPrL5-ieORlWMpnjmOAFIau8QFZCIZyEBKgb6I,3530
|
155
|
-
edsl/scenarios/ScenarioList.py,sha256=
|
155
|
+
edsl/scenarios/ScenarioList.py,sha256=0yH58tbcKJxflsQVcOwh98uU_pzW3w3AGQdKHzftdZk,17895
|
156
156
|
edsl/scenarios/ScenarioListPdfMixin.py,sha256=0xV033SMygr_ObamXwjbzfxEQ0zFEwAJ1w7Wq1ejjUY,3719
|
157
157
|
edsl/scenarios/__init__.py,sha256=a2CIYQWh9bLeYY4qBJBz7ui7RfxpVd0WlYDf8TaT2D0,45
|
158
158
|
edsl/shared.py,sha256=lgLa-mCk2flIhxXarXLtfXZjXG_6XHhC2A3O8yRTjXc,20
|
159
159
|
edsl/study/ObjectEntry.py,sha256=AX3HtPfYlEM1gaa5RIgKyoTxWALakL2yiY2r2Vmg0G4,3164
|
160
160
|
edsl/study/ProofOfWork.py,sha256=Rcf96Mch4qWersHNBq-vWUePGk1D4KmvNTSR2TfFjs8,3398
|
161
161
|
edsl/study/SnapShot.py,sha256=Q_4NPznB3rwOuIuUep1Bw7tenK3cnw-gctDrOq-2Qpk,2364
|
162
|
-
edsl/study/Study.py,sha256=
|
162
|
+
edsl/study/Study.py,sha256=oXr86MLb005dDVRAflQpnaqBuqltvbz05qiZCMg040s,16660
|
163
163
|
edsl/study/__init__.py,sha256=HzE6z2vgmY19NNOW2s9R_WkmNzqswtkw53XV5fiE6ws,94
|
164
164
|
edsl/surveys/DAG.py,sha256=ozQuHo9ZQ8Eet5nDXtp7rFpiSocvvfxIHtyTnztvodg,2380
|
165
165
|
edsl/surveys/Memory.py,sha256=-ikOtkkQldGB_BkPCW3o7AYwV5B_pIwlREw7aVCSHaQ,1113
|
@@ -193,8 +193,8 @@ edsl/utilities/interface.py,sha256=U8iScZb4jB1npPwbndpjCove59ow2cbAST4fl-46FdI,1
|
|
193
193
|
edsl/utilities/repair_functions.py,sha256=tftmklAqam6LOQQu_-9U44N-llycffhW8LfO63vBmNw,929
|
194
194
|
edsl/utilities/restricted_python.py,sha256=5-_zUhrNbos7pLhDl9nr8d24auRlquR6w-vKkmNjPiA,2060
|
195
195
|
edsl/utilities/utilities.py,sha256=7LOMa1ahhi2t3SRwEs3VjroAj0A-5Q-Cn83v0HESADQ,10113
|
196
|
-
edsl-0.1.
|
197
|
-
edsl-0.1.
|
198
|
-
edsl-0.1.
|
199
|
-
edsl-0.1.
|
200
|
-
edsl-0.1.
|
196
|
+
edsl-0.1.29.dev1.dist-info/LICENSE,sha256=_qszBDs8KHShVYcYzdMz3HNMtH-fKN_p5zjoVAVumFc,1111
|
197
|
+
edsl-0.1.29.dev1.dist-info/METADATA,sha256=aoyFfhoIFYOHUt4ixbzqy0oSP7WF7g4FalKAreSo1OA,4102
|
198
|
+
edsl-0.1.29.dev1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
199
|
+
edsl-0.1.29.dev1.dist-info/entry_points.txt,sha256=yqJs04hJLRusoLzIYXGv8tl4TH__0D5SDRwLKV9IJCg,56
|
200
|
+
edsl-0.1.29.dev1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|