From 475a1823f704d416582b9b39c34189a05bc64049 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Sun, 29 Oct 2006 04:36:08 +0000 Subject: [PATCH] * src/GrampsDb/_ReadGedcom.py: Formatting fixes. * src/GrampsDb/_GrampsDbBase.py: Formatting fixes. * src/GrampsDb/_GrampsDbFactories.py: Formatting fixes. * src/GrampsDb/_WriteXML.py: Formatting fixes. * src/GrampsDb/_GrampsBSDDB.py: Formatting fixes. * src/RelLib/_UrlBase.py: Formatting fixes. * src/RelLib/_Url.py: Formatting fixes. * src/RelLib/_Person.py: Formatting fixes. * src/RelLib/_Family.py: Formatting fixes. * src/RelLib/_Place.py: Formatting fixes. * src/RelLib/_Repository.py: Formatting fixes. * src/BasicUtils.py: Formatting fixes. * src/DateHandler/_DateUtils.py: Formatting fixes. svn: r7481 --- gramps2/ChangeLog | 13 ++ gramps2/src/BasicUtils.py | 2 +- gramps2/src/DateHandler/_DateUtils.py | 16 +-- gramps2/src/GrampsDb/_GrampsBSDDB.py | 6 +- gramps2/src/GrampsDb/_GrampsDbBase.py | 7 +- gramps2/src/GrampsDb/_GrampsDbFactories.py | 16 +-- gramps2/src/GrampsDb/_ReadGedcom.py | 152 ++++++++++----------- gramps2/src/GrampsDb/_WriteXML.py | 6 +- gramps2/src/RelLib/_Family.py | 22 +-- gramps2/src/RelLib/_Person.py | 8 +- gramps2/src/RelLib/_Place.py | 11 +- gramps2/src/RelLib/_Repository.py | 4 +- gramps2/src/RelLib/_Url.py | 4 +- gramps2/src/RelLib/_UrlBase.py | 4 +- 14 files changed, 142 insertions(+), 129 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index b299073a1..0bfc7684e 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,17 @@ 2006-10-28 Alex Roitman + * src/GrampsDb/_ReadGedcom.py: Formatting fixes. + * src/GrampsDb/_GrampsDbBase.py: Formatting fixes. + * src/GrampsDb/_GrampsDbFactories.py: Formatting fixes. + * src/GrampsDb/_WriteXML.py: Formatting fixes. + * src/GrampsDb/_GrampsBSDDB.py: Formatting fixes. + * src/RelLib/_UrlBase.py: Formatting fixes. + * src/RelLib/_Url.py: Formatting fixes. + * src/RelLib/_Person.py: Formatting fixes. + * src/RelLib/_Family.py: Formatting fixes. + * src/RelLib/_Place.py: Formatting fixes. + * src/RelLib/_Repository.py: Formatting fixes. + * src/BasicUtils.py: Formatting fixes. + * src/DateHandler/_DateUtils.py: Formatting fixes. * NEWS: Update. * src/ViewManager.py (ViewManager.about): Use const.py. * src/const.py.in (url_manual): Add the link constant. diff --git a/gramps2/src/BasicUtils.py b/gramps2/src/BasicUtils.py index d05cf80e2..0952d6f2c 100644 --- a/gramps2/src/BasicUtils.py +++ b/gramps2/src/BasicUtils.py @@ -51,7 +51,7 @@ class UpdateCallback: @param callback: a function with one arg to execute every so often @type callback: function @param interval: number of seconds at most between the updates - @type callback: int + @type interval: int """ if '__call__' in dir(callback): # callback is really callable self.update = self.update_real diff --git a/gramps2/src/DateHandler/_DateUtils.py b/gramps2/src/DateHandler/_DateUtils.py index ce4bf8848..8ab854535 100644 --- a/gramps2/src/DateHandler/_DateUtils.py +++ b/gramps2/src/DateHandler/_DateUtils.py @@ -55,12 +55,12 @@ def set_date(date_base, text) : """ Sets the date of the DateBase instance. - The date is parsed into a L{Date} instance. + The date is parsed into a Date instance. - @param date: String representation of a date. The locale specific - L{DateParser} is used to parse the string into a GRAMPS L{Date} - object. - @type date: str + @param date_base: The DateBase instance to set the date to. + @type date_base: DateBase + @param text: The text to use for the text string in date + @type text: str """ parser.set_date(date_base.get_date_object(),text) @@ -69,7 +69,7 @@ def get_date(date_base) : Returns a string representation of the date of the DateBase instance. This representation is based off the default date display format - determined by the locale's L{DateDisplay} instance. + determined by the locale's DateDisplay instance. @return: Returns a string representing the DateBase date @rtype: str """ @@ -80,8 +80,8 @@ def get_quote_date(date_base): Returns a string representation of the date of the DateBase instance. This representation is based off the default date display format - determined by the locale's L{DateDisplay} instance. The date is - enclosed in quotes if the L{Date} is not a valid date. + determined by the locale's DateDisplay instance. The date is + enclosed in quotes if the Date is not a valid date. @return: Returns a string representing the DateBase date @rtype: str diff --git a/gramps2/src/GrampsDb/_GrampsBSDDB.py b/gramps2/src/GrampsDb/_GrampsBSDDB.py index 6b1bbc9a6..0d091bbb7 100644 --- a/gramps2/src/GrampsDb/_GrampsBSDDB.py +++ b/gramps2/src/GrampsDb/_GrampsBSDDB.py @@ -652,7 +652,7 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback): Note that this is a generator function, it returns a iterator for use in loops. If you want a list of the results use: - result_list = [i for i in find_backlink_handles(handle)] + > result_list = [i for i in find_backlink_handles(handle)] """ @@ -961,8 +961,8 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback): def _close_early(self): """ Bail out if the incompatible version is discovered: - * close cleanly to not damage data/env - * raise exception + * close cleanly to not damage data/env + * raise exception """ self.metadata.close() self.env.close() diff --git a/gramps2/src/GrampsDb/_GrampsDbBase.py b/gramps2/src/GrampsDb/_GrampsDbBase.py index 000f48068..d5fb65904 100644 --- a/gramps2/src/GrampsDb/_GrampsDbBase.py +++ b/gramps2/src/GrampsDb/_GrampsDbBase.py @@ -1313,9 +1313,8 @@ class GrampsDbBase(GrampsDBCallback): or R%04d. """ self.rprefix = self._validated_id_prefix(val, "R") - - def transaction_begin(self, msg="", batch=False, match=False, - no_magic=False): + + def transaction_begin(self, msg="",batch=False,no_magic=False): """ Creates a new Transaction tied to the current UNDO database. The transaction has no effect until it is committed using the @@ -2064,7 +2063,7 @@ class GrampsDbBase(GrampsDBCallback): Note that this is a generator function, it returns a iterator for use in loops. If you want a list of the results use: - result_list = [i for i in find_backlink_handles(handle)] + > result_list = [i for i in find_backlink_handles(handle)] """ # Make a dictionary of the functions and classes that we need for diff --git a/gramps2/src/GrampsDb/_GrampsDbFactories.py b/gramps2/src/GrampsDb/_GrampsDbFactories.py index b3ec01edd..30b4c041b 100644 --- a/gramps2/src/GrampsDb/_GrampsDbFactories.py +++ b/gramps2/src/GrampsDb/_GrampsDbFactories.py @@ -28,14 +28,14 @@ for a database backend. The app_* constants in const.py can be used to indicate which backend is required e.g.: - # To get the class for the grdb backend - db_class = GrampsDb.gramps_db_factory(db_type = const.app_gramps) - - # To get a XML writer - GrampsDb.gramps_db_writer_factory(db_type = const.app_gramps_xml) - - # To get a Gedcom reader - GrampsDb.gramps_db_reader_factory(db_type = const.app_gedcom) +> # To get the class for the grdb backend +> db_class = GrampsDb.gramps_db_factory(db_type = const.app_gramps) +> +> # To get a XML writer +> GrampsDb.gramps_db_writer_factory(db_type = const.app_gramps_xml) +> +> # To get a Gedcom reader +> GrampsDb.gramps_db_reader_factory(db_type = const.app_gedcom) """ import const diff --git a/gramps2/src/GrampsDb/_ReadGedcom.py b/gramps2/src/GrampsDb/_ReadGedcom.py index 23c1fb7bf..fced989d8 100644 --- a/gramps2/src/GrampsDb/_ReadGedcom.py +++ b/gramps2/src/GrampsDb/_ReadGedcom.py @@ -1585,29 +1585,29 @@ class GedcomParser(UpdateCallback): """ Handling of the GEDCOM INDI tag. - n @XREF:INDI@ INDI {1:1} - +1 RESN {0:1} - +1 <> {0:M} - +1 SEX {0:1} - +1 <> {0:M} - +1 <> {0:M} - +1 <> {0:M} - +1 <> {0:M} - +1 <> {0:M} - +1 SUBM @@ {0:M} - +1 <> {0:M} - +1 ALIA @@ {0:M} - +1 ANCI @@ {0:M} - +1 DESI @@ {0:M} - +1 <> {0:M} - +1 <> {0:M} - +1 <> {0:M} - +1 RFN {0:1} - +1 AFN {0:1} - +1 REFN {0:M} - +2 TYPE {0:1} - +1 RIN {0:1} - +1 <> {0:1} + n @XREF:INDI@ INDI {1:1} + +1 RESN {0:1} + +1 <> {0:M} + +1 SEX {0:1} + +1 <> {0:M} + +1 <> {0:M} + +1 <> {0:M} + +1 <> {0:M} + +1 <> {0:M} + +1 SUBM @@ {0:M} + +1 <> {0:M} + +1 ALIA @@ {0:M} + +1 ANCI @@ {0:M} + +1 DESI @@ {0:M} + +1 <> {0:M} + +1 <> {0:M} + +1 <> {0:M} + +1 RFN {0:1} + +1 AFN {0:1} + +1 REFN {0:M} + +2 TYPE {0:1} + +1 RIN {0:1} + +1 <> {0:1} """ # find the person @@ -2471,21 +2471,21 @@ class GedcomParser(UpdateCallback): """ Parsers the NAME token in a GEDCOM file. The text is in the format of (according to the GEDCOM Spec): - |//|//|//|// + > |//|//|//|// We have encountered some variations that use: - / + > / The basic Name structure is: - n NAME {1:1} - +1 NPFX {0:1} - +1 GIVN {0:1} - +1 NICK {0:1} - +1 SPFX {0:1} - +1 NSFX {0:1} - +1 <> {0:M} - +1 <> {0:M} + > n NAME {1:1} + > +1 NPFX {0:1} + > +1 GIVN {0:1} + > +1 NICK {0:1} + > +1 SPFX +1 SURN {0:1} + > +1 NSFX {0:1} + > +1 <> {0:M} + > +1 <> {0:M} """ # build a RelLib.Name structure from the text @@ -2535,10 +2535,10 @@ class GedcomParser(UpdateCallback): """ CHANGE_DATE:= - n CHAN {1:1} - +1 DATE {1:1} - +2 TIME {0:1} - +1 <> {0:M} + > n CHAN {1:1} + > +1 DATE {1:1} + > +2 TIME {0:1} + > +1 <> {0:M} The Note structure is ignored, since we have nothing corresponding in GRAMPS. @@ -2585,15 +2585,15 @@ class GedcomParser(UpdateCallback): are currently parsing. The GEDCOM spec indicates that valid ASSOC tag is: - n ASSO @@ {0:M} + > n ASSO @@ {0:M} And the the sub tags are: - ASSOCIATION_STRUCTURE:= - +1 TYPE {1:1} - +1 RELA {1:1} - +1 <> {0:M} - +1 <> {0:M} + > ASSOCIATION_STRUCTURE:= + > +1 TYPE {1:1} + > +1 RELA {1:1} + > +1 <> {0:M} + > +1 <> {0:M} GRAMPS only supports ASSO records to people, so if the TYPE is something other than INDI, the record is ignored. @@ -2663,15 +2663,15 @@ class GedcomParser(UpdateCallback): Embedded form - n OBJE @@ {1:1} + > n OBJE @@ {1:1} - Linked form + Linked form - n OBJE {1:1} - +1 FORM {1:1} - +1 TITL {0:1} - +1 FILE {1:1} - +1 <> {0:M} + > n OBJE {1:1} + > +1 FORM {1:1} + > +1 TITL {0:1} + > +1 FILE {1:1} + > +1 <> {0:M} """ if matches[2] and matches[2][0] == '@': ref = RelLib.MediaRef() @@ -2717,12 +2717,12 @@ class GedcomParser(UpdateCallback): def func_person_sex(self,matches,state): """ - +1 SEX {0:1} + > +1 SEX {0:1} Valid values for are: - M = Male - F = Female + > M = Male + > F = Female """ if matches[2] == '': state.person.set_gender(RelLib.Person.UNKNOWN) @@ -2799,16 +2799,16 @@ class GedcomParser(UpdateCallback): """ The RESI tag follows the EVENT_DETAIL structure, which is: - n TYPE {0:1} - n DATE {0:1} - n <> {0:1} - n <> {0:1} - n AGE {0:1} - n AGNC {0:1} - n CAUS {0:1} - n <> {0:M} - n <> {0:M} - n <> {0:M} + > n TYPE {0:1} + > n DATE {0:1} + > n <> {0:1} + > n <> {0:1} + > n AGE {0:1} + > n AGNC {0:1} + > n CAUS {0:1} + > n <> {0:M} + > n <> {0:M} + > n <> {0:M} Currently, the TYPE, AGE, CAUSE, STAT, and other tags which do not apply to an address are ignored. @@ -2862,9 +2862,9 @@ class GedcomParser(UpdateCallback): def func_person_birt(self,matches,state): """ - n BIRT [Y|] {1:1} - +1 <> {0:1} p.* - +1 FAMC @@ {0:1} p.* + > n BIRT [Y|] {1:1} + > +1 <> {0:1} p.* + > +1 FAMC @@ {0:1} p.* I'm not sure what value the FAMC actually offers here, since the FAMC record should handle this. Why it is a valid sub value @@ -3119,15 +3119,15 @@ class GedcomParser(UpdateCallback): def func_repo_addr(self, matches, repo, level): """ - n ADDR {0:1} - +1 CONT {0:M} - +1 ADR1 {0:1} - +1 ADR2 {0:1} - +1 CITY {0:1} - +1 STAE {0:1} - +1 POST {0:1} - +1 CTRY {0:1} - n PHON {0:3} + n ADDR {0:1} + +1 CONT {0:M} + +1 ADR1 {0:1} + +1 ADR2 {0:1} + +1 CITY {0:1} + +1 STAE {0:1} + +1 POST {0:1} + +1 CTRY {0:1} + n PHON {0:3} Some repositories do not try to break up the address, instead they put everything on a single line. Try to determine diff --git a/gramps2/src/GrampsDb/_WriteXML.py b/gramps2/src/GrampsDb/_WriteXML.py index ce886593a..b974e9d8e 100644 --- a/gramps2/src/GrampsDb/_WriteXML.py +++ b/gramps2/src/GrampsDb/_WriteXML.py @@ -122,9 +122,9 @@ class XmlWriter(UpdateCallback): db - database to write callback - function to provide progress indication strip_photos - remove paths off of media object paths - 0: do not touch the paths - 1: remove everything expect the filename - 2: remove leading slash + > 0: do not touch the paths + > 1: remove everything expect the filename + > 2: remove leading slash compress - attempt to compress the database """ UpdateCallback.__init__(self,callback) diff --git a/gramps2/src/RelLib/_Family.py b/gramps2/src/RelLib/_Family.py index eb9514d88..fd6ba802e 100644 --- a/gramps2/src/RelLib/_Family.py +++ b/gramps2/src/RelLib/_Family.py @@ -353,8 +353,8 @@ class Family(PrimaryObject,SourceBase,NoteBase,MediaBase,AttributeBase, Adds the database handle for L{Person} to the Family's list of children. - @param person_handle: L{Person} database handle - @type person_handle: str + @param child_ref: Child Reference instance + @type child_ref: ChildRef """ if not isinstance(child_ref,ChildRef): raise ValueError("expecting ChildRef instance") @@ -365,8 +365,8 @@ class Family(PrimaryObject,SourceBase,NoteBase,MediaBase,AttributeBase, Removes the database handle for L{Person} to the Family's list of children if the L{Person} is already in the list. - @param person_handle: L{Person} database handle - @type person_handle: str + @param child_ref: Child Reference instance + @type child_ref: ChildRef @return: True if the handle was removed, False if it was not in the list. @rtype: bool @@ -382,8 +382,8 @@ class Family(PrimaryObject,SourceBase,NoteBase,MediaBase,AttributeBase, Removes the database handle for L{Person} to the Family's list of children if the L{Person} is already in the list. - @param person_handle: L{Person} database handle - @type person_handle: str + @param child_handle: L{Person} database handle + @type child_handle: str @return: True if the handle was removed, False if it was not in the list. @rtype: bool @@ -394,10 +394,10 @@ class Family(PrimaryObject,SourceBase,NoteBase,MediaBase,AttributeBase, def get_child_ref_list(self): """ - Returns the list of L{Person} handles identifying the children + Returns the list of L{ChildRef} handles identifying the children of the Family. - @return: Returns the list of L{Person} handles assocated with + @return: Returns the list of L{ChildRef} handles assocated with the Family. @rtype: list """ @@ -407,9 +407,9 @@ class Family(PrimaryObject,SourceBase,NoteBase,MediaBase,AttributeBase, """ Assigns the passed list to the Family's list children. - @param child_list: List of L{Person} handles to ba associated - as the Family's list of children. - @type child_list: list of L{Person} handles + @param child_ref_list: List of Child Reference instances to be + associated as the Family's list of children. + @type child_ref_list: list of L{ChildRef} instances """ self.child_ref_list = child_ref_list diff --git a/gramps2/src/RelLib/_Person.py b/gramps2/src/RelLib/_Person.py index ebd062c0a..c98ab1676 100644 --- a/gramps2/src/RelLib/_Person.py +++ b/gramps2/src/RelLib/_Person.py @@ -425,7 +425,7 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase, @param event_ref: the L{EventRef} object associated with the Person's birth. - @type event_handle: EventRef + @type event_ref: EventRef """ if event_ref and not isinstance(event_ref, EventRef): raise ValueError("Expecting EventRef instance") @@ -446,7 +446,7 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase, @param event_ref: the L{EventRef} object associated with the Person's death. - @type event_handle: EventRef + @type event_ref: EventRef """ if event_ref and not isinstance(event_ref, EventRef): raise ValueError("Expecting EventRef instance") @@ -736,7 +736,7 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase, """ Sets the Person instance's L{PersonRef} list to the passed list. - @param event_ref_list: List of valid L{PersonRef} objects - @type event_ref_list: list + @param person_ref_list: List of valid L{PersonRef} objects + @type person_ref_list: list """ self.person_ref_list = person_ref_list diff --git a/gramps2/src/RelLib/_Place.py b/gramps2/src/RelLib/_Place.py index 3af915cfe..c73fb4240 100644 --- a/gramps2/src/RelLib/_Place.py +++ b/gramps2/src/RelLib/_Place.py @@ -286,11 +286,12 @@ class Place(PrimaryObject,SourceBase,NoteBase,MediaBase,UrlBase): This includes the information that is used for display and for sorting. Returns a list consisting of 13 strings. These are: - Place Title, Place ID, Main Location Parish, Main Location County, - Main Location City, Main Location State/Province, - Main Location Country, upper case Place Title, upper case Parish, - upper case city, upper case county, upper case state, - upper case country + + Place Title, Place ID, Main Location Parish, Main Location County, + Main Location City, Main Location State/Province, + Main Location Country, upper case Place Title, upper case Parish, + upper case city, upper case county, upper case state, + upper case country """ if self.main_loc: diff --git a/gramps2/src/RelLib/_Repository.py b/gramps2/src/RelLib/_Repository.py index 42ef87cc9..a98841ac8 100644 --- a/gramps2/src/RelLib/_Repository.py +++ b/gramps2/src/RelLib/_Repository.py @@ -131,8 +131,8 @@ class Repository(PrimaryObject,NoteBase,AddressBase,UrlBase): def set_type(self,the_type): """ - @param type: descriptive type of the Repository - @type type: str + @param the_type: descriptive type of the Repository + @type the_type: str """ self.type.set(the_type) diff --git a/gramps2/src/RelLib/_Url.py b/gramps2/src/RelLib/_Url.py index eba913b92..c5b6ebe2d 100644 --- a/gramps2/src/RelLib/_Url.py +++ b/gramps2/src/RelLib/_Url.py @@ -97,8 +97,8 @@ class Url(SecondaryObject,PrivacyBase): def set_type(self,the_type): """ - @param type: descriptive type of the Url - @type type: str + @param the_type: descriptive type of the Url + @type the_type: str """ self.type.set(the_type) diff --git a/gramps2/src/RelLib/_UrlBase.py b/gramps2/src/RelLib/_UrlBase.py index feefe30df..c22bda6ca 100644 --- a/gramps2/src/RelLib/_UrlBase.py +++ b/gramps2/src/RelLib/_UrlBase.py @@ -96,8 +96,8 @@ class UrlBase: If the instance does not exist in the list, the operation has no effect. - @param attribute: L{Url} instance to remove from the list - @type attribute: L{Url} + @param url: L{Url} instance to remove from the list + @type url: L{Url} @return: True if the url was removed, False if it was not in the list. @rtype: bool