Skip to content

Commit

Permalink
🚑 Fix for asset packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
mtralka committed Oct 25, 2021
1 parent 5cb5a4f commit 8099958
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion eoplatform/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
from eoplatform.main import info


__version__ = "0.1.0"
__version__ = "0.1.1"
28 changes: 16 additions & 12 deletions eoplatform/factory.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from importlib import resources
import json
from os import stat
from pathlib import Path
import sys
from typing import Any
from typing import Dict
from typing import Generator
from typing import Iterator
from typing import List
from typing import Union

from eoplatform.baseClasses import Platform
Expand All @@ -15,32 +17,34 @@
else:
from typing_extensions import Final

PLATFORM_PATH: Final[Path] = Path("eoplatform/platforms")
PLATFORM_PATH: Final[str] = "eoplatform.platforms"


class EOPlatformFactory:
@staticmethod
def generate_platform() -> Generator[Platform, None, None]:

platform_paths: Generator[
Path, None, None
] = EOPlatformFactory._find_platform_files()
platform_names: List[str] = EOPlatformFactory._find_platform_files()

for file in platform_paths:
for name in platform_names:
platform_data: Dict[
str, Union[str, int]
] = EOPlatformFactory._get_platform_data(file)
] = EOPlatformFactory._get_platform_data(name)
yield EOPlatformFactory._produce_platform(platform_data)

@staticmethod
def _find_platform_files() -> Generator[Path, None, None]:
pattern: str = "*.json"
return Path(PLATFORM_PATH).glob(pattern)
def _find_platform_files() -> List[str]:
directory: Iterator[str] = resources.contents(PLATFORM_PATH)
test: List[str] = [f for f in directory if f[-5:] == ".json"]

return test

@staticmethod
def _get_platform_data(platform_file: Path) -> Dict[str, Union[str, int]]:
with open(platform_file, "r") as file:
def _get_platform_data(platform_name: str) -> Dict[str, Union[str, int]]:

with resources.open_text(PLATFORM_PATH, platform_name) as file:
data: Dict[str, Union[str, int]] = json.load(file)

return data

@staticmethod
Expand Down
1 change: 0 additions & 1 deletion eoplatform/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from typing import Union
from typing import cast

from eoplatform.baseClasses import Bands
Expand Down
Empty file.
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
[tool.poetry]
name = "eoplatform"
version = "0.1.0"
version = "0.1.1"
description = "Earth Observation made easy."
authors = ["Matthew Tralka <[email protected]>"]
maintainers = ["Matthew Tralka <[email protected]>"]
license = "GPL-3.0-only"
repository = "README.md"
repository = "https://github.com/mtralka/EOPlatform"
readme = "README.md"
keywords = ["remote sensing", "earth observation", "gis", "education"]
include = ["eoplatform/platforms/*"]


classifiers = [
"Development Status :: 4 - Beta",
Expand Down

0 comments on commit 8099958

Please sign in to comment.