| |
- builtins.object
-
- DistLog
- DistLs
- LLogActivity
- LLogByName
- LLogByVersion
- LLogLifeTimes
- LinkLs
class DistLog(builtins.object) |
|
DistLog(maillike_records=None)
this class contains information of the dist-log.
A typical application of this class would be:
d= DistLog(get_dist_log(config_file))
A DistLog object is very similar to a dictionary that maps
version strings to MailLikeRecord objects.
Here is an example. Note that in this example, the "m" object
simulates the output of get_dist_log():
>>> t='''
... VERSION: 2009-09-14T11:54:21
... ACTION: added
... FROM: pfeiffer@aragon.acc.bessy.de
... BRANCH: mars19
... TAG: mars19-2009-09-14 4
... LOG: bugfix in adimo.st, Adi[VH]GblStt is used instead of AdiMo[VH]GblStt
... %%
... VERSION: 2009-10-05T10:08:12
... ACTION: added
... FROM: pfeiffer@aragon.acc.bessy.de
... BRANCH: mars19
... TAG: mars19-2009-10-05 1
... LOG: the newly compiled version, nothing really new, though...
... '''
>>> m= MailLikeRecords(t)
>>> d= DistLog(m)
>>> list(d.keys())
['2009-09-14T11:54:21', '2009-10-05T10:08:12']
>>> '2009-09-14T11:54:21' in d
True
>>> '2009-09-14T11:54:22' in d
False
>>> d["2009-09-14T11:54:21"]
MailLikeRecord('''
VERSION: 2009-09-14T11:54:21
ACTION: added
FROM: pfeiffer@aragon.acc.bessy.de
BRANCH: mars19
TAG: mars19-2009-09-14 4
LOG: bugfix in adimo.st, Adi[VH]GblStt is used instead of AdiMo[VH]GblStt
''')
>>> d.get("2009-09-14T11:54:21","unknown")
MailLikeRecord('''
VERSION: 2009-09-14T11:54:21
ACTION: added
FROM: pfeiffer@aragon.acc.bessy.de
BRANCH: mars19
TAG: mars19-2009-09-14 4
LOG: bugfix in adimo.st, Adi[VH]GblStt is used instead of AdiMo[VH]GblStt
''')
>>> d.get("2009-09-14T11:54:22","unknown")
'unknown'
>>> for v,r in list(d.items()):
... print(v,":")
... print(" Log:",r["LOG"])
...
2009-09-14T11:54:21 :
Log: bugfix in adimo.st, Adi[VH]GblStt is used instead of AdiMo[VH]GblStt
2009-10-05T10:08:12 :
Log: the newly compiled version, nothing really new, though...
>>> print(d)
VERSION: 2009-09-14T11:54:21
ACTION: added
FROM: pfeiffer@aragon.acc.bessy.de
BRANCH: mars19
TAG: mars19-2009-09-14 4
LOG: bugfix in adimo.st, Adi[VH]GblStt is used instead of AdiMo[VH]GblStt
%%
VERSION: 2009-10-05T10:08:12
ACTION: added
FROM: pfeiffer@aragon.acc.bessy.de
BRANCH: mars19
TAG: mars19-2009-10-05 1
LOG: the newly compiled version, nothing really new, though...
<BLANKLINE>
>>> print(repr(d))
DistLog(MailLikeRecords('''
VERSION: 2009-09-14T11:54:21
ACTION: added
FROM: pfeiffer@aragon.acc.bessy.de
BRANCH: mars19
TAG: mars19-2009-09-14 4
LOG: bugfix in adimo.st, Adi[VH]GblStt is used instead of AdiMo[VH]GblStt
%%
VERSION: 2009-10-05T10:08:12
ACTION: added
FROM: pfeiffer@aragon.acc.bessy.de
BRANCH: mars19
TAG: mars19-2009-10-05 1
LOG: the newly compiled version, nothing really new, though...
'''))
>>> d_selected= d.select(["2009-10-05T10:08:12"])
>>> print(d_selected)
VERSION: 2009-10-05T10:08:12
ACTION: added
FROM: pfeiffer@aragon.acc.bessy.de
BRANCH: mars19
TAG: mars19-2009-10-05 1
LOG: the newly compiled version, nothing really new, though...
<BLANKLINE> |
|
Methods defined here:
- __contains__(self, key)
- returns True, if the version is in the DistLog object.
- __getitem__(self, key)
- returns the MailLikeRecord for a version.
- __init__(self, maillike_records=None)
- initializes the object from a MailLikeRecords object.
- __repr__(self)
- returns a repr-string representation of the object.
- __str__(self)
- returns a string representation of the object.
- convert(self, maillike_records)
- reads the contents of an MailLikeRecords object.
convert data in maillike records.
- get(self, k, d=None)
- returns the MailLikeRecord for a version or a default.
- has_key(self, key)
- returns True, if the version is in the DistLog object.
- items(self)
- returns an iterator over all version MailLikeRecord pairs.
- keys(self)
- returns the sorted list of keys (versions).
- select(self, wanted_versions)
- copy wanted versions from another object to this one.
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class DistLs(builtins.object) |
|
DistLs(lsl_entries)
get directory information on all distributions in the dist-dir.
A typical application of this class would be:
d= DistLs(get_dist_ls(config_file))
A DistLs object is very similar to a dictionary that maps
version strings to LslEntry objects.
Here is an example. Note that in this example, the "lsl" object
simulates the output of get_dist_ls():
>>> t='''
... drwxr-xr-x 7 iocadm epima 4096 2008-05-05 09:15 2009-09-14T11:46:24
... drwxr-xr-x 7 iocadm epima 4096 2008-05-05 09:15 2009-09-14T11:54:21
... drwxr-xr-x 7 iocadm epima 4096 2008-05-05 09:15 2009-10-05T10:08:12
... drwxr-xr-x 2 iocadm epima 4096 2006-10-16 15:24 attic
... -rw-r--r-- 1 iocadm epima 1151533 2009-10-05 10:08 CHANGES-DIST
... -rw-r--r-- 1 iocadm epima 420 2006-10-25 09:32 DIRS
... -rw-r--r-- 1 iocadm epima 20 2009-03-12 15:08 LAST
... '''
>>> lsl= LslEntries(t)
>>> d= DistLs(lsl)
>>> "2009-09-14T11:46:24" in d
True
>>> "2009-09-14T11:46:25" in d
False
>>> list(d.keys())
['2009-09-14T11:46:24', '2009-09-14T11:54:21', '2009-10-05T10:08:12']
>>> d["2009-09-14T11:46:24"]
LslEntry('drwxr-xr-x 7 iocadm epima 4096 2008-05-05 09:15 2009-09-14T11:46:24')
>>> d.get("2009-09-14T11:46:24","unknown")
LslEntry('drwxr-xr-x 7 iocadm epima 4096 2008-05-05 09:15 2009-09-14T11:46:24')
>>> d.get("2009-09-14T11:46:25","unknown")
'unknown'
>>> for n,l in list(d.items()):
... print(n,":")
... print(" ",l)
...
2009-09-14T11:46:24 :
drwxr-xr-x 7 iocadm epima 4096 2008-05-05 09:15 2009-09-14T11:46:24
2009-09-14T11:54:21 :
drwxr-xr-x 7 iocadm epima 4096 2008-05-05 09:15 2009-09-14T11:54:21
2009-10-05T10:08:12 :
drwxr-xr-x 7 iocadm epima 4096 2008-05-05 09:15 2009-10-05T10:08:12
>>> print(d)
drwxr-xr-x 7 iocadm epima 4096 2008-05-05 09:15 2009-09-14T11:46:24
drwxr-xr-x 7 iocadm epima 4096 2008-05-05 09:15 2009-09-14T11:54:21
drwxr-xr-x 7 iocadm epima 4096 2008-05-05 09:15 2009-10-05T10:08:12
>>> print(repr(d))
DistLs(LslEntries('''
drwxr-xr-x 7 iocadm epima 4096 2008-05-05 09:15 2009-09-14T11:46:24
drwxr-xr-x 7 iocadm epima 4096 2008-05-05 09:15 2009-09-14T11:54:21
drwxr-xr-x 7 iocadm epima 4096 2008-05-05 09:15 2009-10-05T10:08:12''')) |
|
Methods defined here:
- __contains__(self, version)
- returns True, if the version is in the DistLs object.
- __getitem__(self, version)
- returns the LslEntry for a version.
- __init__(self, lsl_entries)
- initializes the object from an LslEntries object.
- __repr__(self)
- returns a repr-string representation of the object.
- __str__(self)
- returns a string representation of the object.
- get(self, k, d=None)
- returns the LslEntry for a version or a default.
- has_key(self, version)
- returns True, if the version is in the DistLs object.
- items(self)
- returns an iterator over all version LslEntry pairs.
- keys(self)
- returns the sorted list of keys (versions).
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class LLogActivity(builtins.object) |
|
LLogActivity(versionsortedlog=None, todays_date=None)
calculate a list of versions with a lifetime bigger or equal than a given value.
Here are some examples:
>>> t='''
... DATE: 2008-10-20T12:00:00
... ADDED:
... lrwxrwxrwx 1 iocadm iocadm 47 2008-10-20 12:00 idcp8 -> ../dist/2008-10-16T12:42:03
... %%
... DATE: 2008-10-21T12:00:00
... REMOVED:
... lrwxrwxrwx 1 iocadm iocadm 47 2008-10-20 12:00 idcp8 -> ../dist/2008-10-16T12:42:03
... %%
... DATE: 2008-10-23T12:00:00
... NEW:
... lrwxrwxrwx 1 iocadm iocadm 47 2008-10-23 12:00 idcp8 -> ../dist/2008-10-16T12:42:03
... lrwxrwxrwx 1 iocadm iocadm 47 2008-10-23 12:00 idcp9 -> ../dist/2008-10-16T12:42:03
... %%
... DATE: 2008-10-24T12:00:00
... REMOVED:
... lrwxrwxrwx 1 iocadm iocadm 47 2008-10-23 12:00 idcp9 -> ../dist/2008-10-16T12:42:03
... %%
... DATE: 2008-10-27T12:00:00
... REMOVED:
... lrwxrwxrwx 1 iocadm iocadm 47 2008-10-23 12:00 idcp8 -> ../dist/2008-10-16T12:42:03
... %%
... DATE: 2008-11-09T12:00:00
... ADDED:
... lrwxrwxrwx 1 iocadm iocadm 47 2006-11-09 12:00 idcp8 -> ../dist/2006-11-09T10:28:13
... lrwxrwxrwx 1 iocadm iocadm 47 2006-11-09 12:00 idcp9 -> ../dist/2006-11-09T10:28:13
... %%
... DATE: 2008-11-20T12:00:00
... REMOVED:
... lrwxrwxrwx 1 iocadm iocadm 47 2006-11-09 12:00 idcp8 -> ../dist/2006-11-09T10:28:13
... '''
>>> m= MailLikeRecords(t)
>>> nlog= LLogByName(m)
>>> vlog= LLogByVersion(nlog)
>>> alog= LLogActivity(vlog,datetime.datetime(2008,12,24,12,00,00))
>>> list(alog.keys())
['2006-11-09T10:28:13', '2008-10-16T12:42:03']
>>> "2006-11-09T10:28:13" in alog
True
>>> "2006-11-09T10:28:14" in alog
False
>>> for e in alog["2008-10-16T12:42:03"]:
... print(e)
...
(datetime.datetime(2008, 10, 20, 12, 0), datetime.datetime(2008, 10, 21, 12, 0))
(datetime.datetime(2008, 10, 23, 12, 0), datetime.datetime(2008, 10, 27, 12, 0))
>>> len(alog.get("2008-10-16T12:42:03"))
2
>>> len(alog.get("2008-10-16T12:42:04",[]))
0
>>> for v,e in list(alog.items()):
... print(v, len(e))
...
2006-11-09T10:28:13 1
2008-10-16T12:42:03 2
>>> print(alog)
ver. activated deactivated
2006-11-09T10:28:13:
2008-11-09 12:00:00 NOW
2008-10-16T12:42:03:
2008-10-20 12:00:00 2008-10-21 12:00:00
2008-10-23 12:00:00 2008-10-27 12:00:00
>>> alog2= alog.select_versions(["2008-10-16T12:42:03"])
>>> print(alog2)
ver. activated deactivated
2008-10-16T12:42:03:
2008-10-20 12:00:00 2008-10-21 12:00:00
2008-10-23 12:00:00 2008-10-27 12:00:00
>>> _prset(alog.active_versions())
set(['2006-11-09T10:28:13'])
>>> _prset(alog.inactive_versions())
set(['2008-10-16T12:42:03'])
>>> _prset(alog.inactive_versions(datetime.datetime(2008,10,27,12,0,0)))
set(['2008-10-16T12:42:03'])
print "idle versions:"
print "
".join(sorted(myset))
>>> _prset(alog.inactive_versions(datetime.datetime(2008,10,27,11,0,0)))
set([])
>>> alog.print_()
ver. activated deactivated
2006-11-09T10:28:13:
2008-11-09 12:00:00 NOW
2008-10-16T12:42:03:
2008-10-20 12:00:00 2008-10-21 12:00:00
2008-10-23 12:00:00 2008-10-27 12:00:00
>>> alog.print_(True)
2006-11-09T10:28:13
2008-10-16T12:42:03 |
|
Methods defined here:
- __contains__(self, key)
- returns True, if the version is in the LlogActiveTimes object.
- __getitem__(self, key)
- returns the list of pairs of times for a version.
- __init__(self, versionsortedlog=None, todays_date=None)
- Initialize self. See help(type(self)) for accurate signature.
- __str__(self)
- returns a string representation of the object.
- active_versions(self)
- returns a set of versions that are still active.
- convert(self, versionsortedlog=None)
- calculate timespans when versions where active (in use).
This function converts a LLogByVersion object to an LLogActivity
object. Such an object contains information for each version on the
timespan the version was in use, meaning that at least one link pointed
to that version.
- get(self, k, d=None)
- same as __getitem__ but returns a default if the version is not found.
- has_key(self, key)
- returns True, if the version is in the LlogActiveTimes object.
- inactive_versions(self, since=None)
- returns a set of all inavtive versions.
parameters:
since -- an optional date,
all versions that have become inactive AFTER this
date are not returned.
returns:
a set of versions still active
- items(self)
- returns an iterator over (version,timelist) pairs.
- keys(self)
- returns the sorted list of keys (versions).
- print_(self, brief=False)
- print the object.
- select_versions(self, versions)
- copy wanted versions from another object to this one.
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class LLogByName(builtins.object) |
|
LLogByName(maillike_records=None)
this class holds link-log information sorted by name.
A typical application of this class would be:
l= LLogByName(get_link_log(config_file))
Here is an example. Note that in this example, the "ll" object
simulates the output of get_link_log():
>>> t='''
... DATE: 2006-10-09T16:00:54
... ADDED:
... lrwxr-xr-x 1 idadm expermt 27 Oct 9 16:00 idcp8 -> ../dist/2006-10-09T10:28:13
... lrwxr-xr-x 1 idadm expermt 27 Oct 9 16:00 idcp9 -> ../dist/2006-10-09T10:28:13
... %%
... DATE: 2008-10-20T11:19:30
... NEW:
... lrwxrwxrwx 1 idadm epima 47 2008-10-20 11:19 idcp8 -> ../dist/2008-10-16T12:42:03
... %%
... DATE: 2008-10-21T12:10:00
... REMOVED:
... lrwxrwxrwx 1 idadm epima 47 2008-10-20 11:19 idcp8 -> ../dist/2008-10-16T12:42:03
... '''
>>> m= MailLikeRecords(t)
>>> nlog= LLogByName(m)
>>> "idcp9" in nlog
True
>>> "idcp10" in nlog
False
>>> nlog.name_exists("idcp9")
True
>>> nlog.name_exists("idcp8")
False
>>> _prset(nlog.versions_set())
set(['2006-10-09T10:28:13', '2008-10-16T12:42:03'])
>>> for e in nlog["idcp8"]:
... print(e)
...
(datetime.datetime(2006, 10, 9, 16, 0, 54), '2006-10-09T10:28:13')
(datetime.datetime(2008, 10, 20, 11, 19, 30), '2008-10-16T12:42:03')
(datetime.datetime(2008, 10, 21, 12, 10), None)
>>> for e in nlog.get("idcp8",[]):
... print(e)
...
(datetime.datetime(2006, 10, 9, 16, 0, 54), '2006-10-09T10:28:13')
(datetime.datetime(2008, 10, 20, 11, 19, 30), '2008-10-16T12:42:03')
(datetime.datetime(2008, 10, 21, 12, 10), None)
>>> for e in nlog.get("idcp10",[]):
... print(e)
...
>>> for n,l in list(nlog.items()):
... print(n," len(list):",len(l))
...
idcp8 len(list): 3
idcp9 len(list): 1
>>> print(nlog)
name date version
idcp8:
2006-10-09 16:00:54 2006-10-09T10:28:13
2008-10-20 11:19:30 2008-10-16T12:42:03
2008-10-21 12:10:00 REMOVED
<BLANKLINE>
idcp9:
* 2006-10-09 16:00:54 2006-10-09T10:28:13
>>> nlog2= nlog.select_names(["idcp9"])
>>> print(nlog2)
name date version
idcp9:
* 2006-10-09 16:00:54 2006-10-09T10:28:13
>>> nlog3= nlog.select_versions(["2006-10-09T10:28:13"])
>>> print(nlog3)
name date version
idcp8:
2006-10-09 16:00:54 2006-10-09T10:28:13
<BLANKLINE>
idcp9:
* 2006-10-09 16:00:54 2006-10-09T10:28:13
>>> _prset(nlog.used_versions(["idcp8"]))
set(['2006-10-09T10:28:13', '2008-10-16T12:42:03'])
>>> _prset(nlog.used_versions(["idcp9"]))
set(['2006-10-09T10:28:13'])
>>> nlog.print_()
name date version
idcp8:
2006-10-09 16:00:54 2006-10-09T10:28:13
2008-10-20 11:19:30 2008-10-16T12:42:03
2008-10-21 12:10:00 REMOVED
<BLANKLINE>
idcp9:
* 2006-10-09 16:00:54 2006-10-09T10:28:13
>>> nlog.print_(brief=True)
idcp8
idcp9
>>> nlog.print_(last=2)
name date version
idcp8:
2008-10-20 11:19:30 2008-10-16T12:42:03
2008-10-21 12:10:00 REMOVED
<BLANKLINE>
idcp9:
* 2006-10-09 16:00:54 2006-10-09T10:28:13 |
|
Methods defined here:
- __contains__(self, key)
- returns True, if the name is in the LLogByName object.
- __getitem__(self, key)
- returns the list of (date,version) tuples for a version.
- __init__(self, maillike_records=None)
- initializes the object from a MailLikeRecords object.
- __str__(self)
- returns a string representation of the object.
- get(self, k, d=None)
- returns the (date,version) tuple for a version or a default.
- has_key(self, key)
- returns True, if the name is in the LLogByName object.
- items(self)
- returns an iterator over all pairs of names and list of tuples.
- keys(self)
- returns the sorted list of keys (names).
- name_exists(self, name)
- returns True if the name is not deleted.
- print_(self, brief=False, last=None)
- print the object.
- select_names(self, keys, use_regexp=False)
- copy wanted names from another object to this one.
- select_versions(self, versions)
- copy wanted versions from another object to this one.
- used_versions(self, keys)
- returns a set of versions that were used by the given keys.
parameters:
self -- a dictionary returned by parse_log_by_name
keys -- a set or list of keys.
returns:
a set of versions
- versions_set(self)
- returns a set with all versions.
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class LLogByVersion(builtins.object) |
|
LLogByVersion(llogbyname=None)
this class holds link-log information sorted by version.
Here are some examples:
>>> t='''
... DATE: 2008-10-20T12:00:00
... ADDED:
... lrwxr-xr-x 1 idadm expermt 27 Oct 9 16:00 idcp8 -> ../dist/2006-10-09T10:28:13
... lrwxr-xr-x 1 idadm expermt 27 Oct 9 16:00 idcp9 -> ../dist/2006-10-09T10:28:13
... %%
... DATE: 2008-10-20T12:19:30
... NEW:
... lrwxrwxrwx 1 idadm epima 47 2008-10-20 11:19 idcp8 -> ../dist/2008-10-16T12:42:03
... %%
... DATE: 2008-10-21T12:10:00
... REMOVED:
... lrwxrwxrwx 1 idadm epima 47 2008-10-20 11:19 idcp8 -> ../dist/2008-10-16T12:42:03
... '''
>>> m= MailLikeRecords(t)
>>> nlog= LLogByName(m)
>>> vlog= LLogByVersion(nlog)
>>> list(vlog.keys())
['2006-10-09T10:28:13', '2008-10-16T12:42:03']
>>> "2006-10-09T10:28:13" in vlog
True
>>> "2006-10-09T10:28:14" in vlog
False
>>> ddict= vlog["2006-10-09T10:28:13"]
>>> for d in sorted(ddict.keys()):
... print(d, _rset(ddict[d]))
...
2008-10-20 12:00:00 set(['idcp8', 'idcp9'])
2008-10-20 12:19:30 set(['idcp9'])
>>> sorted(vlog.get("2006-10-09T10:28:13",{}).keys())
[datetime.datetime(2008, 10, 20, 12, 0), datetime.datetime(2008, 10, 20, 12, 19, 30)]
>>> list(vlog.get("2006-10-09T10:28:14",{}).keys())
[]
>>> for v,datedict in list(vlog.items()):
... print(v, len(datedict))
...
2006-10-09T10:28:13 2
2008-10-16T12:42:03 2
>>> print(vlog)
ver. date name(s)
2006-10-09T10:28:13:
2008-10-20 12:00:00 idcp8 idcp9
2008-10-20 12:19:30 idcp9
<BLANKLINE>
2008-10-16T12:42:03:
2008-10-20 12:19:30 idcp8
2008-10-21 12:10:00
>>> vlog2= vlog.select_names(["idcp8"])
>>> print(vlog2)
ver. date name(s)
2006-10-09T10:28:13:
2008-10-20 12:00:00 idcp8
2008-10-20 12:19:30
<BLANKLINE>
2008-10-16T12:42:03:
2008-10-20 12:19:30 idcp8
2008-10-21 12:10:00
>>> vlog2= vlog.select_names(["idcp9"])
>>> print(vlog2)
ver. date name(s)
2006-10-09T10:28:13:
2008-10-20 12:00:00 idcp9
>>> vlog2= vlog.select_versions(["2006-10-09T10:28:13"])
>>> print(vlog2)
ver. date name(s)
2006-10-09T10:28:13:
2008-10-20 12:00:00 idcp8 idcp9
2008-10-20 12:19:30 idcp9
>>> vlog.print_()
ver. date name(s)
2006-10-09T10:28:13:
2008-10-20 12:00:00 idcp8 idcp9
2008-10-20 12:19:30 idcp9
<BLANKLINE>
2008-10-16T12:42:03:
2008-10-20 12:19:30 idcp8
2008-10-21 12:10:00
>>> vlog.print_(brief=True)
version names
2006-10-09T10:28:13 idcp9 |
|
Methods defined here:
- __contains__(self, key)
- returns True, if the version is in the LLogByVersion object.
- __getitem__(self, key)
- returns the dict mapping dates to sets of names for a version.
- __init__(self, llogbyname=None)
- Initialize self. See help(type(self)) for accurate signature.
- __str__(self)
- returns a string representation of the object.
- convert(self, namesortedlog=None)
- convert a LLogByName object to a LLogByVersion object.
This function converts the LLogByName object
to an LLogByVersion object.
- get(self, k, d=None)
- same as __getitem__ but returns a default if the version is not found.
- has_key(self, key)
- returns True, if the version is in the LLogByVersion object.
- items(self)
- returns an iterator over (version,datedict) pairs.
- keys(self)
- returns the sorted list of keys (versions).
- print_(self, brief=False)
- print the object.
- select_names(self, names, use_regexp=False)
- copy wanted names from another object to this one.
- select_versions(self, versions)
- copy wanted versions from another object to this one.
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class LLogLifeTimes(builtins.object) |
|
LLogLifeTimes(llogactivity=None, todays_date=None)
calculate the lifetimes of versions.
Here are some examples:
>>> t='''
... DATE: 2008-10-20T12:00:00
... ADDED:
... lrwxrwxrwx 1 iocadm iocadm 47 2008-10-20 12:00 idcp8 -> ../dist/2008-10-16T12:42:03
... %%
... DATE: 2008-10-21T12:00:00
... REMOVED:
... lrwxrwxrwx 1 iocadm iocadm 47 2008-10-20 12:00 idcp8 -> ../dist/2008-10-16T12:42:03
... %%
... DATE: 2008-10-23T12:00:00
... NEW:
... lrwxrwxrwx 1 iocadm iocadm 47 2008-10-23 12:00 idcp8 -> ../dist/2008-10-16T12:42:03
... lrwxrwxrwx 1 iocadm iocadm 47 2008-10-23 12:00 idcp9 -> ../dist/2008-10-16T12:42:03
... %%
... DATE: 2008-10-24T12:00:00
... REMOVED:
... lrwxrwxrwx 1 iocadm iocadm 47 2008-10-23 12:00 idcp9 -> ../dist/2008-10-16T12:42:03
... %%
... DATE: 2008-10-27T12:00:00
... REMOVED:
... lrwxrwxrwx 1 iocadm iocadm 47 2008-10-23 12:00 idcp8 -> ../dist/2008-10-16T12:42:03
... %%
... DATE: 2008-11-09T12:00:00
... ADDED:
... lrwxrwxrwx 1 iocadm iocadm 47 2006-11-09 12:00 idcp8 -> ../dist/2006-11-09T10:28:13
... lrwxrwxrwx 1 iocadm iocadm 47 2006-11-09 12:00 idcp9 -> ../dist/2006-11-09T10:28:13
... %%
... DATE: 2008-11-20T12:00:00
... REMOVED:
... lrwxrwxrwx 1 iocadm iocadm 47 2006-11-09 12:00 idcp8 -> ../dist/2006-11-09T10:28:13
... '''
>>> m= MailLikeRecords(t)
>>> nlog= LLogByName(m)
>>> vlog= LLogByVersion(nlog)
>>> alog= LLogActivity(vlog,datetime.datetime(2008,12,24,12,00,00))
>>> llog= LLogLifeTimes(alog,datetime.datetime(2008,12,24,12,00,00))
>>> list(llog.keys())
['2006-11-09T10:28:13', '2008-10-16T12:42:03']
>>> "2006-11-09T10:28:13" in llog
True
>>> "2006-11-09T10:28:14" in llog
False
>>> llog['2006-11-09T10:28:13']
45.0
>>> for v,t in list(llog.items()):
... print(v,":",t)
...
2006-11-09T10:28:13 : 45.0
2008-10-16T12:42:03 : 5.0
>>> print(llog)
version lifetime
2006-11-09T10:28:13 45.0
2008-10-16T12:42:03 5.0
>>> llog2= llog.select_versions(["2008-10-16T12:42:03"])
>>> print(llog2)
version lifetime
2008-10-16T12:42:03 5.0
>>> _prset(llog.lifetime_bigger(5))
set(['2006-11-09T10:28:13', '2008-10-16T12:42:03'])
>>> _prset(llog.lifetime_bigger(6))
set(['2006-11-09T10:28:13'])
>>> llog.print_with_actives(alog)
ver. activated deactivated lifetime
2006-11-09T10:28:13:
2008-11-09 12:00:00 NOW
45.0
2008-10-16T12:42:03:
2008-10-20 12:00:00 2008-10-21 12:00:00
2008-10-23 12:00:00 2008-10-27 12:00:00
5.0 |
|
Methods defined here:
- __contains__(self, key)
- returns True, if the version is in the LLogLifeTimes object.
- __getitem__(self, key)
- returns the list lifetimes for a version.
- __init__(self, llogactivity=None, todays_date=None)
- Initialize self. See help(type(self)) for accurate signature.
- __str__(self)
- returns a string representation of the object.
- convert(self, llogactivity, todays_date=None)
- calculate lifetimes of versions in fractional days.
This function calculates the active time in days for
each version.
parameters:
llogactivity -- a dictionary that was created by
active_times_of_log_by_version
todays_date -- define the value that is taken for "today" when a
version is still active. Mainly used for testing.
- get(self, k, d=None)
- same as __getitem__ but returns a default if the version is not found.
- has_key(self, key)
- returns True, if the version is in the LLogLifeTimes object.
- items(self)
- returns an iterator over (version,lifetime) pairs.
- keys(self)
- returns the sorted list of keys (versions).
- lifetime_bigger(self, lifetime)
- calculate a list of versions with a lifetime bigger or equal than a given value.
parameters:
lifetime -- the minimum lifetime in days
- print_(self, brief=False)
- print the object.
- print_with_actives(self, llogactivity)
- print to string together with activity.
- select_versions(self, versions)
- copy wanted versions from another object to this one.
- str_with_actives(self, llogactivity)
- convert to string together with activity.
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class LinkLs(builtins.object) |
|
LinkLs(lsl_entries)
get directory information on all distributions in the dist-dir.
A typical application of this class would be:
d= LinkLs(get_link_ls(config_file))
A LinkLs object is very similar to a dictionary that maps
version strings to LslEntry objects.
Here is an example. Note that in this example, the "lsl" object
simulates the output of get_dist_ls():
>>> t='''
... drwxr-xr-x 2 iocadm iocs 4096 2007-09-19 11:16 attic
... lrwxrwxrwx 1 iocadm iocs 56 2009-02-18 15:12 BAWATCH -> /dist/2009-02-18T15:12:20
... lrwxrwxrwx 1 iocadm iocs 56 2009-10-06 13:40 IOC1S11G -> /dist/2009-10-06T13:40:40
... lrwxrwxrwx 1 iocadm iocs 56 2009-10-06 13:40 IOC1S13G -> /dist/2009-10-06T13:40:40
... -rw-r--r-- 1 iocadm iocs 569628 2009-11-17 09:37 LOG-LINKS
... '''
>>> lsl= LslEntries(t)
>>> d= LinkLs(lsl)
>>> "BAWATCH" in d
True
>>> "attic" in d
False
>>> list(d.keys())
['BAWATCH', 'IOC1S11G', 'IOC1S13G']
>>> d["BAWATCH"]
LslEntry('lrwxrwxrwx 1 iocadm iocs 56 2009-02-18 15:12 BAWATCH -> /dist/2009-02-18T15:12:20')
>>> d.get("BAWATCH","unknown")
LslEntry('lrwxrwxrwx 1 iocadm iocs 56 2009-02-18 15:12 BAWATCH -> /dist/2009-02-18T15:12:20')
>>> d.get("BAWATCHX","unknown")
'unknown'
>>> for n,l in list(d.items()):
... print(n,":")
... print(" ",l)
...
BAWATCH :
lrwxrwxrwx 1 iocadm iocs 56 2009-02-18 15:12 BAWATCH -> /dist/2009-02-18T15:12:20
IOC1S11G :
lrwxrwxrwx 1 iocadm iocs 56 2009-10-06 13:40 IOC1S11G -> /dist/2009-10-06T13:40:40
IOC1S13G :
lrwxrwxrwx 1 iocadm iocs 56 2009-10-06 13:40 IOC1S13G -> /dist/2009-10-06T13:40:40
>>> print(d)
lrwxrwxrwx 1 iocadm iocs 56 2009-02-18 15:12 BAWATCH -> /dist/2009-02-18T15:12:20
lrwxrwxrwx 1 iocadm iocs 56 2009-10-06 13:40 IOC1S11G -> /dist/2009-10-06T13:40:40
lrwxrwxrwx 1 iocadm iocs 56 2009-10-06 13:40 IOC1S13G -> /dist/2009-10-06T13:40:40
>>> print(repr(d))
LinkLs(LslEntries('''
lrwxrwxrwx 1 iocadm iocs 56 2009-02-18 15:12 BAWATCH -> /dist/2009-02-18T15:12:20
lrwxrwxrwx 1 iocadm iocs 56 2009-10-06 13:40 IOC1S11G -> /dist/2009-10-06T13:40:40
lrwxrwxrwx 1 iocadm iocs 56 2009-10-06 13:40 IOC1S13G -> /dist/2009-10-06T13:40:40''')) |
|
Methods defined here:
- __contains__(self, version)
- returns True, if the version is in the DistLs object.
- __getitem__(self, version)
- returns the LslEntry for a version.
- __init__(self, lsl_entries)
- initializes the object from an LslEntries object.
- __repr__(self)
- returns a repr-string representation of the object.
- __str__(self)
- returns a string representation of the object.
- get(self, k, d=None)
- returns the LslEntry for a version or a default.
- has_key(self, version)
- returns True, if the version is in the DistLs object.
- items(self)
- returns an iterator over all version LslEntry pairs.
- keys(self)
- returns the sorted list of keys (versions).
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
| |