INFO1112仅仅友好的提醒者

威公
• 阅读 437

INFO1112 A1 - Just a friendly reminder
In this assignment, you'll be creating a basic application called "Jafr" (short for "Just afriendly reminder"). This application helps multiple users manage their tasks and meetingson a Unix-like OS (a popular choice of OS in industry where developers might sharecomputer system or host web applications).Jafr is Unix-friendly. This means that

1. Users interact with Jafr by typing commands in a command-line interface.
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 whenthey want to make changes outside of Jafr.You will implement Jafr in Python and write a simple start upscriptin Bash. You will thenwrite I/O end to end tests for Jafr.These specifications first describe each behaviour of Jafr. The final sections describe errorhandling, how to write tests for Jafr and provide some hints.

Overview

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.There are two kinds of reminders: tasks and meetings.NoteStudents and tutors often have great suggestions to specifications.While no majorchanges will be made after release, this assignment specification may be clarified up to
Week 4, 27/08/2023. Revised versions will be clearly markedandaccompanyingannouncements made to Edstem.

Setup

Jafr primarily relies on two text files for each user: tasks.md and meetings.md . These textfiles are placed inside a master directory of the user's choosing.The user chooses their master directory inside a JSON file called user-settings.jsonlocated at ~/.jafr/user-settings.json . You may consider ~/.jafr/ a 'hidden' directory,for Jafr's internal use only.user-settings.json has a single key valuepair storing the absolute path to the masterdirectory.Sample user-settings.json :HintNotice that the hidden directory .jafr/ is inside a user's home directory which can besymbolically referred to by ~.

You can fetch the path referred to by ~ in Python by using os.path.expanduser('~')
{
"master": "/home/dailystuff"
}

Help! What's a JSON file?JSON is a universal file format for easy data reading and writing. There are two kinds ofdata 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 ofvalues (exactly like a list in Python).You may use Python's json library in your implementation to read JSONfiles. Seejson.load()Notetasks.md and meetings.md for each user are given inside your scaffold. Assume theuser creates these themselves using their preferred text editor.The ~/.jafr/ directoryfor 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 handlesthis, outside of the scope of yourassignment.Text files containing remindersThe two text files inside the master directory for each user are as follows.tasks.mdThis 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 datetimedocs). You will only everhave to handle dates in the years 1969 - 2068 (inclusive).For examplemeetings.mdThis text file contains dot pointed meetings with the following format. Times follow HH:mm,or moreprecisely the C standard format %H:%M (see the datetime docs).For example

- <task description> Due: <due date> <completion status>
- 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

Notice that a task must end with complete or not complete !Moreover, the format implies that a task description should never contain the stringDue: . You do not have to handle the case where a user does this.- <meeting description> Scheduled: <scheduled time> <scheduled date>- Michael Mai's welcome party Scheduled: 18:00 25/08/23- A1 marking meeting Scheduled: 09:00 01/09/23HintYou do not have tohandle the case where a user places Scheduled: inside themeeting description.Further, as suggested by the links above, it will beeasiest to use datetime to handleall dates/times!Usage
Jafr runs when jafr.py is executed by the Python interpreter. There is one command lineargument which will contain a path (absolute orrelative) to a given passwd file. More on thisbelow.For example
Jafr first displays relevant reminders (tasks followed by meetings),before showing a menu.The menu contains the following.
A user chooses one option only.This invokes the relevant behaviour, described below. If the user enters 6 , Jafr exits. Aftercompleting a behaviour, Jafr returns to the menu.For examplepython3 jafr.py passwdListed meetings are simply displayed in the order that they appear in meetings.mdWhich directory would you like Jafr to use?<absolute path>HintSeejson.dump().Master directory changed to <absolute path>.Which directory would you like Jafr to use?/home/paul/atreides_workMaster directory changed to /home/paul/atreides_work.Hint

Setup

You do not have to handle a missing ~/.jafr directory or~/.jafr/user-settings.jsonfile for any user.If either tasks.md or meetings.md aremissing from the user's chosen master directorythen Jafr does not display any reminders or show the menu. Jafr writes the following
message to standard error before simply exiting.UpdateSome 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 willbe a "non-login" shell and will always run .bashrc .HintIn order to be awarded this section of the assignment, you may assume jafr.py andpasswd exists inside every user's home directory.
Remember .bashrc is a universal script. This means you can findplenty of help bylooking this up online.If the user's chosen masterdirectory does not exist, then Jafr does not display anyreminders or show the menu. Jafr writes the following message to standard error before
exiting.Text filestasks.md and meetings.md can contain any amount of text, and not necessarily onlytasks/meetings. A line is only considered a task or meeting if it is a dot point (the line Edstem. This will make it easier to handle the hidden directories and edittext files.tasks.md and meetings.md filesA test is constructed by creating a .in file and a .out file. The filename prefix to these
should describe the test.The .in file should contain all user input that will be written to standard input. Thecorresponding .out file should contain output that is expected to be written by Jafr to
standard output.The other files and directories present in tests/ are shared across all tests. You may writethree to five test users and a handful of test cases for each user. That is, each test caseshould choose a user to rely on.You can use your own tests as follows.

1. Run python3 jafr.py tests/passwd .
2. Run each test by manually inspecting the appropriate .in and .out file. Enter inputfrom the .in file. Compare your program's actual output to the .out file.Any changes to tasks.md and meetings.md files made by your tests will not be capturedwith a .in and .out 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 ifyou wish, such as current date and current user for each test.See Daniel's video on Canvas for more about manual testing. See pinned post #284 onEdstem for more help around changing users for each test while on your local machine.Further hints and where to startHint"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。
WX:codehelp

点赞
收藏
评论区
推荐文章
blmius blmius
4年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
Oracle 分组与拼接字符串同时使用
SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(
Wesley13 Wesley13
4年前
MySQL 的慢 SQL 怎么优化?
!(https://oscimg.oschina.net/oscnet/7b00ec583b5e42cc80e8c56c6556c082.jpg)Java技术栈www.javastack.cn关注阅读更多优质文章(https://www.oschina.net/action/GoToLink?urlhttp
Wesley13 Wesley13
4年前
Oracle 12c DG备库Alert报错ORA
环境是12.2.0.1version,OracleDataGuard备库近段时间一直报错,但是备库主库同步一致,数据一致。20190306T23:42:22.18404808:00Errorsinfile/u01/app/oracle/diag/rdbms/ccdb/ccdb/trace/ccdb_m000_12
可莉 可莉
4年前
2021年全球公有云终端用户支出将增长18% ;EMNLP 2020最佳论文:无声语音的数字发声
!(https://static001.geekbang.org/infoq/af/af9f6637b50b09be60b00a42f3812d5e.png)开发者社区技术周刊又和大家见面
Stella981 Stella981
4年前
2021年全球公有云终端用户支出将增长18% ;EMNLP 2020最佳论文:无声语音的数字发声
!(https://static001.geekbang.org/infoq/af/af9f6637b50b09be60b00a42f3812d5e.png)开发者社区技术周刊又和大家见面
Stella981 Stella981
4年前
OpenJDK11与Spring Cloud Finchley的不兼容问题与解决
本文的环境:OpenJDK11.0.4,SpringCloudfinchleySR4,SpringBoot2.0.3最近遇到了一个问题,在feign调用的时候,时常会出现这样一个奇怪的错误:2019100708:00:00.620ERRORxxx,e1ba4c7540954aa3,871b99c4576d42e3
Stella981 Stella981
4年前
PHP 类型转换函数intval
<?phpechointval(42);//42echointval(4.2);//4echointval('42');//42echointval('42');//42echointval('42');//42echointval(042)
Easter79 Easter79
4年前
TIOBE 11 月编程语言:Java 首次跌出前二;基于Pytorch的Kornia可微分计算机视觉库开源
!(https://static001.geekbang.org/infoq/af/af9f6637b50b09be60b00a42f3812d5e.png)开发者社区技术周刊又和大家见面了,萌妹子主播为您带来最新一期“开发者技术联播”。让我们一起听听,过去一周有哪些值得我们开发者关注的重要新闻吧。!(https://static001.ge
Stella981 Stella981
4年前
Eureka Server 开启Spring Security Basic认证
!Desktop(https://uploadimages.jianshu.io/upload_images/98242475ce94f98ae00f42f.jpg?imageMogr2/autoorient/strip%7CimageView2/2/w/1240)文章共503字,阅读大约需要2分钟!概述
Stella981 Stella981
4年前
AI 科学家带你快速 Get 人工智能最热技术
!(https://pic3.zhimg.com/80/v2af9f6637b50b09be60b00a42f3812d5e_1440w.jpg)日前,京东智联云与贪心学院联合举办的人工智能前沿技