Skip to content

Instantly share code, notes, and snippets.

View plq's full-sized avatar

Burak Arslan plq

View GitHub Profile
@plq
plq / README
Created August 26, 2013 13:31 — forked from anonymous/README
sample nuitka test program.
@plq
plq / helloworld_null.py
Created October 16, 2013 20:19
Spyne NullServer example.
'''
This is a simple HelloWorld example showing how the NullServer works. The
NullServer is meant to be used mainly for testing.
'''
import logging
logging.basicConfig(level=logging.INFO)
from pprint import pprint
@plq
plq / server.py
Last active December 29, 2015 11:39
simple type as __in_header__ does not work
import logging
from spyne.model.primitive import Boolean, Unicode, Integer
from spyne.model.complex import ComplexModel
from spyne.service import ServiceBase
from spyne.decorator import rpc
class SomeService(ServiceBase):
__in_header__ = Unicode(sub_name='myinfo')
@plq
plq / gist:8113509
Created December 24, 2013 13:39
cpython stacktrace
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff0a4941f in __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_end_element (__pyx_v_self=0x1671e08, __pyx_v_element_config=0xa66d20) at src/lxml/lxml.etree.c:113538
113538 __pyx_t_5 = __pyx_f_4lxml_5etree_22_IncrementalFileWriter__handle_error(__pyx_v_self, __pyx_v_self->_c_out->error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
(gdb) bt
#0 0x00007ffff0a4941f in __pyx_f_4lxml_5etree_22_IncrementalFileWriter__write_end_element (__pyx_v_self=0x1671e08, __pyx_v_element_config=0xa66d20) at src/lxml/lxml.etree.c:113538
#1 0x00007ffff0a4e283 in __pyx_pf_4lxml_5etree_18_FileWriterElement_4__exit__ (__pyx_v_self=0x167e5a0, __pyx_v_exc_type=0x7dde20 <_PyExc_GeneratorExit>, __pyx_v_exc_val=0x16810d8, __pyx_v_exc_tb=0x1677df8)
at src/lxml/lxml.etree.c:114964
#2 0x00007ffff0a4e185 in __pyx_pw_4lxml_5etree_18_FileWriterElement_5__exit__ (__pyx_v_self=0x167e5a0, __pyx_a
@plq
plq / output2
Last active January 1, 2016 15:28
Outsmarting context managers with coroutines
enter 1
enter 2
2 yo
exit 1 (<type 'exceptions.Exception'>, Exception(), <traceback object at 0x6c7b48>)
hey
@plq
plq / outwit.py
Created December 28, 2013 22:21
lxml segfault
from __future__ import print_function
from lxml import etree
from StringIO import StringIO
def coroutine(func):
def start(*args, **kwargs):
ret = func(*args, **kwargs)
try:
@plq
plq / gallery.py
Last active January 4, 2016 08:39
serialization gallery
@plq
plq / null.py
Last active August 29, 2015 13:56
question
from spyne.application import Application
from spyne.decorator import rpc
from spyne.service import ServiceBase
from spyne.protocol.soap import Soap11
from spyne.model.primitive import String, Integer
from spyne.model.complex import ComplexModel
class DatosFac(ComplexModel):
__namespace__ = 'facturamanager.datosfac'
numero = String(pattern=r'[A-Z]/[0-9]+')
#!/usr/bin/env python
# encoding: utf8
# Requires Spyne 2.11
from spyne.model.primitive import *
from spyne.model.complex import *
from spyne.application import Application
from spyne.protocol.soap import Soap11
from spyne.server.wsgi import WsgiApplication
@plq
plq / mi.py
Last active August 29, 2015 14:02
import logging
from uuid import uuid4
from spyne.application import Application
from spyne.decorator import rpc
from spyne.protocol.json import JsonDocument
from spyne.protocol.http import HttpRpc
from spyne.service import ServiceBase
from spyne.model.primitive import String, Integer, Uuid, Unicode
from spyne.model.complex import ComplexModel
from spyne.server.wsgi import WsgiApplication