sharedkernel 1.1.2__tar.gz → 1.2.0__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 (31) hide show
  1. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/PKG-INFO +5 -1
  2. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/README.md +3 -0
  3. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/setup.py +2 -1
  4. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel/common.py +29 -29
  5. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel/config.py +12 -12
  6. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel/enum/error_code.py +12 -12
  7. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel/exception/exception.py +39 -39
  8. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel/exception/exception_handlers.py +74 -74
  9. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel/jwt_service.py +38 -38
  10. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel/objects/base_document.py +8 -8
  11. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel/objects/jwt_model.py +6 -6
  12. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel/objects/result.py +28 -28
  13. sharedkernel-1.2.0/sharedkernel/regex_masking.py +62 -0
  14. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel/string_extentions.py +4 -4
  15. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel.egg-info/PKG-INFO +5 -1
  16. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel.egg-info/SOURCES.txt +1 -0
  17. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel.egg-info/requires.txt +1 -0
  18. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/setup.cfg +0 -0
  19. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel/database/__init__.py +0 -0
  20. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel/database/mongo_generic_repository.py +0 -0
  21. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel/database/vector_database_repository/__init__.py +0 -0
  22. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel/database/vector_database_repository/chroma_startegy.py +0 -0
  23. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel/database/vector_database_repository/milvus_strategy.py +0 -0
  24. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel/database/vector_database_repository/vector_database_repository.py +0 -0
  25. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel/database/vector_database_repository/vector_database_strategy.py +0 -0
  26. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel/enum/__init__.py +0 -0
  27. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel/enum/vector_database_type.py +0 -0
  28. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel/exception/__init__.py +0 -0
  29. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel/objects/__init__.py +0 -0
  30. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel.egg-info/dependency_links.txt +0 -0
  31. {sharedkernel-1.1.2 → sharedkernel-1.2.0}/sharedkernel.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sharedkernel
3
- Version: 1.1.2
3
+ Version: 1.2.0
4
4
  Summary: sharekernel is an shared package between all python projects
5
5
  Author: Smilinno
6
6
  Description-Content-Type: text/markdown
@@ -11,10 +11,14 @@ Requires-Dist: fastapi==0.89.1
11
11
  Requires-Dist: PyJWT
12
12
  Requires-Dist: pymilvus
13
13
  Requires-Dist: chromadb
14
+ Requires-Dist: persian_tools
14
15
 
15
16
  # SharedKernel
16
17
  this a shared kernel package
17
18
 
19
+ # Change Log
20
+ ### Version 1.2.0
21
+ - Implement Regex Masking
18
22
  # Create Package
19
23
  py -m pip install --upgrade build
20
24
  py -m build
@@ -1,6 +1,9 @@
1
1
  # SharedKernel
2
2
  this a shared kernel package
3
3
 
4
+ # Change Log
5
+ ### Version 1.2.0
6
+ - Implement Regex Masking
4
7
  # Create Package
5
8
  py -m pip install --upgrade build
6
9
  py -m build
@@ -27,9 +27,10 @@ setup(
27
27
  "PyJWT",
28
28
  "pymilvus",
29
29
  "chromadb",
30
+ "persian_tools"
30
31
  ],
31
32
  # *strongly* suggested for sharing
32
- version="1.1.2",
33
+ version="1.2.0",
33
34
  description="sharekernel is an shared package between all python projects",
34
35
  long_description=long_description,
35
36
  long_description_content_type="text/markdown",
@@ -1,29 +1,29 @@
1
- import yaml
2
- import json
3
-
4
- def yaml2json(yaml_data:yaml) -> json:
5
-
6
- output = json.dumps(yaml.safe_load(yaml_data), indent=2)
7
-
8
- return json.loads(output)
9
-
10
- def json2yaml(data) -> yaml:
11
-
12
- data=json.dumps(data,default=lambda o: del_none(o.__dict__))
13
-
14
- data=json.loads(data)
15
- output = yaml.dump(data)
16
-
17
- return output
18
-
19
- def del_none(d):
20
- """
21
- Delete keys with the value ``None`` in a dictionary, recursively.
22
- """
23
-
24
- for key, value in list(d.items()):
25
- if value is None:
26
- del d[key]
27
- elif isinstance(value, dict):
28
- del_none(value)
29
- return d
1
+ import yaml
2
+ import json
3
+
4
+ def yaml2json(yaml_data:yaml) -> json:
5
+
6
+ output = json.dumps(yaml.safe_load(yaml_data), indent=2)
7
+
8
+ return json.loads(output)
9
+
10
+ def json2yaml(data) -> yaml:
11
+
12
+ data=json.dumps(data,default=lambda o: del_none(o.__dict__))
13
+
14
+ data=json.loads(data)
15
+ output = yaml.dump(data)
16
+
17
+ return output
18
+
19
+ def del_none(d):
20
+ """
21
+ Delete keys with the value ``None`` in a dictionary, recursively.
22
+ """
23
+
24
+ for key, value in list(d.items()):
25
+ if value is None:
26
+ del d[key]
27
+ elif isinstance(value, dict):
28
+ del_none(value)
29
+ return d
@@ -1,12 +1,12 @@
1
-
2
- # MONGO CONFIG
3
-
4
- # MONGO_CONNECTION_STRING = "mongodb://localhost:27017"
5
- MONGO_CONNECTION_STRING = "mongodb://admin:Xp!j1h73ALrD@188.121.112.202:27017"
6
-
7
- # AUTHENTICATION
8
-
9
- JWT_ISSURE = "enterprise-identity"
10
- JWT_AUDIENCE = "AdminPortal"
11
- JWT_SECRETKEY = "ThereR_10_Project$@$milinnoBut50%OfThemRPublished"
12
- JWT_ALGORITHM= "HS256"
1
+
2
+ # MONGO CONFIG
3
+
4
+ # MONGO_CONNECTION_STRING = "mongodb://localhost:27017"
5
+ MONGO_CONNECTION_STRING = "mongodb://admin:Xp!j1h73ALrD@188.121.112.202:27017"
6
+
7
+ # AUTHENTICATION
8
+
9
+ JWT_ISSURE = "enterprise-identity"
10
+ JWT_AUDIENCE = "AdminPortal"
11
+ JWT_SECRETKEY = "ThereR_10_Project$@$milinnoBut50%OfThemRPublished"
12
+ JWT_ALGORITHM= "HS256"
@@ -1,12 +1,12 @@
1
- from enum import Enum
2
-
3
- class ErrorCode(str, Enum):
4
- Item_NotFound= "یافت نشد"
5
-
6
- Internal_Server= "خطایی در سیستم رخ داده است"
7
-
8
- UnAuthorized= "توکن دسترسی معتبر نمی باشد"
9
-
10
- Success= "با موفقیت انجام شد"
11
-
12
- Intents_Count_Should_Equal_One= "فقط یک اینتنت میتوانید وارد نمایید"
1
+ from enum import Enum
2
+
3
+ class ErrorCode(str, Enum):
4
+ Item_NotFound= "یافت نشد"
5
+
6
+ Internal_Server= "خطایی در سیستم رخ داده است"
7
+
8
+ UnAuthorized= "توکن دسترسی معتبر نمی باشد"
9
+
10
+ Success= "با موفقیت انجام شد"
11
+
12
+ Intents_Count_Should_Equal_One= "فقط یک اینتنت میتوانید وارد نمایید"
@@ -1,39 +1,39 @@
1
- from typing import Any, Dict, Optional
2
- from fastapi import HTTPException, status
3
-
4
- from sharedkernel.enum.error_code import ErrorCode
5
-
6
-
7
- class CustomException(HTTPException):
8
- def __init__(
9
- self,
10
- status_code:int,
11
- error_code: str,
12
- detail: Any = None,
13
- headers: Optional[Dict[str, Any]] = None,
14
- ) -> None:
15
- super().__init__(status_code= status_code,detail= detail)
16
- self.headers = headers
17
- self.error_code = error_code
18
-
19
-
20
- class BusinessException(HTTPException):
21
- def __init__(
22
- self,
23
- error_code: ErrorCode,
24
- headers: Optional[Dict[str, Any]] = None,
25
- ) -> None:
26
- super().__init__(status.HTTP_400_BAD_REQUEST,detail=error_code.value)
27
- self.headers = headers
28
- self.error_code = error_code.name
29
-
30
-
31
- class UnAuthorizedException(HTTPException):
32
- def __init__(
33
- self,
34
- headers: Optional[Dict[str, Any]] = None) -> None:
35
- super().__init__(status.HTTP_401_UNAUTHORIZED, headers)
36
-
37
-
38
-
39
-
1
+ from typing import Any, Dict, Optional
2
+ from fastapi import HTTPException, status
3
+
4
+ from sharedkernel.enum.error_code import ErrorCode
5
+
6
+
7
+ class CustomException(HTTPException):
8
+ def __init__(
9
+ self,
10
+ status_code:int,
11
+ error_code: str,
12
+ detail: Any = None,
13
+ headers: Optional[Dict[str, Any]] = None,
14
+ ) -> None:
15
+ super().__init__(status_code= status_code,detail= detail)
16
+ self.headers = headers
17
+ self.error_code = error_code
18
+
19
+
20
+ class BusinessException(HTTPException):
21
+ def __init__(
22
+ self,
23
+ error_code: ErrorCode,
24
+ headers: Optional[Dict[str, Any]] = None,
25
+ ) -> None:
26
+ super().__init__(status.HTTP_400_BAD_REQUEST,detail=error_code.value)
27
+ self.headers = headers
28
+ self.error_code = error_code.name
29
+
30
+
31
+ class UnAuthorizedException(HTTPException):
32
+ def __init__(
33
+ self,
34
+ headers: Optional[Dict[str, Any]] = None) -> None:
35
+ super().__init__(status.HTTP_401_UNAUTHORIZED, headers)
36
+
37
+
38
+
39
+
@@ -1,74 +1,74 @@
1
-
2
- from fastapi import Request,status
3
- import requests
4
- from fastapi.responses import JSONResponse
5
- from fastapi.exceptions import HTTPException
6
-
7
- from sharedkernel.exception import (
8
- BusinessException,
9
- UnAuthorizedException,
10
- CustomException
11
- )
12
- from sharedkernel.objects import Result
13
- from sharedkernel.enum.error_code import ErrorCode
14
-
15
-
16
-
17
- async def http_exception_handler(request: Request, exc: HTTPException):
18
- if type(exc)==UnAuthorizedException :
19
- return await custom_http_exception_handler(
20
- request,
21
- CustomException
22
- (
23
- status_code= exc.status_code,
24
- error_code= ErrorCode.UnAuthorized.name,
25
- detail= ErrorCode.UnAuthorized.value
26
- )
27
- )
28
-
29
- return await custom_http_exception_handler(
30
- request,
31
- CustomException
32
- (
33
- status_code= exc.status_code,
34
- error_code= requests.status_codes._codes[exc.status_code][0].title(),
35
- detail= exc.detail
36
- )
37
- )
38
-
39
-
40
-
41
- async def business_http_exception_handler(request: Request, exc: BusinessException):
42
- return await custom_http_exception_handler(
43
- request,
44
- CustomException
45
- (
46
- status_code= status.HTTP_400_BAD_REQUEST,
47
- error_code= exc.error_code,
48
- detail= exc.detail
49
- ),
50
- )
51
-
52
- async def custom_http_exception_handler(request: Request, exc: CustomException):
53
- return JSONResponse(
54
- status_code=exc.status_code,
55
- content= Result( isSucceed= False,
56
- data= None,
57
- message= exc.detail,
58
- errorCode= exc.error_code
59
- ).__dict__
60
- )
61
-
62
-
63
- async def exception_handler(request: Request, exc: Exception):
64
-
65
- return await custom_http_exception_handler(
66
- request,
67
- CustomException(
68
- status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
69
- error_code=ErrorCode.Internal_Server.name,
70
- detail=ErrorCode.Internal_Server.value
71
- ),
72
- )
73
-
74
-
1
+
2
+ from fastapi import Request,status
3
+ import requests
4
+ from fastapi.responses import JSONResponse
5
+ from fastapi.exceptions import HTTPException
6
+
7
+ from sharedkernel.exception import (
8
+ BusinessException,
9
+ UnAuthorizedException,
10
+ CustomException
11
+ )
12
+ from sharedkernel.objects import Result
13
+ from sharedkernel.enum.error_code import ErrorCode
14
+
15
+
16
+
17
+ async def http_exception_handler(request: Request, exc: HTTPException):
18
+ if type(exc)==UnAuthorizedException :
19
+ return await custom_http_exception_handler(
20
+ request,
21
+ CustomException
22
+ (
23
+ status_code= exc.status_code,
24
+ error_code= ErrorCode.UnAuthorized.name,
25
+ detail= ErrorCode.UnAuthorized.value
26
+ )
27
+ )
28
+
29
+ return await custom_http_exception_handler(
30
+ request,
31
+ CustomException
32
+ (
33
+ status_code= exc.status_code,
34
+ error_code= requests.status_codes._codes[exc.status_code][0].title(),
35
+ detail= exc.detail
36
+ )
37
+ )
38
+
39
+
40
+
41
+ async def business_http_exception_handler(request: Request, exc: BusinessException):
42
+ return await custom_http_exception_handler(
43
+ request,
44
+ CustomException
45
+ (
46
+ status_code= status.HTTP_400_BAD_REQUEST,
47
+ error_code= exc.error_code,
48
+ detail= exc.detail
49
+ ),
50
+ )
51
+
52
+ async def custom_http_exception_handler(request: Request, exc: CustomException):
53
+ return JSONResponse(
54
+ status_code=exc.status_code,
55
+ content= Result( isSucceed= False,
56
+ data= None,
57
+ message= exc.detail,
58
+ errorCode= exc.error_code
59
+ ).__dict__
60
+ )
61
+
62
+
63
+ async def exception_handler(request: Request, exc: Exception):
64
+
65
+ return await custom_http_exception_handler(
66
+ request,
67
+ CustomException(
68
+ status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
69
+ error_code=ErrorCode.Internal_Server.name,
70
+ detail=ErrorCode.Internal_Server.value
71
+ ),
72
+ )
73
+
74
+
@@ -1,38 +1,38 @@
1
- import jwt
2
- import time
3
- from fastapi import Request
4
- from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
5
-
6
- from sharedkernel.exception.exception import UnAuthorizedException
7
- from sharedkernel.objects import JwtModel
8
-
9
-
10
- class JWTBearer(HTTPBearer):
11
-
12
- def __init__(self,jwt_config:JwtModel, auto_error: bool = True):
13
- self.jwt_config=jwt_config
14
- super(JWTBearer, self).__init__(auto_error=auto_error)
15
-
16
- async def __call__(self, request: Request):
17
- try:
18
- credentials: HTTPAuthorizationCredentials = await super(
19
- JWTBearer, self
20
- ).__call__(request)
21
-
22
- self.verify(credentials.credentials)
23
-
24
- except:
25
- raise UnAuthorizedException()
26
-
27
-
28
- def verify(self, token: str) -> bool:
29
- decoded_token = jwt.decode(
30
- jwt= token.replace("Bearer","").strip(),
31
- key= self.jwt_config.secret_key,
32
- algorithms= self.jwt_config.algorithms,
33
- audience= self.jwt_config.audience,
34
- issuer= self.jwt_config.issuer
35
- )
36
-
37
- if decoded_token["exp"] < time.time():
38
- raise UnAuthorizedException()
1
+ import jwt
2
+ import time
3
+ from fastapi import Request
4
+ from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
5
+
6
+ from sharedkernel.exception.exception import UnAuthorizedException
7
+ from sharedkernel.objects import JwtModel
8
+
9
+
10
+ class JWTBearer(HTTPBearer):
11
+
12
+ def __init__(self,jwt_config:JwtModel, auto_error: bool = True):
13
+ self.jwt_config=jwt_config
14
+ super(JWTBearer, self).__init__(auto_error=auto_error)
15
+
16
+ async def __call__(self, request: Request):
17
+ try:
18
+ credentials: HTTPAuthorizationCredentials = await super(
19
+ JWTBearer, self
20
+ ).__call__(request)
21
+
22
+ self.verify(credentials.credentials)
23
+
24
+ except:
25
+ raise UnAuthorizedException()
26
+
27
+
28
+ def verify(self, token: str) -> bool:
29
+ decoded_token = jwt.decode(
30
+ jwt= token.replace("Bearer","").strip(),
31
+ key= self.jwt_config.secret_key,
32
+ algorithms= self.jwt_config.algorithms,
33
+ audience= self.jwt_config.audience,
34
+ issuer= self.jwt_config.issuer
35
+ )
36
+
37
+ if decoded_token["exp"] < time.time():
38
+ raise UnAuthorizedException()
@@ -1,8 +1,8 @@
1
- from pydantic import BaseModel
2
- from typing import Optional
3
-
4
- class BaseDocument(BaseModel):
5
- id: Optional[str]
6
- is_deleted: bool = False
7
- # created_on: datetime.datetime.now()
8
-
1
+ from pydantic import BaseModel
2
+ from typing import Optional
3
+
4
+ class BaseDocument(BaseModel):
5
+ id: Optional[str]
6
+ is_deleted: bool = False
7
+ # created_on: datetime.datetime.now()
8
+
@@ -1,7 +1,7 @@
1
- from pydantic import BaseModel
2
-
3
- class JwtModel(BaseModel):
4
- secret_key:str
5
- algorithms: str
6
- audience: str
1
+ from pydantic import BaseModel
2
+
3
+ class JwtModel(BaseModel):
4
+ secret_key:str
5
+ algorithms: str
6
+ audience: str
7
7
  issuer: str
@@ -1,28 +1,28 @@
1
- from pydantic import BaseModel
2
-
3
- from typing import Generic, TypeVar
4
-
5
- from pydantic import BaseModel
6
- from pydantic.generics import GenericModel
7
-
8
- from sharedkernel.enum.error_code import ErrorCode
9
-
10
- ResultT = TypeVar("ResultT")
11
-
12
-
13
- class BaseResult(BaseModel):
14
- isSucceed:bool = True
15
- message: str = ErrorCode.Success.value
16
- errorCode: str = None
17
-
18
- class Result(BaseResult,GenericModel, Generic[ResultT]):
19
- data: ResultT =None
20
-
21
- def __init__(
22
- self,
23
- isSucceed:bool = True,
24
- data: object = None,
25
- message: str = ErrorCode.Success.value,
26
- errorCode: str = None
27
- )-> None:
28
- super().__init__(isSucceed= isSucceed, data= data, message= message, errorCode= errorCode)
1
+ from pydantic import BaseModel
2
+
3
+ from typing import Generic, TypeVar
4
+
5
+ from pydantic import BaseModel
6
+ from pydantic.generics import GenericModel
7
+
8
+ from sharedkernel.enum.error_code import ErrorCode
9
+
10
+ ResultT = TypeVar("ResultT")
11
+
12
+
13
+ class BaseResult(BaseModel):
14
+ isSucceed:bool = True
15
+ message: str = ErrorCode.Success.value
16
+ errorCode: str = None
17
+
18
+ class Result(BaseResult,GenericModel, Generic[ResultT]):
19
+ data: ResultT =None
20
+
21
+ def __init__(
22
+ self,
23
+ isSucceed:bool = True,
24
+ data: object = None,
25
+ message: str = ErrorCode.Success.value,
26
+ errorCode: str = None
27
+ )-> None:
28
+ super().__init__(isSucceed= isSucceed, data= data, message= message, errorCode= errorCode)
@@ -0,0 +1,62 @@
1
+ import re
2
+ from persian_tools import national_id, phone_number
3
+ from persian_tools.bank import card_number, sheba
4
+
5
+ class RegexMaskingBuilder:
6
+ def __init__(self, message: str):
7
+ self.message = message
8
+
9
+ def with_card_no(self):
10
+ find_patterns = re.findall(r'(?<!\d)\d{16}(?!\d)', self.message)
11
+ for i in find_patterns:
12
+ if card_number.validate(i):
13
+ self.message = re.sub(i, "*" * 16, self.message)
14
+ return self
15
+
16
+ def with_national_id(self):
17
+ find_patterns = re.findall(r'(?<!\d)\d{10}(?!\d)', self.message)
18
+ for i in find_patterns:
19
+ if national_id.validate(i):
20
+ self.message = re.sub(i, "*" * 10, self.message)
21
+ return self
22
+
23
+ def with_mobile_no(self):
24
+ find_patterns = re.findall(r'(?<!\d)\d{10,12}(?!\d)', self.message)
25
+ for i in find_patterns:
26
+ if phone_number.validate(i):
27
+ self.message = re.sub(i, "*" * len(i), self.message)
28
+ return self
29
+
30
+ def with_sheba(self):
31
+ find_patterns = re.findall(r'|'.join([r'(?<!\d)\d{24}(?!\d)', r'IR\d{24}(?!\d)']), self.message)
32
+ for i in find_patterns:
33
+ if sheba.validate("IR" + i) or sheba.validate(i):
34
+ self.message = re.sub(i, "*" * len(i), self.message)
35
+ return self
36
+
37
+ def with_phone_no(self):
38
+ phone_number_pattern1 = r'(?<!\d)^0[0-9]{2,}-[0-9]{8}$(?!\d)'
39
+ phone_number_pattern2 = r'(?<!\d)^0[0-9]{2,}[0-9]{8}$(?!\d)'
40
+ self.message = re.sub(r'|'.join([phone_number_pattern1, phone_number_pattern2]), "*" * 12, self.message)
41
+ return self
42
+
43
+ def with_cvv2(self):
44
+ self.message = re.sub(r'(?<!\d)\d{3}(?!\d)', "*" * 3, self.message)
45
+ return self
46
+
47
+ def with_peigiri_no(self):
48
+ patterns = {
49
+ r'(?<!\d)\d{6}(?!\d)': "*" * 6,
50
+ r'(?<!\d)\d{12}(?!\d)': "*" * 12,
51
+ r'(?<!\d)\d{20}(?!\d)': "*" * 20
52
+ }
53
+ for key, value in patterns.items():
54
+ self.message = re.sub(key, value, self.message)
55
+ return self
56
+
57
+ def with_account_no(self):
58
+ self.message = re.sub(r'(?<!\d)\d{12,16}(?!\d)', "*" * 16, self.message)
59
+ return self
60
+
61
+ def build(self):
62
+ return self.message
@@ -1,4 +1,4 @@
1
- import re
2
-
3
- def camel_to_snake(value:str):
4
- return re.sub('(?!^)([A-Z]+)', r'_\1',value).lower()
1
+ import re
2
+
3
+ def camel_to_snake(value:str):
4
+ return re.sub('(?!^)([A-Z]+)', r'_\1',value).lower()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sharedkernel
3
- Version: 1.1.2
3
+ Version: 1.2.0
4
4
  Summary: sharekernel is an shared package between all python projects
5
5
  Author: Smilinno
6
6
  Description-Content-Type: text/markdown
@@ -11,10 +11,14 @@ Requires-Dist: fastapi==0.89.1
11
11
  Requires-Dist: PyJWT
12
12
  Requires-Dist: pymilvus
13
13
  Requires-Dist: chromadb
14
+ Requires-Dist: persian_tools
14
15
 
15
16
  # SharedKernel
16
17
  this a shared kernel package
17
18
 
19
+ # Change Log
20
+ ### Version 1.2.0
21
+ - Implement Regex Masking
18
22
  # Create Package
19
23
  py -m pip install --upgrade build
20
24
  py -m build
@@ -3,6 +3,7 @@ setup.py
3
3
  sharedkernel/common.py
4
4
  sharedkernel/config.py
5
5
  sharedkernel/jwt_service.py
6
+ sharedkernel/regex_masking.py
6
7
  sharedkernel/string_extentions.py
7
8
  sharedkernel.egg-info/PKG-INFO
8
9
  sharedkernel.egg-info/SOURCES.txt
@@ -5,3 +5,4 @@ fastapi==0.89.1
5
5
  PyJWT
6
6
  pymilvus
7
7
  chromadb
8
+ persian_tools
File without changes