Updated copyright and translations. Added some missing docstrings.

This commit is contained in:
Bastian Kleineidam 2011-02-17 07:38:02 +01:00
parent 644c72605e
commit e638a2fe6d
22 changed files with 4192 additions and 2560 deletions

View file

@ -121,7 +121,32 @@ doccheck:
py-check-docstrings --force linkcheck/HtmlParser linkcheck/checker \
linkcheck/cache linkcheck/configuration linkcheck/director \
linkcheck/htmlutil linkcheck/logger linkcheck/network \
linkcheck/bookmarks *.py
linkcheck/bookmarks \
linkcheck/__init__.py \
linkcheck/ansicolor.py \
linkcheck/clamav.py \
linkcheck/containers.py \
linkcheck/cookies.py \
linkcheck/decorators.py \
linkcheck/dummy.py \
linkcheck/fileutil.py \
linkcheck/ftpparse.py \
linkcheck/geoip.py \
linkcheck/httputil.py \
linkcheck/i18n.py \
linkcheck/lc_cgi.py \
linkcheck/lock.py \
linkcheck/log.py \
linkcheck/mem.py \
linkcheck/robotparser2.py \
linkcheck/socketutil.py \
linkcheck/strformat.py \
linkcheck/threader.py \
linkcheck/trace.py \
linkcheck/updater.py \
linkcheck/url.py \
linkcheck/winutil.py \
*.py
filescheck:
-./linkchecker $(LCOPTS) http://$(HOST)/

917
doc/de.po

File diff suppressed because it is too large Load diff

View file

@ -9,7 +9,7 @@ linkchecker\-gui \- GUI\-Programm zum Prüfen von Verknüpfungen von Webseiten
und HTML Dokumenten
.
.SH SYNTAX
\fBlinkchecker\-gui\fP [\fIfile\-or\-url\fP]
\fBlinkchecker\-gui\fP [\fIDatei\-oder\-URL\fP]
.
.SH BESCHREIBUNG
Eine graphische Benutzeroberfläche, um Verknüpfungen von Webseiten und HTML

View file

@ -21,6 +21,7 @@ from . import log, LOG_ROOT
from .socketutil import create_socket
class ClamavError (Exception):
"""Raised on clamav errors."""
pass

View file

@ -25,6 +25,7 @@ class AttrDict (dict):
are valid attribute names and not already existing methods."""
def __getattr__ (self, name):
"""Return attribute name from dict."""
return self[name]
@ -40,6 +41,7 @@ class ListDict (dict):
self._keys = []
def setdefault (self, key, *args):
"""Remember key order if key not found."""
if key not in self:
self._keys.append(key)
return super(ListDict, self).setdefault(key, *args)

View file

@ -126,6 +126,7 @@ def timeit (func, log, limit):
def timed (log=sys.stderr, limit=2.0):
"""Decorator to run a function with timing info."""
return lambda func: timeit(func, log, limit)
@ -135,10 +136,13 @@ class memoized (object):
not re-evaluated."""
def __init__(self, func):
"""Store function and initialize the cache."""
self.func = func
self.cache = {}
def __call__(self, *args):
"""Lookup and return cached result if found. Else call stored
function with given arguments."""
try:
return self.cache[args]
except KeyError:
@ -158,11 +162,15 @@ class curried (object):
"""Decorator that returns a function that keeps returning functions
until all arguments are supplied; then the original function is
evaluated."""
def __init__(self, func, *a):
"""Store function and arguments."""
self.func = func
self.args = a
def __call__(self, *a):
"""If all arguments function arguments are supplied, call it.
Else return another curried object."""
args = self.args + a
if len(args) < self.func.func_code.co_argcount:
return curried(self.func, *args)

View file

@ -22,42 +22,55 @@ class Dummy (object):
"""A dummy object ignores all access to it. Useful for testing."""
def __init__ (self, *args, **kwargs):
"""Return None"""
pass
def __call__ (self, *args, **kwargs):
"""Return self."""
return self
def __getattr__ (self, name):
"""Return self."""
return self
def __setattr__ (self, name, value):
"""Return None"""
pass
def __delattr__ (self, name):
"""Return None"""
pass
def __str__ (self):
"""Return 'dummy'"""
return "dummy"
def __repr__ (self):
"""Return '<dummy>'"""
return "<dummy>"
def __unicode__ (self):
"""Return u'dummy'"""
return u"dummy"
def __len__ (self):
"""Return zero"""
return 0
def __getitem__ (self, key):
"""Return self"""
return self
def __setitem__ (self, key, value):
"""Return None"""
pass
def __delitem__ (self, key):
"""Return None"""
pass
def __contains__ (self, key):
"""Return False"""
return False

View file

@ -160,6 +160,7 @@ else:
FSCODING = "utf-8"
def pathencode (path):
"""Encode a path string with the platform file system encoding."""
if isinstance(path, unicode) and not os.path.supports_unicode_filenames:
path = path.encode(FSCODING, "replace")
return path

View file

@ -1,5 +1,5 @@
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2010 Bastian Kleineidam
# Copyright (C) 2010-2011 Bastian Kleineidam
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -58,13 +58,13 @@ class LineEdit (QtGui.QLineEdit):
"""Add Firefox bookmark action to context menu."""
menu = self.createStandardContextMenu()
if find_firefox():
action = menu.addAction(_("Firefox bookmark file"))
action = menu.addAction(_("Insert Firefox bookmark file"))
action.triggered.connect(lambda: self.setText(find_firefox()))
if find_chromium():
action = menu.addAction(_("Google Chrome bookmark file"))
action = menu.addAction(_("Insert Google Chrome bookmark file"))
action.triggered.connect(lambda: self.setText(find_chromium()))
if find_opera():
action = menu.addAction(_("Opera bookmark file"))
action = menu.addAction(_("Insert Opera bookmark file"))
action.triggered.connect(lambda: self.setText(find_opera()))
menu.exec_(event.globalPos())

View file

@ -125,6 +125,9 @@ def get_headers_lang (headers):
def get_locale ():
"""Search the default platform locale and norm it.
@returns (locale, encoding)
@rtype (string, string)"""
loc, encoding = locale.getdefaultlocale()
if loc is None:
loc = "C"

View file

@ -21,6 +21,7 @@ import threading
from . import log, LOG_THREAD
def get_lock (name):
"""Return a new thread lock object."""
return threading.Lock()
# for thread debugging, use the DebugLock wrapper
#return DebugLock(threading.Lock(), name)
@ -28,7 +29,9 @@ def get_lock (name):
class DebugLock (object):
"""Debugging lock class."""
def __init__ (self, lock, name):
"""Store lock and name parameters."""
self.lock = lock
self.name = name

View file

@ -70,11 +70,14 @@ class StoppableThread (threading.Thread):
regularly for the stopped() condition."""
def __init__ (self):
"""Store stop event."""
super(StoppableThread, self).__init__()
self._stop = threading.Event()
def stop (self):
"""Set stop event."""
self._stop.set()
def stopped (self):
"""Return True if stop event is set."""
return self._stop.isSet()

View file

@ -459,6 +459,7 @@ def url_split (url):
def url_unsplit (parts):
"""Rejoin URL parts to a string."""
if parts[2] == default_ports.get(parts[0]):
return "%s://%s%s" % (parts[0], parts[1], parts[3])
return "%s://%s:%d%s" % parts

View file

@ -1,5 +1,5 @@
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2010 Bastian Kleineidam
# Copyright (C) 2010-2011 Bastian Kleineidam
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -39,6 +39,7 @@ def init_win32com ():
def _init ():
"""Initialize the win32com package."""
if has_win32com:
init_win32com()
_init()
@ -74,14 +75,17 @@ def get_word_app ():
def close_word_app (app):
"""Close Word application object."""
app.Quit()
def open_wordfile (app, filename):
"""Open given Word file with application object."""
return app.Documents.Open(filename)
def close_wordfile (doc):
"""Close word file."""
doc.Close()

BIN
po/de.mo Normal file

Binary file not shown.

480
po/de.po

File diff suppressed because it is too large Load diff

BIN
po/es.mo Normal file

Binary file not shown.

2332
po/es.po

File diff suppressed because it is too large Load diff

BIN
po/fr.mo Normal file

Binary file not shown.

2512
po/fr.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2004-2010 Bastian Kleineidam
# Copyright (C) 2004-2011 Bastian Kleineidam
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by