edsl 0.1.39.dev7__py3-none-any.whl → 0.1.39.dev9__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 CHANGED
@@ -1 +1 @@
1
- __version__ = "0.1.39.dev7"
1
+ __version__ = "0.1.39.dev9"
edsl/agents/Agent.py CHANGED
@@ -906,7 +906,7 @@ class Agent(Base):
906
906
  {'traits': {'age': 10, 'hair': 'brown', 'height': 5.5}, 'instruction': 'Have fun.', 'edsl_version': '...', 'edsl_class_name': 'Agent'}
907
907
  """
908
908
  d = {}
909
- d["traits"] = copy.deepcopy(self.traits)
909
+ d["traits"] = copy.deepcopy(dict(self._traits))
910
910
  if self.name:
911
911
  d["name"] = self.name
912
912
  if self.set_instructions:
@@ -93,16 +93,16 @@ class JobsRunnerAsyncio:
93
93
 
94
94
  self.completed = True
95
95
 
96
- def run_progress_bar(stop_event) -> None:
96
+ def run_progress_bar(stop_event, jobs_runner_status) -> None:
97
97
  """Runs the progress bar in a separate thread."""
98
- self.jobs_runner_status.update_progress(stop_event)
98
+ jobs_runner_status.update_progress(stop_event)
99
99
 
100
100
  def set_up_progress_bar(progress_bar: bool, jobs_runner_status):
101
101
  progress_thread = None
102
102
  if progress_bar and jobs_runner_status.has_ep_api_key():
103
103
  jobs_runner_status.setup()
104
104
  progress_thread = threading.Thread(
105
- target=run_progress_bar, args=(stop_event,)
105
+ target=run_progress_bar, args=(stop_event, jobs_runner_status)
106
106
  )
107
107
  progress_thread.start()
108
108
  elif progress_bar:
@@ -148,7 +148,8 @@ class JobsRunnerStatusBase(ABC):
148
148
  }
149
149
 
150
150
  model_queues = {}
151
- for model, bucket in self.jobs_runner.bucket_collection.items():
151
+ # for model, bucket in self.jobs_runner.bucket_collection.items():
152
+ for model, bucket in self.jobs_runner.environment.bucket_collection.items():
152
153
  model_name = model.model
153
154
  model_queues[model_name] = {
154
155
  "language_model_name": model_name,
@@ -327,6 +327,38 @@ class FileStore(Scenario):
327
327
 
328
328
  return ConstructDownloadLink(self).create_link(custom_filename, style)
329
329
 
330
+ def to_pandas(self):
331
+ """
332
+ Convert the file content to a pandas DataFrame if supported by the file handler.
333
+
334
+ Returns:
335
+ pandas.DataFrame: The data from the file as a DataFrame
336
+
337
+ Raises:
338
+ AttributeError: If the file type's handler doesn't support pandas conversion
339
+ """
340
+ handler = FileMethods.get_handler(self.suffix)
341
+ if handler and hasattr(handler, "to_pandas"):
342
+ return handler(self.path).to_pandas()
343
+ raise AttributeError(
344
+ f"Converting {self.suffix} files to pandas DataFrame is not supported"
345
+ )
346
+
347
+ def __getattr__(self, name):
348
+ """
349
+ Delegate pandas DataFrame methods to the underlying DataFrame if this is a CSV file
350
+ """
351
+ if self.suffix == "csv":
352
+ # Get the pandas DataFrame
353
+ df = self.to_pandas()
354
+ # Check if the requested attribute exists in the DataFrame
355
+ if hasattr(df, name):
356
+ return getattr(df, name)
357
+ # If not a CSV or attribute doesn't exist in DataFrame, raise AttributeError
358
+ raise AttributeError(
359
+ f"'{self.__class__.__name__}' object has no attribute '{name}'"
360
+ )
361
+
330
362
 
331
363
  class CSVFileStore(FileStore):
332
364
  @classmethod
@@ -36,3 +36,14 @@ class CsvMethods(FileMethods):
36
36
  with tempfile.NamedTemporaryFile(delete=False, suffix=".csv") as f:
37
37
  df.to_csv(f.name, index=False)
38
38
  return f.name
39
+
40
+ def to_pandas(self):
41
+ """
42
+ Convert the CSV file to a pandas DataFrame.
43
+
44
+ Returns:
45
+ pandas.DataFrame: The data from the CSV as a DataFrame
46
+ """
47
+ import pandas as pd
48
+
49
+ return pd.read_csv(self.path)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: edsl
3
- Version: 0.1.39.dev7
3
+ Version: 0.1.39.dev9
4
4
  Summary: Create and analyze LLM-based surveys
5
5
  Home-page: https://www.expectedparrot.com/
6
6
  License: MIT
@@ -107,5 +107,5 @@ See instructions on [storing API keys](https://docs.expectedparrot.com/en/latest
107
107
 
108
108
  ## 💡 Contributions, feature requests & bugs
109
109
  Interested in contributing? Want us to add a new feature? Found a bug for us to squash?
110
- Please send us an email at [info@expectedparrot.com](mailto:info@expectedparrot.com) or message us at our [Discord channel](https://discord.com/invite/mxAYkjfy9m)..
110
+ Please send us an email at [info@expectedparrot.com](mailto:info@expectedparrot.com) or message us at our [Discord channel](https://discord.com/invite/mxAYkjfy9m).
111
111
 
@@ -2,8 +2,8 @@ edsl/Base.py,sha256=-U6ngLZJDqImrAwF-TSmYzMESre0CG5rq9ZFxFh31sY,12864
2
2
  edsl/BaseDiff.py,sha256=92BirXj2u3TEGHJWni9TBsvZjvq8wpb4wDL2vxX9Lb0,8253
3
3
  edsl/TemplateLoader.py,sha256=sDBlSMt7EfOduM7w3h6v03gvh_Rzn9hVrlS-iLSQdZA,849
4
4
  edsl/__init__.py,sha256=It2k2drMyde7O-xh0yesod2OxZ3W0yW21zZKRVifv6g,1896
5
- edsl/__version__.py,sha256=gtHAghMnWHOXpRbnaV68xhfhsbgWB2pLx6afg2tq9sI,28
6
- edsl/agents/Agent.py,sha256=VLIe9gMnLcZkRCQpz8VofEIAbCWj7jNpWxDw5k3KiXI,40734
5
+ edsl/__version__.py,sha256=J-Zj_t3-7Tsir_Fca5sF0ksqcQWvYAu4ABn2hhjApQQ,28
6
+ edsl/agents/Agent.py,sha256=lF7GD_bCvRLP4hrtm3w451AUfuJln5jZHGYBH84CMVE,40741
7
7
  edsl/agents/AgentList.py,sha256=iRfQfyUYtaJbJ3sRubPqPKRr77nKQgzhFEeZ0wcAEk0,18955
8
8
  edsl/agents/Invigilator.py,sha256=v9KkQ7yQfhwsrZB-7Bu4ZQ-zl_9Hwaxe0uQyxB-Wvss,11862
9
9
  edsl/agents/InvigilatorBase.py,sha256=JIRy7uogI8Hsv8nx8J2zMnd4XK-WQETlSAzkU6uIYNw,8967
@@ -120,8 +120,8 @@ edsl/jobs/interviews/interview_status_enum.py,sha256=KJ-1yLAHdX-p8TiFnM0M3v1tnBw
120
120
  edsl/jobs/jobs_status_enums.py,sha256=li94KU-DHNEq7ksR2ikQxms6W-J7sfiRlmlgGQX3F-E,172
121
121
  edsl/jobs/loggers/HTMLTableJobLogger.py,sha256=0s47WYqT9JK7dF22U_fVDke6_cDjUKxn-KW6JJTwvYg,11717
122
122
  edsl/jobs/results_exceptions_handler.py,sha256=5meG_S2SXehcMbmBks6QC2RRaR79eHAclDwMCbl_6Rs,3258
123
- edsl/jobs/runners/JobsRunnerAsyncio.py,sha256=isYhNeuNlabvjks5whGVzQKn2t1yJXGCyd2Jg_DACeI,5471
124
- edsl/jobs/runners/JobsRunnerStatus.py,sha256=DBXohyKcQJ4bkNzQYHm-lT3BaCbrO5Fi6GKr1Vu4Hfc,10379
123
+ edsl/jobs/runners/JobsRunnerAsyncio.py,sha256=cGGB2wDvdI33y64-VgYj9UZKrRkecmxfpXw5L5kl8_k,5505
124
+ edsl/jobs/runners/JobsRunnerStatus.py,sha256=1aySPXQ0ijCvv6Bqvddqe6Hlr-wAlTvxBV6D3Gvveqw,10466
125
125
  edsl/jobs/runners/JobsRunnerStatusData.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
126
126
  edsl/jobs/tasks/QuestionTaskCreator.py,sha256=Bx7x2_Tc6hQvaAQNtnxvoF52bTCZH7AhiVWg_gSajmo,9934
127
127
  edsl/jobs/tasks/TaskCreators.py,sha256=XqAbNU33378Z4PQncokbfJwnKt3KHR9aqa5fKYRDpfg,2694
@@ -261,7 +261,7 @@ edsl/results/tree_explore.py,sha256=hQjiO4E71rIOPDgEHgK8T8ukxqoNdgX_tvyiDlG4_9U,
261
261
  edsl/scenarios/ConstructDownloadLink.py,sha256=DGfF6hoCUovpTQ_GWiEndc--fXe9St6UdiaPhj7ZJZw,3529
262
262
  edsl/scenarios/DocumentChunker.py,sha256=LZXh_yx507LMNQ-i2VnSHZiPpRI0XQUECO8e3xAKAjI,3545
263
263
  edsl/scenarios/DocxScenario.py,sha256=ul3nkX826m_T6LFptswqtnH5czP_yxMlLWgbTmFIZI4,482
264
- edsl/scenarios/FileStore.py,sha256=c4Mzco_xpcyVGywHHAyPuu53OzRQD_9W9fyyPsYQKtc,16202
264
+ edsl/scenarios/FileStore.py,sha256=onFZAqkdqzyQeQ9_2zn1qGY40SqmRG9X8DvtcbXW39o,17418
265
265
  edsl/scenarios/PdfExtractor.py,sha256=ATJ_QOJ3yE7SkdAu3nQdQ-Z9dSjkBZyrEgeuDNtU_ZQ,1310
266
266
  edsl/scenarios/Scenario.py,sha256=670xmH15K0YZovouw4EQc1fdGerY96gtfgfAOOjSxno,17021
267
267
  edsl/scenarios/ScenarioHtmlMixin.py,sha256=5H8MnPPWqlGZ0_Ojv1WjkFaNNRrr-JpCRwlABDBfPXs,2111
@@ -272,7 +272,7 @@ edsl/scenarios/__init__.py,sha256=CQXwTNTIG9jg_pLkDPZgapUFY0_LwZFVQ8HaYvof0Nc,14
272
272
  edsl/scenarios/directory_scanner.py,sha256=eJHPx6pc_No-I-old0vwrNRwNxmgnn3Fr6mht5mp8Fw,3312
273
273
  edsl/scenarios/file_methods.py,sha256=HeusyoXOi2Bb0Bfp8MVDWKMFpe_ipP-cxENiRrSKZQU,2621
274
274
  edsl/scenarios/handlers/__init__.py,sha256=4GdEfrAk5a7mUfbwnf0TCcrvp1_aAYZPAnd433NmiGM,384
275
- edsl/scenarios/handlers/csv.py,sha256=6wKJwTWqMbVOX5ZgjKmo6fh3P1Y-2QJJ79KJ18hRAnk,1129
275
+ edsl/scenarios/handlers/csv.py,sha256=5W2fWa6FAL_QGTYTVLFaiEr28f6W7FaF-a9drsklSfc,1383
276
276
  edsl/scenarios/handlers/docx.py,sha256=e6POWp3Xs-XCVr8TKMtDka1ZRySXZf17TcSimvw6owY,2203
277
277
  edsl/scenarios/handlers/html.py,sha256=zXipNAYcQE4LRBrKZC9L_tkY1snxQe8ciJ2S1diyMcM,927
278
278
  edsl/scenarios/handlers/json.py,sha256=hlZMHYwwuFrV9bGdbn8MNAjgBFue6l5W2TwCfyxSjZ0,3682
@@ -352,7 +352,7 @@ edsl/utilities/remove_edsl_version.py,sha256=3n2RoXvZ4pH3k-_lc7B-vkeUyHXHX6vKHQS
352
352
  edsl/utilities/repair_functions.py,sha256=tftmklAqam6LOQQu_-9U44N-llycffhW8LfO63vBmNw,929
353
353
  edsl/utilities/restricted_python.py,sha256=5-_zUhrNbos7pLhDl9nr8d24auRlquR6w-vKkmNjPiA,2060
354
354
  edsl/utilities/utilities.py,sha256=FbI9QYGD4eaHrwZ6ePx51jjpatZqwSPHJhimx-h6HyA,12660
355
- edsl-0.1.39.dev7.dist-info/LICENSE,sha256=_qszBDs8KHShVYcYzdMz3HNMtH-fKN_p5zjoVAVumFc,1111
356
- edsl-0.1.39.dev7.dist-info/METADATA,sha256=Ka8rN5o8WyUvd6Sq8tqTlO9ax5Z85j90FCZ0TnlE7Ko,4766
357
- edsl-0.1.39.dev7.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
358
- edsl-0.1.39.dev7.dist-info/RECORD,,
355
+ edsl-0.1.39.dev9.dist-info/LICENSE,sha256=_qszBDs8KHShVYcYzdMz3HNMtH-fKN_p5zjoVAVumFc,1111
356
+ edsl-0.1.39.dev9.dist-info/METADATA,sha256=0NuSOGpTsIOmDsOwyNCVC5d5EJxQj_9dLj670A-rGmk,4765
357
+ edsl-0.1.39.dev9.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
358
+ edsl-0.1.39.dev9.dist-info/RECORD,,