Skip to content

Commit a6f6503

Browse files
DimitriPapadopoulosabravalheri
authored andcommitted
Fix flake8-return warning
RET503 Missing explicit `return` at the end of function able to return non-`None` value
1 parent b76097b commit a6f6503

File tree

11 files changed

+29
-3
lines changed

11 files changed

+29
-3
lines changed

pkg_resources/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,8 +1127,7 @@ def obtain(self, requirement, installer=None):
11271127
None is returned instead. This method is a hook that allows subclasses
11281128
to attempt other ways of obtaining a distribution before falling back
11291129
to the `installer` argument."""
1130-
if installer is not None:
1131-
return installer(requirement)
1130+
return installer(requirement) if installer else None
11321131

11331132
def __iter__(self):
11341133
"""Yield the unique project names of the available distributions"""
@@ -3210,6 +3209,7 @@ def _find_adapter(registry, ob):
32103209
for t in types:
32113210
if t in registry:
32123211
return registry[t]
3212+
return None
32133213

32143214

32153215
def ensure_directory(path):

setuptools/command/bdist_egg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ def can_scan():
419419
"Please ask the author to include a 'zip_safe'"
420420
" setting (either True or False) in the package's setup.py"
421421
)
422+
return False
422423

423424

424425
# Attribute names of options for commands that might need to be convinced to

setuptools/command/build_ext.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def get_abi3_suffix():
7676
return suffix
7777
elif suffix == '.pyd': # Windows
7878
return suffix
79+
return None
7980

8081

8182
class build_ext(_build_ext):

setuptools/command/develop.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ def install_egg_scripts(self, dist):
157157
script_text = strm.read()
158158
self.install_script(dist, script_name, script_text, script_path)
159159

160+
return None
161+
160162
def install_wrapper_scripts(self, dist):
161163
dist = VersionlessRequirement(dist)
162164
return easy_install.install_wrapper_scripts(self, dist)

setuptools/command/easy_install.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@ def install_item(self, spec, download, tmpdir, deps, install_needed=False):
741741
for dist in dists:
742742
if dist in spec:
743743
return dist
744+
return None
744745

745746
def select_scheme(self, name):
746747
try:

setuptools/command/install.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def handle_extra_path(self):
7171
# command without --root or --single-version-externally-managed
7272
self.path_file = None
7373
self.extra_dirs = ''
74+
return None
7475

7576
def run(self):
7677
# Explicit request for old-style install? Just do it
@@ -83,6 +84,8 @@ def run(self):
8384
else:
8485
self.do_egg_install()
8586

87+
return None
88+
8689
@staticmethod
8790
def _called_from_setup(run_frame):
8891
"""
@@ -114,6 +117,8 @@ def _called_from_setup(run_frame):
114117

115118
return caller_module == 'distutils.dist' and info.function == 'run_commands'
116119

120+
return False
121+
117122
def do_egg_install(self):
118123
easy_install = self.distribution.get_command_class('easy_install')
119124

setuptools/depends.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ def extract_constant(code, symbol, default=-1):
159159
else:
160160
const = default
161161

162+
return None
162163

163164
def _update_globals():
164165
"""

setuptools/dist.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,8 @@ def has_contents_for(self, package):
778778
if p == package or p.startswith(pfx):
779779
return True
780780

781+
return False
782+
781783
def _exclude_misc(self, name, value):
782784
"""Handle 'exclude()' for list/tuple attrs without a special handler"""
783785
if not isinstance(value, sequence):

setuptools/msvc.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ def lookup(self, key, name):
577577
finally:
578578
if bkey:
579579
closekey(bkey)
580+
return None
580581

581582

582583
class SystemInfo:
@@ -823,6 +824,7 @@ def WindowsSdkVersion(self):
823824
return '8.1', '8.1a'
824825
elif self.vs_ver >= 14.0:
825826
return '10.0', '8.1'
827+
return None
826828

827829
@property
828830
def WindowsSdkLastVersion(self):
@@ -914,6 +916,8 @@ def WindowsSDKExecutablePath(self):
914916
if execpath:
915917
return execpath
916918

919+
return None
920+
917921
@property
918922
def FSharpInstallDir(self):
919923
"""
@@ -946,6 +950,8 @@ def UniversalCRTSdkDir(self):
946950
if sdkdir:
947951
return sdkdir or ''
948952

953+
return None
954+
949955
@property
950956
def UniversalCRTSdkLastVersion(self):
951957
"""

setuptools/package_index.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ def url_ok(self, url, fatal=False):
406406
raise DistutilsError(msg % url)
407407
else:
408408
self.warn(msg, url)
409+
return False
409410

410411
def scan_egg_links(self, search_path):
411412
dirs = filter(os.path.isdir, search_path)
@@ -648,6 +649,8 @@ def find(req, env=None):
648649
if os.path.exists(dist.download_location):
649650
return dist
650651

652+
return None
653+
651654
if force_scan:
652655
self.prescan()
653656
self.find_packages(requirement)
@@ -671,6 +674,7 @@ def find(req, env=None):
671674
(source and "a source distribution of " or ""),
672675
requirement,
673676
)
677+
return None
674678
else:
675679
self.info("Best match: %s", dist)
676680
return dist.clone(location=dist.download_location)
@@ -1034,6 +1038,7 @@ def find_credential(self, url):
10341038
for repository, cred in self.creds_by_repository.items():
10351039
if url.startswith(repository):
10361040
return cred
1041+
return None
10371042

10381043

10391044
def open_with_auth(url, opener=urllib.request.urlopen):

0 commit comments

Comments
 (0)