Skip to content

Instantly share code, notes, and snippets.

View MatthieuDartiailh's full-sized avatar

Matthieu Dartiailh MatthieuDartiailh

View GitHub Profile
#------------------------------------------------------------------------------
# Copyright (c) 2019, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#------------------------------------------------------------------------------
""" An example illustrating the tracing inside declarative function.
Declarative function body can be traced. When used as the right hand side of
@MatthieuDartiailh
MatthieuDartiailh / enaml_comprehension_in_op.py
Created December 4, 2017 22:04
Expose the bytecode involved in comprehensions
from enaml.compat import IS_PY3
from future.utils import exec_
from enaml.core.enaml_compiler import EnamlCompiler
from enaml.core.parser import parse
# Timeout for qtbot wait (the value used is large due to Travis being sometimes
# very slow).
TIMEOUT = 2000
@MatthieuDartiailh
MatthieuDartiailh / system_error_bug.enaml
Created December 13, 2016 17:36
Demonstrate the SystemError bug appearing on Python 3 when an exception is cleared for unknown reasons
"""Gist demonstarting the SystemError bug on python 3
"""
#-------------------------------------------------------------------------------
# Imports:
#-------------------------------------------------------------------------------
from atom.api import List, observe
from enaml.widgets.api import RawWidget
from enaml.core.declarative import d_
from enaml.widgets.api import Window, Container, Field
enamldef Main(Window):
attr aux = ''
attr bis << str(aux)
bis ::
print(bis)
@MatthieuDartiailh
MatthieuDartiailh / enaml_parent_issue.enaml
Last active May 23, 2016 13:38
Demonstrate issue in reparenting in enaml
# -*- coding: utf-8 -*-
from enaml.core.api import Conditional
from enaml.widgets.api import (Window, Container, ObjectCombo, PushButton,
ScrollArea, GroupBox, Label)
enamldef Displayable(GroupBox): cont:
attr sp_children = []
# -*- coding: utf-8 -*-
from numba import jitclass, float64, jit
from funcsigs import signature
from future.utils import exec_
class Integrand(object):
pass
@MatthieuDartiailh
MatthieuDartiailh / measure_updater.py
Last active August 29, 2015 14:05
Measure updater for new version of HQCMeas.
# -*- coding: utf-8 -*-
"""
"""
import os
from shutil import copyfile
from configobj import ConfigObj
# This dictionary specifies tasks whose name has simply changed but are
# otherwise untouched and can be simply renamed.
UPDATED_TASK_NAMES = {'PrintTask': 'LogTask',
@MatthieuDartiailh
MatthieuDartiailh / gist:10398423
Created April 10, 2014 16:14
Demonstrate the issue with Dict using a Typed as value.
# -*- coding: utf-8 -*-
from atom.api import Atom, Dict, Str, Typed
class aux(Atom):
pass
class A(Atom):
@MatthieuDartiailh
MatthieuDartiailh / atom_issue53.py
Last active January 4, 2016 16:29
Atom issue 53
# -*- coding: utf-8 -*-
from atom.api import Atom, Float
class Test(Atom):
a = b = Float(0)
def _post_setattr_a(x, y, z):
print 'a'