mtgdata 0.2.1__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mtgdata-0.2.1 → mtgdata-0.2.2}/PKG-INFO +1 -1
- {mtgdata-0.2.1 → mtgdata-0.2.2}/mtgdata/scryfall.py +10 -6
- {mtgdata-0.2.1 → mtgdata-0.2.2}/mtgdata.egg-info/PKG-INFO +1 -1
- {mtgdata-0.2.1 → mtgdata-0.2.2}/.github/ISSUE_TEMPLATE/bug-report.md +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/.github/ISSUE_TEMPLATE/feature-request.md +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/.github/ISSUE_TEMPLATE/question.md +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/.github/workflows/lint.yml +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/.github/workflows/python-publish.yml +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/.github/workflows/python-test.yml +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/.github/workflows/version-bump.yaml +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/.gitignore +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/.pre-commit-config.yaml +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/LICENSE.txt +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/README.md +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/mtg-vae.png +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/mtgdata/__init__.py +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/mtgdata/__main__.py +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/mtgdata/scryfall_convert.py +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/mtgdata/util/__init__.py +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/mtgdata/util/hdf5.py +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/mtgdata.egg-info/SOURCES.txt +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/mtgdata.egg-info/dependency_links.txt +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/mtgdata.egg-info/requires.txt +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/mtgdata.egg-info/top_level.txt +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/pyproject.toml +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/pytest.ini +0 -0
- {mtgdata-0.2.1 → mtgdata-0.2.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: mtgdata
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: MTG image dataset with automatic image scraping and conversion.
|
|
5
5
|
Author-email: Nathan Juraj Michlo <NathanJMichlo@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/nmichlo/mtg-dataset
|
|
@@ -183,12 +183,13 @@ class ScryfallCardFace:
|
|
|
183
183
|
def url_path_pair(self) -> Tuple[str, str]:
|
|
184
184
|
return self.img_uri, str(self.img_path)
|
|
185
185
|
|
|
186
|
-
def download(self, *, verbose: bool = True) -> Path:
|
|
187
|
-
|
|
186
|
+
def download(self, *, verbose: bool = True, proxy: ProxyDownloader = None) -> Path:
|
|
187
|
+
proxy = proxy or self._proxy
|
|
188
|
+
if proxy is None:
|
|
188
189
|
if self.img_path.exists():
|
|
189
190
|
return self.img_path
|
|
190
191
|
raise RuntimeError("proxy is not set for downloading!")
|
|
191
|
-
|
|
192
|
+
proxy.download(
|
|
192
193
|
self.img_uri,
|
|
193
194
|
str(self.img_path),
|
|
194
195
|
exists_mode="skip",
|
|
@@ -199,7 +200,9 @@ class ScryfallCardFace:
|
|
|
199
200
|
)
|
|
200
201
|
return self.img_path
|
|
201
202
|
|
|
202
|
-
def dl_and_open_im(
|
|
203
|
+
def dl_and_open_im(
|
|
204
|
+
self, *, verbose: bool = True, proxy: ProxyDownloader = None
|
|
205
|
+
) -> "Image.Image":
|
|
203
206
|
try:
|
|
204
207
|
from PIL import Image
|
|
205
208
|
except ImportError:
|
|
@@ -207,7 +210,7 @@ class ScryfallCardFace:
|
|
|
207
210
|
"PIL is not installed, please install it using: `pip install pillow`"
|
|
208
211
|
)
|
|
209
212
|
|
|
210
|
-
return Image.open(self.download(verbose=verbose))
|
|
213
|
+
return Image.open(self.download(verbose=verbose, proxy=proxy))
|
|
211
214
|
|
|
212
215
|
def __repr__(self):
|
|
213
216
|
return f'<ScryfallCardFace: "{self.name}" ({self.set_code}), {self.img_path}>'
|
|
@@ -218,8 +221,9 @@ class ScryfallCardFace:
|
|
|
218
221
|
resize_mode: Literal["resize", "error", "skip"] = "resize",
|
|
219
222
|
*,
|
|
220
223
|
verbose: bool = True,
|
|
224
|
+
proxy: ProxyDownloader = None,
|
|
221
225
|
) -> "Image.Image":
|
|
222
|
-
img = self.dl_and_open_im(verbose=verbose)
|
|
226
|
+
img = self.dl_and_open_im(verbose=verbose, proxy=proxy)
|
|
223
227
|
if channel_mode == "rgb":
|
|
224
228
|
img = img.convert("RGB")
|
|
225
229
|
if self.img_type.size != img.size:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: mtgdata
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: MTG image dataset with automatic image scraping and conversion.
|
|
5
5
|
Author-email: Nathan Juraj Michlo <NathanJMichlo@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/nmichlo/mtg-dataset
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|