Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
os-version: ['ubuntu-24.04']
python-version: ['3.9', '3.10', '3.11']
python-version: ['3.10', '3.11']

runs-on: ${{ matrix.os-version }}
name: unittests with py-${{ matrix.python-version }} on ${{ matrix.os-version }}
Expand Down
2 changes: 1 addition & 1 deletion core/basic_models/actions/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __init__(self, name=None, params=None, action_id=None, request_type=None, re
:param action_id:
:param request_type:
:param request_data:
:param loader: loader name for data before send. Possible loader values: json.dumps / protobuf
:param loader: loader name for data before send. Possible loader values: json.dumps
"""

self.name: str = name
Expand Down
2 changes: 1 addition & 1 deletion core/unified_template/jinja_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def wrap_datetime(day, month, year, hour, minute, utc_offset=0):
return datetime_ + datetime.timedelta(seconds=utc_offset)


@jinja2.environmentfilter
@jinja2.pass_environment
def co_sort(
environment, value, reverse=False, attribute=None, order=None,
):
Expand Down
8 changes: 4 additions & 4 deletions core/utils/version.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from typing import Optional

import pkg_resources
import importlib.metadata


def _get_distribution_safe(name: str) -> Optional[pkg_resources.DistInfoDistribution]:
def _get_distribution_safe(name: str) -> Optional[importlib.metadata.Distribution]:
try:
distribution = pkg_resources.get_distribution(name)
distribution = importlib.metadata.distribution(name)
return distribution
except pkg_resources.DistributionNotFound:
except importlib.metadata.PackageNotFoundError:
return None


Expand Down
3,151 changes: 1,786 additions & 1,365 deletions poetry.lock

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ classifiers = [


[tool.poetry.dependencies]
python = ">=3.8.1,<3.12"
aiohttp = "3.10.5"
python = ">=3.10,<3.12"
aiohttp = ">3.10.5"
boto = "2.49.0"
cachetools = "5.3.0"
croniter = "1.3.7"
dill = "0.3.6"
ics = "0.6"
Jinja2 = "3.0.3"
Jinja2 = "3.1.6"
keras = {version = "2.12.0", optional = true}
nltk = "3.9.1"
numpy = "1.23.5"
Expand All @@ -43,7 +43,7 @@ scikit-learn = [
{version = "1.1.2", python = "<3.11", optional = true},
{version = "1.2.0", python = "3.11.*", optional = true},
]
setuptools = "75.2.0"
setuptools = ">75.2.0"
tabulate = "0.9.0"
tensorflow = [
{version = "2.12.0", markers = "sys_platform == 'darwin' and platform_machine == 'x86_64'", optional = true},
Expand All @@ -54,7 +54,6 @@ tensorflow-aarch64 = {version = "2.12.0", markers = "sys_platform == 'linux' and
timeout-decorator = "0.4.1"
tqdm = ">=4.66.3"
freezegun = "1.1.0"
protobuf = "3.20.3"
lxml = "4.9.2"
twisted = "24.11.0"
urllib3 = ">=2.0.0"
Expand Down
19 changes: 0 additions & 19 deletions smart_kit/message/smartapp_to_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from core.utils.masking_message import masking
from core.utils.utils import mask_numbers
from smart_kit.configs import settings
from smart_kit.utils import SmartAppToMessage_pb2

if TYPE_CHECKING:
from core.basic_models.actions.command import Command
Expand Down Expand Up @@ -57,36 +56,18 @@ def as_dict(self):
fields.update(self.root_nodes)
return fields

@staticmethod
def as_protobuf_message(data_as_dict):
message = SmartAppToMessage_pb2.SmartAppToMessage()
message.messageId = data_as_dict["messageId"]
message.sessionId = data_as_dict["sessionId"]
message.messageName = data_as_dict["messageName"]
message.payload = data_as_dict["payload"]
uuid = message.uuid.add()
uuid.userId = data_as_dict["uuid"]["userId"]
uuid.userChannel = data_as_dict["uuid"]["userChannel"]
return message

@cached_property
def masked_value(self):
mask_numbers_flag = settings.Settings()["template_settings"].get("mask_numbers", False)
masked_data = mask_numbers(masking(self.as_dict, self.masking_fields)) if mask_numbers_flag else \
masking(self.as_dict, self.masking_fields)
if self.command.loader == "json.dumps":
return json.dumps(masked_data, ensure_ascii=False)
elif self.command.loader == "protobuf":
protobuf_message = self.as_protobuf_message(masked_data)
return protobuf_message.SerializeToString()

@cached_property
def value(self):
if self.command.loader == "json.dumps":
return json.dumps(self.as_dict, ensure_ascii=False)
elif self.command.loader == "protobuf":
protobuf_message = self.as_protobuf_message(self.as_dict)
return protobuf_message.SerializeToString()

def validate(self):
for validator in self.validators:
Expand Down
198 changes: 0 additions & 198 deletions smart_kit/utils/SmartAppToMessage_pb2.py

This file was deleted.

Loading