Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions .envrc

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/testing-and-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']

env:
KEEPAKEY: ${{ secrets.KEEPAKEY }}
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ ci:
autoupdate_schedule: quarterly
repos:
- repo: https://github.com/keewis/blackdoc
rev: v0.4.1
rev: v0.4.5
hooks:
- id: blackdoc
files: \.py$
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.2
rev: v0.14.3
hooks:
- id: ruff-check
args: [--fix, --exit-non-zero-on-fix]
Expand All @@ -28,12 +28,12 @@ repos:
additional_dependencies: [toml]
exclude: tests/
- repo: https://github.com/asottile/pyupgrade
rev: v3.20.0
rev: v3.21.0
hooks:
- id: pyupgrade
args: [--py39-plus, --keep-runtime-typing]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-merge-conflict
- id: debug-statements
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ classifiers = [
"Intended Audience :: End Users/Desktop",
"Topic :: Database :: Front-Ends",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13"
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14"
]
dependencies = [
"numpy >=1.9.3",
Expand Down
4 changes: 2 additions & 2 deletions src/keepa/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,14 +375,14 @@ class Domain(Enum):
BR = "BR"


def _domain_to_dcode(domain: Union[str, Domain]) -> int:
def _domain_to_dcode(domain: str | Domain) -> int:
"""Convert a domain to a domain code."""
if isinstance(domain, Domain):
domain_str = domain.value
else:
domain_str = domain

if domain not in DCODES:
if domain_str not in DCODES:
raise ValueError(f"Invalid domain code {domain}. Should be one of the following:\n{DCODES}")
return DCODES.index(domain_str)

Expand Down
17 changes: 9 additions & 8 deletions tests/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

import keepa
from keepa import keepa_minutes_to_time
from keepa import Keepa

# reduce the request limit for testing

keepa.interface.REQLIM = 2

path = os.path.dirname(os.path.realpath(__file__))
Expand Down Expand Up @@ -89,11 +89,11 @@

# open connection to keepa
@pytest.fixture(scope="module")
def api():
return keepa.Keepa(TESTINGKEY)
def api() -> Keepa:
return Keepa(TESTINGKEY)


def test_deals(api):
def test_deals(api: Keepa) -> None:
deal_parms = {
"page": 0,
"domainId": 1,
Expand Down Expand Up @@ -319,16 +319,17 @@ def test_productquery_offers_multiple(api):
assert np.isin(asins, PRODUCT_ASINS).all()


def test_domain(api):
asin = "0394800028"
request = api.query(asin, history=False, domain="BR")
def test_domain(api: Keepa) -> None:
"""A domain different than the default."""
asin = "3492704794"
request = api.query(asin, history=False, domain=keepa.Domain.DE)
product = request[0]
assert product["asin"] == asin


def test_invalid_domain(api):
with pytest.raises(ValueError):
api.query(PRODUCT_ASIN, history=False, domain="XX")
api.query(PRODUCT_ASIN, domain="XX")


def test_bestsellers(api):
Expand Down