|
15 | 15 | class GithubDependentsInfo:
|
16 | 16 | def __init__(self, repo, **options) -> None:
|
17 | 17 | self.repo = repo
|
18 |
| - self.outputrepo = self.repo if "outputrepo" not in options else options["outputrepo"] |
19 |
| - if self.outputrepo is None or self.outputrepo == "" or len(self.outputrepo) < 4: |
| 18 | + self.outputrepo = options.get("outputrepo", self.repo) |
| 19 | + if len(self.outputrepo or "") < 4: |
20 | 20 | self.outputrepo = self.repo
|
21 | 21 | self.url_init = f"https://github.com/{self.repo}/network/dependents"
|
22 |
| - self.url_starts_with = f"/{self.repo}/network/dependents" + "?package_id=" |
23 |
| - self.sort_key = "name" if "sort_key" not in options else options["sort_key"] |
24 |
| - self.min_stars = None if "min_stars" not in options else options["min_stars"] |
25 |
| - self.json_output = True if "json_output" in options and options["json_output"] is True else False |
26 |
| - self.merge_packages = True if "merge_packages" in options and options["merge_packages"] is True else False |
27 |
| - self.doc_url = options["doc_url"] if "doc_url" in options else None |
28 |
| - self.markdown_file = options["markdown_file"] if "markdown_file" in options else None |
29 |
| - self.badge_color = options["badge_color"] if "badge_color" in options else "informational" |
30 |
| - self.debug = True if "debug" in options and options["debug"] is True else False |
31 |
| - self.overwrite_progress = ( |
32 |
| - True if "overwrite_progress" in options and options["overwrite_progress"] is True else False |
33 |
| - ) |
34 |
| - self.csv_directory = ( |
35 |
| - Path(options["csv_directory"]) |
36 |
| - if ("csv_directory" in options and options["csv_directory"] is not None) |
37 |
| - else None |
38 |
| - ) |
| 22 | + self.url_starts_with = f"/{self.repo}/network/dependents?package_id=" |
| 23 | + self.sort_key = options.get("sort_key", "name") |
| 24 | + self.min_stars = options.get("min_stars") |
| 25 | + self.json_output = bool(options.get("json_output")) |
| 26 | + self.merge_packages = bool(options.get("merge_packages")) |
| 27 | + self.doc_url = options.get("doc_url") |
| 28 | + self.markdown_file = options.get("markdown_file") |
| 29 | + self.badge_color = options.get("badge_color", "informational") |
| 30 | + self.debug = bool(options.get("debug")) |
| 31 | + self.overwrite_progress = (bool(options.get("overwrite_progress"))) |
| 32 | + self.csv_directory = Path(options.get("csv_directory")) |
39 | 33 | self.total_sum = 0
|
40 | 34 | self.total_public_sum = 0
|
41 | 35 | self.total_private_sum = 0
|
|
0 commit comments