mirror of
https://github.com/Benexl/FastAnime.git
synced 2025-12-05 20:40:09 -08:00
feat: copilot instructions
This commit is contained in:
31
.github/copilot-instructions.md
vendored
Normal file
31
.github/copilot-instructions.md
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
You are a senior Python developer with extensive experience in building robust, scalable applications. You excel at:
|
||||
|
||||
## Core Python Expertise
|
||||
|
||||
- Writing clean, maintainable, and efficient Python code
|
||||
- Following PEP 8 style guidelines and Python best practices
|
||||
- Implementing proper error handling and logging
|
||||
- Using type hints and modern Python features (3.8+)
|
||||
- Understanding memory management and performance optimization
|
||||
|
||||
## Development Practices
|
||||
|
||||
- Test-driven development (TDD) and writing comprehensive unit tests
|
||||
- Code reviews and mentoring junior developers
|
||||
- Designing modular, reusable code architectures
|
||||
- Implementing design patterns appropriately
|
||||
- Documentation and code commenting best practices
|
||||
|
||||
## Technical Skills
|
||||
|
||||
- CLI application development (argparse, click, typer)
|
||||
|
||||
## Problem-Solving Approach
|
||||
|
||||
- Break down complex problems into manageable components
|
||||
- Consider edge cases and error scenarios
|
||||
- Optimize for readability first, then performance
|
||||
- Provide multiple solution approaches when applicable
|
||||
- Explain trade-offs and design decisions
|
||||
|
||||
Always provide production-ready code with proper error handling, logging, and documentation.
|
||||
@@ -1,12 +1,10 @@
|
||||
import json
|
||||
import logging
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
from typing import Optional
|
||||
|
||||
from ...core.constants import USER_DATA_PATH
|
||||
from ...core.exceptions import ConfigError
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ...libs.api.types import UserProfile
|
||||
from ...libs.api.types import UserProfile
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -54,11 +54,12 @@ def mock_provider():
|
||||
"""Create a mock anime provider."""
|
||||
provider = Mock()
|
||||
provider.search_anime.return_value = SearchResults(
|
||||
anime=[
|
||||
Anime(
|
||||
name="Test Anime 1",
|
||||
url="https://example.com/anime1",
|
||||
page_info=PageInfo(),
|
||||
results=[
|
||||
SearchResult(
|
||||
id="anime1",
|
||||
title="Test Anime 1",
|
||||
episodes=AnimeEpisodes(sub=["1", "2", "3"]),
|
||||
poster="https://example.com/poster1.jpg"
|
||||
)
|
||||
]
|
||||
|
||||
@@ -7,7 +7,7 @@ from unittest.mock import Mock, patch
|
||||
|
||||
from fastanime.cli.interactive.menus.episodes import episodes
|
||||
from fastanime.cli.interactive.state import ControlFlow, State, MediaApiState, ProviderState
|
||||
from fastanime.libs.providers.anime.types import Anime, Episodes
|
||||
from fastanime.libs.providers.anime.types import Anime, AnimeEpisodes
|
||||
|
||||
|
||||
class TestEpisodesMenu:
|
||||
@@ -43,7 +43,7 @@ class TestEpisodesMenu:
|
||||
url="https://example.com/anime",
|
||||
id="test-anime",
|
||||
poster="https://example.com/poster.jpg",
|
||||
episodes=Episodes(sub=[], dub=["1", "2", "3"]) # No sub episodes
|
||||
episodes=AnimeEpisodes(sub=[], dub=["1", "2", "3"]) # No sub episodes
|
||||
)
|
||||
|
||||
state_no_sub = State(
|
||||
|
||||
@@ -9,7 +9,7 @@ import threading
|
||||
from fastanime.cli.interactive.menus.player_controls import player_controls
|
||||
from fastanime.cli.interactive.state import ControlFlow, State, MediaApiState, ProviderState
|
||||
from fastanime.libs.players.types import PlayerResult
|
||||
from fastanime.libs.providers.anime.types import Server, StreamLink
|
||||
from fastanime.libs.providers.anime.types import Server, EpisodeStream
|
||||
from fastanime.libs.api.types import MediaItem
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from unittest.mock import Mock, patch, MagicMock
|
||||
|
||||
from fastanime.cli.interactive.menus.servers import servers
|
||||
from fastanime.cli.interactive.state import ControlFlow, State, MediaApiState, ProviderState
|
||||
from fastanime.libs.providers.anime.types import Anime, Server, StreamLink
|
||||
from fastanime.libs.providers.anime.types import Anime, Server, EpisodeStream
|
||||
from fastanime.libs.players.types import PlayerResult
|
||||
|
||||
|
||||
@@ -50,16 +50,14 @@ class TestServersMenu:
|
||||
mock_servers = [
|
||||
Server(
|
||||
name="Server 1",
|
||||
url="https://example.com/server1",
|
||||
links=[
|
||||
StreamLink(url="https://example.com/stream1.m3u8", quality=1080, format="m3u8")
|
||||
EpisodeStream(link="https://example.com/stream1.m3u8", quality="1080", format="m3u8")
|
||||
]
|
||||
),
|
||||
Server(
|
||||
name="Server 2",
|
||||
url="https://example.com/server2",
|
||||
links=[
|
||||
StreamLink(url="https://example.com/stream2.m3u8", quality=720, format="m3u8")
|
||||
EpisodeStream(link="https://example.com/stream2.m3u8", quality="720", format="m3u8")
|
||||
]
|
||||
)
|
||||
]
|
||||
@@ -116,8 +114,7 @@ class TestServersMenu:
|
||||
mock_servers = [
|
||||
Server(
|
||||
name="Server 1",
|
||||
url="https://example.com/server1",
|
||||
links=[StreamLink(url="https://example.com/stream1.m3u8", quality=1080, format="m3u8")]
|
||||
links=[EpisodeStream(link="https://example.com/stream1.m3u8", quality="1080", format="m3u8")]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -147,8 +144,7 @@ class TestServersMenu:
|
||||
mock_servers = [
|
||||
Server(
|
||||
name="Server 1",
|
||||
url="https://example.com/server1",
|
||||
links=[StreamLink(url="https://example.com/stream1.m3u8", quality=1080, format="m3u8")]
|
||||
links=[EpisodeStream(link="https://example.com/stream1.m3u8", quality="1080", format="m3u8")]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -178,8 +174,7 @@ class TestServersMenu:
|
||||
mock_servers = [
|
||||
Server(
|
||||
name="TOP", # Matches config server preference
|
||||
url="https://example.com/server1",
|
||||
links=[StreamLink(url="https://example.com/stream1.m3u8", quality=1080, format="m3u8")]
|
||||
links=[EpisodeStream(link="https://example.com/stream1.m3u8", quality="1080", format="m3u8")]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -214,11 +209,10 @@ class TestServersMenu:
|
||||
mock_servers = [
|
||||
Server(
|
||||
name="Server 1",
|
||||
url="https://example.com/server1",
|
||||
links=[
|
||||
StreamLink(url="https://example.com/stream_720.m3u8", quality=720, format="m3u8"),
|
||||
StreamLink(url="https://example.com/stream_1080.m3u8", quality=1080, format="m3u8"),
|
||||
StreamLink(url="https://example.com/stream_480.m3u8", quality=480, format="m3u8")
|
||||
EpisodeStream(link="https://example.com/stream_720.m3u8", quality="720", format="m3u8"),
|
||||
EpisodeStream(link="https://example.com/stream_1080.m3u8", quality="1080", format="m3u8"),
|
||||
EpisodeStream(link="https://example.com/stream_480.m3u8", quality="480", format="m3u8")
|
||||
]
|
||||
)
|
||||
]
|
||||
@@ -255,8 +249,7 @@ class TestServersMenu:
|
||||
mock_servers = [
|
||||
Server(
|
||||
name="Server 1",
|
||||
url="https://example.com/server1",
|
||||
links=[StreamLink(url="https://example.com/stream1.m3u8", quality=1080, format="m3u8")]
|
||||
links=[EpisodeStream(link="https://example.com/stream1.m3u8", quality="1080", format="m3u8")]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -289,7 +282,6 @@ class TestServersMenu:
|
||||
mock_servers = [
|
||||
Server(
|
||||
name="Server 1",
|
||||
url="https://example.com/server1",
|
||||
links=[] # No streaming links
|
||||
)
|
||||
]
|
||||
@@ -331,9 +323,9 @@ class TestServersMenuHelperFunctions:
|
||||
from fastanime.cli.interactive.menus.servers import _filter_by_quality
|
||||
|
||||
links = [
|
||||
StreamLink(url="https://example.com/480.m3u8", quality=480, format="m3u8"),
|
||||
StreamLink(url="https://example.com/720.m3u8", quality=720, format="m3u8"),
|
||||
StreamLink(url="https://example.com/1080.m3u8", quality=1080, format="m3u8")
|
||||
EpisodeStream(link="https://example.com/480.m3u8", quality="480", format="m3u8"),
|
||||
EpisodeStream(link="https://example.com/720.m3u8", quality="720", format="m3u8"),
|
||||
EpisodeStream(link="https://example.com/1080.m3u8", quality="1080", format="m3u8")
|
||||
]
|
||||
|
||||
result = _filter_by_quality(links, "720")
|
||||
@@ -346,8 +338,8 @@ class TestServersMenuHelperFunctions:
|
||||
from fastanime.cli.interactive.menus.servers import _filter_by_quality
|
||||
|
||||
links = [
|
||||
StreamLink(url="https://example.com/480.m3u8", quality=480, format="m3u8"),
|
||||
StreamLink(url="https://example.com/720.m3u8", quality=720, format="m3u8")
|
||||
EpisodeStream(link="https://example.com/480.m3u8", quality="480", format="m3u8"),
|
||||
EpisodeStream(link="https://example.com/720.m3u8", quality="720", format="m3u8")
|
||||
]
|
||||
|
||||
result = _filter_by_quality(links, "1080") # Quality not available
|
||||
@@ -371,10 +363,9 @@ class TestServersMenuHelperFunctions:
|
||||
|
||||
server = Server(
|
||||
name="Test Server",
|
||||
url="https://example.com/server",
|
||||
links=[
|
||||
StreamLink(url="https://example.com/720.m3u8", quality=720, format="m3u8"),
|
||||
StreamLink(url="https://example.com/1080.m3u8", quality=1080, format="m3u8")
|
||||
EpisodeStream(link="https://example.com/720.m3u8", quality="720", format="m3u8"),
|
||||
EpisodeStream(link="https://example.com/1080.m3u8", quality="1080", format="m3u8")
|
||||
]
|
||||
)
|
||||
|
||||
@@ -391,8 +382,7 @@ class TestServersMenuHelperFunctions:
|
||||
|
||||
server = Server(
|
||||
name="Test Server",
|
||||
url="https://example.com/server",
|
||||
links=[StreamLink(url="https://example.com/720.m3u8", quality=720, format="m3u8")]
|
||||
links=[EpisodeStream(link="https://example.com/720.m3u8", quality="720", format="m3u8")]
|
||||
)
|
||||
|
||||
mock_config.general.icons = False
|
||||
|
||||
Reference in New Issue
Block a user