From: Duncan W. <du...@fr...> - 2008-05-11 10:50:47
|
Author: duncan Date: Sun May 11 06:50:48 2008 New Revision: 10716 Log: Fixed epytext docstrings Modified: branches/rel-1/freevo/src/animation/base.py branches/rel-1/freevo/src/animation/transition.py branches/rel-1/freevo/src/config.py branches/rel-1/freevo/src/gui/AlertBox.py branches/rel-1/freevo/src/gui/Border.py branches/rel-1/freevo/src/gui/ConfirmBox.py branches/rel-1/freevo/src/gui/InputBox.py branches/rel-1/freevo/src/gui/PopupBox.py branches/rel-1/freevo/src/tv/edit_favorite.py branches/rel-1/freevo/src/tv/plugins/livepause/chunk_buffer.py branches/rel-1/freevo/src/tv/strptime.py branches/rel-1/freevo/src/tv/xmltv.py branches/rel-1/freevo/src/util/fxdimdb.py Modified: branches/rel-1/freevo/src/animation/base.py ============================================================================== --- branches/rel-1/freevo/src/animation/base.py (original) +++ branches/rel-1/freevo/src/animation/base.py Sun May 11 06:50:48 2008 @@ -39,11 +39,12 @@ Base class for animations, this should perhaps be changed to use sprites in the future (if one decides to go with a RenderGroup model) - @param rectstyle : the rectangle defining the position on the screen (pygame) - @param fps : Desired fps - @param bg_update : update the animation with background from screen - @param bg_wait : initially wait for updated background before activating - @param bg_redraw : set background to original screen bg when finished + @cvar background: Surface Background (screen) + @cvar surface : The Surface obj. to work with + @cvar active : Should it be updated in the poll + @cvar delete : Delete from list on next poll + @cvar updates : list of updates from screen + @cvar next_updat: timestamp for next update """ background = None # Surface Background (screen) @@ -55,6 +56,15 @@ def __init__(self, rectstyle, fps=20, bg_update=True, bg_wait=False, bg_redraw=False): + """ + Initialise an instance of BaseAnimation + + @ivar rectstyle : the rectangle defining the position on the screen (pygame) + @ivar fps : Desired fps + @ivar bg_update : update the animation with background from screen + @ivar bg_wait : initially wait for updated background before activating + @ivar bg_redraw : set background to original screen bg when finished + """ _debug_('__init__(rectstyle=%r, fps=%r, bg_update=%r, bg_wait=%r, bg_redraw=%r)' % \ (rectstyle, fps, bg_update, bg_wait, bg_redraw), 2) @@ -69,33 +79,25 @@ def get_surface(self, width, height): - """ - Helper for creating surfaces - """ + """ Helper for creating surfaces """ _debug_('get_surface(width=%r, height=%r)' % (width, height), 2) return Surface( (width, height), 0, 32) def get_osd(self): - """ - Helper for getting osd singleton - """ + """ Helper for getting osd singleton """ _debug_('get_osd()', 2) return osd.get_singleton() def set_fps(self, fps): - """ - Sets the desired fps - """ + """ Sets the desired fps """ _debug_('set_fps(fps=%r)' % (fps), 2) self.interval = int(1000.0/float(fps)) def set_screen_background(self): - """ - Update the background - """ + """ Update the background """ _debug_('set_screen_background()', 2) if not self.background: self.background = osd.get_singleton().getsurface(rect=self.rect) @@ -125,14 +127,15 @@ def get_rect(self): + """ Get the rectangle of the current object + @returns: the rectangle tuple + """ _debug_('get_rect()', 2) return self.rect def start(self): - """ - Starts the animation - """ + """ Starts the animation """ _debug_('start()', 2) render.get_singleton().add_animation(self) if not self.bg_wait: @@ -140,17 +143,13 @@ def stop(self): - """ - Stops the animation from being polled - """ + """ Stops the animation from being polled """ _debug_('stop()', 2) self.active = False def remove(self): - """ - Flags the animation to be removed from the animation list - """ + """ Flags the animation to be removed from the animation list """ _debug_('remove()', 2) self.active = False @@ -163,8 +162,7 @@ def damage(self, rectstyles=[]): - """ - Checks if the screen background has been damaged + """ Checks if the screen background has been damaged @note: If the rect passed damages our rect, but no actual blit is done on osd.screen, we'll end up with a copy of our animation in our bg. This is BAD. @@ -186,9 +184,7 @@ def poll(self, current_time): - """ - Poll the animations - """ + """ Poll the animations """ _debug_('poll(current_time=%r)' % (current_time), 2) if self.next_update < current_time: self.next_update = current_time + self.interval @@ -201,8 +197,6 @@ def draw(self): - """ - Overload to do stuff with the surface - """ + """ Overload to do stuff with the surface """ _debug_('draw()', 2) pass Modified: branches/rel-1/freevo/src/animation/transition.py ============================================================================== --- branches/rel-1/freevo/src/animation/transition.py (original) +++ branches/rel-1/freevo/src/animation/transition.py Sun May 11 06:50:48 2008 @@ -1,6 +1,6 @@ # -*- coding: iso-8859-1 -*- # ----------------------------------------------------------------------- -# A transition animation, intended use: imageviewer +# transition.py - A transition animation, intended use: imageviewer # Author: Viggo Fredriksen <vi...@ka...> # ----------------------------------------------------------------------- # $Id$ @@ -44,16 +44,18 @@ finished = False # flag for finished animation surf_blend1 = None + """@cvar: first surface""" surf_blend2 = None + """@cvar: second surface""" def __init__(self, surf1, surf2, mode=-1, direction='vertical', fps=25): """ - @param surf1: Surface to blend with - @param surf2: New surface - @param mode: effect to use - @param direction: vertical/horizontal - @param fps: frames per second + Initialise an instance of the Transition class + @ivar surf1: Surface to blend with + @ivar surf2: New surface + @ivar mode: effect to use + @ivar direction: vertical/horizontal """ BaseAnimation.__init__(self, surf1.get_rect(), fps, bg_update=False) _debug_('__init__(surf1=%r, surf2=%r, mode=%r, direction=%r, fps=%r)' % (surf1, surf2, mode, direction, fps), 2) Modified: branches/rel-1/freevo/src/config.py ============================================================================== --- branches/rel-1/freevo/src/config.py (original) +++ branches/rel-1/freevo/src/config.py Sun May 11 06:50:48 2008 @@ -149,35 +149,34 @@ class VideoGroup: """ - @ivar vdev: The video recording device, such as /dev/video0. - @ivar vvbi: The video vbi device, such as /dev/vbi0. - @ivar adev: The audio device, such as: None, /dev/dsp. - @ivar input_type: tuner, webcam - @ivar input_num: The number of this input according to V4L - @ivar tuner_type: internal (on a v4l device), or external (cable or sat box) - @ivar tuner_norm: NTSC, PAL, SECAM - @ivar tuner_chanlist: us-cable, - @ivar tuner_chan: If using input_type=tuner and tuner_type=external set this to - what channel it needs to be to get the signal, usually 3 or 4. - @ivar irsend_trans: IR transmitter to use for multiple external tuners. - @ivar record_group: VideoGroup that records for this tuner, default is to use the - same device for record and play - @ivar desc: A nice description for this VideoGroup. - @ivar group_type: Special variable to identify devices like dvb or ivtv. This can be one of: - - normal, - - ivtv, - - dvb, - - tvalsa or - - webcam. - @ivar cmd: Command for execute external prog after the channel switched, - such as 'sudo /usr/local/bin/setuptuner' """ - def __init__(self, vdev=None, vvbi='/dev/vbi', adev=None, input_type=None, input_num=0, tuner_norm=None, tuner_chanlist=None, tuner_type='internal', tuner_chan=None, irsend_trans=None, record_group=None, desc='Freevo Default Video Group', group_type='normal', cmd=None): + """ + Initialise an instance of a VideoGroup + + @ivar vdev: The video recording device, such as /dev/video0. + @ivar vvbi: The video vbi device, such as /dev/vbi0. + @ivar adev: The audio device, such as: None, /dev/dsp. + @ivar input_type: tuner, webcam + @ivar input_num: The number of this input according to V4L + @ivar tuner_type: internal (on a v4l device), or external (cable or sat box) + @ivar tuner_norm: NTSC, PAL, SECAM + @ivar tuner_chanlist: us-cable, + @ivar tuner_chan: If using input_type=tuner and tuner_type=external set this to + what channel it needs to be to get the signal, usually 3 or 4. + @ivar irsend_trans: IR transmitter to use for multiple external tuners. + @ivar record_group: VideoGroup that records for this tuner, default is to use the + same device for record and play + @ivar desc: A nice description for this VideoGroup. + @ivar group_type: Special variable to identify devices like dvb or ivtv. This + can be one of: 'normal', 'ivtv', 'dvb', 'tvalsa' or 'webcam'. + @ivar cmd: Command for execute external prog after the channel switched, + such as 'sudo /usr/local/bin/setuptuner' + """ (v_norm, v_input, v_clist, v_dev) = TV_SETTINGS.split() if vdev is None: Modified: branches/rel-1/freevo/src/gui/AlertBox.py ============================================================================== --- branches/rel-1/freevo/src/gui/AlertBox.py (original) +++ branches/rel-1/freevo/src/gui/AlertBox.py Sun May 11 06:50:48 2008 @@ -39,23 +39,25 @@ class AlertBox(PopupBox): """ - @ivar text: String to print. - @ivar x: x coordinate. Integer - @ivar y: y coordinate. Integer - @ivar width: Integer - @ivar height: Integer - @ivar icon: icon - @ivar text_prop: A dict of 4 elements composing text proprieties:: - - { 'align_h': align_h, 'align_v': align_v, 'mode': mode, 'hfill': hfill } - align_v = text vertical alignment - align_h = text horizontal alignment - mode = hard (break at chars); soft (break at words) - hfill = True (don't shorten width) or False """ - def __init__(self, text, handler=None, x=None, y=None, width=0, height=0, icon=None, vertical_expansion=1, text_prop=None, parent='osd'): + """ + Initialise an instance of a AlertBox + + @ivar text: String to print. + @ivar x: x coordinate. Integer + @ivar y: y coordinate. Integer + @ivar width: Integer + @ivar height: Integer + @ivar icon: icon + @ivar text_prop: A dict of 4 elements composing text proprieties: + { 'align_h': align_h, 'align_v': align_v, 'mode': mode, 'hfill': hfill }: + - align_v = text vertical alignment + - align_h = text horizontal alignment + - mode = hard (break at chars); soft (break at words) + - hfill = True (don't shorten width) or False + """ PopupBox.__init__(self, text, handler, x, y, width, height, icon, vertical_expansion, text_prop, parent) Modified: branches/rel-1/freevo/src/gui/Border.py ============================================================================== --- branches/rel-1/freevo/src/gui/Border.py (original) +++ branches/rel-1/freevo/src/gui/Border.py Sun May 11 06:50:48 2008 @@ -63,10 +63,12 @@ def __init__(self, parent, style=None, color=None, width=None): """ - @param parent: Object to draw border of; use this to get geometry and stuff. - @param style: Border Type. One of 'flat','shadow','raised' or 'sunken' - @param color: Color of object, Either a Freevo Color object or a color integer. - @param width: Thickness of border. + Initialise an instance of a Border + + @ivar parent: object to draw border of; use this to get geometry and stuff. + @ivar style: border Type. One of 'flat','shadow','raised' or 'sunken' + @ivar color: color of object, Either a Freevo Color object or a color integer. + @ivar width: thickness of border. """ if not parent or not isinstance(parent, GUIObject): raise TypeError, 'You need to set the parent correctly' Modified: branches/rel-1/freevo/src/gui/ConfirmBox.py ============================================================================== --- branches/rel-1/freevo/src/gui/ConfirmBox.py (original) +++ branches/rel-1/freevo/src/gui/ConfirmBox.py Sun May 11 06:50:48 2008 @@ -39,32 +39,33 @@ class ConfirmBox(PopupBox): """ - @ivar text: String to print. - @ivar handler: Handler call-back for the box - @ivar handler_message: If 'handler_message' is set, the box will transform into - a normal pop-up showing this text while 'handler' is called and will destroy - itself after that. - @ivar x: x coordinate. Integer - @ivar y: y coordinate. Integer - @ivar width: width of box - @type width: integer - @ivar height: height of box - @type height: integer - @ivar icon: icon - @ivar text_prop: A dict of 4 elements composing text proprieties:: - - { 'align_h': align_h, 'align_v': align_v, 'mode': mode, 'hfill': hfill } - align_v = text vertical alignment - align_h = text horizontal alignment - mode = hard (break at chars); soft (break at words) - hfill = True (don't shorten width) or False """ def __init__(self, text, handler=None, handler_message=None, default_choice=0, x=None, y=None, width=0, height=0, icon=None, vertical_expansion=1, text_prop=None, parent='osd'): + """ + Initialise an instance of a ConfirmBox - PopupBox.__init__(self, text, handler, x, y, width, height, - icon, vertical_expansion, text_prop, parent) + @ivar text: String to print. + @ivar handler: Handler call-back for the box + @ivar handler_message: If 'handler_message' is set, the box will transform + into a normal pop-up showing this text while 'handler' is called and will + destroy itself after that. + @ivar x: x coordinate. Integer + @ivar y: y coordinate. Integer + @ivar width: Integer + @ivar height: Integer + @ivar icon: icon + @ivar text_prop: A dict of 4 elements composing text proprieties:: + + { 'align_h': align_h, 'align_v': align_v, 'mode': mode, 'hfill': hfill } + align_v = text vertical alignment + align_h = text horizontal alignment + mode = hard (break at chars); soft (break at words) + hfill = True (don't shorten width) or False + """ + + PopupBox.__init__(self, text, handler, x, y, width, height, icon, vertical_expansion, text_prop, parent) self.handler_message = handler_message Modified: branches/rel-1/freevo/src/gui/InputBox.py ============================================================================== --- branches/rel-1/freevo/src/gui/InputBox.py (original) +++ branches/rel-1/freevo/src/gui/InputBox.py Sun May 11 06:50:48 2008 @@ -1,7 +1,7 @@ # -*- coding: iso-8859-1 -*- # ----------------------------------------------------------------------- -# InputBox.py - a popup box that has a message and allows the user -# to input using the remote control +# a popup box that has a message and allows the user to input using the +# remote control # ----------------------------------------------------------------------- # $Id$ # @@ -39,28 +39,28 @@ class InputBox(PopupBox): - """ - @ivar x: x coordinate. Integer - @ivar y: y coordinate. Integer - @ivar width: width of the box - @tyoe width: integer - @ivar height: height of the box - @tyoe width: integer - @ivar text: String to print. - @ivar type: 'normal' or 'password' - @ivar icon: icon - @ivar text_prop: A dict of 4 elements composing text proprieties:: - - { 'align_h': align_h, 'align_v': align_v, 'mode': mode, 'hfill': hfill } - align_v = text vertical alignment - align_h = text horizontal alignment - mode = hard (break at chars); soft (break at words) - hfill = True (don't shorten width) or False - """ def __init__(self, text, handler=None, type='text', x=None, y=None, width=0, height=0, icon=None, vertical_expansion=1, text_prop=None, input_text='', numboxes=0, parent='osd'): + """ + Initialise an instance of a InputBox + + @ivar x: x coordinate. Integer + @ivar y: y coordinate. Integer + @ivar width: Integer + @ivar height: Integer + @ivar text: String to print. + @ivar type: 'normal' or 'password' + @ivar icon: icon + @ivar text_prop: A dict of 4 elements composing text proprieties:: + + { 'align_h': align_h, 'align_v': align_v, 'mode': mode, 'hfill': hfill } + align_v = text vertical alignment + align_h = text horizontal alignment + mode = hard (break at chars); soft (break at words) + hfill = True (don't shorten width) or False + """ PopupBox.__init__(self, text, handler, x, y, width, height, icon, vertical_expansion, text_prop, parent) Modified: branches/rel-1/freevo/src/gui/PopupBox.py ============================================================================== --- branches/rel-1/freevo/src/gui/PopupBox.py (original) +++ branches/rel-1/freevo/src/gui/PopupBox.py Sun May 11 06:50:48 2008 @@ -42,32 +42,27 @@ class PopupBox(Window): - """ - Trying to make a standard popup/dialog box for various usages. - - @ivar x: - x coordinate. Integer - @ivar y: - y coordinate. Integer - @ivar width: - Integer - @ivar height: - Integer - @ivar text: - String to print. - @ivar icon: - icon - @ivar text_prop: - - A dict of 4 elements composing text proprieties:: - { 'align_h': align_h, 'align_v': align_v, 'mode': mode, 'hfill': hfill } - align_v = text vertical alignment - align_h = text horizontal alignment - mode = hard (break at chars); soft (break at words) - hfill = True (don't shorten width) or False - """ + """ + Trying to make a standard popup/dialog box for various usages. + """ def __init__(self, text, handler=None, x=0, y=0, width=0, height=0, icon=None, vertical_expansion=1, text_prop=None, parent='osd'): + """ + Initialise an instance of a PopupBox + + @ivar x: x coordinate. Integer + @ivar y: y coordinate. Integer + @ivar width: Integer + @ivar height: Integer + @ivar text: String to print. + @ivar icon: icon + @ivar text_prop: A dict of 4 elements composing text proprieties + { 'align_h': align_h, 'align_v': align_v, 'mode': mode, 'hfill': hfill }: + - align_v = text vertical alignment + - align_h = text horizontal alignment + - mode = hard (break at chars); soft (break at words) + - hfill = True (don't shorten width) or False + """ self.handler = handler Window.__init__(self, parent, x, y, width, height) Modified: branches/rel-1/freevo/src/tv/edit_favorite.py ============================================================================== --- branches/rel-1/freevo/src/tv/edit_favorite.py (original) +++ branches/rel-1/freevo/src/tv/edit_favorite.py Sun May 11 06:50:48 2008 @@ -54,16 +54,19 @@ class EditFavorite(PopupBox): - """ - @param prog: the program to record - @param left: x coordinate, Integer - @param top: y coordinate, Integer - @param width: width in pixels, Integer - @param height: height in pixels, Integer - @param context: context in which the object is instantiated - """ + """ """ def __init__(self, parent=None, subject=None, left=None, top=None, width=500, height=350, context=None): - """ Initialise EditFavorite instance """ + """ + Initialise an instance of EditFavorite + + @ivar parent: parent of the class + @ivar subject: the title of the program + @ivar left: x coordinate, Integer + @ivar top: y coordinate, Integer + @ivar width: width in pixels, Integer + @ivar height: height in pixels, Integer + @ivar context: context in which the object is instantiated + """ _debug_('EditFavorite.__init__(parent=%r, subject=%r, left=%r, top=%r, width=%r, height=%r, context=%r)' % \ (parent, subject, left, top, width, height, context), 1) Modified: branches/rel-1/freevo/src/tv/plugins/livepause/chunk_buffer.py ============================================================================== --- branches/rel-1/freevo/src/tv/plugins/livepause/chunk_buffer.py (original) +++ branches/rel-1/freevo/src/tv/plugins/livepause/chunk_buffer.py Sun May 11 06:50:48 2008 @@ -1,6 +1,6 @@ # -*- coding: iso-8859-1 -*- # ----------------------------------------------------------------------- -# __init__.py - the Freevo Live Pause module for tv +# Freevo Live Pause module for tv # ----------------------------------------------------------------------- # $Id$ # @@ -56,10 +56,10 @@ def __init__(self, path, size): """ - @param path: Location to create the ring buffer file. - @type path: C(string} - @param size: Size of the ring buffer - @type size: C{integer} + Initialise an instance of ChunkBuffer + + @ivar path: Location to create the ring buffer file. + @ivar size: Size of the ring buffer. """ self.buffer = RingBuffer(path, (size / RB_CHUNK_SIZE) * RB_CHUNK_SIZE) self.last_time = 0 Modified: branches/rel-1/freevo/src/tv/strptime.py ============================================================================== --- branches/rel-1/freevo/src/tv/strptime.py (original) +++ branches/rel-1/freevo/src/tv/strptime.py Sun May 11 06:50:48 2008 @@ -28,27 +28,8 @@ # # ----------------------------------------------------------------------- -"""Strptime-related classes and functions. - -CLASSES - -LocaleTime -- Discovers and/or stores locale-specific time information -TimeRE -- Creates regexes for pattern matching a string of text containing - time information as is returned by time.strftime() - -FUNCTIONS - -firstjulian -- Calculates the Julian date up to the first of the specified year -gregorian -- Calculates the Gregorian date based on the Julian day and year -julianday -- Calculates the Julian day since the first of the year based on the Gregorian date -dayofweek -- Calculates the day of the week from the Gregorian date. -strptime -- Calculates the time struct represented by the passed-in string - -Requires Python 2.2.1 or higher as-is. -Can be used in Python 2.2, though, if the following line is added: - - >>> True = 1; False = 0 - +""" +Strptime-related classes and functions. """ import time import locale @@ -64,29 +45,9 @@ __all__ = ['strptime'] class LocaleTime(object): - """Stores and handles locale-specific information related to time. - - ATTRIBUTES (all read-only after instance creation! Instance variables that - store the values have mangled names): - f_weekday -- full weekday names; %A (7-item list) - a_weekday -- abbreviated weekday names; %a (7-item list) - f_month -- full weekday names; %B (14-item list; dummy value in [0], - which is added by code) - a_month -- abbreviated weekday names; %b (13-item list, dummy value in - [0], which is added by code) - am_pm -- AM/PM representation; %p (2-item list) - LC_date_time -- format string for date/time representation; %c (string) - LC_date -- format string for date representation; %x (string) - LC_time -- format string for time representation; %X (string) - timezone -- daylight- and non-daylight-savings timezone representation; - %Z (3-item list; code tacks on blank item at end for - possible lack of timezone such as UTC) - lang -- Language used by instance (string) - """ - - #<bc>: If LocaleTime is never exposed in the stdlib, can just remove - # to instantiate values and just initially set them all to None. + Stores and handles locale-specific information related to time. + """ def __init__(self, f_weekday=None, a_weekday=None, f_month=None, a_month=None, am_pm=None, LC_date_time=None, LC_time=None, LC_date=None, timezone=None, lang=None): @@ -94,6 +55,23 @@ Only check for passed-in values is that length of sequence is correct. + (all read-only after instance creation! Instance variables that + store the values have mangled names): + + @ivar f_weekday: full weekday names; %A (7-item list) + @ivar a_weekday: abbreviated weekday names; %a (7-item list) + @ivar f_month: full weekday names; %B (14-item list; dummy value in + [0], which is added by code) + @ivar a_month: abbreviated weekday names; %b (13-item list, dummy value + in [0], which is added by code) + @ivar am_pm: AM/PM representation; %p (2-item list) + @ivar LC_date_time: format string for date/time representation; %c (string) + @ivar LC_date: format string for date representation; %x (string) + @ivar LC_time: format string for time representation; %X (string) + @ivar timezone: daylight- and non-daylight-savings timezone + representation; %Z (3-item list; code tacks on blank item at end for + possible lack of %timezone such as UTC) + @ivar lang: Language used by instance (string) """ if f_weekday is None: self.__f_weekday = None @@ -143,7 +121,6 @@ Used for when sequence can contain the empty string as an answer. Also use for padding to get 0-offset indexing with sequence. - """ seq = list(seq) if front: @@ -155,11 +132,9 @@ def __set_nothing(self, stuff): """Raise TypeError when trying to set an attribute. - There should be no need to change these values. This means that it would be better for an exception to be raised then let the assignment happen quietly. - """ raise TypeError("attribute does not support assignment") @@ -176,10 +151,8 @@ self.__calc_weekday() return self.__a_weekday - f_weekday = property(__get_f_weekday, __set_nothing, - doc="Full weekday names") - a_weekday = property(__get_a_weekday, __set_nothing, - doc="Abbreviated weekday names") + f_weekday = property(__get_f_weekday, __set_nothing, doc="Full weekday names") + a_weekday = property(__get_a_weekday, __set_nothing, doc="Abbreviated weekday names") def __get_f_month(self): """Fetch self.f_month (full month names).""" @@ -193,10 +166,8 @@ self.__calc_month() return self.__a_month - f_month = property(__get_f_month, __set_nothing, - doc="Full month names (dummy value at index 0)") - a_month = property(__get_a_month, __set_nothing, - doc="Abbreviated month names (dummy value at index 0)") + f_month = property(__get_f_month, __set_nothing, doc="Full month names (dummy value at index 0)") + a_month = property(__get_a_month, __set_nothing, doc="Abbreviated month names (dummy value at index 0)") def __get_am_pm(self): """Fetch self.am_pm (locale's AM/PM representation).""" @@ -212,8 +183,7 @@ self.__calc_timezone() return self.__timezone - timezone = property(__get_timezone, __set_nothing, - doc="Timezone representation (dummy value at index 2)") + timezone = property(__get_timezone, __set_nothing, doc="Timezone representation (dummy value at index 2)") def __get_LC_date_time(self): """Fetch self.LC_date_time (%c directive).""" @@ -272,7 +242,6 @@ The magic date (2002, 3, 17, hour, 44, 44, 2, 76, 0) is not really that magical; just happened to have used it everywhere else where a static date was needed. - """ am_pm = [] for hour in (01,22): @@ -290,7 +259,6 @@ The order in which values are searched within the format string is very important; it eliminates possible ambiguity for what something represents. - """ time_tuple = time.struct_time((1999,3,17,22,44,55,2,76,0)) date_time = [None, None, None] @@ -332,14 +300,12 @@ Empty string used for matching when timezone is not used/needed such as with UTC. - """ self.__timezone = self.__pad(time.tzname, 0) def __calc_lang(self): """Set self.lang by using locale.getlocale() or locale.getdefaultlocale(). - """ current_lang = locale.getlocale(locale.LC_TIME)[0] if current_lang: @@ -348,14 +314,13 @@ self.__lang = locale.getdefaultlocale()[0] class TimeRE(dict): - """Handle conversion from format directives to regexes.""" - + """ + Handle conversion from format directives to regexes. + """ def __init__(self, locale_time=LocaleTime()): """Initialize instance with non-locale regexes and store LocaleTime object.""" super(TimeRE,self).__init__({ - 'd': r"(?P<d>3[0-1]|[0-2]\d|\d| \d)", #The " \d" option is - #to make %c from ANSI - #C work + 'd': r"(?P<d>3[0-1]|[0-2]\d|\d| \d)", #The " \d" option is to make %c from ANSI C work 'H': r"(?P<H>2[0-3]|[0-1]\d|\d)", 'I': r"(?P<I>0\d|1[0-2]|\d)", 'j': r"(?P<j>(?:3[0-5]\d|6[0-6])|[0-2]\d\d|\d)", @@ -371,21 +336,15 @@ def __getitem__(self, fetch): """Try to fetch regex; if it does not exist, construct it.""" - constructors = {'A': lambda: self.__seqToRE(self.locale_time.f_weekday, - fetch), - 'a': lambda: self.__seqToRE(self.locale_time.a_weekday, - fetch), - 'B': lambda: self.__seqToRE(self.locale_time.f_month[1:], - fetch), - 'b': lambda: self.__seqToRE(self.locale_time.a_month[1:], - fetch), + constructors = {'A': lambda: self.__seqToRE(self.locale_time.f_weekday, fetch), + 'a': lambda: self.__seqToRE(self.locale_time.a_weekday, fetch), + 'B': lambda: self.__seqToRE(self.locale_time.f_month[1:], fetch), + 'b': lambda: self.__seqToRE(self.locale_time.a_month[1:], fetch), 'c': lambda: self.pattern(self.locale_time.LC_date_time), - 'p': lambda: self.__seqToRE(self.locale_time.am_pm, - fetch), + 'p': lambda: self.__seqToRE(self.locale_time.am_pm, fetch), 'x': lambda: self.pattern(self.locale_time.LC_date), 'X': lambda: self.pattern(self.locale_time.LC_time), - 'Z': lambda: self.__seqToRE(self.locale_time.timezone, - fetch), + 'Z': lambda: self.__seqToRE(self.locale_time.timezone, fetch), '%': lambda: '%'} #Could use dict.setdefault(), but it calls dict.__getitem__() so would #have to deal with second call by catching KeyError since the call will @@ -408,7 +367,6 @@ Done in case for some strange reason that names in the locale only differ by a suffix and thus want the name with the suffix to match first. - """ try: a_length = len(a) @@ -453,17 +411,15 @@ object; will return an re object for format if data_string is False. The object passed in for format may either be an re object compiled by - strptime() or a format string. If False is passed in for data_string - then an re object for format will be returned which can be used as an - argument for format. The re object must be used with the same language - as used to compile the re object. - + strptime() or a format string. If False is passed in for data_string then + an re object for format will be returned which can be used as an argument + for format. The re object must be used with the same language as used to + compile the re object. """ locale_time = LocaleTime() if isinstance(format, type(re_compile(''))): if format.pattern.find(locale_time.lang) == -1: - raise TypeError("re object not created with same language as" - "LocaleTime instance") + raise TypeError("re object not created with same language as LocaleTime instance") else: compiled_re = format else: @@ -546,7 +502,6 @@ def julianday(year, month, day): """Calculate the Julian day since the beginning of the year from the Gregorian date. - """ #<bc>: If fxns are never exposed, can inline firstjulian() into julianday. a = (14-month)//12 @@ -556,7 +511,6 @@ def gregorian(julian, year): """Return a 3-item list containing the Gregorian date based on the Julian day. - """ a = 32043+julian+firstjulian(year) b = ((4*a)+3)//146097 Modified: branches/rel-1/freevo/src/tv/xmltv.py ============================================================================== --- branches/rel-1/freevo/src/tv/xmltv.py (original) +++ branches/rel-1/freevo/src/tv/xmltv.py Sun May 11 06:50:48 2008 @@ -305,21 +305,18 @@ def __init__(self, encoding="utf-8", date=None, source_info_url=None, source_info_name=None, generator_info_url=None, generator_info_name=None): """ - @param encoding: The text encoding that will be used. Defaults to 'utf-8' + Initialise an instance of Writer - @param date: The date this data was generated. Optional - - @param source_info_url: A URL for information about the source of the data. - Optional - - @param source_info_name: A human readable description of source_info_url. - Optional - - @param generator_info_url: A URL for information about the program that - is generating the XMLTV document. Optional - - @param generator_info_name: A human readable description of - generator_info_url. Optional + @ivar encoding: The text encoding that will be used. Defaults to 'utf-8' + @ivar date: The date this data was generated. Optional + @ivar source_info_url: A URL for information about the source of the + data. Optional + @ivar source_info_name: A human readable description of source_info_url. + Optional + @ivar generator_info_url: A URL for information about the program that + is generating the XMLTV document. Optional + @ivar generator_info_name: A human readable description of + generator_info_url. Optional """ _debug_('Writer.__init__(encoding=%r, date=%r, source_info_url=%r, source_info_name=%r, generator_info_url=%r, generator_info_name=%r)' % \ (encoding, date, source_info_url, source_info_name, generator_info_url, generator_info_name), 2) Modified: branches/rel-1/freevo/src/util/fxdimdb.py ============================================================================== --- branches/rel-1/freevo/src/util/fxdimdb.py (original) +++ branches/rel-1/freevo/src/util/fxdimdb.py Sun May 11 06:50:48 2008 @@ -126,12 +126,12 @@ def searchImdb(self, name): """ + Search IMDB for the name + @param name: name to search for @type name: string - @returns: id list with tuples: - (id , name, year, type) + @returns: id list with tuples (id , name, year, type) """ - _debug_('searching imdb for "%s"' % (name)) url = 'http://us.imdb.com/Tsearch?title=%s&restrict=Movies+and+TV' % urllib.quote(str(name)) url = 'http://www.imdb.com/find?s=tt;site=aka;q=%s' % urllib.quote(str(name)) |