Skip to content

Commit fe99105

Browse files
committed
Use true booleans and PEP8 for argdefaults.
1 parent 3d6575d commit fe99105

File tree

9 files changed

+21
-21
lines changed

9 files changed

+21
-21
lines changed

Lib/uu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def encode(in_file, out_file, name=None, mode=None):
8080
out_file.write(b' \nend\n')
8181

8282

83-
def decode(in_file, out_file=None, mode=None, quiet=0):
83+
def decode(in_file, out_file=None, mode=None, quiet=False):
8484
"""Decode uuencoded file"""
8585
#
8686
# Open the input file, if needed.

Lib/warnings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def formatwarning(message, category, filename, lineno, line=None):
2929
return s
3030

3131
def filterwarnings(action, message="", category=Warning, module="", lineno=0,
32-
append=0):
32+
append=False):
3333
"""Insert an entry into the list of warnings filters (at the front).
3434
3535
Use assertions to check that all arguments have the right type."""
@@ -49,7 +49,7 @@ def filterwarnings(action, message="", category=Warning, module="", lineno=0,
4949
else:
5050
filters.insert(0, item)
5151

52-
def simplefilter(action, category=Warning, lineno=0, append=0):
52+
def simplefilter(action, category=Warning, lineno=0, append=False):
5353
"""Insert a simple entry into the list of warnings filters (at the front).
5454
5555
A simple filter matches all modules and messages.

Lib/wsgiref/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def application_uri(environ):
6767
url += quote(environ.get('SCRIPT_NAME') or '/')
6868
return url
6969

70-
def request_uri(environ, include_query=1):
70+
def request_uri(environ, include_query=True):
7171
"""Return the full request URI, optionally including the query string"""
7272
url = application_uri(environ)
7373
from urllib.parse import quote

Lib/xml/dom/domreg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def _good_enough(dom, features):
3636
return 0
3737
return 1
3838

39-
def getDOMImplementation(name = None, features = ()):
39+
def getDOMImplementation(name=None, features=()):
4040
"""getDOMImplementation(name = None, features = ()) -> DOM implementation.
4141
4242
Return a suitable DOM implementation. The name is either

Lib/xml/dom/minidom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Node(xml.dom.Node):
4343
def __bool__(self):
4444
return True
4545

46-
def toxml(self, encoding = None):
46+
def toxml(self, encoding=None):
4747
return self.toprettyxml("", "", encoding)
4848

4949
def toprettyxml(self, indent="\t", newl="\n", encoding=None):

Lib/xml/sax/saxutils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def setParent(self, parent):
268268

269269
# --- Utility functions
270270

271-
def prepare_input_source(source, base = ""):
271+
def prepare_input_source(source, base=""):
272272
"""This function takes an InputSource and an optional base URL and
273273
returns a fully resolved InputSource object ready for reading."""
274274

Lib/xmlrpc/client.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ class Marshaller:
474474
# by the way, if you don't understand what's going on in here,
475475
# that's perfectly ok.
476476

477-
def __init__(self, encoding=None, allow_none=0):
477+
def __init__(self, encoding=None, allow_none=False):
478478
self.memo = {}
479479
self.data = None
480480
self.encoding = encoding
@@ -647,7 +647,7 @@ class Unmarshaller:
647647
# and again, if you don't understand what's going on in here,
648648
# that's perfectly ok.
649649

650-
def __init__(self, use_datetime=0):
650+
def __init__(self, use_datetime=False):
651651
self._type = None
652652
self._stack = []
653653
self._marks = []
@@ -880,7 +880,7 @@ def __call__(self):
880880
#
881881
# return A (parser, unmarshaller) tuple.
882882

883-
def getparser(use_datetime=0):
883+
def getparser(use_datetime=False):
884884
"""getparser() -> parser, unmarshaller
885885
886886
Create an instance of the fastest available parser, and attach it
@@ -917,7 +917,7 @@ def getparser(use_datetime=0):
917917
# @return A string containing marshalled data.
918918

919919
def dumps(params, methodname=None, methodresponse=None, encoding=None,
920-
allow_none=0):
920+
allow_none=False):
921921
"""data [,options] -> marshalled data
922922
923923
Convert an argument tuple or a Fault instance to an XML-RPC
@@ -993,7 +993,7 @@ def dumps(params, methodname=None, methodresponse=None, encoding=None,
993993
# (None if not present).
994994
# @see Fault
995995

996-
def loads(data, use_datetime=0):
996+
def loads(data, use_datetime=False):
997997
"""data -> unmarshalled data, method name
998998
999999
Convert an XML-RPC packet to unmarshalled data plus a method
@@ -1114,7 +1114,7 @@ class Transport:
11141114
# that they can decode such a request
11151115
encode_threshold = None #None = don't encode
11161116

1117-
def __init__(self, use_datetime=0):
1117+
def __init__(self, use_datetime=False):
11181118
self._use_datetime = use_datetime
11191119
self._connection = (None, None)
11201120
self._extra_headers = []
@@ -1129,7 +1129,7 @@ def __init__(self, use_datetime=0):
11291129
# @param verbose Debugging flag.
11301130
# @return Parsed response.
11311131

1132-
def request(self, host, handler, request_body, verbose=0):
1132+
def request(self, host, handler, request_body, verbose=False):
11331133
#retry request once if cached connection has gone cold
11341134
for i in (0, 1):
11351135
try:
@@ -1141,7 +1141,7 @@ def request(self, host, handler, request_body, verbose=0):
11411141
if i:
11421142
raise
11431143

1144-
def single_request(self, host, handler, request_body, verbose=0):
1144+
def single_request(self, host, handler, request_body, verbose=False):
11451145
# issue XML-RPC request
11461146
try:
11471147
http_conn = self.send_request(host, handler, request_body, verbose)
@@ -1379,8 +1379,8 @@ class ServerProxy:
13791379
the given encoding.
13801380
"""
13811381

1382-
def __init__(self, uri, transport=None, encoding=None, verbose=0,
1383-
allow_none=0, use_datetime=0):
1382+
def __init__(self, uri, transport=None, encoding=None, verbose=False,
1383+
allow_none=False, use_datetime=False):
13841384
# establish a "logical" server connection
13851385

13861386
# get the url

Lib/xmlrpc/server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def register_instance(self, instance, allow_dotted_names=False):
201201
self.instance = instance
202202
self.allow_dotted_names = allow_dotted_names
203203

204-
def register_function(self, function, name = None):
204+
def register_function(self, function, name=None):
205205
"""Registers a function to respond to XML-RPC requests.
206206
207207
The optional name argument can be used to set a Unicode name
@@ -627,7 +627,7 @@ def handle_get(self):
627627
sys.stdout.buffer.write(response)
628628
sys.stdout.buffer.flush()
629629

630-
def handle_request(self, request_text = None):
630+
def handle_request(self, request_text=None):
631631
"""Handle a single XML-RPC request passed through a CGI post method.
632632
633633
If no XML data is given then it is read from stdin. The resulting
@@ -882,7 +882,7 @@ class DocXMLRPCServer( SimpleXMLRPCServer,
882882
"""
883883

884884
def __init__(self, addr, requestHandler=DocXMLRPCRequestHandler,
885-
logRequests=1, allow_none=False, encoding=None,
885+
logRequests=True, allow_none=False, encoding=None,
886886
bind_and_activate=True):
887887
SimpleXMLRPCServer.__init__(self, addr, requestHandler, logRequests,
888888
allow_none, encoding, bind_and_activate)

Lib/zipfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,7 @@ def close(self):
12581258
class PyZipFile(ZipFile):
12591259
"""Class to create ZIP archives with Python library files and packages."""
12601260

1261-
def writepy(self, pathname, basename = ""):
1261+
def writepy(self, pathname, basename=""):
12621262
"""Add all files from "pathname" to the ZIP archive.
12631263
12641264
If pathname is a package directory, search the directory and

0 commit comments

Comments
 (0)