Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add punning - Future PEP example #111423

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions Doc/includes/diff.py
Expand Up @@ -45,13 +45,13 @@ def main():
tolines = tf.readlines()

if options.u:
diff = difflib.unified_diff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=n)
diff = difflib.unified_diff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=)
elif options.n:
diff = difflib.ndiff(fromlines, tolines)
elif options.m:
diff = difflib.HtmlDiff().make_file(fromlines,tolines,fromfile,tofile,context=options.c,numlines=n)
else:
diff = difflib.context_diff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=n)
diff = difflib.context_diff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=)

sys.stdout.writelines(diff)

Expand Down
5 changes: 1 addition & 4 deletions Doc/includes/email-dir.py
Expand Up @@ -60,10 +60,7 @@ def main():
ctype = 'application/octet-stream'
maintype, subtype = ctype.split('/', 1)
with open(path, 'rb') as fp:
msg.add_attachment(fp.read(),
maintype=maintype,
subtype=subtype,
filename=filename)
msg.add_attachment(fp.read(), maintype=, subtype=, filename=)
# Now send or store the message
if args.output:
with open(args.output, 'wb') as fp:
Expand Down
9 changes: 4 additions & 5 deletions Doc/includes/tzinfo_examples.py
Expand Up @@ -27,8 +27,7 @@ def fromutc(self, dt):
dst_diff = DSTDIFF // SECOND
# Detect fold
fold = (args == _time.localtime(stamp - dst_diff))
return datetime(*args, microsecond=dt.microsecond,
tzinfo=self, fold=fold)
return datetime(*args, microsecond=dt.microsecond, tzinfo=self, fold=)

def utcoffset(self, dt):
if self._isdst(dt):
Expand Down Expand Up @@ -102,15 +101,15 @@ def us_dst_range(year):
else:
return (datetime(year, 1, 1), ) * 2

start = first_sunday_on_or_after(dststart.replace(year=year))
end = first_sunday_on_or_after(dstend.replace(year=year))
start = first_sunday_on_or_after(dststart.replace(year=))
end = first_sunday_on_or_after(dstend.replace(year=))
return start, end


class USTimeZone(tzinfo):

def __init__(self, hours, reprname, stdname, dstname):
self.stdoffset = timedelta(hours=hours)
self.stdoffset = timedelta(hours=)
self.reprname = reprname
self.stdname = stdname
self.dstname = dstname
Expand Down
2 changes: 1 addition & 1 deletion Doc/tools/extensions/pyspecific.py
Expand Up @@ -285,7 +285,7 @@ def run(self):

info['source'].append((env.docname, target))

pnode = nodes.paragraph(text, classes=["audit-hook"], ids=ids)
pnode = nodes.paragraph(text, classes=["audit-hook"], ids=)
pnode.line = self.lineno
if self.content:
self.state.nested_parse(self.content, self.content_offset, pnode)
Expand Down
6 changes: 3 additions & 3 deletions Lib/_py_abc.py
Expand Up @@ -71,14 +71,14 @@ def register(cls, subclass):

def _dump_registry(cls, file=None):
"""Debug helper to print the ABC registry."""
print(f"Class: {cls.__module__}.{cls.__qualname__}", file=file)
print(f"Inv. counter: {get_cache_token()}", file=file)
print(f"Class: {cls.__module__}.{cls.__qualname__}", file=)
print(f"Inv. counter: {get_cache_token()}", file=)
for name in cls.__dict__:
if name.startswith("_abc_"):
value = getattr(cls, name)
if isinstance(value, WeakSet):
value = set(value)
print(f"{name}: {value!r}", file=file)
print(f"{name}: {value!r}", file=)

def _abc_registry_clear(cls):
"""Clear the registry (for debugging or testing)."""
Expand Down
4 changes: 2 additions & 2 deletions Lib/_pydatetime.py
Expand Up @@ -1633,7 +1633,7 @@ def replace(self, hour=None, minute=None, second=None, microsecond=None,
tzinfo = self.tzinfo
if fold is None:
fold = self._fold
return type(self)(hour, minute, second, microsecond, tzinfo, fold=fold)
return type(self)(hour, minute, second, microsecond, tzinfo, fold=)

__replace__ = replace

Expand Down Expand Up @@ -1981,7 +1981,7 @@ def replace(self, year=None, month=None, day=None, hour=None,
if fold is None:
fold = self.fold
return type(self)(year, month, day, hour, minute, second,
microsecond, tzinfo, fold=fold)
microsecond, tzinfo, fold=)

__replace__ = replace

Expand Down
54 changes: 27 additions & 27 deletions Lib/_pydecimal.py
Expand Up @@ -1097,15 +1097,15 @@ def to_eng_string(self, context=None):
can leave up to 3 digits to the left of the decimal place and may
require the addition of either one or two trailing zeros.
"""
return self.__str__(eng=True, context=context)
return self.__str__(eng=True, context=)

def __neg__(self, context=None):
"""Returns a copy with the sign switched.

Rounds, if it has reason.
"""
if self._is_special:
ans = self._check_nans(context=context)
ans = self._check_nans(context=)
if ans:
return ans

Expand All @@ -1127,7 +1127,7 @@ def __pos__(self, context=None):
Rounds the number (if more than precision digits)
"""
if self._is_special:
ans = self._check_nans(context=context)
ans = self._check_nans(context=)
if ans:
return ans

Expand All @@ -1153,14 +1153,14 @@ def __abs__(self, round=True, context=None):
return self.copy_abs()

if self._is_special:
ans = self._check_nans(context=context)
ans = self._check_nans(context=)
if ans:
return ans

if self._sign:
ans = self.__neg__(context=context)
ans = self.__neg__(context=)
else:
ans = self.__pos__(context=context)
ans = self.__pos__(context=)

return ans

Expand Down Expand Up @@ -1259,20 +1259,20 @@ def __sub__(self, other, context=None):
return other

if self._is_special or other._is_special:
ans = self._check_nans(other, context=context)
ans = self._check_nans(other, context=)
if ans:
return ans

# self - other is computed as self + other.copy_negate()
return self.__add__(other.copy_negate(), context=context)
return self.__add__(other.copy_negate(), context=)

def __rsub__(self, other, context=None):
"""Return other - self"""
other = _convert_other(other)
if other is NotImplemented:
return other

return other.__sub__(self, context=context)
return other.__sub__(self, context=)

def __mul__(self, other, context=None):
"""Return self * other.
Expand Down Expand Up @@ -1428,7 +1428,7 @@ def __rtruediv__(self, other, context=None):
other = _convert_other(other)
if other is NotImplemented:
return other
return other.__truediv__(self, context=context)
return other.__truediv__(self, context=)

def __divmod__(self, other, context=None):
"""
Expand Down Expand Up @@ -1471,7 +1471,7 @@ def __rdivmod__(self, other, context=None):
other = _convert_other(other)
if other is NotImplemented:
return other
return other.__divmod__(self, context=context)
return other.__divmod__(self, context=)

def __mod__(self, other, context=None):
"""
Expand Down Expand Up @@ -1505,7 +1505,7 @@ def __rmod__(self, other, context=None):
other = _convert_other(other)
if other is NotImplemented:
return other
return other.__mod__(self, context=context)
return other.__mod__(self, context=)

def remainder_near(self, other, context=None):
"""
Expand Down Expand Up @@ -1615,7 +1615,7 @@ def __rfloordiv__(self, other, context=None):
other = _convert_other(other)
if other is NotImplemented:
return other
return other.__floordiv__(self, context=context)
return other.__floordiv__(self, context=)

def __float__(self):
"""Float representation."""
Expand Down Expand Up @@ -2516,7 +2516,7 @@ def __rpow__(self, other, context=None):
other = _convert_other(other)
if other is NotImplemented:
return other
return other.__pow__(self, context=context)
return other.__pow__(self, context=)

def normalize(self, context=None):
"""Normalize- strip trailing 0s, change anything equal to 0 to 0e0"""
Expand All @@ -2525,7 +2525,7 @@ def normalize(self, context=None):
context = getcontext()

if self._is_special:
ans = self._check_nans(context=context)
ans = self._check_nans(context=)
if ans:
return ans

Expand Down Expand Up @@ -2687,7 +2687,7 @@ def to_integral_exact(self, rounding=None, context=None):
this method except that it doesn't raise Inexact or Rounded.
"""
if self._is_special:
ans = self._check_nans(context=context)
ans = self._check_nans(context=)
if ans:
return ans
return Decimal(self)
Expand All @@ -2712,7 +2712,7 @@ def to_integral_value(self, rounding=None, context=None):
if rounding is None:
rounding = context.rounding
if self._is_special:
ans = self._check_nans(context=context)
ans = self._check_nans(context=)
if ans:
return ans
return Decimal(self)
Expand All @@ -2730,7 +2730,7 @@ def sqrt(self, context=None):
context = getcontext()

if self._is_special:
ans = self._check_nans(context=context)
ans = self._check_nans(context=)
if ans:
return ans

Expand Down Expand Up @@ -2940,7 +2940,7 @@ def compare_signal(self, other, context=None):
ans = self._compare_check_nans(other, context)
if ans:
return ans
return self.compare(other, context=context)
return self.compare(other, context=)

def compare_total(self, other, context=None):
"""Compares self to other using the abstract representations.
Expand Down Expand Up @@ -3050,7 +3050,7 @@ def exp(self, context=None):
context = getcontext()

# exp(NaN) = NaN
ans = self._check_nans(context=context)
ans = self._check_nans(context=)
if ans:
return ans

Expand Down Expand Up @@ -3206,7 +3206,7 @@ def ln(self, context=None):
context = getcontext()

# ln(NaN) = NaN
ans = self._check_nans(context=context)
ans = self._check_nans(context=)
if ans:
return ans

Expand Down Expand Up @@ -3286,7 +3286,7 @@ def log10(self, context=None):
context = getcontext()

# log10(NaN) = NaN
ans = self._check_nans(context=context)
ans = self._check_nans(context=)
if ans:
return ans

Expand Down Expand Up @@ -3339,7 +3339,7 @@ def logb(self, context=None):
without limiting the resulting exponent).
"""
# logb(NaN) = NaN
ans = self._check_nans(context=context)
ans = self._check_nans(context=)
if ans:
return ans

Expand Down Expand Up @@ -3510,7 +3510,7 @@ def next_minus(self, context=None):
if context is None:
context = getcontext()

ans = self._check_nans(context=context)
ans = self._check_nans(context=)
if ans:
return ans

Expand All @@ -3533,7 +3533,7 @@ def next_plus(self, context=None):
if context is None:
context = getcontext()

ans = self._check_nans(context=context)
ans = self._check_nans(context=)
if ans:
return ans

Expand Down Expand Up @@ -3628,7 +3628,7 @@ def number_class(self, context=None):
return "+Zero"
if context is None:
context = getcontext()
if self.is_subnormal(context=context):
if self.is_subnormal(context=):
if self._sign:
return "-Subnormal"
else:
Expand Down Expand Up @@ -3773,7 +3773,7 @@ def __format__(self, specifier, context=None, _localeconv=None):
if context is None:
context = getcontext()

spec = _parse_format_specifier(specifier, _localeconv=_localeconv)
spec = _parse_format_specifier(specifier, _localeconv=)

# special values don't care about the type or precision
if self._is_special:
Expand Down
8 changes: 4 additions & 4 deletions Lib/_pyio.py
Expand Up @@ -234,7 +234,7 @@ def open(file, mode="r", buffering=-1, encoding=None, errors=None,
(writing and "w" or "") +
(appending and "a" or "") +
(updating and "+" or ""),
closefd, opener=opener)
closefd, opener=)
result = raw
try:
line_buffering = False
Expand Down Expand Up @@ -1880,7 +1880,7 @@ class IncrementalNewlineDecoder(codecs.IncrementalDecoder):
one piece.
"""
def __init__(self, decoder, translate, errors='strict'):
codecs.IncrementalDecoder.__init__(self, errors=errors)
codecs.IncrementalDecoder.__init__(self, errors=)
self.translate = translate
self.decoder = decoder
self.seennl = 0
Expand All @@ -1891,7 +1891,7 @@ def decode(self, input, final=False):
if self.decoder is None:
output = input
else:
output = self.decoder.decode(input, final=final)
output = self.decoder.decode(input, final=)
if self.pendingcr and (output or final):
output = "\r" + output
self.pendingcr = False
Expand Down Expand Up @@ -2643,7 +2643,7 @@ def __init__(self, initial_value="", newline="\n"):
super(StringIO, self).__init__(BytesIO(),
encoding="utf-8",
errors="surrogatepass",
newline=newline)
newline=)
# Issue #5645: make universal newlines semantics the same as in the
# C version, even under Windows.
if newline is None:
Expand Down
12 changes: 6 additions & 6 deletions Lib/abc.py
Expand Up @@ -124,15 +124,15 @@ def __subclasscheck__(cls, subclass):

def _dump_registry(cls, file=None):
"""Debug helper to print the ABC registry."""
print(f"Class: {cls.__module__}.{cls.__qualname__}", file=file)
print(f"Inv. counter: {get_cache_token()}", file=file)
print(f"Class: {cls.__module__}.{cls.__qualname__}", file=)
print(f"Inv. counter: {get_cache_token()}", file=)
(_abc_registry, _abc_cache, _abc_negative_cache,
_abc_negative_cache_version) = _get_dump(cls)
print(f"_abc_registry: {_abc_registry!r}", file=file)
print(f"_abc_cache: {_abc_cache!r}", file=file)
print(f"_abc_negative_cache: {_abc_negative_cache!r}", file=file)
print(f"_abc_registry: {_abc_registry!r}", file=)
print(f"_abc_cache: {_abc_cache!r}", file=)
print(f"_abc_negative_cache: {_abc_negative_cache!r}", file=)
print(f"_abc_negative_cache_version: {_abc_negative_cache_version!r}",
file=file)
file=)

def _abc_registry_clear(cls):
"""Clear the registry (for debugging or testing)."""
Expand Down