Skip to content

CLN: replace rwproperty with regular property #4843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 15, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ See :ref:`Internal Refactoring<whatsnew_0130.refactoring>`
- Refactor of Series arithmetic with time-like objects (datetime/timedelta/time
etc.) into a separate, cleaned up wrapper class. (:issue:`4613`)
- Complex compat for ``Series`` with ``ndarray``. (:issue:`4819`)
- Removed unnecessary ``rwproperty`` from codebase in favor of builtin property. (:issue:`4843`)

Experimental Features
~~~~~~~~~~~~~~~~~~~~~
Expand Down
9 changes: 4 additions & 5 deletions pandas/core/internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from pandas.tslib import Timestamp
from pandas import compat
from pandas.compat import range, lrange, lmap, callable, map, zip
from pandas.util import rwproperty


class Block(PandasObject):
Expand Down Expand Up @@ -1450,22 +1449,22 @@ def shape(self):
def itemsize(self):
return self.dtype.itemsize

@rwproperty.getproperty
@property
def fill_value(self):
return self.values.fill_value

@rwproperty.setproperty
@fill_value.setter
def fill_value(self, v):
# we may need to upcast our fill to match our dtype
if issubclass(self.dtype.type, np.floating):
v = float(v)
self.values.fill_value = v

@rwproperty.getproperty
@property
def sp_values(self):
return self.values.sp_values

@rwproperty.setproperty
@sp_values.setter
def sp_values(self, v):
# reset the sparse values
self.values = SparseArray(
Expand Down
9 changes: 4 additions & 5 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
from pandas import compat
from pandas.util.terminal import get_terminal_size
from pandas.compat import zip, lzip, u, OrderedDict
from pandas.util import rwproperty

import pandas.core.array as pa

Expand Down Expand Up @@ -797,19 +796,19 @@ def __contains__(self, key):
return key in self.index

# complex
@rwproperty.getproperty
@property
def real(self):
return self.values.real

@rwproperty.setproperty
@real.setter
def real(self, v):
self.values.real = v

@rwproperty.getproperty
@property
def imag(self):
return self.values.imag

@rwproperty.setproperty
@imag.setter
def imag(self, v):
self.values.imag = v

Expand Down
5 changes: 2 additions & 3 deletions pandas/sparse/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import pandas.index as _index

from pandas import compat
from pandas.util import rwproperty

from pandas.sparse.array import (make_sparse, _sparse_array_op, SparseArray)
from pandas._sparse import BlockIndex, IntIndex
Expand Down Expand Up @@ -213,11 +212,11 @@ def get_values(self):
def block(self):
return self._data._block

@rwproperty.getproperty
@property
def fill_value(self):
return self.block.fill_value

@rwproperty.setproperty
@fill_value.setter
def fill_value(self, v):
self.block.fill_value = v

Expand Down
75 changes: 0 additions & 75 deletions pandas/util/rwproperty.py

This file was deleted.