data-sourcerer 0.1.0__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.
Files changed (95) hide show
  1. data_sourcerer-0.1.0.dist-info/METADATA +52 -0
  2. data_sourcerer-0.1.0.dist-info/RECORD +95 -0
  3. data_sourcerer-0.1.0.dist-info/WHEEL +5 -0
  4. data_sourcerer-0.1.0.dist-info/entry_points.txt +2 -0
  5. data_sourcerer-0.1.0.dist-info/licenses/LICENSE +21 -0
  6. data_sourcerer-0.1.0.dist-info/top_level.txt +1 -0
  7. sourcerer/__init__.py +15 -0
  8. sourcerer/domain/__init__.py +13 -0
  9. sourcerer/domain/access_credentials/__init__.py +7 -0
  10. sourcerer/domain/access_credentials/entities.py +53 -0
  11. sourcerer/domain/access_credentials/exceptions.py +17 -0
  12. sourcerer/domain/access_credentials/repositories.py +84 -0
  13. sourcerer/domain/access_credentials/services.py +91 -0
  14. sourcerer/domain/file_system/__init__.py +7 -0
  15. sourcerer/domain/file_system/entities.py +70 -0
  16. sourcerer/domain/file_system/exceptions.py +17 -0
  17. sourcerer/domain/file_system/services.py +64 -0
  18. sourcerer/domain/shared/__init__.py +6 -0
  19. sourcerer/domain/shared/entities.py +18 -0
  20. sourcerer/domain/storage_provider/__init__.py +7 -0
  21. sourcerer/domain/storage_provider/entities.py +86 -0
  22. sourcerer/domain/storage_provider/exceptions.py +17 -0
  23. sourcerer/domain/storage_provider/services.py +130 -0
  24. sourcerer/infrastructure/__init__.py +13 -0
  25. sourcerer/infrastructure/access_credentials/__init__.py +7 -0
  26. sourcerer/infrastructure/access_credentials/exceptions.py +16 -0
  27. sourcerer/infrastructure/access_credentials/registry.py +120 -0
  28. sourcerer/infrastructure/access_credentials/repositories.py +119 -0
  29. sourcerer/infrastructure/access_credentials/services.py +396 -0
  30. sourcerer/infrastructure/db/__init__.py +6 -0
  31. sourcerer/infrastructure/db/config.py +73 -0
  32. sourcerer/infrastructure/db/models.py +47 -0
  33. sourcerer/infrastructure/file_system/__init__.py +7 -0
  34. sourcerer/infrastructure/file_system/exceptions.py +89 -0
  35. sourcerer/infrastructure/file_system/services.py +147 -0
  36. sourcerer/infrastructure/storage_provider/__init__.py +7 -0
  37. sourcerer/infrastructure/storage_provider/exceptions.py +78 -0
  38. sourcerer/infrastructure/storage_provider/registry.py +84 -0
  39. sourcerer/infrastructure/storage_provider/services.py +509 -0
  40. sourcerer/infrastructure/utils.py +106 -0
  41. sourcerer/presentation/__init__.py +12 -0
  42. sourcerer/presentation/app.py +36 -0
  43. sourcerer/presentation/di_container.py +46 -0
  44. sourcerer/presentation/screens/__init__.py +0 -0
  45. sourcerer/presentation/screens/critical_error/__init__.py +0 -0
  46. sourcerer/presentation/screens/critical_error/main.py +78 -0
  47. sourcerer/presentation/screens/critical_error/styles.tcss +41 -0
  48. sourcerer/presentation/screens/file_system_finder/main.py +248 -0
  49. sourcerer/presentation/screens/file_system_finder/styles.tcss +44 -0
  50. sourcerer/presentation/screens/file_system_finder/widgets/__init__.py +0 -0
  51. sourcerer/presentation/screens/file_system_finder/widgets/file_system_navigator.py +810 -0
  52. sourcerer/presentation/screens/main/__init__.py +0 -0
  53. sourcerer/presentation/screens/main/main.py +469 -0
  54. sourcerer/presentation/screens/main/messages/__init__.py +0 -0
  55. sourcerer/presentation/screens/main/messages/delete_request.py +12 -0
  56. sourcerer/presentation/screens/main/messages/download_request.py +12 -0
  57. sourcerer/presentation/screens/main/messages/preview_request.py +10 -0
  58. sourcerer/presentation/screens/main/messages/resizing_rule.py +21 -0
  59. sourcerer/presentation/screens/main/messages/select_storage_item.py +11 -0
  60. sourcerer/presentation/screens/main/messages/uncheck_files_request.py +8 -0
  61. sourcerer/presentation/screens/main/messages/upload_request.py +10 -0
  62. sourcerer/presentation/screens/main/mixins/__init__.py +0 -0
  63. sourcerer/presentation/screens/main/mixins/resize_containers_watcher_mixin.py +144 -0
  64. sourcerer/presentation/screens/main/styles.tcss +32 -0
  65. sourcerer/presentation/screens/main/widgets/__init__.py +0 -0
  66. sourcerer/presentation/screens/main/widgets/gradient.py +45 -0
  67. sourcerer/presentation/screens/main/widgets/resizing_rule.py +67 -0
  68. sourcerer/presentation/screens/main/widgets/storage_content.py +691 -0
  69. sourcerer/presentation/screens/main/widgets/storage_list_sidebar.py +143 -0
  70. sourcerer/presentation/screens/preview_content/__init__.py +0 -0
  71. sourcerer/presentation/screens/preview_content/main.py +59 -0
  72. sourcerer/presentation/screens/preview_content/styles.tcss +26 -0
  73. sourcerer/presentation/screens/provider_creds_list/__init__.py +0 -0
  74. sourcerer/presentation/screens/provider_creds_list/main.py +164 -0
  75. sourcerer/presentation/screens/provider_creds_list/styles.tcss +65 -0
  76. sourcerer/presentation/screens/provider_creds_registration/__init__.py +0 -0
  77. sourcerer/presentation/screens/provider_creds_registration/main.py +264 -0
  78. sourcerer/presentation/screens/provider_creds_registration/styles.tcss +42 -0
  79. sourcerer/presentation/screens/question/__init__.py +0 -0
  80. sourcerer/presentation/screens/question/main.py +31 -0
  81. sourcerer/presentation/screens/question/styles.tcss +33 -0
  82. sourcerer/presentation/screens/shared/__init__.py +0 -0
  83. sourcerer/presentation/screens/shared/containers.py +13 -0
  84. sourcerer/presentation/screens/shared/widgets/__init__.py +0 -0
  85. sourcerer/presentation/screens/shared/widgets/button.py +54 -0
  86. sourcerer/presentation/screens/shared/widgets/labeled_input.py +80 -0
  87. sourcerer/presentation/screens/storage_action_progress/__init__.py +0 -0
  88. sourcerer/presentation/screens/storage_action_progress/main.py +476 -0
  89. sourcerer/presentation/screens/storage_action_progress/styles.tcss +43 -0
  90. sourcerer/presentation/settings.py +31 -0
  91. sourcerer/presentation/themes/__init__.py +0 -0
  92. sourcerer/presentation/themes/github_dark.py +21 -0
  93. sourcerer/presentation/utils.py +69 -0
  94. sourcerer/settings.py +72 -0
  95. sourcerer/utils.py +32 -0
sourcerer/settings.py ADDED
@@ -0,0 +1,72 @@
1
+ """
2
+ Application settings module.
3
+
4
+ This module contains configuration settings for the application,
5
+ including encryption keys, UI constants, and file type definitions.
6
+ It centralizes configuration values to make them easily accessible
7
+ and modifiable throughout the application.
8
+ """
9
+
10
+ import os
11
+ from pathlib import Path
12
+
13
+ from platformdirs import user_state_dir
14
+
15
+ from sourcerer.utils import get_encryption_key
16
+
17
+ APP_NAME = "sourcerer"
18
+
19
+ APP_DIR = Path(user_state_dir(APP_NAME))
20
+ os.makedirs(APP_DIR, exist_ok=True)
21
+
22
+ DB_NAME = "sourcerer.db"
23
+
24
+ ENCRYPTION_KEY = get_encryption_key(APP_DIR)
25
+
26
+ # Maximum number of parallel download operations
27
+ MAX_PARALLEL_DOWNLOADS = 8
28
+
29
+ PATH_DELIMITER = "/"
30
+
31
+ # UI icons for different file system elements
32
+ DIRECTORY_ICON = "📁"
33
+ FILE_ICON = "📄"
34
+
35
+ # Action icons
36
+ DOWNLOAD_ICON = "📥"
37
+ UPLOAD_ICON = "📤"
38
+ PREVIEW_ICON = "✨"
39
+
40
+ # Time threshold for detecting double-clicks (in seconds)
41
+ DOUBLE_CLICK_THRESHOLD = 1.5
42
+
43
+ # Set of file extensions that are considered text files
44
+ TEXT_EXTENSIONS = {
45
+ ".txt",
46
+ ".md",
47
+ ".json",
48
+ ".yaml",
49
+ ".yml",
50
+ ".csv",
51
+ ".tsv",
52
+ ".log",
53
+ ".ini",
54
+ ".py",
55
+ ".js",
56
+ ".ts",
57
+ ".html",
58
+ ".css",
59
+ ".xml",
60
+ ".toml",
61
+ ".cfg",
62
+ ".sh",
63
+ ".bat",
64
+ ".java",
65
+ ".c",
66
+ ".cpp",
67
+ ".go",
68
+ ".rs",
69
+ }
70
+
71
+
72
+ PAGE_SIZE = 100
sourcerer/utils.py ADDED
@@ -0,0 +1,32 @@
1
+ # Generate and store encryption key in a file
2
+ import os
3
+ import uuid
4
+ from pathlib import Path
5
+
6
+
7
+ def get_encryption_key(path: Path):
8
+ """
9
+ Get the encryption key from a file or generate a new one if the file doesn't exist.
10
+
11
+ path (Path): The path to the file where the encryption key is stored.
12
+ Returns:
13
+ str: The encryption key
14
+ """
15
+
16
+ key_file_path = path / "encryption_key"
17
+
18
+ # If key file exists, read the key from it
19
+ if os.path.exists(key_file_path):
20
+ with open(key_file_path, "r") as f:
21
+ return f.read().strip()
22
+
23
+ # Otherwise, generate a new key and store it
24
+
25
+ # Create directory if it doesn't exist
26
+ os.makedirs(os.path.dirname(key_file_path), exist_ok=True)
27
+
28
+ new_key = str(uuid.uuid4())
29
+ with open(key_file_path, "w") as f:
30
+ f.write(new_key)
31
+
32
+ return new_key