mirror of
https://github.com/josegonzalez/python-github-backup.git
synced 2025-12-06 16:38:03 +01:00
Fix some linting
This commit is contained in:
@@ -110,6 +110,7 @@ def mkdir_p(*args):
|
||||
else:
|
||||
raise
|
||||
|
||||
|
||||
def mask_password(url, secret='*****'):
|
||||
parsed = urlparse(url)
|
||||
|
||||
@@ -120,6 +121,7 @@ def mask_password(url, secret='*****'):
|
||||
|
||||
return url.replace(parsed.password, secret)
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description='Backup a github account')
|
||||
parser.add_argument('user',
|
||||
@@ -268,7 +270,7 @@ def get_auth(args, encode=True):
|
||||
if not auth:
|
||||
return None
|
||||
|
||||
if encode == False:
|
||||
if not encode:
|
||||
return auth
|
||||
|
||||
return base64.b64encode(auth.encode('ascii'))
|
||||
@@ -291,6 +293,7 @@ def get_github_host(args):
|
||||
|
||||
return host
|
||||
|
||||
|
||||
def get_github_repo_url(args, repository):
|
||||
if args.prefer_ssh:
|
||||
return repository['ssh_url']
|
||||
@@ -307,6 +310,7 @@ def get_github_repo_url(args, repository):
|
||||
|
||||
return repo_url
|
||||
|
||||
|
||||
def retrieve_data(args, template, query_args=None, single_request=False):
|
||||
auth = get_auth(args)
|
||||
query_args = get_query_args(query_args)
|
||||
@@ -527,6 +531,7 @@ def backup_repositories(args, output_directory, repositories):
|
||||
if args.incremental:
|
||||
open(last_update_path, 'w').write(last_update)
|
||||
|
||||
|
||||
def backup_issues(args, repo_cwd, repository, repos_template):
|
||||
has_issues_dir = os.path.isdir('{0}/issues/.git'.format(repo_cwd))
|
||||
if args.skip_existing and has_issues_dir:
|
||||
@@ -675,7 +680,7 @@ def backup_hooks(args, repo_cwd, repository, repos_template):
|
||||
hook_cwd = os.path.join(repo_cwd, 'hooks')
|
||||
output_file = '{0}/hooks.json'.format(hook_cwd)
|
||||
template = '{0}/{1}/hooks'.format(repos_template,
|
||||
repository['full_name'])
|
||||
repository['full_name'])
|
||||
try:
|
||||
_backup_data(args,
|
||||
'hooks',
|
||||
|
||||
Reference in New Issue
Block a user