Programming Methods & Algorithms scripts - Top 4 Download

Programming Methods & Algorithms script downloads

Disk Dumper

This script will display a hex dump of the disk specified on the command line. As the last two arguments, the program takes the first sector and last sector that should be displayed by this utility. The size of the sectors is stored in a variable created right after the imports ...
Python

split and join

This script will split a file into several smaller files while at the same time hiding the original formatting of the file. The program has a primitive GUI design, allowing a small amount of interaction with the program. ...
Python

Simple multiline interactive interpreter

This script is a simple embedded multiline python interpreter built around raw_input(). It interrupts the control flow at any given location with 'exec prompt' and gives control to the user. Allways runs in the current scope and can even be started from the pdb prompt in debugging mode.It was tested with python, jython ...
Python

Reloading all modules

When you create a Python module, you can use a test script wich import your module. But you probably have noticed that when you run the test script, it always use the first version of your module even if you made changes in the code.This is because the import statement check ...
Python

Variant assertion

Variant assertion script is Eiffel like loop variant assertion. ...
Python

Automatic indentation of output

This script is an output stream wrapper; possibly useful for debugging code with print statements. When write() is called, it makes a note of the calling frame. The indentation level is equal to the number of frames in the call stack which have been previously noted. ...
Python

Integrating Twisted reactor with IPython

This script allows you to run the Twisted reactor event loop in a thread alongside an IPython shell, for introspecting a running Twisted process. ...
Python

Trace expressions and comments in debug mode

This script acts like a stepping debugger to diagnose and fix your programs. It contains functions for log state and execution flow. ...
Python

Force verbose mode for unittests in an IDE

When running unit tests, using the verbose flag often provides an extra level of protection against mistakes. When running from the command line, this simply means adding the -v option. If you use an IDE, matters become more complicated. While you can often set your IDE to pass in the -v ...
Python

Debug statements include function name

This script allows a user to place debug messages, error messages and standard messages throughout a program. The function name and line number will be added to each debug and error message before it is printed out. In addition, each of these messages can be passed to multiple handler objects that can ...
Python

Null Object Design Pattern

This script is a sample implementation of the 'Null Object' design pattern. Roughly, the goal with Null objects is to provide an 'intelligent' replacement for the often used primitive data type None in Python or Null (or Null pointers) in other languages. These are used for many purposes including the important case ...
Python

AbstractFactory

This script has a base Factory class that is meant to be subclassed and then define a default implementation to return, as well as module's to search for the class implementation. ...
Python

The Singleton Pattern implemented with Python

This script contains a class that shows how to implement the singleton pattern in Python. A singleton is a class that makes sure only one instance of it is ever created. Typically such classes are used to manage resources that by their very nature can only exist once. ...
Python

Real class methods in Python

This script demonstrates 'real' class methods, like they are known from Smalltalk. Class methods implicitely receive the actual class as the first parameter. They are inherited by subclasses, and may as well be overridden. Class methods may return anything, although they are particularly useful as constructing, althbr >/ ...
Python

Restrictive APIs for Python

Python has no inherent provision for a restrictive API that blocks accesses to methods and variables outside an allowed set. Inexperienced Python programmers may fail to adhere to an agreed-upon API, directly accessing the private internals of a class. Adherence to defined APIs is a good thing. This script contains a  ...
Python

How to disable debug logging in release version

When you release your program to client, its a good idea to disable all the debug messages. It is possible via custom configuring debug levels at all modules, but may be implemented using a simple wrapper around logging.getnted usinfunction. ...
Python

Extract a inner function from a class

This function can extract a inner function from a class or a function. It may be useful when writing a unit test code. ...
Python

Extending the logging module

This script helps you in adding new format specifiers to the logging module. In this example, it's for the user name and the name of the function that logged the message. ...
Python

Debuging of object instantiation

If you are debugging a program, this script will help you to know if some special objects exist and where they came from. ...
Python

Debug runtime objects using gc get objects

Since Python 2.2 there is a handy function in the Garbage Collection Module called get_objects(). It gives back a list of all objects that are under control of the Garbeage Collector. This script implements a way you can extract informations of your application in runtime.The example dumps a list of all ...
Python