Merge lp://staging/~mostawesomedude/meliae/trunk into lp://staging/meliae

Proposed by Corbin Simpson
Status: Merged
Approved by: John A Meinel
Approved revision: 186
Merged at revision: 186
Proposed branch: lp://staging/~mostawesomedude/meliae/trunk
Merge into: lp://staging/meliae
Diff against target: 21 lines (+11/-0)
1 file modified
meliae/scanner.py (+11/-0)
To merge this branch: bzr merge lp://staging/~mostawesomedude/meliae/trunk
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+50422@code.staging.launchpad.net

Description of the change

This adds numpy ndarray sizing, which is kind of important for a handful of projects. Hope it's useful!

~ C.

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Does this handle both 64 and 32-bit environments? It looks fine to me,
but I don't know the details of ndarray.

John
=:->
 merge: approve

On Fri, Feb 18, 2011 at 7:23 PM, Corbin Simpson
<<email address hidden> <mailto:<email address hidden>>> wrote:

    Corbin Simpson has proposed merging
    lp:~mostawesomedude/meliae/trunk into lp:meliae.

    Requested reviews:
     Meliae Development Team (meliae-dev)

    For more details, see:
    https://code.launchpad.net/~mostawesomedude/meliae/trunk/+merge/50422

<https://code.launchpad.net/%7Emostawesomedude/meliae/trunk/+merge/50422>

    This adds numpy ndarray sizing, which is kind of important for a
    handful of projects. Hope it's useful!

    ~ C.
    --
    https://code.launchpad.net/~mostawesomedude/meliae/trunk/+merge/50422

<https://code.launchpad.net/%7Emostawesomedude/meliae/trunk/+merge/50422>
    You are subscribed to branch lp:meliae.

    === modified file 'meliae/scanner.py'
    --- meliae/scanner.py 2010-08-10 16:20:09 +0000
    +++ meliae/scanner.py 2011-02-19 01:22:52 +0000
    @@ -27,6 +27,17 @@
     get_referents = _scanner.get_referents
     add_special_size = _scanner.add_special_size

    +def _size_of_ndarray(ndarray_obj):
    + """
    + Return the size of a Numpy ndarray's internal storage.
    +
    + Doesn't yet handle views into other arrays.
    + """
    +
    + return ndarray_obj.nbytes
    +
    +add_special_size("numpy.ndarray", _size_of_ndarray, _size_of_ndarray)
    +

     def dump_all_referenced(outf, obj, is_pending=False):
        """Recursively dump everything that is referenced from obj."""

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1mlNsACgkQJdeBCYSNAAOXRACgxyXbrNOeJ5MRFSm3pM4viWhV
8hkAnAz6rpX/ep1/wTlRA6w8ZplIL+5W
=QArt
-----END PGP SIGNATURE-----

review: Approve
Revision history for this message
Corbin Simpson (mostawesomedude) wrote :

This appears to do exactly what it should do on both my 32-bit and
64-bit machines. There are more involved and detailed ways of looking
up this data, but they appear to be correctly encapsulated in nbytes,
so I'm happy to go with this.

Thanks for Meliae, BTW; it's been invaluable for Bravo!

~ C.

On Thu, Feb 24, 2011 at 9:32 AM, John A Meinel <email address hidden> wrote:
> Review: Approve
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Does this handle both 64 and 32-bit environments? It looks fine to me,
> but I don't know the details of ndarray.
>
> John
> =:->
>  merge: approve
>
> On Fri, Feb 18, 2011 at 7:23 PM, Corbin Simpson
> <<email address hidden> <mailto:<email address hidden>>> wrote:
>
>    Corbin Simpson has proposed merging
>    lp:~mostawesomedude/meliae/trunk into lp:meliae.
>
>    Requested reviews:
>     Meliae Development Team (meliae-dev)
>
>    For more details, see:
>    https://code.launchpad.net/~mostawesomedude/meliae/trunk/+merge/50422
>
> <https://code.launchpad.net/%7Emostawesomedude/meliae/trunk/+merge/50422>
>
>    This adds numpy ndarray sizing, which is kind of important for a
>    handful of projects. Hope it's useful!
>
>    ~ C.
>    --
>    https://code.launchpad.net/~mostawesomedude/meliae/trunk/+merge/50422
>
> <https://code.launchpad.net/%7Emostawesomedude/meliae/trunk/+merge/50422>
>    You are subscribed to branch lp:meliae.
>
>    === modified file 'meliae/scanner.py'
>    --- meliae/scanner.py   2010-08-10 16:20:09 +0000
>    +++ meliae/scanner.py   2011-02-19 01:22:52 +0000
>    @@ -27,6 +27,17 @@
>     get_referents = _scanner.get_referents
>     add_special_size = _scanner.add_special_size
>
>    +def _size_of_ndarray(ndarray_obj):
>    +    """
>    +    Return the size of a Numpy ndarray's internal storage.
>    +
>    +    Doesn't yet handle views into other arrays.
>    +    """
>    +
>    +    return ndarray_obj.nbytes
>    +
>    +add_special_size("numpy.ndarray", _size_of_ndarray, _size_of_ndarray)
>    +
>
>     def dump_all_referenced(outf, obj, is_pending=False):
>        """Recursively dump everything that is referenced from obj."""
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (Cygwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk1mlNsACgkQJdeBCYSNAAOXRACgxyXbrNOeJ5MRFSm3pM4viWhV
> 8hkAnAz6rpX/ep1/wTlRA6w8ZplIL+5W
> =QArt
> -----END PGP SIGNATURE-----
>
>
> --
> https://code.launchpad.net/~mostawesomedude/meliae/trunk/+merge/50422
> You are the owner of lp:~mostawesomedude/meliae/trunk.
>

--
When the facts change, I change my mind. What do you do, sir? ~ Keynes

Corbin Simpson
<email address hidden>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: