Skip to content

Commit 08f7c26

Browse files
committed
👕 make lint process pass and update coding style
1 parent 8795471 commit 08f7c26

File tree

9 files changed

+29
-31
lines changed

9 files changed

+29
-31
lines changed

.moban.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
configuration:
22
template_dir:
3-
- "git://github.com/moremoban/pypi-mobans.git?submodule=true!/templates"
3+
- "git://github.com/moremoban/pypi-mobans.git?submodule=true&branch=dev!/templates"
44
- ".moban.d"
55
configuration: gitfs2.yml
66
targets:

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ stages:
3737
submodules: false
3838
python: 3.6
3939
stage: lint
40-
install: pip install flake8
41-
script: flake8
40+
script: make lint
4241

4342
.moban: &moban
4443
<<: *disable_global

gitfs2.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ entry_points:
1717
- "git = gitfs2:GitFSOpener"
1818
description: "Python file system 2 over GitPython"
1919
moban_command: make format git-diff-check
20+
lint_command: make lint

gitfs2/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# flake8: noqa
2-
from gitfs2._version import __version__
3-
from gitfs2._version import __author__
42
from gitfs2.opener import GitFSOpener
3+
from gitfs2._version import __author__, __version__

gitfs2/opener.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,20 @@ class GitFSOpener(Opener):
1010
def open_fs(self, fs_url, parse_result, writeable, create, cwd):
1111
repo_name, _, dir_path = parse_result.resource.partition("/")
1212
git_url = "{protocol}://{resource}".format(
13-
protocol=parse_result.protocol,
14-
resource=parse_result.resource
13+
protocol=parse_result.protocol, resource=parse_result.resource
1514
)
1615
require = repo.GitRequire(
1716
git_url=git_url,
18-
branch=parse_result.params.get('branch'),
19-
submodule=parse_result.params.get('submodule'),
20-
reference=parse_result.params.get('reference')
17+
branch=parse_result.params.get("branch"),
18+
submodule=parse_result.params.get("submodule"),
19+
reference=parse_result.params.get("reference"),
2120
)
2221
local_folder = repo.git_clone(
23-
require,
24-
action_required=GitFSOpener.update)
22+
require, action_required=GitFSOpener.update
23+
)
2524
if GitFSOpener.update:
2625
GitFSOpener.update = False
2726
if parse_result.path:
28-
local_folder = local_folder+parse_result.path
27+
local_folder = local_folder + parse_result.path
2928
osfs = OSFS(root_path=local_folder)
3029
return osfs

gitfs2/repo.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import fs
77
import fs.path
8-
from gitfs2 import constants, reporter
8+
from gitfs2 import reporter, constants
99

1010

1111
class GitRequire(object):
@@ -41,7 +41,7 @@ def __repr__(self):
4141

4242

4343
def convert_submodule(submodule_string):
44-
if submodule_string in ['1', 'True', 'true']:
44+
if submodule_string in ["1", "True", "true"]:
4545
return True
4646
return False
4747

@@ -93,9 +93,7 @@ def get_repo_name(repo_url):
9393
repo = giturlparse.parse(repo_url.rstrip("/"))
9494
return repo.name
9595
except ParserError:
96-
reporter.error(
97-
constants.MESSAGE_INVALID_GIT_URL % repo_url
98-
)
96+
reporter.error(constants.MESSAGE_INVALID_GIT_URL % repo_url)
9997
raise
10098

10199

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#!/usr/bin/env python3
22

3+
import os
4+
import sys
35
# Template by pypi-mobans
46
import codecs
57
import locale
6-
import os
78
import platform
8-
import sys
99
from shutil import rmtree
1010

11-
from setuptools import Command, find_packages, setup
11+
from setuptools import Command, setup, find_packages
1212

1313
PY2 = sys.version_info[0] == 2
1414
PY26 = PY2 and sys.version_info[1] < 7

tests/test_gitfs_opener.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
import fs
2+
from gitfs2.repo import GitRequire
3+
24
from mock import patch
35
from nose.tools import ok_
4-
from gitfs2.repo import GitRequire
56

67

78
@patch("gitfs2.repo.git_clone")
89
def test_opener(fake_clone):
9-
fake_clone.return_value = '.'
10+
fake_clone.return_value = "."
1011
url = "git://github.com/moremoban/pypi-mobans.git?submodule=true!/tests"
1112
file_system = fs.open_fs(url)
12-
ok_(file_system.exists(u'test_gitfs_opener.py'))
13+
ok_(file_system.exists(u"test_gitfs_opener.py"))
1314
fake_clone.assert_called_with(
1415
GitRequire(
15-
git_url='git://github.com/moremoban/pypi-mobans.git',
16-
submodule='true',
16+
git_url="git://github.com/moremoban/pypi-mobans.git",
17+
submodule="true",
1718
),
18-
action_required=True
19+
action_required=True,
1920
)

tests/test_repo.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import fs.path
2-
from mock import patch
32
from gitfs2.repo import (
3+
GitRequire,
44
git_clone,
5-
get_repo_name,
65
get_app_home,
6+
get_repo_name,
77
make_sure_git_is_available,
88
)
9+
10+
from mock import patch
911
from nose.tools import eq_, raises
10-
from gitfs2.repo import GitRequire
1112

1213

1314
@patch("appdirs.user_cache_dir", return_value="root")
@@ -20,7 +21,7 @@ def setUp(self):
2021
self.repo = "https://github.com/my/" + self.repo_name
2122
self.require = GitRequire(git_url=self.repo)
2223
self.require_with_submodule = GitRequire(
23-
git_url=self.repo, submodule='True'
24+
git_url=self.repo, submodule="True"
2425
)
2526
self.require_with_branch = GitRequire(
2627
git_url=self.repo, branch="ghpages"

0 commit comments

Comments
 (0)