(format) format
Browse files
clean/clean_meta.py
CHANGED
|
@@ -78,8 +78,12 @@ def main():
|
|
| 78 |
updated_after: Optional[str] = cfg.get("updated_after") # ISO date string
|
| 79 |
include_owners: List[str] = cfg.get("include_owners", [])
|
| 80 |
exclude_owners: List[str] = cfg.get("exclude_owners", [])
|
| 81 |
-
include_repo_name_substrings: List[str] = cfg.get(
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
df0 = pd.read_parquet(in_meta)
|
| 85 |
total = len(df0)
|
|
|
|
| 78 |
updated_after: Optional[str] = cfg.get("updated_after") # ISO date string
|
| 79 |
include_owners: List[str] = cfg.get("include_owners", [])
|
| 80 |
exclude_owners: List[str] = cfg.get("exclude_owners", [])
|
| 81 |
+
include_repo_name_substrings: List[str] = cfg.get(
|
| 82 |
+
"include_repo_name_substrings", []
|
| 83 |
+
)
|
| 84 |
+
exclude_repo_name_substrings: List[str] = cfg.get(
|
| 85 |
+
"exclude_repo_name_substrings", []
|
| 86 |
+
)
|
| 87 |
|
| 88 |
df0 = pd.read_parquet(in_meta)
|
| 89 |
total = len(df0)
|
data_collection_utils/github_api_utils.py
CHANGED
|
@@ -81,7 +81,9 @@ def request_json(
|
|
| 81 |
return None
|
| 82 |
|
| 83 |
|
| 84 |
-
def find_readme_file(
|
|
|
|
|
|
|
| 85 |
"""
|
| 86 |
Find a README file located at the repository root using the Contents API.
|
| 87 |
|
|
@@ -119,12 +121,18 @@ def find_readme_file(owner: str, repo: str, ref: Optional[str] = None) -> Option
|
|
| 119 |
name = best.get("name")
|
| 120 |
path = best.get("path")
|
| 121 |
download_url = best.get("download_url")
|
| 122 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
return {"name": name, "path": path, "download_url": download_url}
|
| 124 |
return None
|
| 125 |
|
| 126 |
|
| 127 |
-
def download_readme_to(
|
|
|
|
|
|
|
| 128 |
"""
|
| 129 |
Locate README at repo root and download it into dest_root/NAME.
|
| 130 |
Returns the README info dict if downloaded, else None.
|
|
|
|
| 81 |
return None
|
| 82 |
|
| 83 |
|
| 84 |
+
def find_readme_file(
|
| 85 |
+
owner: str, repo: str, ref: Optional[str] = None
|
| 86 |
+
) -> Optional[Dict[str, str]]:
|
| 87 |
"""
|
| 88 |
Find a README file located at the repository root using the Contents API.
|
| 89 |
|
|
|
|
| 121 |
name = best.get("name")
|
| 122 |
path = best.get("path")
|
| 123 |
download_url = best.get("download_url")
|
| 124 |
+
if (
|
| 125 |
+
isinstance(name, str)
|
| 126 |
+
and isinstance(path, str)
|
| 127 |
+
and isinstance(download_url, str)
|
| 128 |
+
):
|
| 129 |
return {"name": name, "path": path, "download_url": download_url}
|
| 130 |
return None
|
| 131 |
|
| 132 |
|
| 133 |
+
def download_readme_to(
|
| 134 |
+
owner: str, repo: str, dest_root, ref: Optional[str] = None
|
| 135 |
+
) -> Optional[Dict[str, str]]:
|
| 136 |
"""
|
| 137 |
Locate README at repo root and download it into dest_root/NAME.
|
| 138 |
Returns the README info dict if downloaded, else None.
|