Ticket #6781: trac_6781-review.take2.patch

File trac_6781-review.take2.patch, 3.2 KB (added by burcin, 9 years ago)
  • module_list.py

    # HG changeset patch
    # User Burcin Erocal <burcin@erocal.org>
    # Date 1271061722 -7200
    # Node ID 4e803990ffdf6ef22271d2830a45c59c087ab909
    # Parent  350f6f3b08e4dc5afe84484b7159d9a058b01f57
    trac 6781: minor cosmetic changes to the ecl library interface.
    
    diff --git a/module_list.py b/module_list.py
    a b  
    398398    ################################
    399399
    400400    Extension('sage.libs.ecl',
    401               sources = ["sage/libs/ecl/ecl.pyx"],
     401              sources = ["sage/libs/ecl.pyx"],
    402402              libraries = ["ecl"],
    403403              include_dirs = [SAGE_ROOT+'/local/include/ecl/'],
    404404              depends = [SAGE_ROOT + '/local/include/ecl/ecl.h']),
  • ecl.pyx

    diff --git a/sage/libs/ecl/ecl.pxd b/sage/libs/ecl.pxd
    rename from sage/libs/ecl/ecl.pxd
    rename to sage/libs/ecl.pxd
    diff --git a/sage/libs/ecl/ecl.pyx b/sage/libs/ecl.pyx
    rename from sage/libs/ecl/ecl.pyx
    rename to sage/libs/ecl.pyx
    old new  
    1313#rationals to SAGE types Integer and Rational. These parts could easily be
    1414#adapted to work with pure Python types.
    1515
    16 cimport sage.rings.integer
    1716from sage.rings.integer cimport Integer
    18 import sage.rings.integer
    19 from sage.rings.integer import Integer
    20 cimport sage.rings.rational
    2117from sage.rings.rational cimport Rational
    22 import sage.rings.rational
    2318from sage.rings.rational import Rational
    2419
    2520#it would be preferrable to let bint_symbolp wrap an efficient macro
     
    277272            return Ct
    278273        else:
    279274            return Cnil
    280     elif pyobj==None:
     275    elif pyobj is None:
    281276        return Cnil
    282277    elif isinstance(pyobj,int):
    283278        return ecl_make_integer(pyobj)
     
    630625            NotImplementedError: EclObjects can only be compared for equality
    631626            sage: EclObject("<")(a,b)
    632627            <ECL: T>
    633 
    634628        """
    635    
    636629        if   op == 2: # "=="
    637630            if not(isinstance(left,EclObject)) or not(isinstance(right,EclObject)):
    638631                return False
     
    650643        #inappropriate for an *interface*.
    651644        raise NotImplementedError,"EclObjects can only be compared for equality"
    652645 
    653         if not(isinstance(left,EclObject)) or not(isinstance(right,EclObject)):
    654             raise TypeError,"Can only compare EclObjects"
    655         if op == 0: # "<"
    656             pass
    657         elif op == 1: # "<="
    658             pass
    659         elif op == 4: # ">"
    660             pass
    661         elif op == 5: # ">="
    662             pass
    663         else:
    664             raise ValueError,"richcmp received operation code %d"%op
     646        #if not(isinstance(left,EclObject)) or not(isinstance(right,EclObject)):
     647        #    raise TypeError,"Can only compare EclObjects"
     648        #if op == 0: # "<"
     649        #    pass
     650        #elif op == 1: # "<="
     651        #    pass
     652        #elif op == 4: # ">"
     653        #    pass
     654        #elif op == 5: # ">="
     655        #    pass
     656        #else:
     657        #    raise ValueError,"richcmp received operation code %d"%op
    665658
    666659    def eval(self):
    667660        r"""
     
    993986
    994987#input: a cl-object. Output: EclObject wrapping that.
    995988cdef EclObject ecl_wrap(cl_object o):
    996     cdef EclObject obj
    997     obj = EclObject()
     989    cdef EclObject obj = EclObject.__new__(EclObject)
    998990    obj.set_obj(o)
    999991    return obj
    1000992