github-backup 0.47.0__py3-none-any.whl → 0.48.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
github_backup/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.47.0"
1
+ __version__ = "0.48.0"
@@ -19,12 +19,12 @@ import ssl
19
19
  import subprocess
20
20
  import sys
21
21
  import time
22
+ from datetime import datetime
22
23
  from http.client import IncompleteRead
23
24
  from urllib.error import HTTPError, URLError
24
25
  from urllib.parse import quote as urlquote
25
26
  from urllib.parse import urlencode, urlparse
26
27
  from urllib.request import HTTPRedirectHandler, Request, build_opener, urlopen
27
- from datetime import datetime
28
28
 
29
29
  try:
30
30
  from . import __version__
@@ -40,16 +40,21 @@ logger = logging.getLogger(__name__)
40
40
  https_ctx = ssl.create_default_context()
41
41
  if not https_ctx.get_ca_certs():
42
42
  import warnings
43
- warnings.warn('\n\nYOUR DEFAULT CA CERTS ARE EMPTY.\n' +
44
- 'PLEASE POPULATE ANY OF:' +
45
- ''.join([
46
- '\n - ' + x
47
- for x in ssl.get_default_verify_paths()
48
- if type(x) is str
49
- ]) + '\n', stacklevel=2)
43
+
44
+ warnings.warn(
45
+ "\n\nYOUR DEFAULT CA CERTS ARE EMPTY.\n"
46
+ + "PLEASE POPULATE ANY OF:"
47
+ + "".join(
48
+ ["\n - " + x for x in ssl.get_default_verify_paths() if type(x) is str]
49
+ )
50
+ + "\n",
51
+ stacklevel=2,
52
+ )
50
53
  import certifi
54
+
51
55
  https_ctx = ssl.create_default_context(cafile=certifi.where())
52
56
 
57
+
53
58
  def logging_subprocess(
54
59
  popenargs, stdout_log_level=logging.DEBUG, stderr_log_level=logging.ERROR, **kwargs
55
60
  ):
@@ -524,7 +529,7 @@ def get_github_host(args):
524
529
 
525
530
 
526
531
  def read_file_contents(file_uri):
527
- return open(file_uri[len(FILE_URI_PREFIX):], "rt").readline().strip()
532
+ return open(file_uri[len(FILE_URI_PREFIX) :], "rt").readline().strip()
528
533
 
529
534
 
530
535
  def get_github_repo_url(args, repository):
@@ -795,13 +800,15 @@ def download_file(url, path, auth, as_app=False, fine=False):
795
800
  if os.path.exists(path):
796
801
  return
797
802
 
798
- request = _construct_request(per_page=100,
799
- page=1,
800
- query_args={},
801
- template=url,
802
- auth=auth,
803
- as_app=as_app,
804
- fine=fine)
803
+ request = _construct_request(
804
+ per_page=100,
805
+ page=1,
806
+ query_args={},
807
+ template=url,
808
+ auth=auth,
809
+ as_app=as_app,
810
+ fine=fine,
811
+ )
805
812
  request.add_header("Accept", "application/octet-stream")
806
813
  opener = build_opener(S3HTTPRedirectHandler)
807
814
 
@@ -944,11 +951,15 @@ def filter_repositories(args, unfiltered_repositories):
944
951
  if r.get("language") and r.get("language").lower() in languages
945
952
  ] # noqa
946
953
  if name_regex:
947
- repositories = [r for r in repositories if "name" not in r or name_regex.match(r["name"])]
954
+ repositories = [
955
+ r for r in repositories if "name" not in r or name_regex.match(r["name"])
956
+ ]
948
957
  if args.skip_archived:
949
958
  repositories = [r for r in repositories if not r.get("archived")]
950
959
  if args.exclude:
951
- repositories = [r for r in repositories if "name" not in r or r["name"] not in args.exclude]
960
+ repositories = [
961
+ r for r in repositories if "name" not in r or r["name"] not in args.exclude
962
+ ]
952
963
 
953
964
  return repositories
954
965
 
@@ -1244,10 +1255,16 @@ def backup_releases(args, repo_cwd, repository, repos_template, include_assets=F
1244
1255
  if args.skip_prerelease:
1245
1256
  releases = [r for r in releases if not r["prerelease"] and not r["draft"]]
1246
1257
 
1247
- if args.number_of_latest_releases and args.number_of_latest_releases < len(releases):
1248
- releases.sort(key=lambda item: datetime.strptime(item["created_at"], "%Y-%m-%dT%H:%M:%SZ"),
1249
- reverse=True)
1250
- releases = releases[:args.number_of_latest_releases]
1258
+ if args.number_of_latest_releases and args.number_of_latest_releases < len(
1259
+ releases
1260
+ ):
1261
+ releases.sort(
1262
+ key=lambda item: datetime.strptime(
1263
+ item["created_at"], "%Y-%m-%dT%H:%M:%SZ"
1264
+ ),
1265
+ reverse=True,
1266
+ )
1267
+ releases = releases[: args.number_of_latest_releases]
1251
1268
  logger.info("Saving the latest {0} releases to disk".format(len(releases)))
1252
1269
  else:
1253
1270
  logger.info("Saving {0} releases to disk".format(len(releases)))
@@ -1274,7 +1291,7 @@ def backup_releases(args, repo_cwd, repository, repos_template, include_assets=F
1274
1291
  os.path.join(release_assets_cwd, asset["name"]),
1275
1292
  get_auth(args, encode=not args.as_app),
1276
1293
  as_app=args.as_app,
1277
- fine=True if args.token_fine is not None else False
1294
+ fine=True if args.token_fine is not None else False,
1278
1295
  )
1279
1296
 
1280
1297
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: github-backup
3
- Version: 0.47.0
3
+ Version: 0.48.0
4
4
  Summary: backup a github user or organization
5
5
  Home-page: http://github.com/josegonzalez/python-github-backup
6
6
  Author: Jose Diaz-Gonzalez
@@ -186,7 +186,7 @@ Customise the permissions for your use case, but for a personal account full bac
186
186
 
187
187
  **User permissions**: Read access to followers, starring, and watching.
188
188
 
189
- **Repository permissions**: Read access to code, commit statuses, issues, metadata, pages, pull requests, and repository hooks.
189
+ **Repository permissions**: Read access to contents, issues, metadata, pull requests, and webhooks.
190
190
 
191
191
 
192
192
  Prefer SSH
@@ -244,7 +244,7 @@ Gotchas / Known-issues
244
244
  All is not everything
245
245
  ---------------------
246
246
 
247
- The ``--all`` argument does not include: cloning private repos (``-P, --private``), cloning forks (``-F, --fork``), cloning starred repositories (``--all-starred``), ``--pull-details``, cloning LFS repositories (``--lfs``), cloning gists (``--starred-gists``) or cloning starred gist repos (``--starred-gists``). See examples for more.
247
+ The ``--all`` argument does not include: cloning private repos (``-P, --private``), cloning forks (``-F, --fork``), cloning starred repositories (``--all-starred``), ``--pull-details``, cloning LFS repositories (``--lfs``), cloning gists (``--gists``) or cloning starred gist repos (``--starred-gists``). See examples for more.
248
248
 
249
249
  Cloning all starred size
250
250
  ------------------------
@@ -273,12 +273,6 @@ It's therefore recommended to only use the incremental argument if the output/re
273
273
 
274
274
  This is due to needing the correct permission for ``--hooks`` on public repos.
275
275
 
276
- 2. **Releases blocking**
277
-
278
- A known ``--releases`` (required for ``--assets``) error will sometimes block the backup.
279
-
280
- If you're backing up a lot of repositories with releases e.g. an organisation or ``--all-starred``. You may need to remove ``--releases`` (and therefore ``--assets``) to complete a backup. Documented in `issue 209 <https://github.com/josegonzalez/python-github-backup/issues/209>`_.
281
-
282
276
 
283
277
  "bare" is actually "mirror"
284
278
  ---------------------------
@@ -0,0 +1,9 @@
1
+ github_backup/__init__.py,sha256=bkYe4lEQZCEmFm0XRZaZkxTV1niMqR_lbp-tzKL6s6c,23
2
+ github_backup/github_backup.py,sha256=ELVxSHe9i0UzDqaPx3tC7sdDnEClI_nnkJUm51qPPWE,48657
3
+ github_backup-0.48.0.data/scripts/github-backup,sha256=I79TNA67phytRmI9nm_LlD9h2zauXFOsOn9tYyAy9pU,1546
4
+ github_backup-0.48.0.dist-info/LICENSE.txt,sha256=ML-pLyn1qtAKo_DHMcQ8-p7k3f8cp-IR-mf5B49R2rk,1085
5
+ github_backup-0.48.0.dist-info/METADATA,sha256=sMZG88IfiXq7Zg_ae6M4DIWYezMrw_BJJQSTHQXOifA,18847
6
+ github_backup-0.48.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
7
+ github_backup-0.48.0.dist-info/top_level.txt,sha256=Za6fKRAlxZ0b3ZBH_osPqklLe14LetdNAkvAQANT2AA,14
8
+ github_backup-0.48.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
9
+ github_backup-0.48.0.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- github_backup/__init__.py,sha256=aqLqdmGXCjcE1UvvJF8OHznHKbGMeoRrk-C4_mjzdPs,23
2
- github_backup/github_backup.py,sha256=h6lu2QBhjx5yHrSA0ocQ3xga0GdJuj4yG92zJZYtz-0,48732
3
- github_backup-0.47.0.data/scripts/github-backup,sha256=I79TNA67phytRmI9nm_LlD9h2zauXFOsOn9tYyAy9pU,1546
4
- github_backup-0.47.0.dist-info/LICENSE.txt,sha256=ML-pLyn1qtAKo_DHMcQ8-p7k3f8cp-IR-mf5B49R2rk,1085
5
- github_backup-0.47.0.dist-info/METADATA,sha256=Yokav5VhHSroGqxzvkvXZSSPRrD4K4t9vGsCSt1H0Mg,19291
6
- github_backup-0.47.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
7
- github_backup-0.47.0.dist-info/top_level.txt,sha256=Za6fKRAlxZ0b3ZBH_osPqklLe14LetdNAkvAQANT2AA,14
8
- github_backup-0.47.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
9
- github_backup-0.47.0.dist-info/RECORD,,