Permalink
Browse files

Fix: lint errors

  • Loading branch information...
randy3k committed Apr 10, 2018
1 parent 7673c3f commit 1abf7947a5acf4e5fce03843ba8e4e9ea2f0173a
@@ -9,7 +9,7 @@
Hunk = namedtuple("Hunk", ("raw_lines", "changes", "head_start", "head_length", "saved_start", "saved_length"))
Change = namedtuple("Change", ("raw", "type", "head_pos", "saved_pos", "text"))
re_metadata = re.compile("^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@")
re_metadata = re.compile(r"^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@")
def parse_diff(diff_str):
@@ -9,7 +9,7 @@
COMMIT_NODE_CHAR = ""
COMMIT_NODE_CHAR_OPTIONS = "●*"
COMMIT_LINE = re.compile("[%s][ /_\|\-.]*([a-z0-9]{3,})" % COMMIT_NODE_CHAR_OPTIONS)
COMMIT_LINE = re.compile(r"[%s][ /_\|\-.]*([a-z0-9]{3,})" % COMMIT_NODE_CHAR_OPTIONS)
class GsCompareCommitCommand(WindowCommand, GitCommand):
View
@@ -166,9 +166,9 @@ def run(self, edit, reset=False):
cursor_pts = tuple(cursor.a for cursor in self.view.sel() if cursor.a == cursor.b)
self.diff_starts = tuple(region.a for region in self.view.find_all("^diff"))
self.diff_header_ends = tuple(region.b for region in self.view.find_all("^\+\+\+.+\n(?=@@)"))
self.diff_header_ends = tuple(region.b for region in self.view.find_all(r"^\+\+\+.+\n(?=@@)"))
self.hunk_starts = tuple(region.a for region in self.view.find_all("^@@"))
hunk_starts_following_headers = {region.b for region in self.view.find_all("^\+\+\+.+\n(?=@@)")}
hunk_starts_following_headers = {region.b for region in self.view.find_all(r"^\+\+\+.+\n(?=@@)")}
self.hunk_ends = sorted(list(
# Hunks end when the next diff starts.
set(self.diff_starts[1:]) |
View
@@ -80,7 +80,7 @@ def run_async(self, **kwargs):
commiter_str = self.git("shortlog", "-sne", "HEAD")
for line in commiter_str.split('\n'):
m = re.search('\s*(\d*)\s*(.*)\s<(.*)>', line)
m = re.search(r'\s*(\d*)\s*(.*)\s<(.*)>', line)
if m is None:
continue
commit_count, author_name, author_email = m.groups()
@@ -10,7 +10,7 @@
COMMIT_NODE_CHAR = ""
COMMIT_NODE_CHAR_OPTIONS = "●*"
GRAPH_CHAR_OPTIONS = " /_\|\-."
GRAPH_CHAR_OPTIONS = r" /_\|\-."
COMMIT_LINE = re.compile(
"^[{graph_chars}]*[{node_chars}][{graph_chars}]* (?P<commit_hash>[a-f0-9]{{5,40}})".format(
graph_chars=GRAPH_CHAR_OPTIONS, node_chars=COMMIT_NODE_CHAR_OPTIONS))
@@ -69,7 +69,7 @@ def run(self, edit):
args = self.view.settings().get("git_savvy.git_graph_args")
graph_content += self.git(*args)
graph_content = re.sub(
'(^[{}]*)\*'.format(GRAPH_CHAR_OPTIONS),
r'(^[{}]*)\*'.format(GRAPH_CHAR_OPTIONS),
r'\1' + COMMIT_NODE_CHAR, graph_content,
flags=re.MULTILINE)
@@ -107,7 +107,7 @@ def run_async(self):
commiter_str = self.git("shortlog", "-sne", "HEAD")
for line in commiter_str.split('\n'):
m = re.search('\s*(\d*)\s*(.*)\s<(.*)>', line)
m = re.search(r'\s*(\d*)\s*(.*)\s<(.*)>', line)
if m is None:
continue
commit_count, author_name, author_email = m.groups()
View
@@ -317,10 +317,9 @@ def git_binary_path(self):
major = int(match.group(1))
minor = int(match.group(2))
patch = int(match.group(3))
if major < GIT_REQUIRE_MAJOR or \
(major == GIT_REQUIRE_MAJOR and minor < GIT_REQUIRE_MINOR) or \
(major == GIT_REQUIRE_MAJOR and minor == GIT_REQUIRE_MINOR and
patch < GIT_REQUIRE_PATCH):
if major < GIT_REQUIRE_MAJOR \
or (major == GIT_REQUIRE_MAJOR and minor < GIT_REQUIRE_MINOR) \
or (major == GIT_REQUIRE_MAJOR and minor == GIT_REQUIRE_MINOR and patch < GIT_REQUIRE_PATCH):
msg = GIT_TOO_OLD_MSG.format(
GIT_REQUIRE_MAJOR,
GIT_REQUIRE_MINOR,
@@ -42,8 +42,8 @@ def _get_branch_status_components(self):
valid_punctuation = "".join(c for c in string.punctuation if c not in "~^:?*[\\")
branch_pattern = "[A-Za-z0-9" + re.escape(valid_punctuation) + "\u263a-\U0001f645]+?"
branch_suffix = "( \[((ahead (\d+))(, )?)?(behind (\d+))?(gone)?\])?)"
short_status_pattern = "## (" + branch_pattern + ")(\.\.\.(" + branch_pattern + ")" + branch_suffix + "?$"
branch_suffix = r"( \[((ahead (\d+))(, )?)?(behind (\d+))?(gone)?\])?)"
short_status_pattern = "## (" + branch_pattern + r")(\.\.\.(" + branch_pattern + ")" + branch_suffix + "?$"
status_match = re.match(short_status_pattern, first_line)
if not status_match:
@@ -73,7 +73,7 @@ def project_name_from_url(self, input_url):
# git@github.com:divmain/GitSavvy.git
# Kind of funky, but does the job
_split_url = re.split('/|:', input_url)
_split_url = re.split('\.', _split_url[-1])
_split_url = re.split(r'\.', _split_url[-1])
return _split_url[0] if len(_split_url) >= 1 else ''
def username_from_url(self, input_url):
@@ -15,7 +15,7 @@
COMMIT_NODE_CHAR = ""
COMMIT_NODE_CHAR_OPTIONS = "●*"
COMMIT_LINE = re.compile("\s*[%s]\s*([a-z0-9]{3,})" % COMMIT_NODE_CHAR_OPTIONS)
COMMIT_LINE = re.compile(r"\s*[%s]\s*([a-z0-9]{3,})" % COMMIT_NODE_CHAR_OPTIONS)
NEAREST_NODE_PATTERN = re.compile(r'.*\*.*\[(.*?)(?:(?:[\^\~]+[\d]*){1})\]') # http://regexr.com/3gm03
NOT_A_COMMIT_SHA = 'not_a_commit_sha'
View
@@ -1,4 +1,4 @@
[pycodestyle]
count = False
ignore = E401
ignore = E401, W503, W504
max-line-length = 120

0 comments on commit 1abf794

Please sign in to comment.