Skip to content

Commit

Permalink
add linting
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenixthrush committed Nov 26, 2024
1 parent 9f62a99 commit 220d6c1
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Lint with flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
flake8 . --count --exit-zero --max-line-length=127 --statistics --ignore=F401,C901
- name: Analyzing the code with pylint
run: |
Expand Down
2 changes: 0 additions & 2 deletions src/aniworld/aniskip/aniskip.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,12 @@ def build_flags(anime_id: str, episode: int, chapters_file: str) -> str:
)
logging.debug("Response status code: %d", response.status_code)


if response.status_code == 500:
logging.info("Aniskip API is currently not working!")
return ""
if response.status_code != 200:
raise_runtime_error("Failed to fetch AniSkip data.")


metadata = response.json()
logging.debug("AniSkip response: %s", json.dumps(metadata, indent=2))

Expand Down
6 changes: 4 additions & 2 deletions src/aniworld/common/adventure.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ def adventure():

try:
instruction = """
Use simple English so that non-native speakers can understand what's happening, and always ask what "you (the user)" want to do.
Use simple English so that non-native speakers can understand what's happening,
and always ask what "you (the user)" want to do.
You are the narrator in a text adventure game.
Start by telling a very short story of about three sentences to set the scene.
The user will type their answer and you will continue the story based on their input,
Expand All @@ -97,7 +98,8 @@ def adventure():
You need to think about a storyline that does end after some time.
Also add highlights like monster fights with options as running away or fighting.
If the player tries todo non logical things like going to a desert while being at the ocean it shouldn't work.
Also if he tries to use any items that are not logically near you don't allow it, you can't equip a sword without buying it somewhere first.
Also if he tries to use any items that are not logically near you don't allow it,
you can't equip a sword without buying it somewhere first.
You can't buy things while fighting.
Make the fights longer than one prompt, do multiple fight scenes.
"""
Expand Down
27 changes: 21 additions & 6 deletions src/aniworld/extractors/hanime/hanime.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def parse_hanime_url(url):

def download(video, res=1080, verbose=False, folder=False):
true_res = list(video.at_resolution(res).keys())[0].split("-")[1]
_source = list(video.at_resolution(res).values())[0]
_ = list(video.at_resolution(res).values())[0] # source

if folder:
out = f"{video.metadata.franchise_slug}/{video.slug}-{true_res}p.mp4"
Expand Down Expand Up @@ -232,8 +232,10 @@ def output(video, args, franchise=False):
try:
if args.franchise and franchise:
if not args.url:
print(f"Downloading {
video.metadata.franchise_title} franchise...")
print(
f"Downloading {video.metadata.franchise_title} "
"franchise...\n"
)

for slug in video.metadata.franchise_videos:
fran_vid = Video.from_slug(slug)
Expand Down Expand Up @@ -296,11 +298,24 @@ def hanime(url: str = None):
parser.add_argument(
"--page", "-p", help="Page # of search results", default=1, type=int)
parser.add_argument(
"--sort-by", "-s", help="Sorting method for search results ([u]pload, [v]iews, [l]ikes, [r]elease, [t]itle)", default="title")
"--sort-by", "-s",
help=(
"Sorting method for search results "
"([u]pload, [v]iews, [l]ikes, [r]elease, [t]itle)"
),
default="title"
)
parser.add_argument(
"--sort-order", "-w", help="Order of sorting ([a]scending or [d]escending)", default="ascending")
parser.add_argument("--roll-search", "-R",
help="Roll all search pages into one long page, useful for large-volume downloads", action="store_true", default=False)
parser.add_argument(
"--roll-search", "-R",
help=(
"Roll all search pages into one long page, "
"useful for large-volume downloads"
),
action="store_true",
default=False
)
parser.add_argument(
"--resolution", "-r", help="Resolution of download, default 1080", default=1080, type=int)
parser.add_argument("--index", "-i", help="Index of search results to download",
Expand Down

0 comments on commit 220d6c1

Please sign in to comment.