mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Python style fixes + unused imports removal in git cl and friends.
R=sergiyb@chromium.org BUG= Change-Id: I9b886100557bf6efa9be07d40175f7bb919f5294 Reviewed-on: https://chromium-review.googlesource.com/432456 Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org> Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
This commit is contained in:
committed by
Commit Bot
parent
18df0cdf0b
commit
1897532850
@@ -17,7 +17,6 @@ import logging
|
||||
import netrc
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import socket
|
||||
import stat
|
||||
import sys
|
||||
@@ -38,7 +37,6 @@ TRY_LIMIT = 5
|
||||
GERRIT_PROTOCOL = 'https'
|
||||
|
||||
|
||||
|
||||
class GerritError(Exception):
|
||||
"""Exception class for errors commuicating with the gerrit-on-borg service."""
|
||||
def __init__(self, http_status, *args, **kwargs):
|
||||
@@ -200,6 +198,7 @@ class CookiesAuthenticator(Authenticator):
|
||||
return 'Basic %s' % (base64.b64encode('%s:%s' % (auth[0], auth[2])))
|
||||
return None
|
||||
|
||||
|
||||
# Backwards compatibility just in case somebody imports this outside of
|
||||
# depot_tools.
|
||||
NetrcAuthenticator = CookiesAuthenticator
|
||||
@@ -255,7 +254,6 @@ class GceAuthenticator(Authenticator):
|
||||
if resp.status < httplib.INTERNAL_SERVER_ERROR:
|
||||
return resp
|
||||
|
||||
|
||||
@classmethod
|
||||
def _get_token_dict(cls):
|
||||
if cls._token_cache:
|
||||
@@ -277,7 +275,6 @@ class GceAuthenticator(Authenticator):
|
||||
return '%(token_type)s %(access_token)s' % token_dict
|
||||
|
||||
|
||||
|
||||
def CreateHttpConn(host, path, reqtype='GET', headers=None, body=None):
|
||||
"""Opens an https connection to a gerrit service, and sends a request."""
|
||||
headers = headers or {}
|
||||
|
||||
10
git_cl.py
10
git_cl.py
@@ -25,7 +25,6 @@ import re
|
||||
import stat
|
||||
import sys
|
||||
import textwrap
|
||||
import traceback
|
||||
import urllib
|
||||
import urllib2
|
||||
import urlparse
|
||||
@@ -44,7 +43,6 @@ from third_party import upload
|
||||
import auth
|
||||
import checkout
|
||||
import clang_format
|
||||
import commit_queue
|
||||
import dart_format
|
||||
import setup_color
|
||||
import fix_encoding
|
||||
@@ -2007,7 +2005,6 @@ class _RietveldChangelistImpl(_ChangelistCodereviewBase):
|
||||
assert new_state == _CQState.DRY_RUN
|
||||
self.SetFlags({'commit': '1', 'cq_dry_run': '1'})
|
||||
|
||||
|
||||
def CMDPatchWithParsedIssue(self, parsed_issue_arg, reject, nocommit,
|
||||
directory):
|
||||
# PatchIssue should never be called with a dirty tree. It is up to the
|
||||
@@ -2209,6 +2206,7 @@ class _RietveldChangelistImpl(_ChangelistCodereviewBase):
|
||||
self.SetPatchset(patchset)
|
||||
return 0
|
||||
|
||||
|
||||
class _GerritChangelistImpl(_ChangelistCodereviewBase):
|
||||
def __init__(self, changelist, auth_config=None):
|
||||
# auth_config is Rietveld thing, kept here to preserve interface only.
|
||||
@@ -3330,7 +3328,6 @@ def DownloadGerritHook(force):
|
||||
'chmod +x .git/hooks/commit-msg' % src)
|
||||
|
||||
|
||||
|
||||
def GetRietveldCodereviewSettingsInteractively():
|
||||
"""Prompt the user for settings."""
|
||||
server = settings.GetDefaultServerUrl(error_ok=True)
|
||||
@@ -3367,6 +3364,7 @@ def GetRietveldCodereviewSettingsInteractively():
|
||||
SetProperty(settings.GetRunPostUploadHook(), 'Run Post Upload Hook',
|
||||
'run-post-upload-hook', False)
|
||||
|
||||
|
||||
@subcommand.usage('[repo root containing codereview.settings]')
|
||||
def CMDconfig(parser, args):
|
||||
"""Edits configuration for this tree."""
|
||||
@@ -4578,7 +4576,7 @@ def CMDpatch(parser, args):
|
||||
parser.error('current branch must have an associated issue')
|
||||
|
||||
upstream = cl.GetUpstreamBranch()
|
||||
if upstream == None:
|
||||
if upstream is None:
|
||||
parser.error('No upstream branch specified. Cannot reset branch')
|
||||
|
||||
RunGit(['reset', '--hard', upstream])
|
||||
@@ -5000,10 +4998,12 @@ def BuildGitDiffCmd(diff_type, upstream_commit, args):
|
||||
|
||||
return diff_cmd
|
||||
|
||||
|
||||
def MatchingFileType(file_name, extensions):
|
||||
"""Returns true if the file name ends with one of the given extensions."""
|
||||
return bool([ext for ext in extensions if file_name.lower().endswith(ext)])
|
||||
|
||||
|
||||
@subcommand.usage('[files or directories to diff]')
|
||||
def CMDformat(parser, args):
|
||||
"""Runs auto-formatting tools (clang-format etc.) on the diff."""
|
||||
|
||||
@@ -83,6 +83,7 @@ def add_footer_change_id(message, change_id):
|
||||
return add_footer(message, 'Change-Id', change_id,
|
||||
after_keys=['Bug', 'Issue', 'Test', 'Feature'])
|
||||
|
||||
|
||||
def add_footer(message, key, value, after_keys=None):
|
||||
"""Returns a message with given footer appended.
|
||||
|
||||
@@ -163,7 +164,6 @@ def main(args):
|
||||
g.add_argument('--position-num', action='store_true')
|
||||
g.add_argument('--json', help="filename to dump JSON serialized headers to.")
|
||||
|
||||
|
||||
opts = parser.parse_args(args)
|
||||
|
||||
if opts.ref:
|
||||
|
||||
@@ -703,7 +703,7 @@ class TestGitCl(TestCase):
|
||||
'--cc', ','.join(['joe@example.com'] + cc),
|
||||
] + (['--private'] if private else []) + [
|
||||
'--git_similarity', similarity or '50'
|
||||
] + (['--git_no_find_copies'] if find_copies == False else []) + [
|
||||
] + (['--git_no_find_copies'] if find_copies is False else []) + [
|
||||
'fake_ancestor_sha', 'HEAD'
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user