semvec/pypi-packages huggingface dataset:
basicstruct 1.0.3
A simple struct-like object for Python
License: MIT
Keywords: struct,bean,basic struct,record,slots

basicstruct
===========

.. image:: https://travis-ci.org/Nurdok/basicstruct.svg
    :target: https://travis-ci.org/Nurdok/basicstruct


.. image:: https://coveralls.io/repos/Nurdok/basicstruct/badge.svg?branch=master&service=github
  :target: https://coveralls.io/github/Nurdok/basicstruct?branch=master


A simple struct-like object for Python.  
Compatible with Python 2.6+, 3.x, pypy and pypy3.

Installation
^^^^^^^^^^^^

.. code-block:: python

    pip install basicstruct
    
Usage
^^^^^

 To create your own struct, inherit from `BasicStruct` and define the field with the `__slots__` class member.
 `BasicStruct` are efficient objects that are automatically comparable, hashable, picklable, printable and reprable.

.. code-block:: python

    from basicstruct import BasicStruct
    
    class Point(BasicStruct):
        __slots__ = ('x', 'y')
        
    p1 = Point(2, 3)
    p2 = Point(1, y=6)
    p3 = Point(x=0, y=0)
    
    print(p1)  # prints: Point(x=2, y=3)
pycloser 0.2
Сlean exit for Python scripts after Ctrl-C.
License: MIT
Keywords: signals exit

pycloser
========

Сlean exit for Python scripts after Ctrl-C. Inspired by `xlab’s Closer`_
for Go (Golang). # Usage

.. code:: python

    from pycloser import defer, listen, close

    # Push inform function to stack.
    @defer
    def inform():
        print('You close programm with Ctrl-C.')

    # Push goodbuy function to stack.
    @defer
    def goodbuy():
        print('Goodbuy!')

    # Listening SIGINT, SIGTERM and SIGHUP OS signals.
    # When it sended, listen() pop deferred functions from stack
    # and call its one after the other.
    listen()

    # Main programm loop
    for x in range(1, 10):
        print("{0}: {1}".format(x, input(">> ")))

    # Pop deferred functions from stack and call its, if signal was not sended.
    close()

.. _xlab’s Closer: https://github.com/xlab/closer