Simplify: set([GEN]) → set(GEN)
This commit is contained in:
1 parent
e03feeb7ac
commit
a6f701802f
5 files changed
+18
-18
No files matched your search
@@ -158,11 +158,11 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
|
||||
if verbose:
|
||||
print("keywords are unexpanded, not using")
|
||||
raise NotThisMethod("unexpanded keywords, not a git-archive tarball")
|
||||
refs = set([r.strip() for r in refnames.strip("()").split(",")])
|
||||
refs = set(r.strip() for r in refnames.strip("()").split(","))
|
||||
# starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of
|
||||
# just "foo-1.0". If we see a "tag: " prefix, prefer those.
|
||||
TAG = "tag: "
|
||||
tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)])
|
||||
tags = set(r[len(TAG):] for r in refs if r.startswith(TAG))
|
||||
if not tags:
|
||||
# Either we're using git < 1.8.3, or there really are no tags. We use
|
||||
# a heuristic: assume all version tags have a digit. The old git %d
|
||||
@@ -171,7 +171,7 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
|
||||
# between branches and tags. By ignoring refnames without digits, we
|
||||
# filter out many common branch names like "release" and
|
||||
# "stabilization", as well as "HEAD" and "master".
|
||||
tags = set([r for r in refs if re.search(r'\d', r)])
|
||||
tags = set(r for r in refs if re.search(r'\d', r))
|
||||
if verbose:
|
||||
print("discarding '%s', no digits" % ",".join(refs-tags))
|
||||
|
||||
|
||||
@@ -772,17 +772,17 @@ class FilebasedUserManager(UserManager):
|
||||
|
||||
def _to_groups(self, *groups):
|
||||
return list(set(filter(lambda x: x is not None,
|
||||
[self._group_manager._to_group(group) for group in groups])))
|
||||
(self._group_manager._to_group(group) for group in groups))))
|
||||
|
||||
def _to_permissions(self, *permissions):
|
||||
return list(set(filter(lambda x: x is not None,
|
||||
[Permissions.find(permission) for permission in permissions])))
|
||||
(Permissions.find(permission) for permission in permissions))))
|
||||
|
||||
def _from_groups(self, *groups):
|
||||
return list(set([group.key for group in groups]))
|
||||
return list(set(group.key for group in groups))
|
||||
|
||||
def _from_permissions(self, *permissions):
|
||||
return list(set([permission.key for permission in permissions]))
|
||||
return list(set(permission.key for permission in permissions))
|
||||
|
||||
# ~~ Deprecated methods follow
|
||||
|
||||
|
||||
@@ -1681,7 +1681,7 @@ class CaseInsensitiveSet(collections.Set):
|
||||
"""
|
||||
|
||||
def __init__(self, *args):
|
||||
self.data = set([x.lower() if isinstance(x, past.builtins.basestring) else x for x in args])
|
||||
self.data = set(x.lower() if isinstance(x, past.builtins.basestring) else x for x in args)
|
||||
|
||||
def __contains__(self, item):
|
||||
if isinstance(item, past.builtins.basestring):
|
||||
|
||||
@@ -256,23 +256,23 @@ class PositionRecord(object):
|
||||
return True
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
attrs = self._standard_attrs | set([key for key in kwargs if self.valid_e(key)])
|
||||
attrs = self._standard_attrs | set(key for key in kwargs if self.valid_e(key))
|
||||
for attr in attrs:
|
||||
setattr(self, attr, kwargs.get(attr))
|
||||
|
||||
def copy_from(self, other):
|
||||
# make sure all standard attrs and attrs from other are set
|
||||
attrs = self._standard_attrs | set([key for key in dir(other) if self.valid_e(key)])
|
||||
attrs = self._standard_attrs | set(key for key in dir(other) if self.valid_e(key))
|
||||
for attr in attrs:
|
||||
setattr(self, attr, getattr(other, attr))
|
||||
|
||||
# delete attrs other doesn't have
|
||||
attrs = set([key for key in dir(self) if self.valid_e(key)]) - attrs
|
||||
attrs = set(key for key in dir(self) if self.valid_e(key)) - attrs
|
||||
for attr in attrs:
|
||||
delattr(self, attr)
|
||||
|
||||
def as_dict(self):
|
||||
attrs = self._standard_attrs | set([key for key in dir(self) if self.valid_e(key)])
|
||||
attrs = self._standard_attrs | set(key for key in dir(self) if self.valid_e(key))
|
||||
return dict((attr, getattr(self, attr)) for attr in attrs)
|
||||
|
||||
class TemperatureRecord(object):
|
||||
|
||||
Vendored
+6
-6
@@ -657,11 +657,11 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
|
||||
if verbose:
|
||||
print("keywords are unexpanded, not using")
|
||||
raise NotThisMethod("unexpanded keywords, not a git-archive tarball")
|
||||
refs = set([r.strip() for r in refnames.strip("()").split(",")])
|
||||
refs = set(r.strip() for r in refnames.strip("()").split(","))
|
||||
# starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of
|
||||
# just "foo-1.0". If we see a "tag: " prefix, prefer those.
|
||||
TAG = "tag: "
|
||||
tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)])
|
||||
tags = set(r[len(TAG):] for r in refs if r.startswith(TAG))
|
||||
if not tags:
|
||||
# Either we're using git < 1.8.3, or there really are no tags. We use
|
||||
# a heuristic: assume all version tags have a digit. The old git %%d
|
||||
@@ -670,7 +670,7 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
|
||||
# between branches and tags. By ignoring refnames without digits, we
|
||||
# filter out many common branch names like "release" and
|
||||
# "stabilization", as well as "HEAD" and "master".
|
||||
tags = set([r for r in refs if re.search(r'\d', r)])
|
||||
tags = set(r for r in refs if re.search(r'\d', r))
|
||||
if verbose:
|
||||
print("discarding '%%s', no digits" %% ",".join(refs-tags))
|
||||
|
||||
@@ -1229,11 +1229,11 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
|
||||
if verbose:
|
||||
print("keywords are unexpanded, not using")
|
||||
raise NotThisMethod("unexpanded keywords, not a git-archive tarball")
|
||||
refs = set([r.strip() for r in refnames.strip("()").split(",")])
|
||||
refs = set(r.strip() for r in refnames.strip("()").split(","))
|
||||
# starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of
|
||||
# just "foo-1.0". If we see a "tag: " prefix, prefer those.
|
||||
TAG = "tag: "
|
||||
tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)])
|
||||
tags = set(r[len(TAG):] for r in refs if r.startswith(TAG))
|
||||
if not tags:
|
||||
# Either we're using git < 1.8.3, or there really are no tags. We use
|
||||
# a heuristic: assume all version tags have a digit. The old git %d
|
||||
@@ -1242,7 +1242,7 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
|
||||
# between branches and tags. By ignoring refnames without digits, we
|
||||
# filter out many common branch names like "release" and
|
||||
# "stabilization", as well as "HEAD" and "master".
|
||||
tags = set([r for r in refs if re.search(r'\d', r)])
|
||||
tags = set(r for r in refs if re.search(r'\d', r))
|
||||
if verbose:
|
||||
print("discarding '%s', no digits" % ",".join(refs-tags))
|
||||
|
||||
|
||||
Reference in new issue
Block a user