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

Add EnumAttr in neotraits

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.7
    • Fix Version/s: 2.4
    • Component/s: None
    • Labels:
      None
    • Epic Link:
    • Sprint:
      VBC Sprint 13
    • TVB-C Task:
      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

              Assignee:
              robert.vincze Robert Francisc Vincze
              Reporter:
              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