Search
New Code
Advanced Amazon Clone App 2.0
Appjetty Delivery Date Manager 1.0.0
The C# Barcode Library 2020.5.0
Chowtro - Online Restaurant Food Ordering Software 1.0
Alvas.Audio.Core 2019.0
Sainsburys Script 1.3.2
Grptalk free
Devart Excel Add-in for PostgreSQL 2.1
Classified Software - Classifieds Listing Script 1.3.0
.Net Native Interface Library for Pascal 1.0.0.0
VaxVoIP WebPhone SDK 4.0.5
PostgreSQL Data Access Components 6.2.4
Virtual Data Access Components 11.2.4
White-label Uber clone 2.0
phpSoftPro Social Bookmarking 1.43
Top Code
phpEnter 5.1.
Single Leg MLM 1.2.1
Azizi search engine script PHP 4.1.10
Paste phpSoftPro 1.4.1
Extreme Injector 3.7
Deals and Discounts Website Script 1.0.2
Solid File System OS edition 5.1
Classified Ad Lister 1.0
Aglowsoft SQL Query Tools 8.2
Invoice Manager by PHPJabbers 3.0
ICPennyBid Penny Auction Script 4.0
PHP Review Script 1.0
ATN Resume Finder 2.0
ATN Site Builder 3.0
Availability Booking Calendar PHP 1.0
Code Listing by Jan Kaliszewski

Code 1-7 of 7   






A simple implementation of a dictionary which always (when applicable) returns keys, values, items (key-value pairs) sorted by keys (inserting/removing order doesn't matter and only keys are important; so please note that it is something different than OrderedDict in Python 3.1/2.7 or Django's SortedDict).



This module provides an easy way to define and use your own around/before/after auxiliary methods, similar to those used in CLOS (Common Lisp Object System).



My approach to that common issue focuses on efficiency and elegant, declarative style of definition. That's why:


The way switches work is based on unwrapped defaultdict/list lookup.
The way you define switches is based on...



A Python 2.x/3.x-compatibile multiprocess-safe logging file-handler (logging.FileHandler replacement, designed for logging to a single file from multiple independent processes) together with a simple interprocess recursive lock -- universal...



A quick fcntl.flock(fcntl.LOCK_EX | fcntl.LOCK_NB) call sampling script: with one file object (and descriptor) or separate file objects (and different descriptors) pointing to the same filesystem path -- with/without threading or forking.



Just import, call and log your selected call/return/exception/etc. events.
You can use a standard Python logger from the logging module.
Quite flexible tool and about 50 efective SLOC only (excluding the example script).
For...



If you need


to define named tuple subclasses (including reusable abstract ones), adding/overriding some methods, in a convenient way;
to have the named tuple ABC (abstract base class) for isinstance/issubclass tests;
or...