pearmut 0.2.7__tar.gz → 0.2.8__tar.gz

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.
Files changed (24) hide show
  1. {pearmut-0.2.7 → pearmut-0.2.8}/PKG-INFO +1 -1
  2. {pearmut-0.2.7 → pearmut-0.2.8}/pearmut.egg-info/PKG-INFO +1 -1
  3. {pearmut-0.2.7 → pearmut-0.2.8}/pyproject.toml +1 -1
  4. {pearmut-0.2.7 → pearmut-0.2.8}/server/cli.py +19 -23
  5. {pearmut-0.2.7 → pearmut-0.2.8}/LICENSE +0 -0
  6. {pearmut-0.2.7 → pearmut-0.2.8}/README.md +0 -0
  7. {pearmut-0.2.7 → pearmut-0.2.8}/pearmut.egg-info/SOURCES.txt +0 -0
  8. {pearmut-0.2.7 → pearmut-0.2.8}/pearmut.egg-info/dependency_links.txt +0 -0
  9. {pearmut-0.2.7 → pearmut-0.2.8}/pearmut.egg-info/entry_points.txt +0 -0
  10. {pearmut-0.2.7 → pearmut-0.2.8}/pearmut.egg-info/requires.txt +0 -0
  11. {pearmut-0.2.7 → pearmut-0.2.8}/pearmut.egg-info/top_level.txt +0 -0
  12. {pearmut-0.2.7 → pearmut-0.2.8}/server/app.py +0 -0
  13. {pearmut-0.2.7 → pearmut-0.2.8}/server/assignment.py +0 -0
  14. {pearmut-0.2.7 → pearmut-0.2.8}/server/static/assets/favicon.svg +0 -0
  15. {pearmut-0.2.7 → pearmut-0.2.8}/server/static/assets/style.css +0 -0
  16. {pearmut-0.2.7 → pearmut-0.2.8}/server/static/dashboard.bundle.js +0 -0
  17. {pearmut-0.2.7 → pearmut-0.2.8}/server/static/dashboard.html +0 -0
  18. {pearmut-0.2.7 → pearmut-0.2.8}/server/static/index.html +0 -0
  19. {pearmut-0.2.7 → pearmut-0.2.8}/server/static/listwise.bundle.js +0 -0
  20. {pearmut-0.2.7 → pearmut-0.2.8}/server/static/listwise.html +0 -0
  21. {pearmut-0.2.7 → pearmut-0.2.8}/server/static/pointwise.bundle.js +0 -0
  22. {pearmut-0.2.7 → pearmut-0.2.8}/server/static/pointwise.html +0 -0
  23. {pearmut-0.2.7 → pearmut-0.2.8}/server/utils.py +0 -0
  24. {pearmut-0.2.7 → pearmut-0.2.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pearmut
3
- Version: 0.2.7
3
+ Version: 0.2.8
4
4
  Summary: A tool for evaluation of model outputs, primarily MT.
5
5
  Author-email: Vilém Zouhar <vilem.zouhar@gmail.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pearmut
3
- Version: 0.2.7
3
+ Version: 0.2.8
4
4
  Summary: A tool for evaluation of model outputs, primarily MT.
5
5
  Author-email: Vilém Zouhar <vilem.zouhar@gmail.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pearmut"
3
- version = "0.2.7"
3
+ version = "0.2.8"
4
4
  description = "A tool for evaluation of model outputs, primarily MT."
5
5
  readme = "README.md"
6
6
  license = { text = "MIT" }
@@ -278,26 +278,24 @@ def _add_single_campaign(data_file, overwrite, server):
278
278
  )
279
279
 
280
280
  # Symlink path is based on the destination, stripping the 'assets/' prefix
281
- symlink_path = f"{STATIC_DIR}/{assets_destination}"
281
+ symlink_path = f"{STATIC_DIR}/{assets_destination}".rstrip("/")
282
282
 
283
283
  # Remove existing symlink if present and we are overriding the same campaign
284
284
  if os.path.lexists(symlink_path):
285
285
  # Check if any other campaign is using this destination
286
286
  current_campaign_id = campaign_data['campaign_id']
287
- tasks_dir = f"{ROOT}/data/tasks"
288
- if os.path.exists(tasks_dir):
289
- for task_file in os.listdir(tasks_dir):
290
- if task_file.endswith('.json'):
291
- other_campaign_id = task_file[:-5]
292
- if other_campaign_id != current_campaign_id:
293
- with open(f"{tasks_dir}/{task_file}", "r") as f:
294
- other_campaign = json.load(f)
295
- other_assets = other_campaign.get("info", {}).get("assets")
296
- if other_assets and isinstance(other_assets, dict):
297
- if other_assets.get("destination") == assets_destination:
298
- raise ValueError(
299
- f"Assets destination '{assets_destination}' is already used by campaign '{other_campaign_id}'."
300
- )
287
+
288
+ for other_campaign_id in progress_data.keys():
289
+ if other_campaign_id == current_campaign_id:
290
+ continue
291
+ with open(f"{ROOT}/data/tasks/{other_campaign_id}.json", "r") as f:
292
+ other_campaign = json.load(f)
293
+ other_assets = other_campaign.get("info", {}).get("assets")
294
+ if other_assets:
295
+ if other_assets.get("destination") == assets_destination:
296
+ raise ValueError(
297
+ f"Assets destination '{assets_destination}' is already used by campaign '{other_campaign_id}'."
298
+ )
301
299
  # Only allow overwrite if it's the same campaign
302
300
  if overwrite:
303
301
  os.remove(symlink_path)
@@ -305,7 +303,8 @@ def _add_single_campaign(data_file, overwrite, server):
305
303
  raise ValueError(f"Assets destination '{assets_destination}' is already taken.")
306
304
 
307
305
  # Ensure the assets directory exists
308
- os.makedirs(f"{STATIC_DIR}/assets", exist_ok=True)
306
+ # get parent of symlink_path dir
307
+ os.makedirs(os.path.dirname(symlink_path), exist_ok=True)
309
308
 
310
309
  os.symlink(assets_real_path, symlink_path, target_is_directory=True)
311
310
  print(f"Assets symlinked: {symlink_path} -> {assets_real_path}")
@@ -391,7 +390,7 @@ def main():
391
390
  campaign_data = json.load(f)
392
391
  destination = campaign_data.get("info", {}).get("assets", {}).get("destination")
393
392
  if destination:
394
- symlink_path = f"{STATIC_DIR}/{destination}"
393
+ symlink_path = f"{STATIC_DIR}/{destination}".rstrip("/")
395
394
  if os.path.islink(symlink_path):
396
395
  os.remove(symlink_path)
397
396
  print(f"Assets symlink removed: {symlink_path}")
@@ -436,12 +435,9 @@ def main():
436
435
  )
437
436
  if confirm.lower() == 'y':
438
437
  # Unlink all assets first
439
- tasks_dir = f"{ROOT}/data/tasks"
440
- if os.path.exists(tasks_dir):
441
- for task_file in os.listdir(tasks_dir):
442
- if task_file.endswith('.json'):
443
- campaign_id = task_file[:-5]
444
- _unlink_assets(campaign_id)
438
+ progress_data = load_progress_data()
439
+ for campaign_id in progress_data.keys():
440
+ _unlink_assets(campaign_id)
445
441
  shutil.rmtree(f"{ROOT}/data/tasks", ignore_errors=True)
446
442
  shutil.rmtree(f"{ROOT}/data/outputs", ignore_errors=True)
447
443
  if os.path.exists(f"{ROOT}/data/progress.json"):
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes