Let old date-extracting methods use dates_extract and mark them as deprecated
This commit is contained in:
62
redfam.py
62
redfam.py
@@ -382,62 +382,46 @@ Maximum number of articles in red_fam exceeded, maximum number is 8, \
|
|||||||
return (beginning, ending)
|
return (beginning, ending)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@deprecated( extract_dates )
|
||||||
def is_beginning( cls, line ):
|
def is_beginning( cls, line ):
|
||||||
"""
|
"""
|
||||||
Returns the first timestamp found in line, otherwise None
|
Returns the first timestamp found in line, otherwise None
|
||||||
|
|
||||||
@param str line String to search in
|
@param str line String to search in
|
||||||
|
|
||||||
@returns str Timestamp, otherwise None
|
@returns str Timestamp, otherwise None
|
||||||
"""
|
"""
|
||||||
|
|
||||||
match = cls.__timestamp_pat.search( line )
|
return cls.extract_dates( line )[0]
|
||||||
if match:
|
|
||||||
# Since some timestamps are broken we need to reconstruct them
|
|
||||||
# by regex match groups
|
|
||||||
result = match.group(1) + ", " + match.group(2) + ". " +\
|
|
||||||
match.group(3) + ". " + match.group(4)
|
|
||||||
return result
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def is_ending( cls, line ):
|
@deprecated( extract_dates )
|
||||||
|
def is_ending( cls, line, isarchive=False ):
|
||||||
"""
|
"""
|
||||||
Returns the timestamp of done notice ( if one ), otherwise None
|
Returns the timestamp of done notice ( if one ), otherwise None
|
||||||
@param str line String to search in
|
|
||||||
|
@param line String to search in
|
||||||
@returns str Timestamp, otherwise None
|
@type line str
|
||||||
|
@param isarchive If true skip searching done notice (on archivepages)
|
||||||
|
@type isarchive bool
|
||||||
|
|
||||||
|
@returns Timestamp, otherwise None
|
||||||
|
@returntype str
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if ( cls.__done_notice in line ) or ( cls.__done_notice2 in line ):
|
return cls.extract_dates( line )[1]
|
||||||
match = cls.__timestamp_pat.search( line )
|
|
||||||
if match:
|
|
||||||
# Since some timestamps are broken we need to reconstruct them
|
|
||||||
# by regex match groups
|
|
||||||
result = match.group(1) + ", " + match.group(2) + ". " +\
|
|
||||||
match.group(3) + ". " + match.group(4)
|
|
||||||
return result
|
|
||||||
return None
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@deprecated( extract_dates )
|
||||||
def is_ending2( cls, line ):
|
def is_ending2( cls, line ):
|
||||||
"""
|
"""
|
||||||
Returns the last timestamp found in line, otherwise None
|
Returns the last timestamp found in line, otherwise None
|
||||||
@param str line String to search in
|
@param str line String to search in
|
||||||
|
|
||||||
@returns str Timestamp, otherwise None
|
@returns str Timestamp, otherwise None
|
||||||
"""
|
"""
|
||||||
|
|
||||||
matches = cls.__timestamp_pat.findall( line )
|
return cls.extract_dates( line, True )[1]
|
||||||
if matches:
|
|
||||||
# Since some timestamps are broken we need to reconstruct them
|
|
||||||
# by regex match groups
|
|
||||||
result = matches[-1][0] + ", " + matches[-1][1] + ". " +\
|
|
||||||
matches[-1][2] + ". " + matches[-1][3]
|
|
||||||
return result
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
class RedFamWorker( RedFam ):
|
class RedFamWorker( RedFam ):
|
||||||
|
|||||||
Reference in New Issue
Block a user