From a44681070c0abbff750228ff6b3f069375deb51c Mon Sep 17 00:00:00 2001 From: mraniki <8766259+mraniki@users.noreply.github.com> Date: Thu, 7 Sep 2023 11:12:58 +0200 Subject: [PATCH 1/5] =?UTF-8?q?=E2=AC=86=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/dependabot.yml | 2 +- pyproject.toml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f35cebc..1814eae 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,6 +6,6 @@ updates: directory: "/" target-branch: "dev" schedule: - interval: "daily" + interval: "weekly" commit-message: prefix: "⬆️ 🤖 Dependencies" diff --git a/pyproject.toml b/pyproject.toml index faa3769..ac37f60 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,8 +31,8 @@ emoji = "^2.5.1" [tool.poetry.group.dev.dependencies] -python-semantic-release = "^8.0.2" -ruff = ">=0.0.287,<0.0.288" +python-semantic-release = "^8.0.7" +ruff = "*" [tool.ruff] select = [ From d20f9015a3141a46c88d773ea7c3bf7016bc44a4 Mon Sep 17 00:00:00 2001 From: mraniki <8766259+mraniki@users.noreply.github.com> Date: Thu, 7 Sep 2023 21:23:36 +0200 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=93=9D=20=F0=9F=94=A5=20remove=20emoj?= =?UTF-8?q?i=20dep=20and=20improve=20docs.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- findmyorder/main.py | 78 ++++++++++++++++++++++++++++++++++++++------- pyproject.toml | 3 +- 2 files changed, 68 insertions(+), 13 deletions(-) diff --git a/findmyorder/main.py b/findmyorder/main.py index 5ea8cf6..cdc35c2 100644 --- a/findmyorder/main.py +++ b/findmyorder/main.py @@ -1,9 +1,9 @@ """ FindMyOrder Main + """ from datetime import datetime -import emoji from loguru import logger from pyparsing import ( Combine, @@ -22,7 +22,23 @@ class FindMyOrder: - """find an order class""" + """ + Class to find an order + + Args: + None + + Returns: + None + + Methods: + search(my_string: str) -> bool + get_info() -> str + identify_order(my_string: str) -> dict + get_order(msg: str) -> dict + replace_instrument(order: dict) -> None + + """ def __init__( self, @@ -33,7 +49,16 @@ async def search( self, my_string: str, ) -> bool: - """Search an order.""" + """ + Search an order. + + Args: + my_string (str): Message + + Returns: + bool + + """ if my_string: string_check = my_string.split()[0].lower() self.logger.debug("Searching order identifier in {}", string_check) @@ -42,18 +67,30 @@ async def search( return False async def get_info(self): - """get info about the class""" - return f"{__class__.__name__} {__version__}\n" + """ + get info about the class + + Returns: + str - async def contains_emoji(self, input_string: str) -> bool: - """Check if the input string contains an emoji.""" - return any(emoji.is_emoji(character) for character in input_string) + """ + return f"{__class__.__name__} {__version__}\n" async def identify_order( self, my_string: str, ) -> dict: - """Identify an order.""" + """ + Identify an order and return a dictionary + with the order parameters + + Args: + my_string (str): Message + + Returns: + dict + + """ try: action = ( one_of(settings.action_identifier, caseless=True) @@ -105,7 +142,17 @@ async def get_order( self, msg: str, ): - """get an order.""" + """ + Get an order from a message. The message can be + an order or an order identifier + + Args: + msg (str): Message + + Returns: + dict + + """ if not await self.search(msg): self.logger.debug("No order identified") return None @@ -122,7 +169,16 @@ async def get_order( return order async def replace_instrument(self, order): - """replace instrument by an alternative instrument""" + """ + Replace instrument by an alternative instrument, if the + instrument is not in the mapping, it will be ignored. + + Args: + order (dict): + + Returns: + dict + """ instrument = order["instrument"] for item in settings.mapping: if item["id"] == instrument: diff --git a/pyproject.toml b/pyproject.toml index ac37f60..2aaa85e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,10 +24,9 @@ packages = [ [tool.poetry.dependencies] python = "^3.10" -dynaconf = "^3.1.12" +dynaconf = "^3.2.0" loguru = "^0.6.0" pyparsing = "^3.0.9" -emoji = "^2.5.1" [tool.poetry.group.dev.dependencies] From a293eda07c929f89b130c2318c38e57f71b1ce22 Mon Sep 17 00:00:00 2001 From: mraniki <8766259+mraniki@users.noreply.github.com> Date: Thu, 7 Sep 2023 21:28:20 +0200 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=8E=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- findmyorder/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/findmyorder/main.py b/findmyorder/main.py index cdc35c2..e704631 100644 --- a/findmyorder/main.py +++ b/findmyorder/main.py @@ -1,6 +1,6 @@ """ FindMyOrder Main - + """ from datetime import datetime @@ -23,7 +23,7 @@ class FindMyOrder: """ - Class to find an order + Class to find and parse trading order Args: None From 3cd4cdd8470519f599b7a25cca248c0524a6b98f Mon Sep 17 00:00:00 2001 From: mraniki Date: Thu, 7 Sep 2023 19:41:06 +0000 Subject: [PATCH 4/5] Update Requirements --- .requirements/requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/.requirements/requirements.txt b/.requirements/requirements.txt index fcc8bff..e56a211 100644 --- a/.requirements/requirements.txt +++ b/.requirements/requirements.txt @@ -1,6 +1,5 @@ colorama==0.4.6 ; python_version >= "3.10" and python_version < "4.0" and sys_platform == "win32" dynaconf==3.2.2 ; python_version >= "3.10" and python_version < "4.0" -emoji==2.8.0 ; python_version >= "3.10" and python_version < "4.0" loguru==0.6.0 ; python_version >= "3.10" and python_version < "4.0" pyparsing==3.1.1 ; python_version >= "3.10" and python_version < "4.0" win32-setctime==1.1.0 ; python_version >= "3.10" and python_version < "4.0" and sys_platform == "win32" From ccb4af321cd2276ac677233316f7a9623a12b08a Mon Sep 17 00:00:00 2001 From: mraniki Date: Thu, 7 Sep 2023 21:46:27 +0200 Subject: [PATCH 5/5] :fire: Remove test_contains_emoji function --- tests/test_unit.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tests/test_unit.py b/tests/test_unit.py index d7481c4..daec050 100644 --- a/tests/test_unit.py +++ b/tests/test_unit.py @@ -212,16 +212,4 @@ async def test_mapping_order( assert type(result["timestamp"] is datetime) -@pytest.mark.asyncio -async def test_contains_no_emoji(fmo, order): - """check emoji""" - result = await fmo.contains_emoji(order) - assert result is False - - -@pytest.mark.asyncio -async def test_contains_emoji(fmo,order_with_emoji): - """check emoji""" - result = await fmo.contains_emoji(order_with_emoji) - assert result is True