Programming Methods & Algorithms Python scripts - Top 4 Download

Programming Methods & Algorithms Python script downloads

Fast select

This script allows you to quickly select the n-th rank ordered element of a given sequence. It modifies the ordering of the given sequence. ...
Python

Fifo as single linked lists

Fifo mean "First In First Out". This script  creates a container, which only allows element insertion and removal and where the first element inserted is the first element removed. ...
Python

Find the most frequent elements

This script returns a sorted list of the most common to least common elements and their counts. If n is specified, return only the n most common elements. ...
Python

Finding the convex hull of a set of 2D points

This simple code calculates the convex hull of a set of 2D points and generates EPS files to visualise them. ...
Python

Finding the value passed to a function by name

Sometimes inside a decorator that creates a function with a generic (*args, **kwargs) signature, you want to access a value passed for a particular parameter name to a wrapped function, but don't know whether that value will be passed as a positional or keyword argument, or whether the wrapped function defines ...
Python

Finite State Machine FSM

This script shows a Finite State Machine (FSM) that can be used for small parsing tasks. The code is quite simple. The bulk of it is comments. In addition to state this FSM also maintains a user defined "something". This "something" is effectively memory, so this FSM could be considered a ...
Python

First Class Enums in Python

This script allows you to do true immutable symbolic enumeration with qualified value access. Most propoqualifiedor an enum in python attempt to solve the issue with a single class. However, fact is that enum has a dual nature: It declares a new anonimous type *and* all possible instances (values) of that ...
Python

Flexible enumerate

Flexible enumerate() script adds an additional start argument to the built-in enumerate function. ...
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

Format number function

For many languages it is possible to use the locale module to format numbers. But there are at least three languages for which the locale.localeconv()['thousands_sep'] is empty: brazilian portuguese - 'pt_br', portuguese - 'pt' and spanish - 'es'. The first function, format_positive_integer() will return the passed integer number as a string ...
Python

Format warnings for Visual Studio

Visual Studio can be configured to invoke a Python script during your build process. If you need to do this, you'll likely want to report errors and warnings in a way that Visual Studio will understand. This script uses the standard Python warnings framework, and installs a custom warning message formatter that ...
Python

Function composition

This script contains two classes that show two styles of function composition. The difference is only when the second function (g) returns a tuple. compose function passes the results of g as a tuple, mcompose treats it as a tuple of args to pass along. Note that extra args provided to (m)compose are treated ...
Python

Function emulation using call

This script defines a simple but useful class that emulates a function to gracefully permit latent assignment. In other words, you can use the emulating class as a valid function in assignments with the ability to later associate a function to perform the actual operations. ...
Python

Functional dictionary and list types

The purpose of this module is to provide a dictionary and list type that can aid in relational algebra, functional programming, list-oriented programming, and perhaps even code obfuscation. ...
Python

Generator for integer partitions

Generator for integer partitions script uses an iterative procedure to deal with integer partitions. ...
Python

Get attributes of an object in MS Active Directory

Sometimes it is useful to know what attributes are available to you for an object in active directory. You cannot ask the object directly for that, instead you need to use the schema of the object. All of this is done with python's COM support using win32com. By default only attributes ...
Python

get date wrapper to datetime module

The datetime module only accepts inputs of time it understands. For example, the months given to it have to be in range of values 1-12. This wrapper works around that issue and enables you to move forward or backward more arbitrary units of time. It does that by changing the year, ...
Python

Get system language dependent paths on windows

This module provides a few functions to retrieve the path names of some windows system directories from the registry and the environment. These path names can be different depending on OS version, installation language, current user and personal setup. Because of this, they should not be included statically in your program. ...
Python

Getting SYSTEM environment variable under Windows

This script allows you to get SYSTEM environment value, as if running under Service or SYSTEM account.As you can see in Windows Control Panel 'System' applet there are two groups of environment variables: USER and SYSTEM. This script presents a function for retrieve SYSTEM variable value.  ...
Python

Graph Script

This script allows you to create a directed Graph container that can be useful for the collections module. To show its basic API, a complete implementation is available. Many different graph implementations are possible, but this is flexible, fast and simple enough. ...
Python