Skip to content

Commit

Permalink
add new types(typing), pretty vars in types
Browse files Browse the repository at this point in the history
  • Loading branch information
D4n13l3k00 committed Aug 12, 2021
1 parent ae437a4 commit e08862d
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 25 deletions.
5 changes: 4 additions & 1 deletion anipics/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Copyright 2021 D4n13l3k00.
# SPDX-License-Identifier: AGPL-3.0-or-later
# SPDX-License-Identifier: AGPL-3.0-or-later

__author__ = 'D4n13l3k00'
__version__ = '1.3'

from aioify import aioify

Expand Down
2 changes: 1 addition & 1 deletion anipics/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright 2021 D4n13l3k00.
# SPDX-License-Identifier: AGPL-3.0-or-later
# SPDX-License-Identifier: AGPL-3.0-or-later

from typing import *

Expand Down
104 changes: 85 additions & 19 deletions anipics/parser.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,90 @@
# Copyright 2021 D4n13l3k00.
# SPDX-License-Identifier: AGPL-3.0-or-later
# SPDX-License-Identifier: AGPL-3.0-or-later

from typing import Coroutine, Union
from typing import *

import requests
from bs4 import BeautifulSoup

from .models import Models

class _types:
NekosLifeType = NewType('NekosLifeType', str)
AnimeApiHisokaType = NewType('NekosLifeType', str)

class Parser:
class NekosLife:
class types:
femdom, tickle, classic, ngif, erofeet, meow, erok, poke, les, hololewd, lewdk, keta, feetg, nsfw_neko_gif, eroyuri, kiss, _8ball, kuni, tits, pussy_jpg, cum_jpg, pussy, lewdkemo, lizard, slap, lewd, cum, cuddle, spank, smallboobs, goose, Random_hentai_gif, avatar, fox_girl, nsfw_avatar, hug, gecg, boobs, pat, feet, smug, kemonomimi, solog, holo, wallpaper, bj, woof, yuri, trap, anal, baka, blowjob, holoero, feed, neko, gasm, hentai, futanari, ero, solo, waifu, pwankg, eron, erokemo = 'femdom', 'tickle', 'classic', 'ngif', 'erofeet', 'meow', 'erok', 'poke', 'les', 'hololewd', 'lewdk', 'keta', 'feetg', 'nsfw_neko_gif', 'eroyuri', 'kiss', '8ball', 'kuni', 'tits', 'pussy_jpg', 'cum_jpg', 'pussy', 'lewdkemo', 'lizard', 'slap', 'lewd', 'cum', 'cuddle', 'spank', 'smallboobs', 'goose', 'Random_hentai_gif', 'avatar', 'fox_girl', 'nsfw_avatar', 'hug', 'gecg', 'boobs', 'pat', 'feet', 'smug', 'kemonomimi', 'solog', 'holo', 'wallpaper', 'bj', 'woof', 'yuri', 'trap', 'anal', 'baka', 'blowjob', 'holoero', 'feed', 'neko', 'gasm', 'hentai', 'futanari', 'ero', 'solo', 'waifu', 'pwankg', 'eron', 'erokemo'
femdom: _types.NekosLifeType = 'femdom'
tickle: _types.NekosLifeType = 'tickle'
classic: _types.NekosLifeType = 'classic'
ngif: _types.NekosLifeType = 'ngif'
erofeet: _types.NekosLifeType = 'erofeet'
meow: _types.NekosLifeType = 'meow'
erok: _types.NekosLifeType = 'erok'
poke: _types.NekosLifeType = 'poke'
les: _types.NekosLifeType = 'les'
hololewd: _types.NekosLifeType = 'hololewd'
lewdk: _types.NekosLifeType = 'lewdk'
keta: _types.NekosLifeType = 'keta'
feetg: _types.NekosLifeType = 'feetg'
nsfw_neko_gif: _types.NekosLifeType = 'nsfw_neko_gif'
eroyuri: _types.NekosLifeType = 'eroyuri'
kiss: _types.NekosLifeType = 'kiss'
_8ball: _types.NekosLifeType = '8ball'
kuni: _types.NekosLifeType = 'kuni'
tits: _types.NekosLifeType = 'tits'
pussy_jpg: _types.NekosLifeType = 'pussy_jpg'
cum_jpg: _types.NekosLifeType = 'cum_jpg'
pussy: _types.NekosLifeType = 'pussy'
lewdkemo: _types.NekosLifeType = 'lewdkemo'
lizard: _types.NekosLifeType = 'lizard'
slap: _types.NekosLifeType = 'slap'
lewd: _types.NekosLifeType = 'lewd'
cum: _types.NekosLifeType = 'cum'
cuddle: _types.NekosLifeType = 'cuddle'
spank: _types.NekosLifeType = 'spank'
smallboob: _types.NekosLifeType = 'smallboobs'
goose: _types.NekosLifeType = 'goose'
random_hentai_gif: _types.NekosLifeType = 'Random_hentai_gif'
avatar: _types.NekosLifeType = 'avatar'
fox_girl: _types.NekosLifeType = 'fox_girl'
nsfw_avatar: _types.NekosLifeType = 'nsfw_avatar'
hug: _types.NekosLifeType = 'hug'
gecg: _types.NekosLifeType = 'gecg'
boobs: _types.NekosLifeType = 'boobs'
pat: _types.NekosLifeType = 'pat'
feet: _types.NekosLifeType = 'feet'
smug: _types.NekosLifeType = 'smug'
kemonomimi: _types.NekosLifeType = 'kemonomimi'
solog: _types.NekosLifeType = 'solog'
holo: _types.NekosLifeType = 'holo'
wallpaper: _types.NekosLifeType = 'wallpaper'
bj: _types.NekosLifeType = 'bj'
woof: _types.NekosLifeType = 'woof'
yuri: _types.NekosLifeType = 'yuri'
trap: _types.NekosLifeType = 'trap'
anal: _types.NekosLifeType = 'anal'
baka: _types.NekosLifeType = 'baka'
blowjob: _types.NekosLifeType = 'blowjob'
holoero: _types.NekosLifeType = 'holoero'
feed: _types.NekosLifeType = 'feed'
neko: _types.NekosLifeType = 'neko'
gasm: _types.NekosLifeType = 'gasm'
hentai: _types.NekosLifeType = 'hentai'
futanari: _types.NekosLifeType = 'futanari'
ero: _types.NekosLifeType = 'ero'
solo: _types.NekosLifeType = 'solo'
waifu: _types.NekosLifeType = 'waifu'
pwankg: _types.NekosLifeType = 'pwankg'
eron: _types.NekosLifeType = 'eron'
erokemo: _types.NekosLifeType = 'erokemo'

def get(query: str) -> Union[Models.Result, Coroutine[None, None, Models.Result]]:
def get(query: Union[_types.NekosLifeType, str]) -> Union[Models.Result, Coroutine[None, None, Models.Result]]:
"""Get picture from nekos.life
Args:
query (str): category or Parser.NekosLife.types.*
query (NekosLifeType): See Parser/asyncParser.NekosLife.types
Returns:
Models.Result
Expand All @@ -31,26 +97,26 @@ def get(query: str) -> Union[Models.Result, Coroutine[None, None, Models.Result]
class AnimeApiHisoka:
class types:
class SFW:
hug = "hug"
kiss = "kiss"
slap = "slap"
wink = "wink"
pat = "pat"
kill = "kill"
cuddle = "cuddle"
punch = "punch"
waifu = "waifu"
hug: _types.AnimeApiHisokaType = "hug"
kiss: _types.AnimeApiHisokaType = "kiss"
slap: _types.AnimeApiHisokaType = "slap"
wink: _types.AnimeApiHisokaType = "wink"
pat: _types.AnimeApiHisokaType = "pat"
kill: _types.AnimeApiHisokaType = "kill"
cuddle: _types.AnimeApiHisokaType = "cuddle"
punch: _types.AnimeApiHisokaType = "punch"
waifu: _types.AnimeApiHisokaType = "waifu"

class NSFW:
hentai = "hentai"
boobs = "boobs"
lesbian = "lesbian"
hentai: _types.AnimeApiHisokaType = "hentai"
boobs: _types.AnimeApiHisokaType = "boobs"
lesbian: _types.AnimeApiHisokaType = "lesbian"

def get(query: str, nsfw: bool = False) -> Union[Models.Result, Coroutine[None, None, Models.Result]]:
def get(query: Union[_types.AnimeApiHisokaType, str], nsfw: bool = False) -> Union[Models.Result, Coroutine[None, None, Models.Result]]:
"""Get picture from nime-api.hisoka17.repl.co
Args:
query (str): category or Parser.AnimeApiHisoka.types.*
query (AnimeApiHisokaType): See Parser/asyncParser.AnimeApiHisoka.types
Returns:
Models.Result
Expand Down
4 changes: 2 additions & 2 deletions example.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright 2021 D4n13l3k00.
# SPDX-License-Identifier: AGPL-3.0-or-later
# SPDX-License-Identifier: AGPL-3.0-or-later

import asyncio

Expand All @@ -8,7 +8,7 @@

def sync_example():
nk = Parser.NekosLife
print(nk.get(nk.types.neko).url)
print(nk.get(nk.types.spank).url)
ap = Parser.AniPics
print(ap.get().url)
aah = Parser.AnimeApiHisoka
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copyright 2021 D4n13l3k00.
# SPDX-License-Identifier: AGPL-3.0-or-later
# SPDX-License-Identifier: AGPL-3.0-or-later

from setuptools import setup

with open("README.md", "r") as fh:
long_description = fh.read()

setup(name='anipics',
version='1.2',
version='1.3',
description='Simple module for getting anime pictures',
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit e08862d

Please sign in to comment.