Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
betodealmeida committed Jul 31, 2024
1 parent 1f09be6 commit a38b8ca
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/shillelagh/adapters/api/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ class Column:
Column("assignees", "assignees[*].login", JSONString()),
Column("reactions", "reactions", JSONString()),
],
"stats/punch_card": [
Column("dow", "$.[0]", Integer()),
Column("hour", "$.[1]", Integer()),
Column("commits", "$.[2]", Integer()),
],
"stats/participation": [
Column("all", "all", JSONString()),
Column("owner", "owner", JSONString()),
],
},
}

Expand All @@ -115,11 +124,11 @@ class GitHubAPI(Adapter):
def supports(uri: str, fast: bool = True, **kwargs: Any) -> Optional[bool]:
parsed = urllib.parse.urlparse(uri)

if parsed.path.count("/") != 4:
if parsed.path.count("/") <= 4:
return False

# pylint: disable=unused-variable
_, base, owner, repo, resource = parsed.path.rsplit("/", 4)
_, base, owner, repo, resource = parsed.path.split("/", 4)
return (
parsed.netloc == "api.github.com"
and base in TABLES
Expand All @@ -129,7 +138,7 @@ def supports(uri: str, fast: bool = True, **kwargs: Any) -> Optional[bool]:
@staticmethod
def parse_uri(uri: str) -> Tuple[str, str, str, str]:
parsed = urllib.parse.urlparse(uri)
_, base, owner, repo, resource = parsed.path.rsplit("/", 4)
_, base, owner, repo, resource = parsed.path.split("/", 4)
return (
base,
owner,
Expand Down

0 comments on commit a38b8ca

Please sign in to comment.