Skip to content

Rename replace_axes as set_axes + update doc of rename method #147

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
Mar 14, 2017

Conversation

alixdamman
Copy link
Collaborator

fix #121 : Update docstring of set_labels.

fix #133 : Rename replace_axes as set_axes.

Add inplace flag to set_axes and rename methods

Copy link
Contributor

@gdementen gdementen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the release notes in the other PR will need to be updated too

larray/core.py Outdated
@@ -4319,6 +4328,10 @@ def rename(self, renames=None, to=None, **kwargs):
nat2\\sex2 | M | F
BE | 0 | 1
FO | 2 | 3
>>> arr.rename({'nat': 'nat2', 'sex': 'sex2'})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duh? this is the same as the previous example?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was to test the inplace flag. I failded to properly clean the examples.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

@@ -3905,7 +3905,7 @@ def __init__(self,
raise ValueError("length of axes %s does not match "
"data shape %s" % (axes.shape, data.shape))

# Because __getattr__ and __setattr__ have been rewritten
# Because __getattr__ and __setattr__ have been overridden
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even though it is indeed the case, __setattr__ should actually not be overridden (ever since we changed __getattr__ to return axes). It might be better to fix that in a separate PR though, because most (all?) object.__setattr__ could/should be replaced.

larray/core.py Outdated
@@ -3976,28 +3973,37 @@ def replace_axes(self, axes_to_replace=None, new_axis=None, **kwargs):
a1 | 3 | 4 | 5
>>> row = Axis('row', ['r0', 'r1'])
>>> column = Axis('column', ['c0', 'c1', 'c2'])
>>> arr.replace_axes(x.a, row)

Replace one axis (expect 2 arguments)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the "expect 2 arguments" part is a bit strange. who should expect? the function or the user? => replace by somethng like:
Replace one axis (the second argument is required when using this syntax)

fix larray-project#133  :Rename replace_axes as set_axes.

Add inplace flag to set_axes and rename methods
@alixdamman alixdamman force-pushed the rename_replace_axes branch from a0bd8c8 to a139f99 Compare March 13, 2017 15:14
@gdementen
Copy link
Contributor

LGTM

@gdementen gdementen merged commit f837e2a into larray-project:master Mar 14, 2017
@alixdamman alixdamman deleted the rename_replace_axes branch March 14, 2017 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rename replace_axes to set_axes and update set_labels API? document that a single string is allowed in set_labels
2 participants