Skip to content

Commit c3c54bf

Browse files
committed
Adapt Python3 compatibility
* Remove old if clause for Python2 * Use "yield from" instead of for loop
1 parent 0be380b commit c3c54bf

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

semver.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ def wrapper(*args, **kwargs):
118118
else:
119119
msg.append("Use the respective 'semver.VersionInfo.{r}' instead.")
120120

121-
# hasattr is needed for Python2 compatibility:
122-
f = func.__qualname__ if hasattr(func, "__qualname__") else func.__name__
121+
f = func.__qualname__
123122
r = replace or f
124123

125124
frame = inspect.currentframe().f_back
@@ -317,9 +316,7 @@ def to_dict(self):
317316

318317
def __iter__(self):
319318
"""Implement iter(self)."""
320-
# As long as we support Py2.7, we can't use the "yield from" syntax
321-
for v in self.to_tuple():
322-
yield v
319+
yield from self.to_tuple()
323320

324321
@staticmethod
325322
def _increment_string(string):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy