Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further improvements to issues and times.py #25

Merged
merged 3 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .issues/Instructor_issue_2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Instructor Issue 2

Please write some assertions to test if the methods in times.py are working as expected.
19 changes: 6 additions & 13 deletions .issues/exercise_1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,11 @@

Please follow these instructions step-by-step before the course starts.

## 1. Fork this repository
### 1. Fork this repository

![Indicates where the Fork button is (top-right corner of the repository page)](https://i.imgur.com/ZCxOrOX.png)
![Indicates where the Fork button is (top-right corner of the repository page)](https://i.imgur.com/HiBlmrj.png)

## 2. Go to the settings in your fork

![Indicates where the settings button appears once the repository is forked](https://i.imgur.com/1aGRVVB.png)

## 3. Enable issues

![Enable issues on your fork](https://user-images.githubusercontent.com/963242/95435705-ce66b700-094a-11eb-8424-770ed92a99f6.png)

## 4. Clone your repository locally
### 2. Clone your repository locally

In a `bash` terminal on your computer, run:
```bash
Expand All @@ -31,9 +23,10 @@ A folder named `rse-best-practices-playground` should be listed.

(If this does not work, you may have to set up a personal access token: Follow the instructions [in the GitHub documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token) and get in touch with the course organisers if you encounter issues.)

## 5. React to this issue with :+1:
### 3. React to this issue with :+1:
![Select and add a reaction to this comment](https://user-images.githubusercontent.com/963242/95435873-0bcb4480-094b-11eb-9d37-2fdefdcb8c6f.png)

## 6. (Optional) Have a look at the code
The next exercises will be described in the issues of the original repository (the one you made your fork from).
### 4. (Optional) Have a look at the code

You may want to study the code in `times.py`. You can find it by navigating to `rse-best-practices-playground` > `rse_best_practices_playground` > `times.py`. Can you figure out what the code is meant to do?
3 changes: 3 additions & 0 deletions .issues/instructor_issue_1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Instructor Issue 1

Please document what the methods in times.py are doing by writing some comments at the top of the file.
17 changes: 0 additions & 17 deletions rse_best_practices_playground/times.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ def print_fastest_time(time_list):
def time_range(
start_time, end_time, number_of_intervals=1, gap_between_intervals_s=0
):
"""
Example:
>>> time_range("2010-01-12 10:00:00", "2010-01-12 12:00:00")
[('2010-01-12 10:00:00', '2010-01-12 12:00:00')]
"""
start_time_s = datetime.datetime.strptime(start_time, "%Y-%m-%d %H:%M:%S")
end_time_s = datetime.datetime.strptime(end_time, "%Y-%m-%d %H:%M:%S")
d = (
Expand All @@ -65,13 +60,6 @@ def time_range(


def compute_overlap_time(range1, range2):
"""
Example:
>>> range1 = time_range("2010-01-12 10:00:00", "2010-01-12 12:00:00")
>>> range2 = time_range("2010-01-12 10:30:00", "2010-01-23 10:45:00")
>>> compute_overlap_time(range1, range2)
>>> [('2010-01-12 10:30:00', '2010-01-12 10:45:00')]
"""
overlap_time = []
for start1, end1 in range1:
for start2, end2 in range2:
Expand All @@ -84,11 +72,6 @@ def compute_overlap_time(range1, range2):
def time_range_less_precise(
start_time, end_time, number_of_intervals=10, gap_between_intervals_s=5
):
"""
Example:
>>> time_range("2010-01-12 10:00:00", "2010-01-12 12:00:00", 2, 60)
[('2010-01-12 10:00:00', '2010-01-12 12:00:00')]
"""
start_time_s = datetime.datetime.strptime(start_time, "%Y-%m-%d %H:%M:%S")
end_time_s = datetime.datetime.strptime(end_time, "%Y-%m-%d %H:%M:%S")
d = (
Expand Down