temporary commit (read desc)

**This commit needs to be squashed!**

- establish general project structure
- put together a simple gitea wrapper
  - probably should be replaced with giteapy (see README.md)
This commit is contained in:
randomuser 2024-03-24 18:15:31 -05:00
parent 9ba4609ce8
commit bdf00e6324
7 changed files with 43 additions and 0 deletions

View File

View File

@ -0,0 +1,3 @@
from cli import main
main()

2
gitea_github_sync/cli.py Normal file
View File

@ -0,0 +1,2 @@
import argparse

View File

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,2 @@
class GiteaIssue:

View File

@ -0,0 +1,35 @@
from urllib.parse import urlparse
def urlparse_w(url):
parseresult = urlparse(url)
splitted_path = parseresult.path.split('/')
# add some more metadata
gitea_username = splitted_path[1]
gitea_reponame = splitted_path[2]
return {
"raw": parseresult,
"username": gitea_username,
"reponame": gitea_reponame,
}
class GiteaRepo:
def __init__(self, urlspec):
"""
Return a GiteaRepo from a urlspec (see urllib.parse.ParseResult) and some other metadata
For implementation details, see urlparse_w.
If you want to take an actual url, use the .from_url classmethod.
"""
self.urlspec = urlspec
@classmethod
def from_url(cls, url):
"""
Return a GiteaRepo from a url.
"""
parsed = urlparse_w(url)
return cls(parsed)