Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install pd.find

How to install pd.find

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install pd.find
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.0.3 Available View build log
Windows (64-bit)
0.0.3 Available View build log
Mac OS X (10.5+)
0.0.3 Available View build log
Linux (32-bit)
0.0.3 Available View build log
Linux (64-bit)
0.0.3 Available View build log
 
Author
License
GPL v2.1
Dependencies
Depended by
Imports
Lastest release
version 0.0.3 on Jan 5th, 2011

Module pd.find present simple way use filesystem to search and read files on it. File system using showed as simple as using ordinal dict:

>>> import pd.find
>>> f=pd.find.file.File("/etc/sysconfig")
>>> f

System Message: ERROR/3 (<string>, line 11)

Inconsistent literal block quoting.

'/etc/sysconfig' >>> f.keys() ['harddisk', 'lm_sensors', 'ipw3945d~', 'syscheckerrc', 'mouse'] >>> f['lm_sensors'] '/etc/sysconfig/lm_sensors' >>> print str(f['lm_sensors']) # /etc/sysconfig/lm_sensors - Defines modules loaded by

Other important pakage mission is find files by the way similar to command line find utility:

>>> import pd.find
>>> pd.find.find("/etc/sysconfig",lambda x : x.isreg() and x.check_regex(".*rc"))

System Message: ERROR/3 (<string>, line 24)

Inconsistent literal block quoting.

<generator object at 0xb7cca7cc> >>> for item in pd.find.find("/etc/sysconfig",lambda x : x.isreg() and x.check_regex(".*rc$")) : ... print item.path ... /etc/sysconfig/xinitrc /etc/sysconfig/syscheckerrc >>>

Using pd.find.file.File

Constructor issued as in example above, with one required argument - path to file or directory. There are other arguments:

dereference Follow symlinks (is False by default)

The File object to provide some useful methods and attributes:

path Attribute present absolute file path;

__str__() Method returns file body if it can;

Other attributes do condition check and will be described bellow.

Issue pd.find.find utility

The pd.find.find utility issued to reqursive search files to satisfy some conditions. Utility accept followed arguments:

path Directory path to search begin with;

condition Condition checked on scanned files and directories. If condition satisfy - object yielded by utility;

precondition Condition checked before subdirectory scan. If condition does not satisfy, subdirectory will not be scaned;

dereference On true value of this argument searhing will be followed by symbolic link.

Utility return generator of list object find by them.

Tests provided by File Object

mtime Return modification time

atime Return last access time

ctime Return creation time """ return self.__checktime_(stat.ST_CTIME)

newer Return true if object is more newer then input path

check_name Return true if object name are equal to input name

check_path Return true if object path are equal to input path

check_path_regex Return true if regexp matched object path

check_regex Return true if regexp matched object name

check_iregex Return true if regexp matched object name

depth Return current depth on file tree

dele Delete file by path of current object

execute Frm will be substituted by substring "{}" on path and executed by os.system() call

Ho-ho. Sorry my English :)

System Message: WARNING/2 (<string>, line 120)

Bullet list ends without a blank line; unexpected unindent.
  • Some documentation wrote

System Message: WARNING/2 (<string>, line 123)

Bullet list ends without a blank line; unexpected unindent.
  • first official release

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.