🎨 Change set constructors to literals
This commit is contained in:
1 parent
af60fd6428
commit
986312b6ae
5 files changed
+14
-14
No files matched your search
@@ -159,11 +159,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 = {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 = {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
|
||||
@@ -172,7 +172,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 = {r for r in refs if re.search(r'\d', r)}
|
||||
if verbose:
|
||||
print("discarding '%s', no digits" % ",".join(refs-tags))
|
||||
|
||||
|
||||
@@ -841,10 +841,10 @@ class FilebasedUserManager(UserManager):
|
||||
(Permissions.find(permission) for permission in permissions))))
|
||||
|
||||
def _from_groups(self, *groups):
|
||||
return list(set(group.key for group in groups))
|
||||
return list({group.key for group in groups})
|
||||
|
||||
def _from_permissions(self, *permissions):
|
||||
return list(set(permission.key for permission in permissions))
|
||||
return list({permission.key for permission in permissions})
|
||||
|
||||
# ~~ Deprecated methods follow
|
||||
|
||||
|
||||
@@ -658,7 +658,7 @@ class WsgiInputContainer(object):
|
||||
status_code, reason = data["status"].split(" ", 1)
|
||||
status_code = int(status_code)
|
||||
headers = data["headers"]
|
||||
header_set = set(k.lower() for (k, v) in headers)
|
||||
header_set = {k.lower() for (k, v) in headers}
|
||||
body = tornado.escape.utf8(body)
|
||||
if status_code != 304:
|
||||
if "content-length" not in header_set:
|
||||
@@ -666,7 +666,7 @@ class WsgiInputContainer(object):
|
||||
if "content-type" not in header_set:
|
||||
headers.append(("Content-Type", "text/html; charset=UTF-8"))
|
||||
|
||||
header_set = set(k.lower() for (k, v) in headers)
|
||||
header_set = {k.lower() for (k, v) in headers}
|
||||
for header, value in self.headers.items():
|
||||
if header.lower() not in header_set:
|
||||
headers.append((header, value))
|
||||
|
||||
@@ -1696,7 +1696,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 = {x.lower() if isinstance(x, past.builtins.basestring) else x for x in args}
|
||||
|
||||
def __contains__(self, item):
|
||||
if isinstance(item, past.builtins.basestring):
|
||||
|
||||
@@ -282,23 +282,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 | {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 | {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 = {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 | {key for key in dir(self) if self.valid_e(key)}
|
||||
return dict((attr, getattr(self, attr)) for attr in attrs)
|
||||
|
||||
class TemperatureRecord(object):
|
||||
@@ -1107,8 +1107,8 @@ class MachineCom(object):
|
||||
return process_gcode_line(line), tags
|
||||
|
||||
return list(filter(lambda x: x[0] is not None and x[0].strip() != "",
|
||||
map(process,
|
||||
scriptLines)))
|
||||
map(process,
|
||||
scriptLines)))
|
||||
|
||||
|
||||
def sendGcodeScript(self, scriptName, replacements=None, tags=None, part_of_job=False):
|
||||
|
||||
Reference in new issue
Block a user