candidate-local 0.0.1__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.
- candidate_local/__init__.py +0 -0
- candidate_local/constants_src_candidate_local.py +19 -0
- candidate_local/cv_storage.py +47 -0
- candidate_local/file_type.py +20 -0
- candidate_local-0.0.1.dist-info/METADATA +24 -0
- candidate_local-0.0.1.dist-info/RECORD +8 -0
- candidate_local-0.0.1.dist-info/WHEEL +5 -0
- candidate_local-0.0.1.dist-info/top_level.txt +1 -0
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from logger_local.LoggerComponentEnum import LoggerComponentEnum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ConstantsSrcCandidateLocal:
|
|
5
|
+
"""Constants for the candidate_local component"""
|
|
6
|
+
|
|
7
|
+
DEVELOPER_EMAIL_ADDRESS = 'RachelBrodsky@circ.zone'
|
|
8
|
+
|
|
9
|
+
CANDIDATE_LOCAL_PYTHON_CODE_COMPONENT_ID = 10104
|
|
10
|
+
CANDIDATE_LOCAL_PYTHON_CODE_COMPONENT_NAME = 'Candidate Local Python package Code'
|
|
11
|
+
|
|
12
|
+
CANDIDATE_LOCAL_PYTHON_CODE_LOGGER_OBJECT = {
|
|
13
|
+
'component_id': CANDIDATE_LOCAL_PYTHON_CODE_COMPONENT_ID,
|
|
14
|
+
'component_name': CANDIDATE_LOCAL_PYTHON_CODE_COMPONENT_NAME,
|
|
15
|
+
'component_category': LoggerComponentEnum.ComponentCategory.Code.value,
|
|
16
|
+
'developer_email': DEVELOPER_EMAIL_ADDRESS
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
CV_FILE_TYPE_NAME = 'resume'
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import tempfile
|
|
3
|
+
|
|
4
|
+
from logger_local.MetaLogger import MetaLogger
|
|
5
|
+
|
|
6
|
+
from .constants_src_candidate_local import ConstantsSrcCandidateLocal
|
|
7
|
+
from .file_type import FileType
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class CvStorage(metaclass=MetaLogger, object=ConstantsSrcCandidateLocal.CANDIDATE_LOCAL_PYTHON_CODE_LOGGER_OBJECT):
|
|
11
|
+
"""Uploads CV attachment bytes to S3 via storage-local, returning the storage_id.
|
|
12
|
+
|
|
13
|
+
storage/file_type are injectable (each defaults to a real instance, needing a DB/AWS
|
|
14
|
+
connection) so tests can pass fakes instead.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
def __init__(self, storage=None, file_type: FileType = None) -> None:
|
|
18
|
+
self._storage = storage
|
|
19
|
+
self._file_type = file_type
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def storage(self):
|
|
23
|
+
if self._storage is None:
|
|
24
|
+
from storage_local.aws_s3_storage_local.Storage import Storage
|
|
25
|
+
self._storage = Storage()
|
|
26
|
+
return self._storage
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def file_type(self) -> FileType:
|
|
30
|
+
if self._file_type is None:
|
|
31
|
+
self._file_type = FileType()
|
|
32
|
+
return self._file_type
|
|
33
|
+
|
|
34
|
+
def upload_cv(self, *, filename: str, content: bytes) -> int:
|
|
35
|
+
file_type_id = self.file_type.get_or_create_file_type_id(ConstantsSrcCandidateLocal.CV_FILE_TYPE_NAME)
|
|
36
|
+
with tempfile.TemporaryDirectory() as tmp_dir:
|
|
37
|
+
local_file_path = os.path.join(tmp_dir, filename)
|
|
38
|
+
with open(local_file_path, "wb") as file:
|
|
39
|
+
file.write(content)
|
|
40
|
+
storage_id = self.storage.put(file_type_id, local_file_path)
|
|
41
|
+
return storage_id
|
|
42
|
+
|
|
43
|
+
def upload_cv_attachments(self, attachments: list) -> list:
|
|
44
|
+
# attachments: [{"filename", "content_type", "content"}] as returned by
|
|
45
|
+
# ImapMessages.get_pdf_word_attachments()
|
|
46
|
+
return [self.upload_cv(filename=attachment["filename"], content=attachment["content"])
|
|
47
|
+
for attachment in attachments]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from logger_local.MetaLogger import MetaLogger
|
|
2
|
+
|
|
3
|
+
from database_mysql_local.generic_crud import GenericCRUD
|
|
4
|
+
|
|
5
|
+
from .constants_src_candidate_local import ConstantsSrcCandidateLocal
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class FileType(metaclass=MetaLogger, object=ConstantsSrcCandidateLocal.CANDIDATE_LOCAL_PYTHON_CODE_LOGGER_OBJECT):
|
|
9
|
+
"""Resolves a storage.file_type_table.file_type name (e.g. "resume") to its file_type_id,
|
|
10
|
+
creating the row if it doesn't exist yet - avoids hardcoding a guessed numeric ID."""
|
|
11
|
+
|
|
12
|
+
def __init__(self, crud=None) -> None:
|
|
13
|
+
self.crud = crud or GenericCRUD(
|
|
14
|
+
default_schema_name='storage',
|
|
15
|
+
default_table_name='file_type_table',
|
|
16
|
+
default_column_name='file_type_id',
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
def get_or_create_file_type_id(self, name: str) -> int:
|
|
20
|
+
return self.crud.insert_if_not_exists(data_dict={"file_type": name}, data_dict_compare={"file_type": name})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: candidate-local
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: PyPI Package for Circles candidate-local Python
|
|
5
|
+
Home-page: https://github.com/circles-zone/candidate-local-python-package
|
|
6
|
+
Author: Circles
|
|
7
|
+
Author-email: info@circlez.ai
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: python-sdk-remote
|
|
12
|
+
Requires-Dist: logger-local
|
|
13
|
+
Requires-Dist: database-mysql-local
|
|
14
|
+
Requires-Dist: storage-local
|
|
15
|
+
Dynamic: author
|
|
16
|
+
Dynamic: author-email
|
|
17
|
+
Dynamic: classifier
|
|
18
|
+
Dynamic: description
|
|
19
|
+
Dynamic: description-content-type
|
|
20
|
+
Dynamic: home-page
|
|
21
|
+
Dynamic: requires-dist
|
|
22
|
+
Dynamic: summary
|
|
23
|
+
|
|
24
|
+
PyPI Package for Circles candidate-local Python
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
candidate_local/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
candidate_local/constants_src_candidate_local.py,sha256=8uub1ILvNwJa0YISLH0m5lJ3qkFR-IDfNUjOiCgD9n4,711
|
|
3
|
+
candidate_local/cv_storage.py,sha256=vAUV-MXoaxhrmZsm_s6XE0FvEyRehJshRct_M4uf4Qk,1866
|
|
4
|
+
candidate_local/file_type.py,sha256=o-wcwSwXTNpyTSEQEHryxOY32F8kKZ1Nx_Bn_2RIoZo,891
|
|
5
|
+
candidate_local-0.0.1.dist-info/METADATA,sha256=qbui3BssbstgM1PzogIFoDa79g1lmzJ0HUovq6H3fZo,718
|
|
6
|
+
candidate_local-0.0.1.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
7
|
+
candidate_local-0.0.1.dist-info/top_level.txt,sha256=EfAjJU94vP48dEoDYLkgicztjf3v8U-ohkV8BNGvAfk,16
|
|
8
|
+
candidate_local-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
candidate_local
|