update
This commit is contained in:
parent
c76fecf528
commit
4951c06b70
12
action.yml
Normal file
12
action.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
name: "Leetcode - Readme"
|
||||||
|
author: "Smart-SangGe"
|
||||||
|
description: "Leetcode graph in your profile readme"
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
LEETCODE_USERNAME:
|
||||||
|
description: "Leetcode username"
|
||||||
|
required: true
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "docker"
|
||||||
|
image: "dockerfile"
|
101
main.py
Normal file
101
main.py
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
"""
|
||||||
|
Leetcode status visualizer!
|
||||||
|
Contains status bar and skills box
|
||||||
|
|
||||||
|
status bar like this:
|
||||||
|
|
||||||
|
```txt
|
||||||
|
Total solved: xxx
|
||||||
|
|
||||||
|
Easy: xxx/xxx Beats xx%
|
||||||
|
XXXX..........
|
||||||
|
|
||||||
|
Medium: xxx/xxx Beats xx%
|
||||||
|
XXXX..........
|
||||||
|
|
||||||
|
Hard: xxx/xxx Beats xx%
|
||||||
|
XXXX..........
|
||||||
|
```
|
||||||
|
|
||||||
|
skills box like this:
|
||||||
|
|
||||||
|
```txt
|
||||||
|
Top Leetcode Skills
|
||||||
|
|
||||||
|
1. Divide and Conquer (1) XXXXX..... Advanced
|
||||||
|
2. Trie (1) XXXXX..... Advanced
|
||||||
|
3. Hash Table (1) XXXXX..... Intermediate
|
||||||
|
4. Math (3) XXXXX..... Intermediate
|
||||||
|
5. Recursion (1) XX........ Intermediate
|
||||||
|
```
|
||||||
|
"""
|
||||||
|
|
||||||
|
# standard
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
|
||||||
|
# external
|
||||||
|
|
||||||
|
from gitea import *
|
||||||
|
import requests
|
||||||
|
|
||||||
|
############## data ##################
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True)
|
||||||
|
class LeetcodeInput:
|
||||||
|
"""Leetcode Input Env Varidables."""
|
||||||
|
|
||||||
|
# constants
|
||||||
|
prefix_length: int = 16
|
||||||
|
graph_length: int = 25
|
||||||
|
|
||||||
|
# mapped env var
|
||||||
|
# # required
|
||||||
|
gitea_token: str = os.getenv("GITHUB_TOKEN")
|
||||||
|
gitea_url: str = os.getenv("GITHUB_SERVER_URL")
|
||||||
|
leetcode_username: str = os.getenv("USERNAME")
|
||||||
|
|
||||||
|
# # depends
|
||||||
|
commit_message: str = os.getenv("INPUT_COMMIT_MESSAGE", "Update leetcode status")
|
||||||
|
|
||||||
|
def validate_input(self) -> bool:
|
||||||
|
"""Validate Input Env Var"""
|
||||||
|
if not self.gitea_token or not self.gitea_url or not self.leetcode_username:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
############# logic ###################
|
||||||
|
|
||||||
|
|
||||||
|
def make_title() -> str:
|
||||||
|
"""Count total solved number"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def make_graph() -> str:
|
||||||
|
"""Make graph from the API's data"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def fetch_data() -> str:
|
||||||
|
"""Fetch data from leetcode api"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def genesis() -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
lc_i = LeetcodeInput()
|
||||||
|
if not lc_i.validate_input():
|
||||||
|
print("Input error")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
genesis()
|
||||||
|
|
||||||
|
print("\nThanks for using Leetcode readme")
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
py-gitea>=0.2.6
|
Loading…
x
Reference in New Issue
Block a user