Skip to content

Commit

Permalink
fix: remove extras_require from setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
leandcesar committed Jul 23, 2024
1 parent 9bb1d12 commit ddffec0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 33 deletions.
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
aiohttp==3.8.4
dacite==1.8.0
requests==2.31.0
aiohttp>=3.8.4
dacite>=1.8.0
requests>=2.31.0
7 changes: 0 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

with open("requirements.txt") as f:
requirements = f.read().splitlines()
requirements.remove("aiohttp==3.8.4")
requirements.remove("requests==2.31.0")

with open("requirements-test.txt") as f:
test_requirements = f.read().splitlines()
Expand Down Expand Up @@ -52,11 +50,6 @@
],
zip_safe=False,
install_requires=requirements,
extras_require={
"async": ["aiohttp==3.8.4"],
"sync": ["requests==2.31.0"],
"full": ["aiohttp==3.8.4", "requests==2.31.0"],
},
tests_require=test_requirements,
test_suite="tests",
)
7 changes: 1 addition & 6 deletions themoviedb/routes_async/_base.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
# -*- coding: utf-8 -*-
import os
import sys
from typing import Any, Dict, Optional

try:
from aiohttp import ClientSession
except ImportError:
print("The 'aiohttp' package is required for async support. Install it using 'pip install themoviedb[async]'.")
sys.exit(1)
from aiohttp import ClientSession


class Base:
Expand Down
7 changes: 1 addition & 6 deletions themoviedb/routes_sync/_base.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
# -*- coding: utf-8 -*-
import os
import sys
from typing import Any, Dict, Optional

try:
from requests import Session
except ImportError:
print("The 'requests' package is required for sync support. Install it using 'pip install themoviedb[sync]'.")
sys.exit(1)
from requests import Session


class Base:
Expand Down
16 changes: 5 additions & 11 deletions themoviedb/schemas/_result.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from dataclasses import dataclass
from datetime import date
from typing import Generic, Iterator, Optional, TypeVar
from typing import Generic, Optional, TypeVar

T = TypeVar("T")

Expand All @@ -19,26 +19,20 @@ class Result(Generic[T]):
def __bool__(self) -> bool:
return bool(self.results)

def __iter__(self) -> Iterator:
def __iter__(self):
if self.results is None:
return iter([])
if isinstance(self.results, list):
return iter(self.results)
raise TypeError("Result is not iterable")
return iter(self.results)

def __getitem__(self, index):
if self.results is None:
raise IndexError("Result is empty")
if isinstance(self.results, list):
return self.results[index]
raise TypeError("Result is not indexable")
return self.results[index]

def __len__(self) -> int:
if self.results is None:
return 0
if isinstance(self.results, list):
return len(self.results)
raise TypeError("Result does not have length")
return len(self.results) # type: ignore


@dataclass
Expand Down

0 comments on commit ddffec0

Please sign in to comment.