You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ks...@apache.org on 2018/12/15 16:17:30 UTC
[arrow] branch master updated: ARROW-3971: [Python] Remove
deprecations in 0.11 and prior
This is an automated email from the ASF dual-hosted git repository.
kszucs pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new e098651 ARROW-3971: [Python] Remove deprecations in 0.11 and prior
e098651 is described below
commit e098651a12f8199936f48f523e4f062a411969f7
Author: Wes McKinney <we...@apache.org>
AuthorDate: Sat Dec 15 17:17:09 2018 +0100
ARROW-3971: [Python] Remove deprecations in 0.11 and prior
Author: Wes McKinney <we...@apache.org>
Closes #3180 from wesm/ARROW-3971 and squashes the following commits:
2a367f5d <Wes McKinney> Remove Python deprecations in 0.11 and prior
---
python/pyarrow/_parquet.pyx | 2 +-
python/pyarrow/feather.py | 6 ------
python/pyarrow/filesystem.py | 5 +----
python/pyarrow/formatting.py | 43 -------------------------------------------
python/pyarrow/parquet.py | 15 ++++++---------
python/pyarrow/util.py | 16 ++++++----------
6 files changed, 14 insertions(+), 73 deletions(-)
diff --git a/python/pyarrow/_parquet.pyx b/python/pyarrow/_parquet.pyx
index 36a4d34..2e92bac 100644
--- a/python/pyarrow/_parquet.pyx
+++ b/python/pyarrow/_parquet.pyx
@@ -32,8 +32,8 @@ from pyarrow.lib cimport (Array, Schema,
NativeFile, get_reader, get_writer)
from pyarrow.compat import tobytes, frombytes
-from pyarrow.formatting import indent
from pyarrow.lib import ArrowException, NativeFile, _stringify_path
+from pyarrow.util import indent
import six
import warnings
diff --git a/python/pyarrow/feather.py b/python/pyarrow/feather.py
index 930e999..faa2f7d 100644
--- a/python/pyarrow/feather.py
+++ b/python/pyarrow/feather.py
@@ -20,7 +20,6 @@ import os
import six
import pandas as pd
-import warnings
from pyarrow.compat import pdapi
from pyarrow.lib import FeatherError # noqa
@@ -44,11 +43,6 @@ class FeatherReader(ext.FeatherReader):
self.source = source
self.open(source)
- def read(self, *args, **kwargs):
- warnings.warn("read has been deprecated. Use read_pandas instead.",
- FutureWarning, stacklevel=2)
- return self.read_pandas(*args, **kwargs)
-
def read_table(self, columns=None):
if columns is None:
return self._read()
diff --git a/python/pyarrow/filesystem.py b/python/pyarrow/filesystem.py
index f1d0eec..8188a26 100644
--- a/python/pyarrow/filesystem.py
+++ b/python/pyarrow/filesystem.py
@@ -148,8 +148,7 @@ class FileSystem(object):
raise NotImplementedError
def read_parquet(self, path, columns=None, metadata=None, schema=None,
- use_threads=True, nthreads=None,
- use_pandas_metadata=False):
+ use_threads=True, use_pandas_metadata=False):
"""
Read Parquet data from path in file system. Can read from a single file
or a directory of files
@@ -176,8 +175,6 @@ class FileSystem(object):
table : pyarrow.Table
"""
from pyarrow.parquet import ParquetDataset
- from pyarrow.util import _deprecate_nthreads
- use_threads = _deprecate_nthreads(use_threads, nthreads)
dataset = ParquetDataset(path, schema=schema, metadata=metadata,
filesystem=self)
return dataset.read(columns=columns, use_threads=use_threads,
diff --git a/python/pyarrow/formatting.py b/python/pyarrow/formatting.py
deleted file mode 100644
index 5ef9482..0000000
--- a/python/pyarrow/formatting.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Pretty-printing and other formatting utilities for Arrow data structures
-
-import pyarrow.lib as lib
-import warnings
-
-try:
- from textwrap import indent
-except ImportError:
- def indent(text, prefix):
- return ''.join(prefix + line for line in text.splitlines(True))
-
-
-def array_format(arr, window=10):
- warnings.warn("array_format is deprecated, use Array.format() instead",
- FutureWarning)
- return arr.format(window=window)
-
-
-def value_format(x, indent_level=0):
- warnings.warn("value_format is deprecated",
- FutureWarning)
- if isinstance(x, lib.ListValue):
- contents = ',\n'.join(value_format(item) for item in x)
- return '[{0}]'.format(indent(contents, ' ').strip())
- else:
- return repr(x)
diff --git a/python/pyarrow/parquet.py b/python/pyarrow/parquet.py
index 3ebfc8c..b89145a 100644
--- a/python/pyarrow/parquet.py
+++ b/python/pyarrow/parquet.py
@@ -35,7 +35,7 @@ from pyarrow._parquet import (ParquetReader, RowGroupStatistics, # noqa
from pyarrow.compat import guid
from pyarrow.filesystem import (LocalFileSystem, _ensure_filesystem,
_get_fs_from_path)
-from pyarrow.util import _is_path_like, _stringify_path, _deprecate_nthreads
+from pyarrow.util import _is_path_like, _stringify_path
def _check_contains_null(val):
@@ -135,8 +135,8 @@ class ParquetFile(object):
def num_row_groups(self):
return self.reader.num_row_groups
- def read_row_group(self, i, columns=None, nthreads=None,
- use_threads=True, use_pandas_metadata=False):
+ def read_row_group(self, i, columns=None, use_threads=True,
+ use_pandas_metadata=False):
"""
Read a single row group from a Parquet file
@@ -157,7 +157,6 @@ class ParquetFile(object):
pyarrow.table.Table
Content of the row group as a table (of columns)
"""
- use_threads = _deprecate_nthreads(use_threads, nthreads)
column_indices = self._get_column_indices(
columns, use_pandas_metadata=use_pandas_metadata)
return self.reader.read_row_group(i, column_indices=column_indices,
@@ -1071,9 +1070,7 @@ Returns
def read_table(source, columns=None, use_threads=True, metadata=None,
- use_pandas_metadata=False, memory_map=True,
- nthreads=None):
- use_threads = _deprecate_nthreads(use_threads, nthreads)
+ use_pandas_metadata=False, memory_map=True):
if _is_path_like(source):
fs = _get_fs_from_path(source)
return fs.read_parquet(source, columns=columns,
@@ -1094,8 +1091,8 @@ read_table.__doc__ = _read_table_docstring.format(
Content of the file as a table (of columns)""")
-def read_pandas(source, columns=None, use_threads=True,
- memory_map=True, nthreads=None, metadata=None):
+def read_pandas(source, columns=None, use_threads=True, memory_map=True,
+ metadata=None):
return read_table(source, columns=columns,
use_threads=use_threads,
metadata=metadata, memory_map=True,
diff --git a/python/pyarrow/util.py b/python/pyarrow/util.py
index 1c26ee5..7cf57d8 100644
--- a/python/pyarrow/util.py
+++ b/python/pyarrow/util.py
@@ -21,6 +21,12 @@ import six
import warnings
try:
+ from textwrap import indent
+except ImportError:
+ def indent(text, prefix):
+ return ''.join(prefix + line for line in text.splitlines(True))
+
+try:
# pathlib might not be available
try:
import pathlib
@@ -72,13 +78,3 @@ def _stringify_path(path):
return str(path)
raise TypeError("not a path-like object")
-
-
-def _deprecate_nthreads(use_threads, nthreads):
- if nthreads is not None:
- warnings.warn("`nthreads` argument is deprecated, "
- "pass `use_threads` instead", FutureWarning,
- stacklevel=3)
- if nthreads > 1:
- use_threads = True
- return use_threads