Trees Indices Help
Trac
Package trac :: Package util

Package util

source code

Submodules

Classes
WindowsError
Dummy exception replacing WindowsError on non-Windows platforms
AtomicFile
A file that appears atomically with its full content.
NaivePopen
errorlevel, out (a string) and err (a string).
Ranges
Holds information about ranges parsed from a string
Functions
get_reporter_id(req, arg_name=None) source code
getuser() source code
embedded_numbers(s)
Comparison function for natural order sorting based on http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/214202. source code
read_file(path, mode='r')
Read a file and return its content. source code
create_file(path, data='', mode='w')
Create a new file with the given data. source code
create_unique_file(path)
Create a new file. source code
makedirs(path, overwrite=False) source code
copytree(src, dst, symlinks=False, skip=[], overwrite=False)
Recursively copy a directory tree using copy2() (from shutil.copytree.) source code
is_path_below(path, parent)
Return True iff path is equal to parent or is located below parent at any level. source code
arity(f)
Return the number of arguments expected by the given function, unbound or bound method. source code
get_last_traceback() source code
get_lines_from_file(filename, lineno, context=0, globals=None)
Return content number of lines before and after the specified lineno from the (source code) file identified by filename. source code
get_frame_info(tb)
Return frame information for a traceback. source code
safe__import__(module_name)
Safe imports: rollback after a failed import. source code
get_doc(obj)
Return the docstring of an object as a tuple (summary, description), where summary is the first paragraph and description is the remaining text. source code
get_module_path(module)
Return the base path the given module is imported from source code
get_sources(path)
Return a dictionary mapping Python module source paths to the distributions that contain them. source code
get_pkginfo(dist)
Get a dictionary containing package information for a package source code
warn_setuptools_issue(out=None) source code
hex_entropy(bytes=32) source code
md5crypt(password, salt, magic='1ドル$') source code
to_ranges(revs)
Converts a list of revisions to a minimal set of ranges. source code
content_disposition(type=None, filename=None)
Generate a properly escaped Content-Disposition header. source code
pairwise(iterable) source code
partition(iterable, order=None) source code
as_int(s, default, min=None, max=None)
Convert s to an int and limit it to the given range, or return default if unsuccessful. source code
as_bool(value)
Convert the given value to a bool. source code
pathjoin(*args)
Strip / from the arguments and join them with a single /. source code
Variables
DIGITS = re.compile(r'(\d+)')
MOVEFILE_REPLACE_EXISTING = 0x1
MOVEFILE_WRITE_THROUGH = 0x8
MoveFileEx = ctypes.windll.kernel32.MoveFileExW
CreateTransaction = ctypes.windll.ktmw32.CreateTransaction
CommitTransaction = ctypes.windll.ktmw32.CommitTransaction
MoveFileTransacted = ctypes.windll.kernel32.MoveFileTransactedW
CloseHandle = ctypes.windll.kernel32.CloseHandle
can_rename_open_file = True
__package__ = 'trac.util'

Imports: errno, inspect, izip, tee, locale, os, find_distributions, random, re, shutil, sys, tempfile, time, quote, unquote, urlencode, any, md5, sha1, sorted, to_unicode, getpreferredencoding, pwd, ctypes, rename, urandom, TracError, reversed, escape, unescape, Markup, Deuglifier, CRLF, to_utf8, shorten_line, wrap, pretty_size, pretty_timedelta, format_datetime, format_date, format_time, get_date_format_hint, get_datetime_format_hint, http_date, parse_date, autoreload, compat, concurrency, daemon, datefmt, html, presentation, text, translation


Function Details

create_unique_file(path)

source code
Create a new file. An index is added if the path exists

copytree(src, dst, symlinks=False, skip=[], overwrite=False)

source code

Recursively copy a directory tree using copy2() (from shutil.copytree.)

Added a skip parameter consisting of absolute paths which we don't want to copy.

get_lines_from_file(filename, lineno, context=0, globals=None)

source code

Return content number of lines before and after the specified lineno from the (source code) file identified by filename.

Returns a (lines_before, line, lines_after) tuple.

safe__import__(module_name)

source code

Safe imports: rollback after a failed import.

Initially inspired from the RollbackImporter in PyUnit, but it's now much simpler and works better for our needs.

See http://pyunit.sourceforge.net/notes/reloading.html

get_pkginfo(dist)

source code

Get a dictionary containing package information for a package

dist can be either a Distribution instance or, as a shortcut, directly the module instance, if one can safely infer a Distribution instance from it.

Always returns a dictionary but it will be empty if no Distribution instance can be created for the given module.

pairwise(iterable)

source code
>>> list(pairwise([0, 1, 2, 3]))
[(0, 1), (1, 2), (2, 3)]

Deprecated: since 0.11 (if this really needs to be used, rewrite it without izip)

as_bool(value)

source code

Convert the given value to a bool.

If value is a string, return True for any of "yes", "true", "enabled", "on" or non-zero numbers, ignoring case. For non-string arguments, return the argument converted to a bool, or False if the conversion fails.


Trees Indices Help
Trac

AltStyle によって変換されたページ (->オリジナル) /