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
This commit is contained in:
parent
e1786b5416
commit
efa3b51fd0
@ -72,7 +72,6 @@ B_CRLF = b'\r\n'
|
|||||||
|
|
||||||
# The class itself
|
# The class itself
|
||||||
class FTP:
|
class FTP:
|
||||||
|
|
||||||
'''An FTP client class.
|
'''An FTP client class.
|
||||||
|
|
||||||
To create a connection, call the class using these arguments:
|
To create a connection, call the class using these arguments:
|
||||||
@ -105,12 +104,13 @@ class FTP:
|
|||||||
passiveserver = 1
|
passiveserver = 1
|
||||||
encoding = "latin-1"
|
encoding = "latin-1"
|
||||||
|
|
||||||
# Initialization method (called by class instantiation).
|
|
||||||
# Initialize host to localhost, port to standard ftp port
|
|
||||||
# Optional arguments are host (for connect()),
|
|
||||||
# and user, passwd, acct (for login())
|
|
||||||
def __init__(self, host='', user='', passwd='', acct='',
|
def __init__(self, host='', user='', passwd='', acct='',
|
||||||
timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=None):
|
timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=None):
|
||||||
|
"""Initialization method (called by class instantiation).
|
||||||
|
Initialize host to localhost, port to standard ftp port.
|
||||||
|
Optional arguments are host (for connect()),
|
||||||
|
and user, passwd, acct (for login()).
|
||||||
|
"""
|
||||||
self.source_address = source_address
|
self.source_address = source_address
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
if host:
|
if host:
|
||||||
@ -823,7 +823,6 @@ def parse227(resp):
|
|||||||
'''Parse the '227' response for a PASV request.
|
'''Parse the '227' response for a PASV request.
|
||||||
Raises error_proto if it does not contain '(h1,h2,h3,h4,p1,p2)'
|
Raises error_proto if it does not contain '(h1,h2,h3,h4,p1,p2)'
|
||||||
Return ('host.addr.as.numbers', port#) tuple.'''
|
Return ('host.addr.as.numbers', port#) tuple.'''
|
||||||
|
|
||||||
if resp[:3] != '227':
|
if resp[:3] != '227':
|
||||||
raise error_reply(resp)
|
raise error_reply(resp)
|
||||||
global _227_re
|
global _227_re
|
||||||
@ -843,7 +842,6 @@ def parse229(resp, peer):
|
|||||||
'''Parse the '229' response for an EPSV request.
|
'''Parse the '229' response for an EPSV request.
|
||||||
Raises error_proto if it does not contain '(|||port|)'
|
Raises error_proto if it does not contain '(|||port|)'
|
||||||
Return ('host.addr.as.numbers', port#) tuple.'''
|
Return ('host.addr.as.numbers', port#) tuple.'''
|
||||||
|
|
||||||
if resp[:3] != '229':
|
if resp[:3] != '229':
|
||||||
raise error_reply(resp)
|
raise error_reply(resp)
|
||||||
left = resp.find('(')
|
left = resp.find('(')
|
||||||
@ -865,7 +863,6 @@ def parse257(resp):
|
|||||||
'''Parse the '257' response for a MKD or PWD request.
|
'''Parse the '257' response for a MKD or PWD request.
|
||||||
This is a response to a MKD or PWD request: a directory name.
|
This is a response to a MKD or PWD request: a directory name.
|
||||||
Returns the directoryname in the 257 reply.'''
|
Returns the directoryname in the 257 reply.'''
|
||||||
|
|
||||||
if resp[:3] != '257':
|
if resp[:3] != '257':
|
||||||
raise error_reply(resp)
|
raise error_reply(resp)
|
||||||
if resp[3:5] != ' "':
|
if resp[3:5] != ' "':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user