From db491b392663f94744db70313866307fb69c210e Mon Sep 17 00:00:00 2001 From: Nicolas-Klatzer Date: Fri, 9 Apr 2021 16:11:46 +0200 Subject: [PATCH 1/6] (#68) Fixed the asyncio.create_task name parameter bug which is unsupported in 3.7. Added better logging to from_dict and fixed minor issue with entity validation --- README.md | 18 +++++++++--------- openhivenpy/__init__.py | 4 ++-- openhivenpy/gateway/connection.py | 4 ++-- openhivenpy/gateway/ws.py | 2 +- openhivenpy/types/attatchment.py | 2 +- openhivenpy/types/context.py | 2 +- openhivenpy/types/embed.py | 2 +- openhivenpy/types/entity.py | 4 ++-- openhivenpy/types/house.py | 4 ++-- openhivenpy/types/invite.py | 2 +- openhivenpy/types/member.py | 2 +- openhivenpy/types/mention.py | 2 +- openhivenpy/types/message.py | 4 ++-- openhivenpy/types/private_room.py | 4 ++-- openhivenpy/types/relationship.py | 2 +- openhivenpy/types/room.py | 2 +- openhivenpy/types/user.py | 4 ++-- openhivenpy/types/usertyping.py | 2 +- setup.py | 6 +++--- 19 files changed, 36 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index d55f800..05b75f4 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,19 @@ # ![OpenHiven.py](https://images.nxybi.me/da4e88d64f12.png)
OpenHiven.py ## The OpenSource Python API Wrapper for Hiven! -[![Package Version](https://img.shields.io/badge/package%20version-v0.1.3.dev2-purple?logo=python)](https://github.com/FrostbyteSpace/openhiven.py) +[![Package Version](https://img.shields.io/badge/package%20version-v0.1.3.1-purple?logo=python)](https://github.com/Nicolas-Klatzer/openhiven.py) [![Python Version](https://img.shields.io/badge/python->=3.7-blue?logo=python)](https://python.org) -![Build](https://img.shields.io/github/workflow/status/FrostbyteSpace/openhiven.py/CodeQL?logo=github) -[![Latest Commit](https://img.shields.io/github/last-commit/FrostbyteSpace/openhiven.py?logo=github&color=violet)](https://github.com/FrostbyteSpace/openhiven.py/commits/mainy) -![Lines of Code](https://img.shields.io/tokei/lines/github/FrostbyteSpace/openhiven.py) -[![License](https://img.shields.io/github/license/FrostbyteSpace/openhiven.py)](https://github.com/FrostbyteSpace/openhiven.py/blob/main/LICENSE) +![Build](https://img.shields.io/github/workflow/status/Nicolas-Klatzer/openhiven.py/CodeQL?logo=github) +[![Latest Commit](https://img.shields.io/github/last-commit/Nicolas-Klatzer/openhiven.py?logo=github&color=violet)](https://github.com/Nicolas-Klatzer/openhiven.py/commits/mainy) +![Lines of Code](https://img.shields.io/tokei/lines/github/Nicolas-Klatzer/openhiven.py) +[![License](https://img.shields.io/github/license/Nicolas-Klatzer/openhiven.py)](https://github.com/Nicolas-Klatzer/openhiven.py/blob/main/LICENSE) [![Documentation Status](https://readthedocs.org/projects/openhivenpy/badge/?version=latest)](https://readthedocs.org/projects/openhivenpy/) ## Dependencies -[![aiohttp](https://img.shields.io/github/pipenv/locked/dependency-version/FrostbyteSpace/openhiven.py/aiohttp/main)](https://docs.aiohttp.org/en/stable/) -[![asyncio](https://img.shields.io/github/pipenv/locked/dependency-version/FrostbyteSpace/openhiven.py/asyncio/main)](https://docs.python.org/3/library/asyncio.html) -[![typing](https://img.shields.io/github/pipenv/locked/dependency-version/FrostbyteSpace/openhiven.py/typing/main)](https://docs.python.org/3/library/typing.html) +[![aiohttp](https://img.shields.io/github/pipenv/locked/dependency-version/Nicolas-Klatzer/openhiven.py/aiohttp/main)](https://docs.aiohttp.org/en/stable/) +[![asyncio](https://img.shields.io/github/pipenv/locked/dependency-version/Nicolas-Klatzer/openhiven.py/asyncio/main)](https://docs.python.org/3/library/asyncio.html) +[![typing](https://img.shields.io/github/pipenv/locked/dependency-version/Nicolas-Klatzer/openhiven.py/typing/main)](https://docs.python.org/3/library/typing.html) ## Installation ### Install (PyPi Release) @@ -30,7 +30,7 @@ python3 -m pip install -U openhivenpy==version ### Install (Github Build) ```bash -python3 -m pip install -U https://github.com/FrostbyteSpace/openhiven.py/archive/main.zip +python3 -m pip install -U https://github.com/Nicolas-Klatzer/openhiven.py/archive/main.zip ``` ## Documentation diff --git a/openhivenpy/__init__.py b/openhivenpy/__init__.py index 5f4baf5..8574048 100644 --- a/openhivenpy/__init__.py +++ b/openhivenpy/__init__.py @@ -31,8 +31,8 @@ __title__ = "openhiven.py" __author__ = "Nicolas Klatzer" __license__ = "MIT" -__version__ = "0.1.3.dev2" -__copyright__ = "FrostbyteSpace" +__version__ = "0.1.3.1" +__copyright__ = "Nicolas Klatzer" import logging diff --git a/openhivenpy/gateway/connection.py b/openhivenpy/gateway/connection.py index 9aa8d90..561eb6f 100644 --- a/openhivenpy/gateway/connection.py +++ b/openhivenpy/gateway/connection.py @@ -125,7 +125,7 @@ async def startup(): # Fetching the startup_task from the object that stores them async_task = getattr(self._startup_tasks_handler, task_name) # Creating a callable task and appending it to the methods to call - _tasks.append(asyncio.create_task(async_task(), name=task_name)) + _tasks.append(asyncio.create_task(async_task())) # Passing all tasks as args to the event loop await asyncio.gather(*_tasks) @@ -155,7 +155,7 @@ async def __background_loop(): # Fetching the startup_task from the object that stores them async_task = getattr(self._background_tasks_handler, task_name) # Creating a callable task - _tasks.append(asyncio.create_task(async_task(), name=task_name)) + _tasks.append(asyncio.create_task(async_task())) # Passing all tasks as args to the event loop await asyncio.gather(*_tasks) diff --git a/openhivenpy/gateway/ws.py b/openhivenpy/gateway/ws.py index 2ee968a..09816b3 100644 --- a/openhivenpy/gateway/ws.py +++ b/openhivenpy/gateway/ws.py @@ -232,7 +232,7 @@ async def ws_connection(): return # Creating a task that wraps the coroutine - self._connection_task = asyncio.create_task(ws_connection(), name="openhivenpy-ws-connection") + self._connection_task = asyncio.create_task(ws_connection()) # Running the task in the background try: diff --git a/openhivenpy/types/attatchment.py b/openhivenpy/types/attatchment.py index 45d3baa..b0a2ed1 100644 --- a/openhivenpy/types/attatchment.py +++ b/openhivenpy/types/attatchment.py @@ -65,7 +65,7 @@ async def from_dict(cls, data: dict, http, **kwargs): except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", diff --git a/openhivenpy/types/context.py b/openhivenpy/types/context.py index cefbb57..af8ca17 100644 --- a/openhivenpy/types/context.py +++ b/openhivenpy/types/context.py @@ -66,7 +66,7 @@ async def from_dict(cls, data: dict, http, **kwargs): except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", diff --git a/openhivenpy/types/embed.py b/openhivenpy/types/embed.py index 2a7789f..ed301f8 100644 --- a/openhivenpy/types/embed.py +++ b/openhivenpy/types/embed.py @@ -68,7 +68,7 @@ async def from_dict(cls, data: dict, http, **kwargs): except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", diff --git a/openhivenpy/types/entity.py b/openhivenpy/types/entity.py index 2cdea36..97a6a97 100644 --- a/openhivenpy/types/entity.py +++ b/openhivenpy/types/entity.py @@ -18,7 +18,7 @@ class EntitySchema(Schema): id = fields.Int(required=True) name = fields.Str(required=True) type = fields.Int(required=True) - resource_pointers = fields.List(fields.Field(), required=True) + resource_pointers = fields.List(fields.Field(), allow_none=True, required=True) house_id = fields.Str(default=None) position = fields.Int(default=0) @@ -81,7 +81,7 @@ async def from_dict(cls, data: dict, http, house, **kwargs): except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", diff --git a/openhivenpy/types/house.py b/openhivenpy/types/house.py index 0b0e2fc..5d7c234 100644 --- a/openhivenpy/types/house.py +++ b/openhivenpy/types/house.py @@ -118,7 +118,7 @@ async def from_dict(cls, data: dict, http, rooms: typing.List[room.Room], **kwar except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", @@ -231,7 +231,7 @@ async def from_dict(cls, data: dict, http, rooms: typing.List[room.Room], **kwar except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", diff --git a/openhivenpy/types/invite.py b/openhivenpy/types/invite.py index 812b98f..c97920f 100644 --- a/openhivenpy/types/invite.py +++ b/openhivenpy/types/invite.py @@ -111,7 +111,7 @@ async def from_dict(cls, except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", diff --git a/openhivenpy/types/member.py b/openhivenpy/types/member.py index 353b670..cb3d6ba 100644 --- a/openhivenpy/types/member.py +++ b/openhivenpy/types/member.py @@ -111,7 +111,7 @@ async def from_dict(cls, except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", diff --git a/openhivenpy/types/mention.py b/openhivenpy/types/mention.py index 8855930..b986dcb 100644 --- a/openhivenpy/types/mention.py +++ b/openhivenpy/types/mention.py @@ -64,7 +64,7 @@ async def from_dict(cls, except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", diff --git a/openhivenpy/types/message.py b/openhivenpy/types/message.py index ee34e12..d1c9f06 100644 --- a/openhivenpy/types/message.py +++ b/openhivenpy/types/message.py @@ -108,7 +108,7 @@ async def from_dict(cls, data: dict, **kwargs): except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", @@ -235,7 +235,7 @@ async def from_dict(cls, except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", diff --git a/openhivenpy/types/private_room.py b/openhivenpy/types/private_room.py index 52d67b5..bd7d5a1 100644 --- a/openhivenpy/types/private_room.py +++ b/openhivenpy/types/private_room.py @@ -136,7 +136,7 @@ async def from_dict(cls, except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", @@ -287,7 +287,7 @@ async def from_dict(cls, data: dict, http, client_user, **kwargs): except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", diff --git a/openhivenpy/types/relationship.py b/openhivenpy/types/relationship.py index ed67fea..66f856b 100644 --- a/openhivenpy/types/relationship.py +++ b/openhivenpy/types/relationship.py @@ -107,7 +107,7 @@ async def from_dict(cls, except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", diff --git a/openhivenpy/types/room.py b/openhivenpy/types/room.py index 701ab91..b08a072 100644 --- a/openhivenpy/types/room.py +++ b/openhivenpy/types/room.py @@ -114,7 +114,7 @@ async def from_dict(cls, except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", diff --git a/openhivenpy/types/user.py b/openhivenpy/types/user.py index 2ba1397..c819071 100644 --- a/openhivenpy/types/user.py +++ b/openhivenpy/types/user.py @@ -113,7 +113,7 @@ async def from_dict(cls, except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", @@ -197,7 +197,7 @@ async def from_dict(cls, except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", diff --git a/openhivenpy/types/usertyping.py b/openhivenpy/types/usertyping.py index f750c17..ad0c994 100644 --- a/openhivenpy/types/usertyping.py +++ b/openhivenpy/types/usertyping.py @@ -98,7 +98,7 @@ async def from_dict(cls, except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", diff --git a/setup.py b/setup.py index f58a8a5..6a8b270 100644 --- a/setup.py +++ b/setup.py @@ -8,18 +8,18 @@ setuptools.setup( name="openhivenpy", - version="0.1.3.dev2", + version="0.1.3.1", author="Nicolas Klatzer", author_email="nicolas.klatzer@gmail.com", description="The OpenSource Python API Wrapper for Hiven!", long_description=long_description, long_description_content_type="text/markdown", license="MIT", - url="https://github.com/FrostbyteSpace/openhiven.py", + url="https://github.com/Nicolas-Klatzer/openhiven.py", project_urls={ "Docs Rewrite": "https://openhivenpy.readthedocs.io/en/mkdocs-material-rewrite/", "Hiven API Docs": "https://openhivenpy.readthedocs.io/en/mkdocs-material-rewrite/api_reference/", - "Issues": "https://github.com/FrostbyteSpace/openhiven.py/issues/", + "Issues": "https://github.com/Nicolas-Klatzer/openhiven.py/issues/", "Changelog": "https://openhivenpy.readthedocs.io/en/mkdocs-material-rewrite/changelog.html" }, packages=setuptools.find_packages(), From 85c3025503acada753cdf6094a58c42287deff40 Mon Sep 17 00:00:00 2001 From: Nicolas-Klatzer Date: Fri, 9 Apr 2021 16:15:14 +0200 Subject: [PATCH 2/6] Renamed description-file to description_file --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 224a779..0f94f37 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,2 @@ [metadata] -description-file = README.md \ No newline at end of file +description_file = README.md \ No newline at end of file From fbf2fd7e5d78fd5d307cb14359a3c8dd5de7e7ed Mon Sep 17 00:00:00 2001 From: Nicolas-Klatzer Date: Fri, 9 Apr 2021 16:21:53 +0200 Subject: [PATCH 3/6] Updated LICENSE --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 834a970..cfeb0ff 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 Frostbyte Development Team +Copyright (c) 2020-2021 Nicolas Klatzer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From bbe27e1f06025b1a1c985a6b71dcb6227f4e5524 Mon Sep 17 00:00:00 2001 From: Nicolas-Klatzer Date: Fri, 9 Apr 2021 16:25:42 +0200 Subject: [PATCH 4/6] Updated Licensing --- CODE_OF_CONDUCT.md | 2 +- LICENSE | 2 +- README.md | 2 +- openhivenpy/__init__.py | 2 +- openhivenpy/client/__init__.py | 2 +- openhivenpy/events/__init__.py | 2 +- openhivenpy/exception.py | 2 +- openhivenpy/gateway/__init__.py | 2 +- openhivenpy/types/__init__.py | 2 +- openhivenpy/utils/__init__.py | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 20f8898..0163701 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -55,7 +55,7 @@ further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at space.frostbyte@gmail.com. All +reported by contacting the project team at nicolas.klatzer@gmail.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. diff --git a/LICENSE b/LICENSE index cfeb0ff..5f5a302 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020-2021 Nicolas Klatzer +Copyright (c) 2020 - 2021 Nicolas Klatzer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 05b75f4..11537bf 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ python3 -m pip install -U https://github.com/Nicolas-Klatzer/openhiven.py/archiv ## Documentation For full documentation visit the documentation our readthedocs-page [here](https://openhivenpy.readthedocs.io/en/latest/) or go to the github pages build -[here](https://frostbytespace.github.io/docs_openhiven.py/build/) +[here](https://nicolas-klatzer.github.io/docs_openhiven.py/build/) ### Usage Example diff --git a/openhivenpy/__init__.py b/openhivenpy/__init__.py index 8574048..95b74fe 100644 --- a/openhivenpy/__init__.py +++ b/openhivenpy/__init__.py @@ -6,7 +6,7 @@ Under MIT License -Copyright © 2020 Frostbyte Development Team +Copyright © 2020 - 2021 Nicolas Klatzer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/openhivenpy/client/__init__.py b/openhivenpy/client/__init__.py index 90c49f3..5acd125 100644 --- a/openhivenpy/client/__init__.py +++ b/openhivenpy/client/__init__.py @@ -6,7 +6,7 @@ Under MIT License -Copyright © 2020 Frostbyte Development Team +Copyright © 2020 - 2021 Nicolas Klatzer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/openhivenpy/events/__init__.py b/openhivenpy/events/__init__.py index fbd9ed2..dc95acb 100644 --- a/openhivenpy/events/__init__.py +++ b/openhivenpy/events/__init__.py @@ -6,7 +6,7 @@ Under MIT License -Copyright © 2020 Frostbyte Development Team +Copyright © 2020 - 2021 Nicolas Klatzer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/openhivenpy/exception.py b/openhivenpy/exception.py index 0b5b91c..602f9e7 100644 --- a/openhivenpy/exception.py +++ b/openhivenpy/exception.py @@ -5,7 +5,7 @@ Under MIT License -Copyright © 2020 Frostbyte Development Team +Copyright © 2020 - 2021 Nicolas Klatzer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/openhivenpy/gateway/__init__.py b/openhivenpy/gateway/__init__.py index 3781a2c..62b8df6 100644 --- a/openhivenpy/gateway/__init__.py +++ b/openhivenpy/gateway/__init__.py @@ -6,7 +6,7 @@ Under MIT License -Copyright © 2020 Frostbyte Development Team +Copyright © 2020 - 2021 Nicolas Klatzer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/openhivenpy/types/__init__.py b/openhivenpy/types/__init__.py index ce3e4d5..2d0db7d 100644 --- a/openhivenpy/types/__init__.py +++ b/openhivenpy/types/__init__.py @@ -6,7 +6,7 @@ Under MIT License -Copyright © 2020 Frostbyte Development Team +Copyright © 2020 - 2021 Nicolas Klatzer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/openhivenpy/utils/__init__.py b/openhivenpy/utils/__init__.py index ad3d8e9..fc15b46 100644 --- a/openhivenpy/utils/__init__.py +++ b/openhivenpy/utils/__init__.py @@ -6,7 +6,7 @@ Under MIT License -Copyright © 2020 Frostbyte Development Team +Copyright © 2020 - 2021 Nicolas Klatzer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 7ad0f56d3430d9fa9deeac4bf573020b0d75b07f Mon Sep 17 00:00:00 2001 From: Nicolas-Klatzer Date: Fri, 9 Apr 2021 16:32:27 +0200 Subject: [PATCH 5/6] Updated MANIFEST.in --- MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 08cf9d2..f57e853 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ global-include requirements.txt include openhivenpy/*.env -exclude doc-examples +global-exclude *__pycache__*/ graft openhivenpy \ No newline at end of file From 4271f2fc40d04f13d898520f4ac0213165bbf79a Mon Sep 17 00:00:00 2001 From: Nicolas-Klatzer Date: Fri, 9 Apr 2021 16:40:24 +0200 Subject: [PATCH 6/6] Added from e to add the exception to the traceback to better log the exceptions --- openhivenpy/types/attatchment.py | 4 ++-- openhivenpy/types/context.py | 4 ++-- openhivenpy/types/embed.py | 4 ++-- openhivenpy/types/entity.py | 4 ++-- openhivenpy/types/house.py | 8 ++++---- openhivenpy/types/invite.py | 4 ++-- openhivenpy/types/member.py | 4 ++-- openhivenpy/types/mention.py | 4 ++-- openhivenpy/types/message.py | 8 ++++---- openhivenpy/types/private_room.py | 8 ++++---- openhivenpy/types/relationship.py | 4 ++-- openhivenpy/types/room.py | 4 ++-- openhivenpy/types/user.py | 8 ++++---- openhivenpy/types/usertyping.py | 4 ++-- 14 files changed, 36 insertions(+), 36 deletions(-) diff --git a/openhivenpy/types/attatchment.py b/openhivenpy/types/attatchment.py index b0a2ed1..bc37df6 100644 --- a/openhivenpy/types/attatchment.py +++ b/openhivenpy/types/attatchment.py @@ -65,14 +65,14 @@ async def from_dict(cls, data: dict, http, **kwargs): except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'", data=data) from e except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", suffix=f"Failed to initialise {cls.__name__} due to exception:\n" f"{sys.exc_info()[0].__name__}: {e}!") raise errs.InitializationError(f"Failed to initialise {cls.__name__} due to exception:\n" - f"{sys.exc_info()[0].__name__}: {e}!") + f"{sys.exc_info()[0].__name__}: {e}!") from e else: # Adding the http attribute for API interaction instance._http = http diff --git a/openhivenpy/types/context.py b/openhivenpy/types/context.py index af8ca17..0d2bfc4 100644 --- a/openhivenpy/types/context.py +++ b/openhivenpy/types/context.py @@ -66,14 +66,14 @@ async def from_dict(cls, data: dict, http, **kwargs): except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'", data=data) from e except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", suffix=f"Failed to initialise {cls.__name__} due to exception:\n" f"{sys.exc_info()[0].__name__}: {e}!") raise errs.InitializationError(f"Failed to initialise {cls.__name__} due to exception:\n" - f"{sys.exc_info()[0].__name__}: {e}!") + f"{sys.exc_info()[0].__name__}: {e}!") from e else: # Adding the http attribute for API interaction instance._http = http diff --git a/openhivenpy/types/embed.py b/openhivenpy/types/embed.py index ed301f8..9b9f686 100644 --- a/openhivenpy/types/embed.py +++ b/openhivenpy/types/embed.py @@ -68,14 +68,14 @@ async def from_dict(cls, data: dict, http, **kwargs): except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'", data=data) from e except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", suffix=f"Failed to initialise {cls.__name__} due to exception:\n" f"{sys.exc_info()[0].__name__}: {e}!") raise errs.InitializationError(f"Failed to initialise {cls.__name__} due to exception:\n" - f"{sys.exc_info()[0].__name__}: {e}!") + f"{sys.exc_info()[0].__name__}: {e}!") from e else: # Adding the http attribute for API interaction instance._http = http diff --git a/openhivenpy/types/entity.py b/openhivenpy/types/entity.py index 97a6a97..b675a28 100644 --- a/openhivenpy/types/entity.py +++ b/openhivenpy/types/entity.py @@ -81,14 +81,14 @@ async def from_dict(cls, data: dict, http, house, **kwargs): except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'", data=data) from e except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", suffix=f"Failed to initialise {cls.__name__} due to exception:\n" f"{sys.exc_info()[0].__name__}: {e}!") raise errs.InitializationError(f"Failed to initialise {cls.__name__} due to exception:\n" - f"{sys.exc_info()[0].__name__}: {e}!") + f"{sys.exc_info()[0].__name__}: {e}!") from e else: # Adding the http attribute for API interaction instance._http = http diff --git a/openhivenpy/types/house.py b/openhivenpy/types/house.py index 5d7c234..40fb7ae 100644 --- a/openhivenpy/types/house.py +++ b/openhivenpy/types/house.py @@ -118,14 +118,14 @@ async def from_dict(cls, data: dict, http, rooms: typing.List[room.Room], **kwar except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'", data=data) from e except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", suffix=f"Failed to initialise {cls.__name__} due to exception:\n" f"{sys.exc_info()[0].__name__}: {e}!") raise errs.InitializationError(f"Failed to initialise {cls.__name__} due to exception:\n" - f"{sys.exc_info()[0].__name__}: {e}!") + f"{sys.exc_info()[0].__name__}: {e}!") from e else: # Adding the http attribute for API interaction instance._http = http @@ -231,14 +231,14 @@ async def from_dict(cls, data: dict, http, rooms: typing.List[room.Room], **kwar except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'", data=data) from e except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", suffix=f"Failed to initialise {cls.__name__} due to exception:\n" f"{sys.exc_info()[0].__name__}: {e}!") raise errs.InitializationError(f"Failed to initialise {cls.__name__} due to exception:\n" - f"{sys.exc_info()[0].__name__}: {e}!") + f"{sys.exc_info()[0].__name__}: {e}!") from e else: # Adding the http attribute for API interaction instance._http = http diff --git a/openhivenpy/types/invite.py b/openhivenpy/types/invite.py index c97920f..27b0eba 100644 --- a/openhivenpy/types/invite.py +++ b/openhivenpy/types/invite.py @@ -111,14 +111,14 @@ async def from_dict(cls, except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'", data=data) from e except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", suffix=f"Failed to initialise {cls.__name__} due to exception:\n" f"{sys.exc_info()[0].__name__}: {e}!") raise errs.InitializationError(f"Failed to initialise {cls.__name__} due to exception:\n" - f"{sys.exc_info()[0].__name__}: {e}!") + f"{sys.exc_info()[0].__name__}: {e}!") from e else: # Adding the http attribute for API interaction instance._http = http diff --git a/openhivenpy/types/member.py b/openhivenpy/types/member.py index cb3d6ba..0223716 100644 --- a/openhivenpy/types/member.py +++ b/openhivenpy/types/member.py @@ -111,14 +111,14 @@ async def from_dict(cls, except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'", data=data) from e except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", suffix=f"Failed to initialise {cls.__name__} due to exception:\n" f"{sys.exc_info()[0].__name__}: {e}!") raise errs.InitializationError(f"Failed to initialise {cls.__name__} due to exception:\n" - f"{sys.exc_info()[0].__name__}: {e}!") + f"{sys.exc_info()[0].__name__}: {e}!") from e else: # Adding the http attribute for API interaction instance._http = http diff --git a/openhivenpy/types/mention.py b/openhivenpy/types/mention.py index b986dcb..8a4ae6f 100644 --- a/openhivenpy/types/mention.py +++ b/openhivenpy/types/mention.py @@ -64,14 +64,14 @@ async def from_dict(cls, except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'", data=data) from e except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", suffix=f"Failed to initialise {cls.__name__} due to exception:\n" f"{sys.exc_info()[0].__name__}: {e}!") raise errs.InitializationError(f"Failed to initialise {cls.__name__} due to exception:\n" - f"{sys.exc_info()[0].__name__}: {e}!") + f"{sys.exc_info()[0].__name__}: {e}!") from e else: return instance diff --git a/openhivenpy/types/message.py b/openhivenpy/types/message.py index d1c9f06..3811629 100644 --- a/openhivenpy/types/message.py +++ b/openhivenpy/types/message.py @@ -108,14 +108,14 @@ async def from_dict(cls, data: dict, **kwargs): except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'", data=data) from e except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", suffix=f"Failed to initialise {cls.__name__} due to exception:\n" f"{sys.exc_info()[0].__name__}: {e}!") raise errs.InitializationError(f"Failed to initialise {cls.__name__} due to exception:\n" - f"{sys.exc_info()[0].__name__}: {e}!") + f"{sys.exc_info()[0].__name__}: {e}!") from e else: return instance @@ -235,14 +235,14 @@ async def from_dict(cls, except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'", data=data) from e except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", suffix=f"Failed to initialise {cls.__name__} due to exception:\n" f"{sys.exc_info()[0].__name__}: {e}!") raise errs.InitializationError(f"Failed to initialise {cls.__name__} due to exception:\n" - f"{sys.exc_info()[0].__name__}: {e}!") + f"{sys.exc_info()[0].__name__}: {e}!") from e else: # Adding the http attribute for API interaction instance._http = http diff --git a/openhivenpy/types/private_room.py b/openhivenpy/types/private_room.py index bd7d5a1..3c14cb1 100644 --- a/openhivenpy/types/private_room.py +++ b/openhivenpy/types/private_room.py @@ -136,14 +136,14 @@ async def from_dict(cls, except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'", data=data) from e except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", suffix=f"Failed to initialise {cls.__name__} due to exception:\n" f"{sys.exc_info()[0].__name__}: {e}!") raise errs.InitializationError(f"Failed to initialise {cls.__name__} due to exception:\n" - f"{sys.exc_info()[0].__name__}: {e}!") + f"{sys.exc_info()[0].__name__}: {e}!") from e else: # Adding the http attribute for API interaction instance._http = http @@ -287,14 +287,14 @@ async def from_dict(cls, data: dict, http, client_user, **kwargs): except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'", data=data) from e except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", suffix=f"Failed to initialise {cls.__name__} due to exception:\n" f"{sys.exc_info()[0].__name__}: {e}!") raise errs.InitializationError(f"Failed to initialise {cls.__name__} due to exception:\n" - f"{sys.exc_info()[0].__name__}: {e}!") + f"{sys.exc_info()[0].__name__}: {e}!") from e else: # Adding the http attribute for API interaction instance._http = http diff --git a/openhivenpy/types/relationship.py b/openhivenpy/types/relationship.py index 66f856b..d7a4c8b 100644 --- a/openhivenpy/types/relationship.py +++ b/openhivenpy/types/relationship.py @@ -107,14 +107,14 @@ async def from_dict(cls, except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'", data=data) from e except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", suffix=f"Failed to initialise {cls.__name__} due to exception:\n" f"{sys.exc_info()[0].__name__}: {e}!") raise errs.InitializationError(f"Failed to initialise {cls.__name__} due to exception:\n" - f"{sys.exc_info()[0].__name__}: {e}!") + f"{sys.exc_info()[0].__name__}: {e}!") from e else: # Adding the http attribute for API interaction instance._http = http diff --git a/openhivenpy/types/room.py b/openhivenpy/types/room.py index b08a072..6c90172 100644 --- a/openhivenpy/types/room.py +++ b/openhivenpy/types/room.py @@ -114,14 +114,14 @@ async def from_dict(cls, except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'", data=data) from e except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", suffix=f"Failed to initialise {cls.__name__} due to exception:\n" f"{sys.exc_info()[0].__name__}: {e}!") raise errs.InitializationError(f"Failed to initialise {cls.__name__} due to exception:\n" - f"{sys.exc_info()[0].__name__}: {e}!") + f"{sys.exc_info()[0].__name__}: {e}!") from e else: # Adding the http attribute for API interaction instance._http = http diff --git a/openhivenpy/types/user.py b/openhivenpy/types/user.py index c819071..415ff1e 100644 --- a/openhivenpy/types/user.py +++ b/openhivenpy/types/user.py @@ -113,14 +113,14 @@ async def from_dict(cls, except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'", data=data) from e except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", suffix=f"Failed to initialise {cls.__name__} due to exception:\n" f"{sys.exc_info()[0].__name__}: {e}!") raise errs.InitializationError(f"Failed to initialise {cls.__name__} due to exception:\n" - f"{sys.exc_info()[0].__name__}: {e}!") + f"{sys.exc_info()[0].__name__}: {e}!") from e else: # Adding the http attribute for API interaction instance._http = http @@ -197,14 +197,14 @@ async def from_dict(cls, except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'", data=data) from e except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", suffix=f"Failed to initialise {cls.__name__} due to exception:\n" f"{sys.exc_info()[0].__name__}: {e}!") raise errs.InitializationError(f"Failed to initialise {cls.__name__} due to exception:\n" - f"{sys.exc_info()[0].__name__}: {e}!") + f"{sys.exc_info()[0].__name__}: {e}!") from e else: # Adding the http attribute for API interaction instance._http = http diff --git a/openhivenpy/types/usertyping.py b/openhivenpy/types/usertyping.py index ad0c994..d430a72 100644 --- a/openhivenpy/types/usertyping.py +++ b/openhivenpy/types/usertyping.py @@ -98,14 +98,14 @@ async def from_dict(cls, except ValidationError as e: utils.log_validation_traceback(cls, e) - raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'",data=data) + raise errs.InvalidPassedDataError(f"Failed to perform validation in '{cls.__name__}'", data=data) from e except Exception as e: utils.log_traceback(msg=f"Traceback in '{cls.__name__}' Validation:", suffix=f"Failed to initialise {cls.__name__} due to exception:\n" f"{sys.exc_info()[0].__name__}: {e}!") raise errs.InitializationError(f"Failed to initialise {cls.__name__} due to exception:\n" - f"{sys.exc_info()[0].__name__}: {e}!") + f"{sys.exc_info()[0].__name__}: {e}!") from e else: # Adding the http attribute for API interaction instance._http = http