Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit976e14d

Browse files
authored
Merge pull request#1397 from JohnVillalovos/jlvillal/flake8
Fix all issues reported by running: tox -e pep8 and enable pep8 as a linter check
2 parents5fac07a +40f4ab2 commit976e14d

33 files changed

+149
-157
lines changed

‎.github/workflows/lint.yml‎

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ env:
1212
PY_COLORS:1
1313

1414
jobs:
15-
black:
16-
runs-on:ubuntu-latest
17-
steps:
18-
-uses:actions/checkout@v2
19-
-uses:actions/setup-python@v2
20-
-uses:psf/black@stable
21-
with:
22-
black_args:". --check"
2315
commitlint:
2416
runs-on:ubuntu-latest
2517
steps:
@@ -28,10 +20,15 @@ jobs:
2820
fetch-depth:0
2921
-uses:wagoid/commitlint-github-action@v3
3022

31-
mypy:
23+
linters:
3224
runs-on:ubuntu-latest
3325
steps:
3426
-uses:actions/checkout@v2
3527
-uses:actions/setup-python@v2
3628
-run:pip install --upgrade tox
37-
-run:tox -e mypy
29+
-name:Run black code formatter (https://black.readthedocs.io/en/stable/)
30+
run:tox -e black -- --check
31+
-name:Run flake8 (https://flake8.pycqa.org/en/latest/)
32+
run:tox -e pep8
33+
-name:Run mypy static typing checker (http://mypy-lang.org/)
34+
run:tox -e mypy

‎gitlab/__init__.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@
1818

1919
importwarnings
2020

21-
importgitlab.config
22-
fromgitlab.__version__import (
21+
importgitlab.config# noqa: F401
22+
fromgitlab.__version__import (# noqa: F401
2323
__author__,
2424
__copyright__,
2525
__email__,
2626
__license__,
2727
__title__,
2828
__version__,
2929
)
30-
fromgitlab.clientimportGitlab,GitlabList
31-
fromgitlab.constimport*# noqa
32-
fromgitlab.exceptionsimport*# noqa
30+
fromgitlab.clientimportGitlab,GitlabList# noqa: F401
31+
fromgitlab.constimport*# noqa: F401,F403
32+
fromgitlab.exceptionsimport*# noqa: F401,F403
3333

3434

3535
warnings.filterwarnings("default",category=DeprecationWarning,module="^gitlab")

‎gitlab/cli.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
importsys
2424
fromtypingimportAny,Callable,Dict,Optional,Tuple,Union
2525

26-
importgitlab.config
26+
importgitlab.config# noqa: F401
2727

2828
camel_re=re.compile("(.)([A-Z])")
2929

@@ -162,7 +162,6 @@ def docs() -> argparse.ArgumentParser:
162162
if"sphinx"notinsys.modules:
163163
sys.exit("Docs parser is only intended for build_sphinx")
164164

165-
parser=_get_base_parser(add_help=False)
166165
# NOTE: We must delay import of gitlab.v4.cli until now or
167166
# otherwise it will cause circular import errors
168167
importgitlab.v4.cli

‎gitlab/mixins.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
Dict,
2323
List,
2424
Optional,
25-
Tuple,
2625
Type,
2726
TYPE_CHECKING,
2827
Union,

‎gitlab/tests/mixins/test_mixin_methods.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def resp_cont(url, request):
4444

4545

4646
deftest_refresh_mixin(gl):
47-
classO(RefreshMixin,FakeObject):
47+
classTestClass(RefreshMixin,FakeObject):
4848
pass
4949

5050
@urlmatch(scheme="http",netloc="localhost",path="/api/v4/tests/42",method="get")
@@ -55,7 +55,7 @@ def resp_cont(url, request):
5555

5656
withHTTMock(resp_cont):
5757
mgr=FakeManager(gl)
58-
obj=O(mgr, {"id":42})
58+
obj=TestClass(mgr, {"id":42})
5959
res=obj.refresh()
6060
assertresisNone
6161
assertobj.foo=="bar"
@@ -265,7 +265,7 @@ def test_save_mixin(gl):
265265
classM(UpdateMixin,FakeManager):
266266
pass
267267

268-
classO(SaveMixin,base.RESTObject):
268+
classTestClass(SaveMixin,base.RESTObject):
269269
pass
270270

271271
@urlmatch(scheme="http",netloc="localhost",path="/api/v4/tests/42",method="put")
@@ -276,7 +276,7 @@ def resp_cont(url, request):
276276

277277
withHTTMock(resp_cont):
278278
mgr=M(gl)
279-
obj=O(mgr, {"id":42,"foo":"bar"})
279+
obj=TestClass(mgr, {"id":42,"foo":"bar"})
280280
obj.foo="baz"
281281
obj.save()
282282
assertobj._attrs["foo"]=="baz"

‎gitlab/tests/mixins/test_object_mixins_attributes.py‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,35 +27,35 @@
2727

2828

2929
deftest_access_request_mixin():
30-
classO(AccessRequestMixin):
30+
classTestClass(AccessRequestMixin):
3131
pass
3232

33-
obj=O()
33+
obj=TestClass()
3434
asserthasattr(obj,"approve")
3535

3636

3737
deftest_subscribable_mixin():
38-
classO(SubscribableMixin):
38+
classTestClass(SubscribableMixin):
3939
pass
4040

41-
obj=O()
41+
obj=TestClass()
4242
asserthasattr(obj,"subscribe")
4343
asserthasattr(obj,"unsubscribe")
4444

4545

4646
deftest_todo_mixin():
47-
classO(TodoMixin):
47+
classTestClass(TodoMixin):
4848
pass
4949

50-
obj=O()
50+
obj=TestClass()
5151
asserthasattr(obj,"todo")
5252

5353

5454
deftest_time_tracking_mixin():
55-
classO(TimeTrackingMixin):
55+
classTestClass(TimeTrackingMixin):
5656
pass
5757

58-
obj=O()
58+
obj=TestClass()
5959
asserthasattr(obj,"time_stats")
6060
asserthasattr(obj,"time_estimate")
6161
asserthasattr(obj,"reset_time_estimate")
@@ -64,16 +64,16 @@ class O(TimeTrackingMixin):
6464

6565

6666
deftest_set_mixin():
67-
classO(SetMixin):
67+
classTestClass(SetMixin):
6868
pass
6969

70-
obj=O()
70+
obj=TestClass()
7171
asserthasattr(obj,"set")
7272

7373

7474
deftest_user_agent_detail_mixin():
75-
classO(UserAgentDetailMixin):
75+
classTestClass(UserAgentDetailMixin):
7676
pass
7777

78-
obj=O()
78+
obj=TestClass()
7979
asserthasattr(obj,"user_agent_detail")

‎gitlab/tests/objects/test_appearance.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ def test_get_update_appearance(gl, resp_application_appearance):
6363

6464

6565
deftest_update_appearance(gl,resp_application_appearance):
66-
resp=gl.appearance.update(title=new_title,description=new_description)
66+
gl.appearance.update(title=new_title,description=new_description)

‎gitlab/tests/objects/test_bridges.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
"""
22
GitLab API: https://docs.gitlab.com/ee/api/jobs.html#list-pipeline-bridges
33
"""
4-
importre
5-
64
importpytest
75
importresponses
86

9-
fromgitlab.v4.objectsimportProject,ProjectPipelineBridge
7+
fromgitlab.v4.objectsimportProjectPipelineBridge
108

119

1210
@pytest.fixture

‎gitlab/tests/objects/test_project_merge_request_approvals.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def test_project_approval_manager_update_uses_post(project, resp_snippet):
241241
assertisinstance(
242242
approvals,gitlab.v4.objects.merge_request_approvals.ProjectApprovalManager
243243
)
244-
assertapprovals._update_uses_post==True
244+
assertapprovals._update_uses_postisTrue
245245

246246

247247
deftest_list_merge_request_approval_rules(project,resp_snippet):
@@ -257,7 +257,7 @@ def test_update_merge_request_approvals_set_approvers(project, resp_snippet):
257257
approvals,
258258
gitlab.v4.objects.merge_request_approvals.ProjectMergeRequestApprovalManager,
259259
)
260-
assertapprovals._update_uses_post==True
260+
assertapprovals._update_uses_postisTrue
261261
response=approvals.set_approvers(
262262
updated_approval_rule_approvals_required,
263263
approver_ids=updated_approval_rule_user_ids,
@@ -277,7 +277,7 @@ def test_create_merge_request_approvals_set_approvers(project, resp_snippet):
277277
approvals,
278278
gitlab.v4.objects.merge_request_approvals.ProjectMergeRequestApprovalManager,
279279
)
280-
assertapprovals._update_uses_post==True
280+
assertapprovals._update_uses_postisTrue
281281
response=approvals.set_approvers(
282282
new_approval_rule_approvals_required,
283283
approver_ids=new_approval_rule_user_ids,

‎gitlab/tests/objects/test_runners.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,31 +200,31 @@ def resp_runner_verify():
200200

201201
deftest_owned_runners_list(gl:gitlab.Gitlab,resp_get_runners_list):
202202
runners=gl.runners.list()
203-
assertrunners[0].active==True
203+
assertrunners[0].activeisTrue
204204
assertrunners[0].id==6
205205
assertrunners[0].name=="test-name"
206206
assertlen(runners)==1
207207

208208

209209
deftest_project_runners_list(gl:gitlab.Gitlab,resp_get_runners_list):
210210
runners=gl.projects.get(1,lazy=True).runners.list()
211-
assertrunners[0].active==True
211+
assertrunners[0].activeisTrue
212212
assertrunners[0].id==6
213213
assertrunners[0].name=="test-name"
214214
assertlen(runners)==1
215215

216216

217217
deftest_group_runners_list(gl:gitlab.Gitlab,resp_get_runners_list):
218218
runners=gl.groups.get(1,lazy=True).runners.list()
219-
assertrunners[0].active==True
219+
assertrunners[0].activeisTrue
220220
assertrunners[0].id==6
221221
assertrunners[0].name=="test-name"
222222
assertlen(runners)==1
223223

224224

225225
deftest_all_runners_list(gl:gitlab.Gitlab,resp_get_runners_list):
226226
runners=gl.runners.all()
227-
assertrunners[0].active==True
227+
assertrunners[0].activeisTrue
228228
assertrunners[0].id==6
229229
assertrunners[0].name=="test-name"
230230
assertlen(runners)==1
@@ -238,7 +238,7 @@ def test_create_runner(gl: gitlab.Gitlab, resp_runner_register):
238238

239239
deftest_get_update_runner(gl:gitlab.Gitlab,resp_runner_detail):
240240
runner=gl.runners.get(6)
241-
assertrunner.active==True
241+
assertrunner.activeisTrue
242242
runner.tag_list.append("new")
243243
runner.save()
244244

@@ -259,14 +259,14 @@ def test_disable_group_runner(gl: gitlab.Gitlab, resp_runner_disable):
259259

260260
deftest_enable_project_runner(gl:gitlab.Gitlab,resp_runner_enable):
261261
runner=gl.projects.get(1,lazy=True).runners.create({"runner_id":6})
262-
assertrunner.active==True
262+
assertrunner.activeisTrue
263263
assertrunner.id==6
264264
assertrunner.name=="test-name"
265265

266266

267267
deftest_enable_group_runner(gl:gitlab.Gitlab,resp_runner_enable):
268268
runner=gl.groups.get(1,lazy=True).runners.create({"runner_id":6})
269-
assertrunner.active==True
269+
assertrunner.activeisTrue
270270
assertrunner.id==6
271271
assertrunner.name=="test-name"
272272

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp