1. Homepage
  2. Programming
  3. INFO1112 A1 - Just a friendly reminder

INFO1112 A1 - Just a friendly reminder

Engage in a Conversation
The University of SydneyINFO1112Computing 1B OS and Network PlatformsPythonComputer NetworksOperating System

INFO1112 A1 - Just a friendly reminder CourseNana.COM

In this assignment, you'll be creating a basic application called "Jafr" (short for "Just a friendly reminder"). This application helps multiple users manage their tasks and meetings on a Unix-like OS (a popular choice of OS in industry where developers might share a computer system or host web applications). CourseNana.COM

Jafr is Unix-friendly. This means that
1. Users interact with Jafr by typing commands in a command-line interface. CourseNana.COM

2. Jafr assumes that all the tasks and meetings are stored in text files that are otherwise managed by users of the shared system. Users simply edit these files themselves when they want to make changes outside of Jafr. CourseNana.COM

You will implement Jafr in Python and write a simple start up script in Bash. You will then write I/O end to end tests for Jafr. CourseNana.COM

These specifications first describe each behaviour of Jafr. The final sections describe error handling, how to write tests for Jafr and provide some hints. CourseNana.COM

Overview CourseNana.COM

Jafr is designed to run whenever a user opens their terminal at the beginning of their day. Users can choose to view reminders that are relevant to the current day, or make changes. Changes can include sharing reminders with other users. CourseNana.COM

There are two kinds of reminders: tasks and meetings. CourseNana.COM

Setup CourseNana.COM

Jafr primarily relies on two text files for each user: tasks.md and meetings.md . These text files are placed inside a master directory of the user's choosing. CourseNana.COM

The user chooses their master directory inside a JSON file called
located at
~/.jafr/user-settings.json . You may consider a 'hidden' directory, for Jafr's internal use only. CourseNana.COM

user-settings.json

~/.jafr/ CourseNana.COM

Hint CourseNana.COM

Notice that the hidden directory .jafr/ is inside a user's home directory which can be symbolically referred to by ~ .
You can fetch the path referred to by
~ in Python by using os.path.expanduser('~') CourseNana.COM

user-settings.json has a single key value pair storing the absolute path to the master directory. CourseNana.COM

Sample user-settings.json : CourseNana.COM

"master": "/home/dailystuff"

Help! What's a JSON file? CourseNana.COM

JSON is a universal file format for easy data reading and writing. There are two kinds of data structures possible to write in JSON: objects and arrays.
Curly braces are used to define an object: a collection of name/value pairs (exactly like a dictionary in Python). Square brackets are used to define an array: an ordered list of values (exactly like a list in Python).
CourseNana.COM

You may use Python's json library in your implementation to read JSON files. See json.load() CourseNana.COM

Note CourseNana.COM

tasks.md and meetings.md for each user are given inside your scaffold. Assume the user creates these themselves using their preferred text editor.
The
~/.jafr/ directory for each user is also given inside your scaffold. You do not have to handle the case where ~/.jafr/user-settings.json is missing for any user. Assume Jafr has some installation script that handles this, outside of the scope of your assignment. CourseNana.COM

Text files containing reminders CourseNana.COM

The two text files inside the master directory for each user are as follows. CourseNana.COM

tasks.md CourseNana.COM

This text file contains dot pointed tasks with the following format. Dates follow DD/MM/YY, or more precisely the C standard format %d/%m/%y (see the datetime docs). You will only ever have to handle dates in the years 1969 - 2068 (inclusive). CourseNana.COM

- <task description> Due: <due date> <completion status> For example CourseNana.COM

- Complete INFO1112 A1 Due: 01/10/23 not complete
- Acquire Twitter Due: 30/10/23 complete
- Study linux namespaces Due: 30/09/23 not complete

Hint CourseNana.COM

Notice that a task must end with complete or not complete !
Moreover, the format implies that a task description should never contain the string
CourseNana.COM

Due: . You do not have to handle the case where a user does this. CourseNana.COM

meetings.md CourseNana.COM

This text file contains dot pointed meetings with the following format. Times follow HH:mm, or more precisely the C standard format %H:%M (see the datetime docs). CourseNana.COM

- <meeting description> Scheduled: <scheduled time> <scheduled date> For example CourseNana.COM

- Michael Mai's welcome party Scheduled: 18:00 25/08/23
- A1 marking meeting Scheduled: 09:00 01/09/23

Hint CourseNana.COM

You do not have to handle the case where a user places Scheduled: inside the meeting description.
Further, as suggested by the links above, it will be easiest to use
datetime to handle all dates/times! CourseNana.COM

Usage CourseNana.COM

Jafr runs when jafr.py is executed by the Python interpreter. There is one command line argument which will contain a path (absolute or relative) to a given passwd file. More on this below. CourseNana.COM

For example CourseNana.COM

python3 jafr.py passwd
Jafr first displays relevant reminders (tasks followed by meetings), before showing a menu. CourseNana.COM

The menu contains the following. CourseNana.COM

What would you like to do?
1. Complete tasks
2. Add a new meeting.
3. Share a task.
4. Share a meeting.
5. Change Jafr's master directory.
6. Exit

A user chooses one option only. CourseNana.COM

<menu num> CourseNana.COM

This invokes the relevant behaviour, described below. If the user enters 6 , Jafr exits. After completing a behaviour, Jafr returns to the menu. CourseNana.COM

For example CourseNana.COM

Just a friendly reminder! You have these tasks to finish today.
- Read INFO1112 A1 specs
- Fix bug 1 inside Jafr
- Study ELEC1601
These tasks need to be finished in the next three days!
- Shower by 03/08/23
- Organise paul's brithday by 03/08/23
You have the following meetings today!
- Michael Mai's welcome party at 18:00
- Resume writing workshop at 09:00
- Jafr dev meeting at 13:30
You have the following meetings scheduled over the next week!
- Barbenheimer marathon on 06/08/23 at 17:00
- Academic advice on 02/08/23 at 14:30

Displaying tasks CourseNana.COM

Jafr will write two views of tasks to standard output. The first is a view of all tasks that are due today that have not been completed. The second is a view of all tasks that are due in the upcoming three days that have not been completed. CourseNana.COM

Today's view has the following format. CourseNana.COM

For example CourseNana.COM

The upcoming three days' view has the following format. CourseNana.COM

For example CourseNana.COM

Just a friendly reminder! You have these tasks to finish today.
- <task description>
- <task description>
[...]
Just a friendly reminder! You have these tasks to finish today.
- Read INFO1112 A1 specs
- Fix bug 1 inside Jafr
- Study ELEC1601
These tasks need to be finished in the next three days!
- <task description> by <due date>
- <task description> by <due date>
[...]
These tasks need to be finished in the next three days!
- Shower by 03/08/23
- Organise paul's birthday by 04/08/23
- ELEC1601 group meeting on 03/08/23 at 11:00
What would you like to do?
1. Complete tasks
2. Add a new meeting.
3. Share a task.
4. Share a meeting.
5. Change Jafr's master directory.
6. Exit

Hint CourseNana.COM

The "upcoming" three days' view does not include the current day. Instead, "upcoming" implies the three days following the current day. CourseNana.COM

Displaying meetings CourseNana.COM

Jafr will write two views of meetings to standard output. The first is a view of all events that are scheduled today. The second is a view of all events that are scheduled in the upcoming 7 days. CourseNana.COM

Today's view has the following format. CourseNana.COM

For example CourseNana.COM

The upcoming 7 days' view has the following format. CourseNana.COM

For example CourseNana.COM

You have the following meetings today!
- <meeting description> at <scheduled time>
- <meeting description> at <scheduled time>
[...]
You have the following meetings today!
- Michael Mai's welcome party at 18:00
- Resume writing workshop at 09:00
- Jafr dev meeting at 13:30
You have the following meetings scheduled over the next week!
- <meeting description> on <scheduled date> at <scheduled time>
- <meeting description> on <scheduled date> at <scheduled time>
[...]
You have the following meetings scheduled over the next week!
- Barbenheimer marathon on 06/08/23 at 17:00
- Academic advice on 02/08/23 at 14:30
- ELEC1601 group meeting on 03/08/23 at 11:00

Listed tasks are simply displayed in the order that they appear in tasks.md CourseNana.COM

Changing the user's master directory CourseNana.COM

Jafr allows the user to change their chosen master directory that contains tasks.md and meetings.md . CourseNana.COM

  Which directory would you like Jafr to use?

The user enters an absolute path. CourseNana.COM

<absolute path>
Jafr should replace the master object in ~/.jafr/user-settings.json appropriately. CourseNana.COM

Jafr then writes a confirmation message to standard output. CourseNana.COM

  Master directory changed to <absolute path>.

For example CourseNana.COM

Hint CourseNana.COM

See json.dump(). CourseNana.COM

Which directory would you like Jafr to use?
/home/paul/atreides_work
Master directory changed to /home/paul/atreides_work.

Hint CourseNana.COM

Jafr does not move tasks.md or meetings.md when changing the master directory. You can assume the user handles this themselves. This also allows the user to have multiple directories containing reminders and have Jafr focus on one at a time. CourseNana.COM

Completing tasks CourseNana.COM

Jafr allows the user to mark tasks as completed. The user is first prompted for which task they would like to complete. All not complete tasks are shown and numbered, in the order they appear in tasks.md . CourseNana.COM

Listed meetings are simply displayed in the order that they appear in meetings.md CourseNana.COM

The user then selects task(s) by their number, separated by whitespace. CourseNana.COM

<task num> [<task num> ... <task num>]
Jafr should modify tasks.md appropriately and write a message to standard output. Tasks CourseNana.COM

inside tasks.md are modified in place (in the same line). Marked as complete. CourseNana.COM

For example CourseNana.COM

Which task(s) would you like to mark as completed?
1. Shower by 26/07/23
2. Invite friend by 27/07/23
3. Read INFO1112 A1 specs by 28/07/23

13
Marked as complete.
CourseNana.COM

If all tasks are already complete then Jafr just writes the following to standard output. CourseNana.COM

  No tasks to complete!

Adding new meetings CourseNana.COM

Jafr allows users to add meetings. The user is first prompted for a meeting description, then a date, then a time. CourseNana.COM

Please enter a meeting description:
<meeting description>
Please enter a date:
<scheduled date>
Please enter a time:
<scheduled time>
Ok, I have added <meeting description> on <scheduled date> at <scheduled
time>.

Jafr should then modify meetings.md appropriately. A meeting is appended to the bottom of meetings.md as follows. CourseNana.COM

Which task(s) would you like to mark as completed?
1. <task description> by <due date:DD/MM/YY>
2. <task description> by <due date:DD/MM/YY>
[...]
##### added by you

- <meeting> CourseNana.COM

Would you like to share this meeting? [y/n]:
Who would you like to share with?
<user ID> <user name>
<user ID> <user name>

[...] CourseNana.COM

tasks.md     meetings.md
Which task would you like to share?
1. <task description> by <due date>
2. <task description> by <due date>
[...]
<meeting description> on
<scheduled date> at <scheduled time>
Who would you like to share with?
<user ID> <user name>
<user ID> <user name>
[...]
<user ID> [<user ID> ... <user ID>]

tasks.md CourseNana.COM

meetings.md CourseNana.COM

The user is also prompted to optionally enter people to share the meeting with. CourseNana.COM

See more about sharing below. CourseNana.COM

Sharing tasks and meetings CourseNana.COM

Jafr allows users to share tasks or meetings from their own and files with other users. CourseNana.COM

The user is first prompted for which task (or meeting) they would like to share. They are shown all tasks (or meetings) regardless of completion or scheduled date. CourseNana.COM

The analogous meetings option contains numbered lines with . CourseNana.COM

The user then selects one task (or meeting) by its number in the shown list. CourseNana.COM

The user is then prompted for the user IDs with whom they would like to share their selection. They should not be shown their own user ID here. CourseNana.COM

The user then selects users by their user ID, separated by whitespace. CourseNana.COM

Jafr should then append the selected task or meeting to the other user's or appropriately, as follows. CourseNana.COM


A confirmation message is finally written to standard output ( or ). CourseNana.COM


For example CourseNana.COM

##### shared by <user name> - <task> CourseNana.COM

Hint CourseNana.COM

The above heading ##### shared by <user name> is always created, regardless of previous sharing history! You may assume the user will clean up their text file in their own time, after noticing added meetings.
This applies to
Adding new meetings in your own meetings.md as above too. CourseNana.COM

Meeting CourseNana.COM

Task shared. CourseNana.COM

shared. CourseNana.COM

Which task would you like to share?
1. Fix bug 1 in Jafr by 08/08/23
2. Apply for research grant by 10/08/23
3. Shower by 03/08/23
1
Who would you like to share with?
0001 michaelmai
0002 hazemelalfy
0003 paulatreides
0004 prathampurohit
0001 0004
Task shared.

Note CourseNana.COM

Other users' and will be inside their own master directory, as CourseNana.COM

listed in their CourseNana.COM

tasks.md CourseNana.COM

meetings.md CourseNana.COM

~/.jafr/user-settings.json
user-settings.json
user-settings.json

How does Jafr find other users' home directories? CourseNana.COM

As you may have realised, in order for Jafr to append tasks/meetings to other users' .md files, it must be able to locate the of each user. However the location of depends on the current user's home directory! How will the application find other users' home directories? CourseNana.COM

All users' home directories will be contained inside a given file. CourseNana.COM

file CourseNana.COM

You will be given a passwd file (it is already present in your scaffold). This is a text file where each line denotes a different user on the shared computer system. Each line contains a user's username, hashed password, user ID, group ID, user ID info, home directory, and default shell. CourseNana.COM

Example passwd file: CourseNana.COM

<username>:<password>:<user ID>:<group ID>:<user ID info>:<home
directory>:<default shell>
michaelmai:x:0001:8888:staff user:/michael:/bin/bash
hazemelalfy:x:0002:8888:staff user:/hazem:/bin/bash
paulatreides:x:0003:1112:student user:/paul:/bin/bash
prathampurohit:x:0004:8888:staff user:/pratham:/bin/bash

Help! What's a passwd file? CourseNana.COM

passwd files are universal in Unix-like systems. They always contain the above information. This is how the OS remembers information about each user! However, usually the file is stored at /etc/passwd . Take a look at /etc/passwd on your own system! CourseNana.COM

You may notice that there is some unnecessary information in the passwd file. Jafr only requires the username, user ID and home directory. CourseNana.COM

Hint CourseNana.COM

You can find the current user's username using the environ object from the os module. https://docs.python.org/3/library/os.html#os.environ
This a dictionary containing environment variables, exposed by the os module. You can access the username as follows. CourseNana.COM

os.environ['USER']

Please use this method. Others have been found to not work correctly on Edstem. CourseNana.COM

Running Jafr when Bash is started CourseNana.COM

Jafr is designed to be run whenever a terminal running Bash is started. This section explains how this can be achieved. CourseNana.COM

Most Unix-like operating systems shipped with Bash allow users to customise a Bash script that is run whenever Bash is started. This script is called .bashrc and is stored inside the user's home directory (i.e. at ~/.bashrc ). CourseNana.COM

Once you have read the Usage section, have a go at modifying ~/.bashrc on your system so that it runs Jafr when bash is started. Your submission must include a .bashrc file that is able to do this. CourseNana.COM

You can check for the expected behaviour as follows. 1. Ensure your terminal runs bash. CourseNana.COM

2. Open a terminal window. On some systems you may need to run bash yourself (see Update below). CourseNana.COM

3. See if Jafr displays its views correctly. CourseNana.COM

Update CourseNana.COM

Some systems (which include Edstem's Arch and macOS) may not run .bashrc in login shells. These are shells that are started upon logging in.
However, on
any system you may start Bash again by simply executing bash . This will be a "non-login" shell and will always run .bashrc . CourseNana.COM

You may provide comments inside a readme.md to your marker about any expectations you have for this to work correctly. CourseNana.COM

Hint CourseNana.COM

In order to be awarded this section of the assignment, you may assume jafr.py and passwd exists inside every user's home directory. CourseNana.COM

Remember .bashrc is a universal script. This means you can find plenty of help by looking this up online. CourseNana.COM

Text files CourseNana.COM

tasks.md and meetings.md can contain any amount of text, and not necessarily only tasks/meetings. A line is only considered a task or meeting if it is a dot point (the line starts with - ). CourseNana.COM

For example, suppose tasks.md contains CourseNana.COM

Note CourseNana.COM

Any amount of indentation is allowed before a dot point! CourseNana.COM

### School tasks
- Go to school Due: 01/08/23 not complete
- English homework Due: 02/08/23 not complete
CourseNana.COM

        - English homework introduction Due: 01/08/23 not complete

### Chores
- Take out trash Due: 01/08/23 not complete CourseNana.COM

##### shared by hazemelalfy
- Study linux namespaces Due: 04/08/23 not complete CourseNana.COM

Then there are five tasks recognisable by Jafr. CourseNana.COM

Help! Why do I have to parse these files for dot points? CourseNana.COM

Jafr is designed to rely on text files that are otherwise freely editable by users. Different users may have different methods of organising their tasks or meetings. Think of Jafr as a parser that adapts to each user's context.
The
re module may be helpful here. CourseNana.COM

Missing tasks.md or meetings.md file.

Displaying tasks and meetings CourseNana.COM

Any malformed tasks or meetings are skipped when displaying them. No error message is given. CourseNana.COM

Menu CourseNana.COM

If the user enters an invalid <menu num> , then Jafr prompts them with a single-line explanation written to standard output, before allowing input again. CourseNana.COM

Sharing tasks and meetings CourseNana.COM

Any malformed tasks or meetings are skipped when displaying them. No error message is given. CourseNana.COM

If the user enters an invalid option at any point, Jafr prompts them with a single-line explanation written to standard output, before allowing input again. CourseNana.COM

Hint CourseNana.COM

For those new to Python, a try block will be useful here to simply skip malformed tasks/meetings after a dot point. CourseNana.COM

Hint CourseNana.COM

It is up to you what explanation is given. Our only requirement is that it fits in one line and is appropriate. CourseNana.COM

Specifically, if the user enters an invalid; CourseNana.COM

    <num>
    <user ID>

then they are prompted with a single-line explanation. You do not have to handle a malformed passwd file. CourseNana.COM

Changing the user's master directory CourseNana.COM

You do not have to handle any invalid user input here. If the chosen master directory ends up being malformed in user-settings.json , the error handling in Setup above will at least cover this when opening Jafr. CourseNana.COM

Writing your own tests CourseNana.COM

You will write I/O end-to-end tests for Jafr inside a directory tests/ . You must test CourseNana.COM

1. Displaying reminders. 2. Completing tasks.
3. Adding new meetings. CourseNana.COM

You do NOT have to test CourseNana.COM

1. Sharing tasks and meetings (including sharing after adding new meetings) 2. Changing the user's master directory
3. Running Jafr when Bash is started CourseNana.COM

"Home directories" of your test users will need to be defined in your tests/passwd file. While tests/passwd may not be used by your tests (which do not need to cover sharing), it will still be useful for your marker. CourseNana.COM

A test is constructed by creating a .in file and a .out file. The filename prefix to these should describe the test. CourseNana.COM

The .in file should contain all user input that will be written to standard input. The corresponding .out file should contain output that is expected to be written by Jafr to standard output. CourseNana.COM

The other files and directories present in tests/ are shared across all tests. You may write three to five test users and a handful of test cases for each user. That is, each test case should choose a user to rely on. CourseNana.COM

You can use your own tests as follows. CourseNana.COM

  1. Run python3 jafr.py tests/passwd . CourseNana.COM

  2. Run each test by manually inspecting the appropriate .in and .out file. Enter input CourseNana.COM

    from the .in file. Compare your program's actual output to the .out file. CourseNana.COM

Any changes to and meetings.md files made by your tests will not be captured CourseNana.COM

with a .in and file. You do not have to capture these changes in your tests.
You may include any comments about your testing in a
test_readme.md to your marker if CourseNana.COM

you wish, such as current date and current user for each test. CourseNana.COM

See Daniel's video on Canvas for more about manual testing. See pinned post #284 on Edstem for more help around changing users for each test while on your local machine. CourseNana.COM

Further hints and where to start CourseNana.COM

tasks.md CourseNana.COM

meetings.md CourseNana.COM

Hint CourseNana.COM

The allowed libraries themselves provide hints on how you can make this assignment easier! See Submission and marking below. CourseNana.COM

Hint CourseNana.COM

This hint only matters if you're aiming to submit automated end-to-end tests that can run on Ed (not required).
Awkwardly, because of how Ed submission workspaces work, each test user's home directory path in
tests/passwd would need to begin with /home/tests/ . CourseNana.COM

Note the default user's home directory on Ed is /home . CourseNana.COM

Here's a suggested order of what to work on in this assignment. CourseNana.COM

  1. Draw a picture for yourself of how Jafr interacts with the filesystem. CourseNana.COM

  2. Plan your code. What functions will you write? CourseNana.COM

  3. Work on setup and displaying reminders. Write tests. CourseNana.COM

  4. Work on making modifications to tasks/meetings. Write tests. CourseNana.COM

  5. Work on sharing tasks/meetings. Write tests. CourseNana.COM

  6. Work on .bashrc . You might be surprised how simple the solution is here, but it takes some time to understand what is required. CourseNana.COM

  7. Write final tests. Try to catch bugs in your own code and fix them. CourseNana.COM

Submission and marking CourseNana.COM

An Edstem workspace will be made available for you to test and submit your code. Public test cases will be released up to 25/08/23. For Assignment 1, there will be no private or hidden test cases. CourseNana.COM

Files to submit CourseNana.COM

Your submission should include CourseNana.COM

jafr.py
.bashrc
tests/

Optionally, your submission may include CourseNana.COM

You might have noticed that tasks and meetings are saved in Markdown files. These are just text files (Unix users' favourite type of files), with the additional benefit of mark up via very simple formatting. Markdown happens to be used everywhere across software documentation, and so you can learn it if you like. However it's not necessary at all for this assignment. CourseNana.COM

You can remove staff's comments present in the scaffold's readme.md or just add your own at the top of the file. CourseNana.COM

Allowed libraries CourseNana.COM

sys
json
datetime
re
os
typing

All other libraries are disallowed. CourseNana.COM

The following functions are banned inside the os module. See thread #468 on Edstem for more discussion. CourseNana.COM


CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
The University of Sydney代写,INFO1112代写,Computing 1B OS and Network Platforms代写,Python代写,Computer Networks代写,Operating System代写,The University of Sydney代编,INFO1112代编,Computing 1B OS and Network Platforms代编,Python代编,Computer Networks代编,Operating System代编,The University of Sydney代考,INFO1112代考,Computing 1B OS and Network Platforms代考,Python代考,Computer Networks代考,Operating System代考,The University of Sydneyhelp,INFO1112help,Computing 1B OS and Network Platformshelp,Pythonhelp,Computer Networkshelp,Operating Systemhelp,The University of Sydney作业代写,INFO1112作业代写,Computing 1B OS and Network Platforms作业代写,Python作业代写,Computer Networks作业代写,Operating System作业代写,The University of Sydney编程代写,INFO1112编程代写,Computing 1B OS and Network Platforms编程代写,Python编程代写,Computer Networks编程代写,Operating System编程代写,The University of Sydneyprogramming help,INFO1112programming help,Computing 1B OS and Network Platformsprogramming help,Pythonprogramming help,Computer Networksprogramming help,Operating Systemprogramming help,The University of Sydneyassignment help,INFO1112assignment help,Computing 1B OS and Network Platformsassignment help,Pythonassignment help,Computer Networksassignment help,Operating Systemassignment help,The University of Sydneysolution,INFO1112solution,Computing 1B OS and Network Platformssolution,Pythonsolution,Computer Networkssolution,Operating Systemsolution,