Coverage for py_template/example_module.py: 100%

18 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-09-03 17:24 +0000

1def fibonacci(n: int) -> list[int]: 

2 """ 

3 Example function. 

4 

5 Parameters 

6 ---------- 

7 n : int 

8 Integer term up to which the sequence is calculated 

9 

10 Returns 

11 ------- 

12 fib_seq : list[int] 

13 The Fibonacci sequence up to term `n` 

14 """ 

15 fib_seq = [] 

16 

17 a, b = 0, 1 

18 

19 for i in range(n): 

20 a, b = b, a + b 

21 fib_seq.append(a) 

22 

23 return fib_seq 

24 

25 

26class SoftwareGroup: 

27 """ 

28 Example class. 

29 

30 Parameters 

31 ---------- 

32 people : str 

33 Group members 

34 purpose : str 

35 Group objectives 

36 """ 

37 

38 def __init__(self, people: str, purpose: str) -> None: 

39 self.people = people 

40 self.purpose = purpose 

41 self.meeting_format = "hack session + office hour + periodic tutorial" 

42 

43 def long_term_goals(self) -> str: 

44 research_goal = "develop open-source research software for astronomy" 

45 community_goal = "improve diversity in astro software positions" 

46 education_goal = "organize and run astro software workshops" 

47 cca_goal = "improve software knowledge and practices at CCA" 

48 return ", ".join( 

49 [self.purpose, research_goal, community_goal, education_goal, cca_goal] 

50 )