Skip to content

Commit

Permalink
Merge pull request #496 from nucleic/members-add
Browse files Browse the repository at this point in the history
core: use atom.add_member to add members after a class is defined
  • Loading branch information
MatthieuDartiailh committed Jun 14, 2022
2 parents e17ff71 + 1b3bdbf commit c0f7cb3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ jobs:
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Setup Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.x'
- name: Build sdist
run: |
pip install --upgrade pip
Expand Down
14 changes: 3 additions & 11 deletions enaml/core/compiler_helpers.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#------------------------------------------------------------------------------
# Copyright (c) 2013, Nucleic Development Team.
# Copyright (c) 2013-2022, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------------------------------------
from functools import update_wrapper

from atom.api import Event, Instance, Member
from atom.api import Event, Instance, Member, add_member
from atom.datastructures.api import sortedmap

from .alias import Alias
Expand Down Expand Up @@ -154,16 +154,8 @@ def add_storage(node, name, store_type, kind):
else:
raise RuntimeError("invalid kind '%s'" % kind)

if member is not None:
new.set_index(member.index)
new.copy_static_observers(member)
else:
new.set_index(len(members))

new.set_name(name)
patch_d_member(new)
members[name] = new
setattr(klass, name, new)
add_member(klass, name, new)


def declarative_node(klass, identifier, scope_key, store_locals):
Expand Down

0 comments on commit c0f7cb3

Please sign in to comment.