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/.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" diff --git a/findmyorder/main.py b/findmyorder/main.py index 5ea8cf6..e704631 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 and parse trading 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 - 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) + Returns: + str + + """ + 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 faa3769..2aaa85e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,15 +24,14 @@ 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] -python-semantic-release = "^8.0.2" -ruff = ">=0.0.287,<0.0.288" +python-semantic-release = "^8.0.7" +ruff = "*" [tool.ruff] select = [ 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