Skip to content

Commit efa3b51

Browse files
alanyeemiss-islington
authored andcommitted
Enforce PEP 257 conventions in ftplib.py (GH-15604)
-`"""` over `'''` -no blank line either before or after the docstring. -place the closing quotes on a line by themselves
1 parent e1786b5 commit efa3b51

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

Lib/ftplib.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ class error_proto(Error): pass # response does not begin with [1-5]
7272

7373
# The class itself
7474
class FTP:
75-
7675
'''An FTP client class.
7776
7877
To create a connection, call the class using these arguments:
@@ -105,12 +104,13 @@ class FTP:
105104
passiveserver = 1
106105
encoding = "latin-1"
107106

108-
# Initialization method (called by class instantiation).
109-
# Initialize host to localhost, port to standard ftp port
110-
# Optional arguments are host (for connect()),
111-
# and user, passwd, acct (for login())
112107
def __init__(self, host='', user='', passwd='', acct='',
113108
timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=None):
109+
"""Initialization method (called by class instantiation).
110+
Initialize host to localhost, port to standard ftp port.
111+
Optional arguments are host (for connect()),
112+
and user, passwd, acct (for login()).
113+
"""
114114
self.source_address = source_address
115115
self.timeout = timeout
116116
if host:
@@ -823,7 +823,6 @@ def parse227(resp):
823823
'''Parse the '227' response for a PASV request.
824824
Raises error_proto if it does not contain '(h1,h2,h3,h4,p1,p2)'
825825
Return ('host.addr.as.numbers', port#) tuple.'''
826-
827826
if resp[:3] != '227':
828827
raise error_reply(resp)
829828
global _227_re
@@ -843,7 +842,6 @@ def parse229(resp, peer):
843842
'''Parse the '229' response for an EPSV request.
844843
Raises error_proto if it does not contain '(|||port|)'
845844
Return ('host.addr.as.numbers', port#) tuple.'''
846-
847845
if resp[:3] != '229':
848846
raise error_reply(resp)
849847
left = resp.find('(')
@@ -865,7 +863,6 @@ def parse257(resp):
865863
'''Parse the '257' response for a MKD or PWD request.
866864
This is a response to a MKD or PWD request: a directory name.
867865
Returns the directoryname in the 257 reply.'''
868-
869866
if resp[:3] != '257':
870867
raise error_reply(resp)
871868
if resp[3:5] != ' "':

0 commit comments

Comments
 (0)