Uploaded image for project: 'The Virtual Brain'
  1. The Virtual Brain
  2. TVB-2755

Add EnumAttr in neotraits

    XMLWordPrintable

Details

    • Task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.7
    • 2.4
    • None
    • None
    • VBC Sprint 13
    • 8.2 Pipeline Integration

    Description

      -    projection_type = Attr(field_type=str, default=EEG_POLYMORPHIC_IDENTITY)
      +   projection_type = Attr(field_type=str, default=ProjectionsType.EEG.value)
      

      why not field_type=ProjectionsType, default=ProjectionsType.EEG ?
      The actual value of an enum is an implementation detail.
      or with neotraits support, perhaps more concisely,

      projection_type = EnumAttr(default=ProjectionsType.EEG)
      with internally initializing field_type=default.__class__?
      

      Pushing this further the enum class could also allow generating instances from a enum member directly, since manually coding that is error-prone.

      Gliffy Diagrams

        Attachments

          Activity

            People

              robert.vincze Robert Francisc Vincze
              marmaduke.woodman Marmaduke Woodman
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 1 week Original Estimate - 1 week
                  1w
                  Remaining:
                  Time Spent - 2 weeks, 3 days, 2 hours Remaining Estimate - 4 hours
                  4h
                  Logged:
                  Time Spent - 2 weeks, 3 days, 2 hours Remaining Estimate - 4 hours
                  2w 3d 2h