"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "fail2ban/server/mytime.py" between
fail2ban-0.10.5.tar.gz and fail2ban-0.11.1.tar.gz

About:

mytime.py  (fail2ban-0.10.5):mytime.py  (fail2ban-0.11.1)
skipping to change at line 116 skipping to change at line 116
def localtime(x=None): def localtime(x=None):
"""Decorate time.localtime() for the purpose of testing mocking """Decorate time.localtime() for the purpose of testing mocking
@return time.localtime() if setTime was called with None @return time.localtime() if setTime was called with None
""" """
if MyTime.myTime is None or x is not None: if MyTime.myTime is None or x is not None:
return time.localtime(x) return time.localtime(x)
else: else:
return time.localtime(MyTime.myTime) return time.localtime(MyTime.myTime)
@staticmethod
def time2str(unixTime, format="%Y-%m-%d %H:%M:%S"):
"""Convert time to a string representing as date and time using g
iven format.
Default format is ISO 8601, YYYY-MM-DD HH:MM:SS without microseco
nds.
@return ISO-capable string representation of given unixTime
"""
return datetime.datetime.fromtimestamp(
unixTime).replace(microsecond=0).strftime(format)
## precreate/precompile primitives used in str2seconds: ## precreate/precompile primitives used in str2seconds:
## preparing expression: ## preparing expression:
_str2sec_prep = re.compile(r"(?i)(?<=[a-z])(\d)") _str2sec_prep = re.compile(r"(?i)(?<=[a-z])(\d)")
## finally expression: ## finally expression:
_str2sec_fini = re.compile(r"(\d)\s+(\d)") _str2sec_fini = re.compile(r"(\d)\s+(\d)")
## wrapper for each sub part: ## wrapper for each sub part:
_str2sec_subpart = r"(?i)(?<=[\d\s])(%s)\b" _str2sec_subpart = r"(?i)(?<=[\d\s])(%s)\b"
## parts to be replaced - pair of (regexp x replacement): ## parts to be replaced - pair of (regexp x replacement):
_str2sec_parts = ( _str2sec_parts = (
 End of changes. 1 change blocks. 
0 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)