mirror of
https://github.com/gogcom/galaxy-integrations-python-api.git
synced 2026-01-01 19:38:21 -05:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92b1d8e4df | ||
|
|
4adef2dace | ||
|
|
1430fe39d7 | ||
|
|
c591efc493 | ||
|
|
7c4f3fba5b | ||
|
|
f2e2e41d04 | ||
|
|
25b850d8bb | ||
|
|
403736612a | ||
|
|
3071c2e771 |
@@ -34,6 +34,8 @@ pytest
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
### 0.21
|
||||||
|
* Add `Epic` platform.
|
||||||
### 0.16
|
### 0.16
|
||||||
* Do not log sensitive data.
|
* Do not log sensitive data.
|
||||||
* Return `LocalGameState` as int (possible combination of flags).
|
* Return `LocalGameState` as int (possible combination of flags).
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class Platform(Enum):
|
|||||||
Origin = "origin"
|
Origin = "origin"
|
||||||
Uplay = "uplay"
|
Uplay = "uplay"
|
||||||
Battlenet = "battlenet"
|
Battlenet = "battlenet"
|
||||||
|
Epic = "epic"
|
||||||
|
|
||||||
class Feature(Enum):
|
class Feature(Enum):
|
||||||
Unknown = "Unknown"
|
Unknown = "Unknown"
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class Dlc():
|
|||||||
class Game():
|
class Game():
|
||||||
game_id: str
|
game_id: str
|
||||||
game_title: str
|
game_title: str
|
||||||
dlcs: List[Dlc]
|
dlcs: Optional[List[Dlc]]
|
||||||
license_info: LicenseInfo
|
license_info: LicenseInfo
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
20
galaxy/tools.py
Normal file
20
galaxy/tools.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import io
|
||||||
|
import os
|
||||||
|
import zipfile
|
||||||
|
from glob import glob
|
||||||
|
|
||||||
|
def zip_folder(folder):
|
||||||
|
files = glob(os.path.join(folder, "**"), recursive=True)
|
||||||
|
files = [file.replace(folder + os.sep, "") for file in files]
|
||||||
|
files = [file for file in files if file]
|
||||||
|
|
||||||
|
zip_buffer = io.BytesIO()
|
||||||
|
with zipfile.ZipFile(zip_buffer, mode="w", compression=zipfile.ZIP_DEFLATED) as zipf:
|
||||||
|
for file in files:
|
||||||
|
zipf.write(os.path.join(folder, file), arcname=file)
|
||||||
|
return zip_buffer
|
||||||
|
|
||||||
|
def zip_folder_to_file(folder, filename):
|
||||||
|
zip_content = zip_folder(folder).getbuffer()
|
||||||
|
with open(filename, "wb") as archive:
|
||||||
|
archive.write(zip_content)
|
||||||
@@ -2,5 +2,4 @@ from unittest.mock import MagicMock
|
|||||||
|
|
||||||
class AsyncMock(MagicMock):
|
class AsyncMock(MagicMock):
|
||||||
async def __call__(self, *args, **kwargs):
|
async def __call__(self, *args, **kwargs):
|
||||||
# pylint: disable=useless-super-delegation
|
|
||||||
return super(AsyncMock, self).__call__(*args, **kwargs)
|
return super(AsyncMock, self).__call__(*args, **kwargs)
|
||||||
2
setup.py
2
setup.py
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="galaxy.plugin.api",
|
name="galaxy.plugin.api",
|
||||||
version="0.20",
|
version="0.22",
|
||||||
description="Galaxy python plugin API",
|
description="Galaxy python plugin API",
|
||||||
author='Galaxy team',
|
author='Galaxy team',
|
||||||
author_email='galaxy@gog.com',
|
author_email='galaxy@gog.com',
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import pytest
|
|||||||
|
|
||||||
from galaxy.api.plugin import Plugin
|
from galaxy.api.plugin import Plugin
|
||||||
from galaxy.api.consts import Platform
|
from galaxy.api.consts import Platform
|
||||||
from tests.async_mock import AsyncMock
|
from galaxy.unittest.mock import AsyncMock
|
||||||
|
|
||||||
@pytest.fixture()
|
@pytest.fixture()
|
||||||
def reader():
|
def reader():
|
||||||
|
|||||||
Reference in New Issue
Block a user