Skip to content

Commit 11f8f5e

Browse files
fix lint job
1 parent ec92614 commit 11f8f5e

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

gitlab_submodule/objects.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ def __init__(self,
1313
name: str,
1414
path: str,
1515
url: str,
16-
branch: Optional[str]=None,
17-
ignore: Optional[str]=None,
18-
update: Optional[str]=None,
19-
recurse: bool=False,
20-
shallow: bool=False):
16+
branch: Optional[str] = None,
17+
ignore: Optional[str] = None,
18+
update: Optional[str] = None,
19+
recurse: bool = False,
20+
shallow: bool = False):
2121

2222
self.parent_project = parent_project
2323
self.parent_ref = parent_ref
@@ -31,8 +31,10 @@ def __init__(self,
3131
self.shallow = shallow
3232

3333
def keys(self):
34-
return {'parent_project', 'parent_ref', 'name', 'path', 'url',
35-
'update', 'branch', 'ignore', 'shallow', 'recurse'}
34+
return {
35+
'parent_project', 'parent_ref', 'name', 'path', 'url',
36+
'update', 'branch', 'ignore', 'shallow', 'recurse'
37+
}
3638

3739
def __getitem__(self, key):
3840
if key in self.keys():
@@ -43,11 +45,13 @@ def __getitem__(self, key):
4345
def __str__(self):
4446
keys = sorted(self.keys())
4547
class_part = f"<class '{self.__class__.__name__}'>"
48+
4649
def to_str(key):
4750
if isinstance(self[key], str):
4851
return f"'{self[key]}'"
4952
else:
5053
return str(self[key])
54+
5155
attributes = [f"'{key}': {to_str(key)}" for key in keys]
5256
return class_part + ' => {' + ', '.join(attributes) + '}'
5357

gitlab_submodule/read_gitmodules.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ def _get_gitmodules_file_content(project: Project,
3737
except Exception:
3838
return None
3939

40+
4041
def _read_gitmodules_file_content(
41-
gitmodules_file_content: str) -> Iterable[dict[str, Union[None, bool, str]]]:
42+
gitmodules_file_content: str
43+
) -> Iterable[dict[str, Union[None, bool, str]]]:
4244
"""Parses contents of .gitmodule file using configparser"""
4345
config = configparser.ConfigParser()
4446
config.optionxform = str
@@ -55,6 +57,12 @@ def _read_gitmodules_file_content(
5557
}
5658
except (AttributeError, KeyError):
5759
raise RuntimeError('Failed parsing the .gitmodules contnet')
58-
kwargs.update((opt, config.get(section, opt, fallback=None)) for opt in stropts)
59-
kwargs.update((opt, config.getboolean(section, opt, fallback=False)) for opt in boolopts)
60+
kwargs.update(
61+
(opt, config.get(section, opt, fallback=None))
62+
for opt in stropts
63+
)
64+
kwargs.update(
65+
(opt, config.getboolean(section, opt, fallback=False))
66+
for opt in boolopts
67+
)
6068
yield kwargs

tests/test_objects.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def test_Subproject_str(self):
165165
name='test_submodule',
166166
url='git@gitlab.com:test/submodule',
167167
path='include/test_submodule',
168-
branch = "development"
168+
branch='development'
169169
)
170170
mock_project = DictMock()
171171
mock_project.name = 'project'
@@ -212,7 +212,7 @@ def test_Subproject_repr(self):
212212
name='test_submodule',
213213
url='git@gitlab.com:test/submodule',
214214
path='include/test_submodule',
215-
branch = "development"
215+
branch='development'
216216
)
217217
mock_project = DictMock()
218218
mock_project.name = 'project'

0 commit comments

Comments
 (0)