-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: snake_case * chore: remove unneeded f-strings * chore: typos * chore: bless codebase * fix: oooopsss * refactor: update logging
- Loading branch information
Showing
9 changed files
with
129 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
__pycache__ | ||
__pycache__ | ||
.idea | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,48 @@ | ||
from anilist_readme.graphql import grapql | ||
from anilist_readme.actions_utils import actions_input, add_secret | ||
from anilist_readme.config import ANILIST_QUERY | ||
from anilist_readme.actions_utils import actionsInput, add_secret | ||
from anilist_readme.list_activity import ListActivity, validLanguage | ||
from anilist_readme.readme_actions import find_readme, open_readme, update_readme | ||
from anilist_readme.git import git_add_commit_push | ||
from anilist_readme.graphql import grapql | ||
from anilist_readme.list_activity import ListActivity, validate_language | ||
from anilist_readme.readme_actions import find_readme, open_readme, update_readme | ||
|
||
|
||
def main( | ||
user_id: str, | ||
preferred_language: str, | ||
max_post_count: str, | ||
readme_path: str, | ||
commit_message: str, | ||
gh_token: str, | ||
commit_email: str, | ||
commit_username: str, | ||
user_id: str, | ||
preferred_language: str, | ||
max_post_count: str, | ||
readme_path: str, | ||
commit_message: str, | ||
gh_token: str, | ||
commit_email: str, | ||
commit_username: str, | ||
): | ||
validLanguage(preferred_language) | ||
language = validate_language(preferred_language) | ||
|
||
response = grapql(ANILIST_QUERY, {"id": int(user_id), "post_count": int(max_post_count)}) | ||
parsed = [ListActivity(activity, preferred_language) for activity in response["data"]["Page"]["activities"]] | ||
parsed = [ListActivity(activity, language) for activity in response["data"]["Page"]["activities"]] | ||
readme = open_readme(readme_path) | ||
update_readme(readme, readme_path, parsed) | ||
add_secret(gh_token) | ||
git_add_commit_push(readme_path, commit_message, gh_token, commit_email, commit_username) | ||
|
||
|
||
if __name__ == "__main__": | ||
user_id: str = actionsInput("USER_ID", False) | ||
preferred_language = actionsInput("PREFERRED_LANGUAGE", False) | ||
max_post_count = int(actionsInput("MAX_POST_COUNT", False)) | ||
readme_path = actionsInput("README_PATH") or find_readme() | ||
commit_message = actionsInput("COMMIT_MESSAGE", False) | ||
gh_token = actionsInput("GH_TOKEN", False) | ||
commit_email = actionsInput("COMMIT_EMAIL", False) | ||
commit_username = actionsInput("COMMIT_USERNAME", False) | ||
user_id = actions_input("USER_ID", optional=False) | ||
preferred_language = actions_input("PREFERRED_LANGUAGE", optional=False) | ||
max_post_count = actions_input("MAX_POST_COUNT", optional=False) | ||
readme_path = actions_input("README_PATH", optional=True) or find_readme() | ||
commit_message = actions_input("COMMIT_MESSAGE", optional=False) | ||
gh_token = actions_input("GH_TOKEN", optional=False) | ||
commit_email = actions_input("COMMIT_EMAIL", optional=False) | ||
commit_username = actions_input("COMMIT_USERNAME", optional=False) | ||
|
||
main( | ||
user_id, | ||
preferred_language, | ||
max_post_count, | ||
readme_path, | ||
commit_message, | ||
gh_token, | ||
commit_email, | ||
commit_username, | ||
user_id=user_id, | ||
preferred_language=preferred_language, | ||
max_post_count=max_post_count, | ||
readme_path=readme_path, | ||
commit_message=commit_message, | ||
gh_token=gh_token, | ||
commit_email=commit_email, | ||
commit_username=commit_username, | ||
) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import logging | ||
|
||
logger = logging.getLogger("AniList") | ||
logger.setLevel(logging.INFO) | ||
|
||
handler = logging.StreamHandler() | ||
handler.setFormatter(logging.Formatter(fmt='%(asctime)s [%(levelname)s] - %(name)s: %(message)s', | ||
datefmt="%x %X")) | ||
|
||
logger.addHandler(handler) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters