Skip to content

Commit 237a024

Browse files
committed
remove intermediate variables
1 parent d2be9b9 commit 237a024

File tree

1 file changed

+25
-36
lines changed

1 file changed

+25
-36
lines changed

pandas/io/parsers.py

Lines changed: 25 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
# so we need to remove it if we see it.
5454
_BOM = u('\ufeff')
5555

56-
_parser_params = r"""{summary}
56+
_parser_params = r"""
57+
{summary}
5758
5859
Also supports optionally iterating or breaking of the file
5960
into chunks.
@@ -325,19 +326,6 @@
325326
>>> pd.{func_name}('data.csv') # doctest: +SKIP
326327
"""
327328

328-
# Summary line for read_csv,read_table and read_fwf
329-
_summary_read_csv = """
330-
Read a comma-separated values (csv) file into DataFrame."""
331-
332-
_summary_read_table = """
333-
Read general delimited file into DataFrame.
334-
335-
.. deprecated:: 0.24.0
336-
Use :func:`pandas.read_csv` instead, passing ``sep='\t'`` if necessary."""
337-
338-
_summary_read_fwf = """
339-
Read a table of fixed-width formatted lines into DataFrame."""
340-
341329
# engine is not used in read_fwf() so is factored out of the shared docstring
342330
_engine_doc = """engine : {'c', 'python'}, optional
343331
Parser engine to use. The C engine is faster while the python engine is
@@ -355,18 +343,6 @@
355343
Alias for sep.
356344
"""
357345

358-
_read_csv_doc = (_parser_params
359-
.format(summary=_summary_read_csv,
360-
sep_doc=_sep_doc.format(default="','"),
361-
engine_doc=_engine_doc,
362-
func_name='read_csv'))
363-
364-
_read_table_doc = (_parser_params
365-
.format(summary=_summary_read_table,
366-
sep_doc=_sep_doc.format(default="\\t (tab-stop)"),
367-
engine_doc=_engine_doc,
368-
func_name='read_table'))
369-
370346
_fwf_widths = """\
371347
colspecs : list of pairs (int, int) or 'infer'. optional
372348
A list of pairs (tuples) giving the extents of the fixed-width
@@ -383,12 +359,6 @@
383359
if it is not spaces (e.g., '~').
384360
"""
385361

386-
_read_fwf_doc = (_parser_params
387-
.format(summary=_summary_read_fwf,
388-
sep_doc='',
389-
engine_doc='',
390-
func_name='read_fwf'))
391-
392362

393363
def _validate_integer(name, val, min_val=0):
394364
"""
@@ -734,13 +704,32 @@ def parser_f(filepath_or_buffer,
734704

735705

736706
read_csv = _make_parser_function('read_csv', default_sep=',')
737-
read_csv = Appender(_read_csv_doc)(read_csv)
707+
read_csv = Appender(_parser_params.format(
708+
func_name='read_csv',
709+
summary=('Read a comma-separated values (csv) file '
710+
'into DataFrame.'),
711+
sep_doc=_sep_doc.format(default="','"),
712+
engine_doc=_engine_doc)
713+
)(read_csv)
738714

739715
read_table = _make_parser_function('read_table', default_sep='\t')
740-
read_table = Appender(_read_table_doc)(read_table)
716+
read_table = Appender(_parser_params.format(
717+
func_name='read_table',
718+
summary="""Read general delimited file into DataFrame.
741719
742-
743-
@Appender(_read_fwf_doc)
720+
.. deprecated:: 0.24.0
721+
Use :func:`pandas.read_csv` instead, passing ``sep='\\t'`` if necessary.""",
722+
sep_doc=_sep_doc.format(default="\\t (tab-stop)"),
723+
engine_doc=_engine_doc)
724+
)(read_table)
725+
726+
727+
@Appender(_parser_params.format(
728+
func_name='read_fwf',
729+
summary=('Read a table of fixed-width formatted lines '
730+
'into DataFrame.'),
731+
sep_doc='',
732+
engine_doc=''))
744733
def read_fwf(filepath_or_buffer, colspecs='infer', widths=None, **kwds):
745734
# Check input arguments.
746735
if colspecs is None and widths is None:

0 commit comments

Comments
 (0)