Skip to content

Commit

Permalink
Rewrote docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
magnuswatn committed Jan 21, 2017
1 parent e6c4d77 commit 3bf3608
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions fodselsnummer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,17 @@
xrange = range #pylint: disable=W0622, C0103

def check_fnr(fnr):
"""Check if a number is a valid fodselsnumber.
Only checks the control digits, do not check if the
individual numbers are used in the relevant year"""
"""
Check if a number is a valid fodselsnumber.
Only checks the control digits, does not check if the
individual numbers are used in the relevant year
Args:
fnr: A string containing the fodselsnummer to check
Returns:
True if it is a valid fodselsnummer, False otherwise.
"""
if not re.match(r'\d{11}', fnr):
return False
generatedfnr = _generate_control_digits(fnr[0:9])
Expand All @@ -22,8 +30,15 @@ def check_fnr(fnr):
return False

def generate_fnr_for_year(year, d_numbers):
"""Generates all the possible fodselsnumbers for a year,
optionally with D numbers"""
"""
Generates all the possible fodselsnumbers for a year.
Args:
year: The year to generate fodselsnummers for (integer)
d_numbers: True if you want d-numbers as well, False otherwise.
Returns:
A list with all the possible fodselsnummers for that year.
"""
allfnrs = []
startdate = date(year, 1, 1)
enddate = date(year, 12, 31)
Expand All @@ -33,8 +48,15 @@ def generate_fnr_for_year(year, d_numbers):
return allfnrs

def generate_fnr_for_day(day, d_numbers):
"""Generates all the possible fodselsnumbers for a day,
optionally with D numbers"""
"""
Generates all the possible fodselsnumbers for a day.
Args:
day: The day to generate fodslesnummers for (datetime)
d_numbers: True if you want d-numbers as well, False otherwise.
Returns:
A list with all the possible fodselsnummers for that day.
"""
thisdaysfnr = []
stupid1900s = False
datestring = day.strftime('%d%m%y')
Expand Down

0 comments on commit 3bf3608

Please sign in to comment.